@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&family=Merriweather:wght@400;700&display=swap");

:root {
  color-scheme: light;
  --brand-50: #fff6ed;
  --brand-100: #ffe7d1;
  --brand-200: #ffd2a8;
  --brand-300: #ffb26e;
  --brand-400: #ff9842;
  --brand-500: #ff7a1a;
  --brand-600: #f0640b;
  --brand-700: #c84f06;
  --brand-800: #9a3d08;
  --brand-900: #6b2b07;
  --bg: #fff7f0;
  --surface: #fffaf6;
  --surface-strong: #fff3e7;
  --text: #2b1a12;
  --muted: #7b5a46;
  --border: rgba(123, 90, 70, 0.18);
  --accent: var(--brand-600);
  --accent-strong: var(--brand-500);
  --ok: #2b7a4b;
  --bad: #b3432b;

  /* Danger palette (used by .btn-danger / icon buttons) */
  --danger-50: #fff1f0;
  --danger-100: #ffe1df;
  --danger-200: #ffb8b2;
  --danger-500: #e5484d;
  --danger-600: #d63d43;

  /* Generic hover/fg tokens used by some components */
  --bg-hover: rgba(255, 122, 26, 0.12);
  --fg: var(--text);

  --nav-bg: #ff8a2a;
  --nav-ink: #2b1a12;
  --nav-panel: #ff8a2a;
  --nav-panel-ink: #2b1a12;
  --nav-panel-border: rgba(255, 255, 255, 0.22);
  --nav-shadow: 0 10px 30px rgba(107, 43, 7, 0.18);
  --card-shadow: 0 14px 30px rgba(107, 43, 7, 0.1);
  --card: var(--surface);
  --ink: var(--text);
}


* {
  box-sizing: border-box;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

canvas {
  max-width: 100%;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", Arial, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle at top, rgba(255, 255, 255, 0.9), rgba(255, 247, 240, 0.2)),
    radial-gradient(circle at 20% 20%, rgba(255, 152, 66, 0.18), transparent 45%);
  transition: background-color 0.3s, color 0.3s;
  font-size: 15.5px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.brand-subtitle {
  max-width: 1200px;
  margin: 10px auto 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--brand-500) var(--brand-100);
  scrollbar-width: thin;
}

@media (min-width: 768px) {
  *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  *::-webkit-scrollbar-track {
    background: var(--brand-100);
  }

  *::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    border-radius: 999px;
    border: 2px solid var(--brand-100);
  }
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--brand-700);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(255, 122, 26, 0.6);
  outline-offset: 2px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background-color: var(--nav-bg);
  box-shadow: var(--nav-shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible;
}

.site-header > * {
  min-width: 0;
}

.site-header h1 {
  margin: 0;
  font-size: 18px;
  font-family: "Merriweather", serif;
  color: var(--nav-ink);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-search {
  position: relative;
}

.header-search-toggle {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
  color: var(--nav-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.header-search-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(420px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 12px;
  z-index: 1600;
  display: none;
}

.header-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-search-input {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 14px;
}

.header-search-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff1e1;
  cursor: pointer;
}

.header-search-results {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.header-search-list {
  display: grid;
  gap: 8px;
}

.header-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffaf4;
}

.header-search-label {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.header-search-add {
  min-height: 32px;
}

.header-search-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  z-index: 1500;
}

.header-search-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.header-search-panel.is-open {
  display: block;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--nav-ink);
  font-weight: 700;
  font-size: 13px;
}

.header-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.18);
}

.header-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-name-link {
  color: inherit;
  text-decoration: none;
}

.header-user-name-link:hover {
  text-decoration: underline;
}

.header-user-points {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}

.header-clawbot-link,
.header-featured-link,
.header-leo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--nav-ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.header-clawbot-link:hover,
.header-featured-link:hover,
.header-leo-link:hover {
  background: rgba(255, 255, 255, 0.28);
}

.header-featured-link {
  font-weight: 700;
}

.header-leo-link {
  font-weight: 700;
}

.header-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--nav-ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 520px) {
  /* Mobile header: keep everything on one row and allow horizontal scroll for links */
  .site-header {
    flex-wrap: nowrap;
  }

  .header-right {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .header-right::-webkit-scrollbar {
    height: 0;
  }

  .header-clawbot-link,
  .header-featured-link,
  .header-leo-link,
  .header-login {
    flex: 0 0 auto;
  }
}

.header-login:hover {
  background: rgba(255, 255, 255, 0.28);
}

.toast-container {
  position: fixed;
  right: 16px;
  top: 72px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(58, 29, 11, 0.92);
  color: #fff3e6;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(58, 29, 11, 0.2);
  transform: translateY(-10px);
  opacity: 0;
  animation: toast-enter 0.3s ease forwards, toast-exit 0.4s ease forwards 2.4s;
}

.toast.positive {
  background: rgba(42, 122, 68, 0.92);
}

.toast.notice {
  background: rgba(217, 119, 6, 0.92);
}

@keyframes toast-enter {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-exit {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

.site-title a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.site-title-icon {
  width: 28px;
  height: 28px;
  color: var(--nav-ink);
}

/* Brand icon (small enough for mobile header) */
.brand-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
}

.nav-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: visible;
  white-space: nowrap;
}

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-label {
  width: 46px;
  height: 46px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(107, 43, 7, 0.18);
  filter: drop-shadow(0 6px 16px rgba(107, 43, 7, 0.18));
  backdrop-filter: blur(6px);
}

.nav-toggle-bars {
  position: relative;
  width: 22px;
  height: 3px;
  background: linear-gradient(90deg, var(--nav-ink), rgba(43, 26, 18, 0.7));
  border-radius: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 3px;
  background: linear-gradient(90deg, var(--nav-ink), rgba(43, 26, 18, 0.7));
  border-radius: 0;
  transition: transform 0.2s ease;
}

.nav-toggle-bars::before {
  top: -7px;
}

.nav-toggle-bars::after {
  top: 7px;
}

.nav-toggle:checked + .nav-toggle-label .nav-toggle-bars {
  background: transparent;
}

.nav-toggle:checked + .nav-toggle-label .nav-toggle-bars::before {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle:checked + .nav-toggle-label .nav-toggle-bars::after {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(39, 21, 11, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(360px, 86vw);
  max-width: calc(100vw - 24px);
  height: 100vh;
  background: var(--nav-panel);
  box-shadow: 18px 0 40px rgba(107, 43, 7, 0.25);
  padding: 18px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  z-index: 1400;
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--nav-panel-border);
}

.nav-drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nav-panel-ink);
  letter-spacing: 0.08em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-drawer-title:hover {
  color: var(--nav-panel-ink);
  text-decoration: underline;
}

.nav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--nav-panel-ink);
  cursor: pointer;
}

.nav-auth {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--nav-panel-border);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--nav-panel-ink);
  font-size: 14px;
  font-weight: 700;
}

.nav-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.18);
}

.nav-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--nav-panel-ink);
  font-weight: 700;
  text-decoration: none;
}

.nav-auth-link:hover {
  background: rgba(255, 255, 255, 0.28);
}

.nav-section {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--nav-panel-border);
}

.nav-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.nav-submenu {
  border-bottom: 1px solid var(--nav-panel-border);
  padding-bottom: 10px;
}

.nav-submenu[open] {
  padding-bottom: 12px;
}

.nav-submenu-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--nav-panel-ink);
  font-weight: 700;
  font-size: 14px;
}

.nav-submenu-title::-webkit-details-marker {
  display: none;
}

.nav-submenu-title::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(43, 26, 18, 0.7);
  border-bottom: 2px solid rgba(43, 26, 18, 0.7);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.nav-submenu[open] .nav-submenu-title::after {
  transform: rotate(-135deg);
}

.nav-submenu-panel {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.nav-submenu-group {
  padding: 6px 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.nav-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--nav-panel-ink);
  margin: 12px 0 6px;
}

.nav-title-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--nav-panel-ink);
  text-decoration: none;
  margin: 12px 0 6px;
}

.nav-title-link:hover {
  color: var(--nav-panel-ink);
}

.nav-drawer a {
  display: block;
  min-height: 44px;
  padding: 12px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--nav-panel-ink);
  font-weight: 700;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.nav-drawer a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-toggle:checked ~ .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-toggle:checked ~ .nav-drawer {
  transform: translateX(0);
}

nav a {
  margin-right: 0;
}

h1,
h2,
h3 {
  font-family: "Merriweather", serif;
  color: var(--text);
}

h2 {
  font-size: 1.2em;
  border-bottom: 2px solid rgba(255, 122, 26, 0.28);
  padding-bottom: 8px;
  margin-top: 18px;
}

.home-section-title {
  font-size: 20px;
}

h3 {
  font-size: 1.05em;
  color: var(--accent);
}

.container {
  max-width: 1200px;
  width: min(1200px, calc(100% - 28px));
  margin: 14px auto 20px;
  background-color: transparent;
  padding: 0;
}

.container.grid-layout {
  max-width: 1200px;
  width: min(1200px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}

.container.overview-page {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

.container.grid-layout.overview-page {
  width: 100vw !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.container.grid-layout .card {
  margin-bottom: 0;
}

.card.full {
  grid-column: 1 / -1;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.6);
  margin-bottom: 16px;
}

.card > :first-child {
  margin-top: 0;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.perf-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-strong);
}

.perf-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.label-link {
  color: inherit;
  text-decoration: none;
}

.label-link:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

.perf-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.perf-date {
  white-space: nowrap;
}

.perf-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.perf-item {
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.perf-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.perf-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.perf-up {
  color: var(--bad);
}

.perf-down {
  color: var(--ok);
}

.news-click-count {
  margin-left: 6px;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.news-click-count::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 5c5.05 0 9.31 3.08 11 7-1.69 3.92-5.95 7-11 7S2.69 15.92 1 12c1.69-3.92 5.95-7 11-7zm0 2C7.85 7 4.35 9.41 2.86 12 4.35 14.59 7.85 17 12 17s7.65-2.41 9.14-5C19.65 9.41 16.15 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 5c5.05 0 9.31 3.08 11 7-1.69 3.92-5.95 7-11 7S2.69 15.92 1 12c1.69-3.92 5.95-7 11-7zm0 2C7.85 7 4.35 9.41 2.86 12 4.35 14.59 7.85 17 12 17s7.65-2.41 9.14-5C19.65 9.41 16.15 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z'/></svg>") no-repeat center / contain;
}

.overlap-news-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.overlap-news-item.news-item {
  padding: 12px 14px;
}

.overlap-news-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface);
}

.overlap-news-item:target {
  border-color: rgba(255, 152, 66, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 152, 66, 0.25);
}

.overlap-news-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.theme-news-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.theme-news-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface);
}

.theme-news-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

mark {
  background: rgba(255, 210, 168, 0.6);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.grid > * {
  min-width: 0;
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.summary-grid {
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid > * {
  min-width: 0;
}

.summary-grid .label {
  font-size: 14px;
}

.summary-list {
  line-height: 1.4;
  margin-top: 6px;
}

.data-table tr.overlap-4 td {
  background-color: rgba(255, 210, 168, 0.6);
}

.data-table tr.overlap-3 td {
  background-color: rgba(255, 231, 209, 0.75);
}

.data-table tr.overlap-2 td {
  background-color: rgba(255, 249, 244, 0.9);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-block;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--brand-500), var(--brand-700));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Themes (mobile-first) */
.theme-items-cards {
  display: none;
}

/* Theme detail table tweaks */
.theme-detail-table {
  min-width: 760px; /* allow horizontal scroll instead of wrapping headers */
}
.theme-detail-table th {
  white-space: nowrap;
}
.theme-detail-table td.reason-cell {
  white-space: pre-wrap;
  /* Avoid any inherited monospace spacing; keep lines aligned */
  font-family: inherit;
}

/* Highlight top-5 rows when locked (to hint “these are the key ones”) */
.theme-top5-locked td {
  background: rgba(255, 152, 66, 0.10);
  border-top: 1px solid rgba(255, 152, 66, 0.25);
  border-bottom: 1px solid rgba(255, 152, 66, 0.25);
}
.theme-top5-locked td:first-child {
  border-left: 2px solid rgba(255, 152, 66, 0.55);
}
.theme-top5-locked td:last-child {
  border-right: 2px solid rgba(255, 152, 66, 0.55);
  font-weight: 700;
}

@media (max-width: 768px) {
  .theme-top5-locked-card {
    border: 2px solid rgba(255, 152, 66, 0.55);
    background: rgba(255, 152, 66, 0.08);
  }
}

@media (max-width: 768px) {
  .theme-items-table {
    display: none;
  }
  .theme-items-cards {
    display: grid;
    gap: 10px;
  }
  .theme-item-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    padding: 12px;
    display: grid;
    gap: 8px;
  }
  .theme-item-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }
  .theme-item-card-title {
    font-weight: 800;
    color: var(--text);
    overflow-wrap: anywhere;
  }
  .theme-item-card-sub {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
  }
  .theme-item-score {
    font-weight: 800;
    color: var(--text);
  }
  .theme-item-score small {
    font-weight: 700;
    color: var(--muted);
    margin-left: 6px;
  }
  .theme-item-reason {
    white-space: pre-wrap;
    color: var(--muted);
    line-height: 1.55;
    font-size: 13px;
  }
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 6px;
}

.filter-input,
.filter-select {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 14px;
  min-height: 44px;
  background: #fff;
  color: var(--text);
}

.filter-input {
  min-width: 240px;
  flex: 1 1 240px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.data-table .num {
  text-align: right;
}

.favorite-col,
.favorite-cell {
  text-align: center;
  width: 84px;
}

.favorite-btn {
  border: 1px solid rgba(107, 43, 7, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: #5b2b12;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px; /* Space between icon and text if text is ever used */
}
.favorite-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  transition: all 0.2s ease-in-out;
}

.favorite-btn.is-added {
  border-color: var(--brand-600);
  background: var(--brand-100);
  color: var(--brand-800);
}
.favorite-btn.is-added svg {
  fill: var(--brand-600);
  stroke: var(--brand-600);
}

.favorite-btn.is-limit {
  border-color: #d97706;
  color: #9a5b1a;
  background: rgba(217, 119, 6, 0.12);
}

.order-controls {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.order-btn {
  width: 32px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff7f0;
  color: #5b2b12;
  font-weight: 700;
  cursor: pointer;
}

.order-btn:active {
  transform: translateY(1px);
}

.order-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.favorite-move-select {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 12px;
  background: #fff;
  color: #5b2b12;
}

.favorites-news-wrap {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

.favorites-news-group {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.favorite-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.drag-handle {
  cursor: grab;
  user-select: none;
  white-space: nowrap;
}

.fav-stock-table tr.dragging {
  opacity: 0.6;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.group-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.group-id {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

.rename-group-btn {
  margin-left: 8px;
}

.admin-stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.admin-points-input {
  width: 90px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}

.news-table {
  table-layout: fixed;
}

.news-table th:nth-child(1),
.news-table td:nth-child(1) {
  width: 52%;
  word-break: break-word;
}

.news-table th:nth-child(2),
.news-table td:nth-child(2) {
  width: 14%;
}

.news-table th:nth-child(3),
.news-table td:nth-child(3) {
  width: 20%;
}

.news-table th:nth-child(4),
.news-table td:nth-child(4) {
  width: 14%;
  word-break: break-word;
}

.points-up {
  color: #2a7a44;
  font-weight: 700;
}

.points-down {
  color: #b43131;
  font-weight: 700;
}

.news-item {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
}

.news-item h3 {
  margin: 0 0 8px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.news-item + .news-item {
  margin-top: 12px;
}

.ok {
  color: var(--ok);
}

.bad {
  color: var(--bad);
}

.delta-up {
  color: var(--bad);
}

.delta-down {
  color: var(--ok);
}

.qr {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr img {
  width: 240px;
  max-width: 70vw;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.support-actions {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff1e1;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

.topic-count {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: #ffe7d1;
}

.chart-box {
  width: 100%;
  max-width: 520px;
  height: 360px;
  margin: 0 auto;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-box-pie {
  width: 100%;
  max-width: 520px;
  height: 520px;
}

.chart-box-bar {
  width: 100%;
  height: 520px;
}

.chart-box-wide {
  width: 100%;
  max-width: 1600px;
  height: clamp(360px, 45vw, 520px);
}

.overview-page .chart-box-wide {
  max-width: 1800px;
}

.pp-5BDKWZQVQL7TA {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: none;
  border-radius: 0.25rem;
  min-width: 11.625rem;
  padding: 0 2rem;
  height: 2.625rem;
  font-weight: bold;
  background-color: #ffd140;
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.25rem;
  cursor: pointer;
  text-decoration: none;
}

.pp-5BDKWZQVQL7TA:hover {
  background-color: #e6be2f;
  color: #111;
}

@media (max-width: 768px) {
  .site-header {
    padding: 12px 14px;
    gap: 10px;
  }

  .container {
    width: calc(100% - 24px);
    margin: 12px auto 16px;
  }

  .container.overview-page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .container.grid-layout {
    display: block;
  }

  .container.grid-layout .card {
    width: 100%;
    margin-bottom: 16px;
  }

  .card {
    border-radius: 18px;
    margin-bottom: 12px;
    padding: 16px;
  }

  .chart-box-bar {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .chart-box-pie {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .site-header h1 {
    font-size: 16px;
  }

  h2 {
    font-size: 14px;
    line-height: 1.35;
  }

  h3 {
    font-size: 14px;
    line-height: 1.35;
  }

  .card-header h2 {
    font-size: 13px;
  }

  .nav-wrap {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .nav-drawer a {
    font-size: 15px;
  }

  .favorite-btn {
    min-height: 44px;
    padding: 8px 14px;
  }

  .order-btn {
    width: 40px;
    height: 36px;
  }

  .nav-toggle-label {
    position: static;
    width: 46px;
    height: 46px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    z-index: 1;
  }

  .nav-drawer {
    height: 100dvh;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .header-user-points {
    display: none;
  }

  .header-search-panel {
    position: fixed;
    inset: auto 12px 12px;
    width: calc(100vw - 24px);
    border-radius: 18px;
    max-height: 70vh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .header-search-results {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
  }

  .toast-container {
    top: 12px;
    right: 12px;
  }

  .data-table {
    font-size: 13px;
  }

  .chart-box {
    width: 100%;
    max-width: 100%;
    height: clamp(280px, 70vw, 360px);
  }

  .chart-box-pie {
    width: 100%;
    max-width: 420px;
    height: clamp(320px, 80vw, 440px);
  }

  .chart-box-bar {
    height: clamp(320px, 80vw, 520px);
  }

  .overview-page .chart-box-bar,
  .overview-page .chart-box-pie {
    width: calc(100% + 32px);
    max-width: none;
    margin-left: -16px;
    margin-right: -16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .summary-grid .label {
    font-size: 11px;
  }

  .summary-grid .value {
    font-size: 14px;
  }

  .summary-list {
    font-size: 12px;
  }

}

@media (min-width: 1024px) {
  body {
    font-size: 16.5px;
  }

  .site-header {
    padding: 18px 32px;
  }

  .site-header h1 {
    font-size: 22px;
  }

  .container {
    width: min(1200px, calc(100% - 80px));
  }

  .container.grid-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .card {
    padding: 22px 24px;
    border-radius: 20px;
    margin-bottom: 20px;
  }
}

@media (min-width: 1280px) {
  .container {
    width: min(1200px, calc(100% - 120px));
  }
}

.news-articles-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-article-card {
  padding: 12px;
  border-radius: 14px;
  background-color: #fff;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s ease;
}

.news-article-card:hover {
  box-shadow: 0 10px 18px rgba(107, 43, 7, 0.12);
}

@media (max-width: 768px) {
  .news-articles-container {
    gap: 2px;
  }

  .card.full {
    padding-top: 2px;
  }

  .card-header {
    margin-bottom: 2px;
  }

  .card-header h2 {
    margin: 0;
  }

  .card.full #news-container {
    margin-top: 0;
  }

  .card.full .news-item:first-child {
    margin-top: 0;
  }

  .news-item {
    margin-top: 2px;
  }

  .news-item + .news-item {
    margin-top: 2px;
  }

  .news-article-card {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .news-article-card:hover {
    box-shadow: none;
  }

  .news-action-btn {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .news-comment-input {
    min-height: 40px;
  }
}

.news-article-title {
  display: block;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.news-article-title:hover {
  text-decoration: underline;
}

.news-article-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 6px;
}

.news-article-source {
  font-weight: 700;
}

.news-articles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.news-articles li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.news-article-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.news-action-btn {
  border: 1px solid var(--border);
  background: #fff1e1;
  color: var(--text);
  border-radius: 999px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.news-action-btn.is-active {
  background: #ffe1c2;
  border-color: rgba(255, 122, 26, 0.45);
}

.news-comment-box {
  width: 100%;
  display: none;
  gap: 6px;
  margin-top: 6px;
}

.news-comment-box.is-open {
  display: flex;
}

.news-comment-input {
  flex: 1;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
}

.saved-news-wrap {
  display: grid;
  gap: 10px;
}

.saved-news-list {
  display: grid;
  gap: 10px;
}

.saved-news-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  gap: 8px;
}

.saved-news-title {
  font-weight: 700;
}

.saved-news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.saved-news-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffe1c2;
  color: var(--text);
  font-weight: 700;
}

.saved-news-comment {
  background: #fff1e1;
  border-radius: 10px;
  padding: 4px 8px;
  color: var(--text);
}

.saved-news-remove {
  justify-self: start;
}

.hot-news-block {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.hot-news-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hot-news-item {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  gap: 6px;
}

.hot-news-title {
  font-weight: 700;
  text-decoration: none;
}

.hot-news-title:hover {
  text-decoration: underline;
}

.hot-news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.card-header h2 {
  margin: 0;
  border: none;
  padding: 0;
}

.news-controls {
  display: flex;
  gap: 8px;
}

.card-like {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.card-like-btn {
  /* Inherit icon button styles */
  font-weight: 700;
  cursor: pointer;
  /* Specific styling (if any unique) */
  /* min-height: 32px; (already covered by btn-icon height) */
}

.card-like-btn.is-active {
  background: #ffe1c2;
  border-color: rgba(255, 122, 26, 0.45);
}

.card-like-count {
  font-weight: 700;
}

.news-control-btn {
  background: #fff1e1;
  border: 1px solid var(--border);
  color: #5b2b12;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.news-control-btn:hover {
  background: #ffe1c2;
}

.news-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.news-item-header h3 {
  margin: 0;
}

.news-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
}

.news-articles-container.hidden {
  display: none;
}

/* Styling for upload_report.html form fields */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}

.form-group input[type="text"],
.form-group textarea,
.form-group input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  box-sizing: border-box; /* Ensure padding doesn't add to width */
  background: var(--surface);
  color: var(--text);
}

.form-group textarea {
  resize: vertical; /* Allow vertical resizing */
  min-height: 100px;
}

.form-actions {
  margin-top: 20px;
  text-align: right;
}

/* Styling for reports.html listing */
.reports-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.reports-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}
.reports-list {
  display: grid;
  gap: 16px;
}

.report-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-strong);
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.report-title {
  font-weight: 700;
  color: var(--text);
  font-size: 1.1em;
  flex-basis: 100%; /* Take full width on small screens */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9em;
  color: var(--muted);
  white-space: nowrap;
}

.report-author .avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--brand-100);
}

.report-date {
  font-size: 0.9em;
  color: var(--muted);
}

.report-description {
  font-size: 0.95em;
  color: var(--text);
  margin-top: 0;
  margin-bottom: 12px;
  white-space: pre-wrap; /* Preserve formatting */
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.report-actions .btn-small {
  padding: 6px 12px;
  font-size: 0.85em;
  min-height: 32px;
}

.report-actions span {
  font-size: 0.9em;
  color: var(--muted);
}

.report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag-item {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background-color: var(--brand-100);
  color: var(--brand-800);
  border-radius: 999px;
  border: 1px solid var(--brand-200);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
.btn-icon:hover {
  background-color: var(--bg-hover);
  color: var(--fg);
}
.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}
.btn-icon.liked svg {
  stroke: var(--brand-600);
  fill: var(--brand-100);
}
.btn-icon.loading {
  opacity: 0.5;
  cursor: wait;
}
.btn-danger.btn-icon,
.btn-danger.btn-icon:hover {
    color: var(--danger-500);
    border-color: var(--danger-200);
    background-color: var(--danger-50);
}
.btn-danger.btn-icon:hover {
    background-color: var(--danger-100);
}


.report-thumbnail {
  margin-top: 12px;
  margin-bottom: 12px;
}



.report-thumbnail img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .report-meta {
    flex-wrap: nowrap; /* Keep items in one line on larger screens */
  }
  .report-title {
    flex-basis: auto; /* Auto width */
  }
  .report-author {
    margin-left: auto; /* Push author to right if title is short */
  }
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-strong);
}

.btn-danger {
  background-color: var(--danger-500);
  color: #fff;
  border-color: var(--danger-500);
}
.btn-danger:hover {
  background-color: var(--danger-600);
  border-color: var(--danger-600);
}
.reports-search {
  display: flex;
  gap: 8px;
  flex: 1;
  margin: 0 16px;
}
.reports-search input {
  width: 100%;
  max-width: 400px;
}

.no-results {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
/* latest-report-card on homepage */
.latest-report-card {
    background: var(--surface-strong);
}
.latest-report-card .report-content {
    padding: 16px;
}
.latest-report-card .report-meta {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.latest-report-card .report-title-link {
    text-decoration: none;
    color: inherit;
    flex-basis: 100%;
}
.latest-report-card .report-title {
    font-size: 1.25em;
    margin: 0;
}
.latest-report-card .report-author,
.latest-report-card .report-date {
    font-size: 0.9em;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.latest-report-card .report-thumbnail-link {
    display: block;
    margin-bottom: 12px;
}

/* Homepage latest report image: fit without forcing scroll */
/* Also make it full-bleed horizontally (remove side padding look). */
.latest-report-card .report-thumbnail {
    margin-left: -16px;
    margin-right: -16px;
}

.latest-report-card .report-thumbnail img {
    max-height: min(60vh, 520px);
    width: 100%;
    height: auto;
    object-fit: contain;
    aspect-ratio: auto;
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}
.latest-report-card .report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.latest-report-card .report-actions .btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    min-height: 32px;
}
 
/* Themes */ 

/* Themes */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.theme-card {
  padding: 16px;
  text-decoration: none;
  color: inherit;
}
.theme-card-title {
  font-weight: 700;
  font-size: 1.05em;
}
.theme-card-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95em;
}
.theme-card-meta {
  margin-top: 10px;
  font-size: 0.9em;
}

/* Admin themes: top list is stacked (no sidebar) for better editing space */
.themes-admin-top {
  display: grid;
  gap: 10px;
}

.themes-admin-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}

.theme-pill:hover {
  background: rgba(255, 255, 255, 0.8);
}

.theme-pill.is-active {
  border-color: rgba(255, 122, 26, 0.45);
  background: #ffe1c2;
}

/* Theme item edit panel (admin) */
.theme-item-edit-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.45);
  display: grid;
  gap: 10px;
}

/* Make inputs fill the panel width (override min-width used elsewhere) */
.theme-item-edit-panel .filter-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.theme-item-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.theme-item-edit-grid label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.theme-item-edit-locked {
  grid-column: 1 / -1;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.theme-item-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .theme-item-edit-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .theme-item-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* Generic table wrapper (used across templates) */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Table base styles (some templates use .table, others use .data-table) */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.form-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.form-grid { display:grid; gap:8px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
