:root {
  --bg-0: #05060b;
  --bg-1: #0a0d18;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --panel-border: rgba(255, 255, 255, 0.09);
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --gray: #6b7280;
  --text-hi: #f4f5fb;
  --text-mid: #a6acc4;
  --text-low: #5c6280;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text-hi); min-height: 100vh; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.18), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(34, 211, 238, 0.14), transparent 45%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

.glass {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  backdrop-filter: blur(18px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 20px 32px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(5,6,11,0.92), rgba(5,6,11,0.55));
  border-bottom: 1px solid var(--panel-border); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; background: linear-gradient(135deg, var(--violet), var(--cyan)); color: #06070d;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.45);
}
.brand-text h1 { margin: 0; font-size: 18px; font-weight: 700; }
.brand-text span { font-size: 12px; color: var(--text-mid); }

.read-only-badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.4px; padding: 7px 12px; border-radius: 999px;
  color: #ffe0b3; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35);
}

.phase-banner {
  max-width: 1200px; margin: 18px auto 0; padding: 12px 20px;
  background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px; font-size: 13px; color: #ffe6b8; line-height: 1.5;
  font-weight: 600;
}

.phase-banner.mode-real {
  background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.4); color: #ffd9d9;
}

.layout { max-width: 1200px; margin: 0 auto; padding: 20px 32px 80px; display: flex; flex-direction: column; gap: 20px; }
.panel { padding: 24px; }
.panel-head { margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-sub { font-size: 12px; color: var(--text-low); }
.panel-head-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.panel-head-row h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.count-badge {
  font-size: 11px; font-weight: 800; background: linear-gradient(135deg, var(--violet), var(--cyan));
  color: #06070d; padding: 2px 9px; border-radius: 999px;
}

select {
  background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); color: var(--text-hi);
  padding: 8px 12px; border-radius: 10px; font-size: 12.5px;
}

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; color: var(--text-low); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 8px 10px; border-bottom: 1px solid var(--panel-border);
}
.data-table tbody td { padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text-mid); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: rgba(255,255,255,0.035); }
.data-table tbody td:first-child { color: var(--text-hi); font-weight: 600; }

.empty-state { color: var(--text-low); font-size: 13px; padding: 24px 4px; text-align: center; }

.badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.3px;
  white-space: nowrap; display: inline-block;
}
.badge-neutral { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-good { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-warn { background: rgba(251,191,36,0.15); color: var(--amber); }
.badge-bad { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-gray { background: rgba(107,114,128,0.18); color: #b6bccb; }

.action-btn {
  font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; border: 1px solid;
  margin-right: 6px;
}
.action-approve { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.35); color: #b7f5d8; }
.action-discard { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #ffd9d9; }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.drawer.open { display: flex; }
.drawer-card { width: min(520px, 100%); max-height: 84vh; overflow-y: auto; padding: 26px; position: relative; }
.drawer-close { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.06); border: none; color: var(--text-hi); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px; }

.chat-bubble { padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; font-size: 13px; max-width: 85%; }
.chat-bubble.in { background: rgba(255,255,255,0.06); color: var(--text-hi); }
.chat-bubble.out { background: rgba(139, 92, 246, 0.18); color: #f1eaff; margin-left: auto; }
.chat-meta { font-size: 10px; color: var(--text-low); margin-top: 2px; }
