:root {
  --bg: #0b0f17;
  --bg-gradient: radial-gradient(circle at 10% 10%, #1a2440 0%, var(--bg) 50%);
  --text: #e7ecf5;
  --muted: #9cb1d1;
  --panel: #121a27;
  --panel-2: #182235;
  --border: #24334d;
  --accent: #6ea8fe;
  --accent-2: #8b5cf6;
  --input-bg: #0e1522;
  --card-bg: linear-gradient(180deg, rgba(24,34,53,0.7), rgba(17,23,35,0.7));
  --soft-bg: rgba(9, 14, 24, 0.75);
}

html[data-theme="light"] {
  --bg: #eef3fb;
  --bg-gradient: radial-gradient(circle at 10% 10%, #ffffff 0%, #eef3fb 60%);
  --text: #18243a;
  --muted: #506180;
  --panel: #f8fbff;
  --panel-2: #edf4ff;
  --border: #cfdced;
  --accent: #3b82f6;
  --accent-2: #7c3aed;
  --input-bg: #ffffff;
  --card-bg: linear-gradient(180deg, #ffffff, #f7fbff);
  --soft-bg: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { border-right: 1px solid var(--border); padding: 18px; background: color-mix(in oklab, var(--panel) 85%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.logo { width: 36px; height: 36px; border-radius: 10px; display:grid; place-items:center; font-weight:700; background: linear-gradient(120deg,var(--accent),var(--accent-2)); color: #fff; }
.brand-title { font-weight: 700; }

.nav { display: grid; gap: 8px; }
.nav-item { text-align:left; background: transparent; border:1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px; cursor:pointer; }
.nav-item.active { background: var(--panel-2); border-color: var(--accent); }

.soon-block { margin-top: 16px; border:1px dashed var(--border); border-radius: 10px; padding: 10px; opacity: .85; }
.soon-title { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.soon-list { margin-top: 6px; display: grid; gap: 6px; }
.soon-item {
  text-align: left;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  cursor: not-allowed;
  opacity: .9;
}
.soon-item:disabled { color: var(--muted); }

.main { padding: 20px; }
.topbar { display:flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
h1 { margin: 0; font-size: 24px; }
.topbar-controls { display:flex; align-items: center; gap: 8px; }
.control { display:grid; gap:5px; font-size:12px; color: var(--muted); }

select, input, button { border:1px solid var(--border); border-radius: 10px; padding: 9px 10px; background: var(--input-bg); color: var(--text); }
button { cursor:pointer; }
button:hover { border-color: var(--accent); }

.role-pill { background: linear-gradient(120deg,var(--accent),var(--accent-2)); color:#fff; font-size:12px; font-weight:700; padding: 6px 10px; border-radius: 999px; text-transform: uppercase; }

.content { display:grid; gap: 12px; }
.card { border:1px solid var(--border); border-radius: 14px; background: var(--card-bg); padding: 14px; }
.row-between { display:flex; justify-content: space-between; align-items: center; gap: 8px; }
.button-row { display:flex; gap:8px; flex-wrap:wrap; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.search-row { display:grid; grid-template-columns: 1fr auto; gap:8px; }
.chat-window { margin-top:10px; min-height: 120px; max-height: 220px; overflow:auto; border:1px solid var(--border); border-radius:10px; padding:10px; background: var(--soft-bg); }
.message { border-radius: 8px; padding:8px 10px; margin-bottom:8px; }
.message.ai { background: color-mix(in oklab, var(--accent) 20%, transparent); }
.message.user { background: color-mix(in oklab, var(--accent-2) 18%, transparent); }
.result-summary { margin-top: 10px; padding: 8px 10px; border:1px solid var(--border); border-radius:10px; }

.filters-row { display:flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.filters-row label { display:grid; gap:4px; font-size:12px; color: var(--muted); }

.project-list { display:grid; gap:8px; }
.project-card { width:100%; text-align:left; border:1px solid var(--border); border-radius: 12px; background: var(--soft-bg); padding: 10px; }
.project-card.active { border-color: var(--accent); }
.project-title-row { display:flex; justify-content: space-between; align-items:center; }
.project-title { font-weight:700; }
.archive-pill { font-size: 11px; background: #f59e0b; color:#111; border-radius: 999px; padding: 2px 7px; }
.hitlist-pill { font-size: 11px; background: linear-gradient(120deg, #ef4444, #f97316); color:#fff; border-radius: 999px; padding: 2px 7px; font-weight: 700; letter-spacing: .3px; }
.pill-row { display:flex; gap: 6px; align-items: center; }
.detail-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.data-source { margin-top: 12px; }
.data-note { font-size: 11px; color: var(--muted); line-height: 1.4; }
.data-note code { background: var(--input-bg); padding: 1px 4px; border-radius: 4px; font-size: 10px; }
.legacy-wrap { margin-top: 14px; }
.legacy-block { border:1px dashed var(--border); border-radius: 10px; padding: 8px 10px; background: var(--soft-bg); }
.legacy-block summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.legacy-block summary:hover { color: var(--text); }
.legacy-body { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.project-logline { margin: 6px 0; color: var(--muted); }
.project-meta { margin:0; font-size: 13px; }

.pagination { margin-top: 10px; display:flex; align-items:center; justify-content:flex-end; gap: 8px; }
.applied-banner { margin: 8px 0; padding: 8px 10px; border:1px dashed var(--border); border-radius:10px; color: var(--muted); }

.tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 10px; }
.tab-btn.active { background: var(--panel-2); border-color: var(--accent); }
.tab-panel { display:none; }
.tab-panel.active { display:block; }
.panel-grid { display:grid; grid-template-columns: repeat(2,minmax(140px,1fr)); gap:10px; }
.field { border:1px solid var(--border); border-radius:10px; background: var(--soft-bg); padding:8px; }
.field-label { font-size:12px; color: var(--muted); }
.field-value { margin-top:4px; font-weight:600; }
.hidden-value { opacity: .7; font-style: italic; }

.stack { display:grid; gap:8px; }
.item { border:1px solid var(--border); border-radius:10px; background: var(--soft-bg); padding:10px; }
.item-title { font-weight:700; margin-bottom: 4px; }
.item-sub { color: var(--muted); font-size: 13px; }
.mini-title { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }

.toggle-wrap { display:flex; align-items:center; gap:6px; font-size: 13px; color: var(--muted); }
.toggle-wrap input { width: 16px; height: 16px; }

.admin-only.hidden, .hidden { display:none !important; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .grid-2, .panel-grid { grid-template-columns: 1fr; }
}
