:root {
  --bg: #090d1a;
  --bg-soft: linear-gradient(145deg, rgba(37, 48, 94, 0.45), rgba(19, 23, 44, 0.85));
  --panel: rgba(23, 27, 48, 0.92);
  --muted: #8b90a6;
  --text: #f5f7ff;
  --accent: #3b82f6;
  --ok: #34d399;
  --warn: #f59e0b;
  --danger: #ef4444;
  --badge: rgba(56, 63, 92, 0.7);
  --border: rgba(113, 128, 170, 0.28);
  --shadow: 0 22px 42px rgba(6, 10, 24, 0.6);
  --glass: rgba(18, 23, 44, 0.78);
  --surface-strong: rgba(12, 17, 34, 0.92);
  --surface-soft: rgba(27, 33, 60, 0.78);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
}

body {
  background-image: radial-gradient(circle at 20% 20%, rgba(72, 110, 255, 0.2), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(255, 128, 128, 0.18), transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(58, 196, 168, 0.2), transparent 55%), var(--bg-soft);
  background-attachment: fixed;
}

body.light {
  --bg: #eef1f8;
  --bg-soft: linear-gradient(160deg, rgba(255, 255, 255, 1), rgba(235, 240, 255, 1));
  --panel: rgba(255, 255, 255, 0.9);
  --muted: #5d6380;
  --text: #14172b;
  --accent: #2563eb;
  --ok: #148a63;
  --warn: #b57405;
  --danger: #c0392b;
  --badge: rgba(37, 99, 235, 0.08);
  --border: rgba(19, 23, 44, 0.08);
  --shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
  --glass: rgba(255, 255, 255, 0.85);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(248, 250, 255, 0.92);
}

.hidden {
  display: none !important;
}

.debug-banner {
  border: 1px solid var(--warn);
  background: rgba(245, 158, 11, 0.12);
  color: var(--warn);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

body.light .debug-banner {
  background: rgba(245, 158, 11, 0.18);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 11, 24, 0.88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 12px 28px rgba(8, 12, 28, 0.55);
}

body.light .topbar {
  background: rgba(255, 255, 255, 0.85);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent);
  color: #08122a;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.35);
}

.titles h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.titles h1 span {
  color: var(--accent);
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

/* Stats */
.content {
  padding: 28px clamp(20px, 4vw, 64px) 40px;
  display: grid;
  gap: 30px;
  max-width: 1600px;
  margin: 0 auto;
}

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

.stat {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(9, 13, 26, 0.6);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.24);
  display: grid;
  place-items: center;
  font-size: 26px;
}

.stat.highlight {
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.4), rgba(59, 130, 246, 0.3));
  border-color: transparent;
  color: #021018;
}

.stat.highlight .stat-icon {
  background: rgba(52, 211, 153, 0.2);
}

.stat.highlight .stat-label {
  color: rgba(2, 17, 24, 0.55);
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.stat-value {
  font-weight: 800;
  font-size: 30px;
}

body.light .stat {
  border-color: rgba(19, 23, 44, 0.04);
}

body.light .stat.highlight {
  color: var(--text);
}

body.light .stat.highlight .stat-label {
  color: rgba(20, 23, 43, 0.55);
}

/* Panel + Columns */
.panel {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(6, 10, 24, 0.6);
  overflow: hidden;
}

.panel-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(18, 23, 44, 0.1));
}

.panel h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.hint {
  color: var(--muted);
  margin-top: 0;
  font-size: 13px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  padding: 24px 28px 32px;
  background: radial-gradient(circle at 15% 30%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(circle at 85% 20%, rgba(52, 211, 153, 0.18), transparent 60%);
}

.col {
  background: rgba(12, 18, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  min-height: 260px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 32px rgba(6, 9, 20, 0.55);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

body.light .col {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 10, 24, 0.55);
}

.market {
  display: flex;
  align-items: center;
  gap: 14px;
}

.market-logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.market-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.market-sub {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(189, 196, 224, 0.75);
}

.badge {
  background: var(--badge);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 12px;
  border-radius: 14px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  min-width: 48px;
  text-align: center;
}

.badge.danger {
  color: #fff;
  background: var(--danger);
  border-color: transparent;
}

/* Rows + Items */
.rows {
  list-style: none;
  margin: 0;
  padding: 12px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row-title {
  font-weight: 700;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 20, 42, 0.8);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.items {
  list-style: none;
  margin: 8px 0 0;
  padding: 12px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  border-radius: 14px;
  background: rgba(9, 13, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.items::-webkit-scrollbar {
  width: 8px;
}

.items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.items::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: rgba(21, 27, 49, 0.85);
  box-shadow: 0 10px 20px rgba(6, 9, 20, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(6, 9, 20, 0.5);
}

.item .title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.item .sources {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.btn {
  background: var(--accent);
  color: #08122a;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.dimension-panel {
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dimension-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dimension-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dimension-group {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 18px;
  background: rgba(10, 14, 32, 0.65);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body.light .dimension-group {
  background: rgba(255, 255, 255, 0.85);
}

.dimension-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.dimension-group-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--muted);
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.dimension-card {
  position: relative;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 20px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(16, 22, 44, 0.98), rgba(8, 12, 30, 0.94));
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 18px 30px rgba(6, 9, 20, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dimension-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.38);
  box-shadow: 0 22px 36px rgba(6, 9, 20, 0.65);
}

body.light .dimension-card {
  background: rgba(255, 255, 255, 0.95);
}

.dimension-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.dimension-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.dimension-sub {
  font-size: 12px;
  color: var(--muted);
}

.dimension-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 12, 28, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.1);
  min-width: 0;
}

body.light .dimension-fields {
  background: rgba(248, 250, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.08);
}

.dimension-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}

.dimension-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.9);
}

body.light .dimension-label {
  color: rgba(51, 65, 85, 0.8);
}

.dimension-input {
  padding: 11px 12px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(5, 9, 22, 0.85);
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  width: 100%;
  min-width: 0;
}

.dimension-input::placeholder {
  color: rgba(148, 163, 184, 0.55);
  font-weight: 500;
}

.dimension-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background: rgba(8, 12, 28, 0.95);
}

body.light .dimension-input {
  background: rgba(240, 243, 250, 0.8);
  border-color: rgba(19, 23, 44, 0.12);
}

.dimension-input.missing {
  border-color: rgba(239, 68, 68, 0.85);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
  background: rgba(127, 29, 29, 0.2);
}

body.light .dimension-input.missing {
  background: rgba(254, 226, 226, 0.8);
  border-color: rgba(239, 68, 68, 0.7);
}

.dimension-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dimension-status {
  font-size: 12px;
  color: var(--muted);
}

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

.dimension-status.warn {
  color: var(--warn);
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 32px 0 48px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
  }

  .content {
    padding: 20px;
  }

  .columns {
    grid-template-columns: 1fr;
    padding: 20px;
  }

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

  .dimension-group {
    padding: 16px;
  }

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

  .market-logo {
    width: 44px;
    height: 44px;
  }
}


/* === Cron Status (Topbar) === */
.cron-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 16px;
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.9;
}

.cron-line {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.cron-label {
  color: var(--muted-text, #aaa);
}

.cron-value {
  font-family: monospace;
  color: var(--text-color, #eee);
}
