:root {
  --bg:        #1a1a2e;
  --bg-card:   #16213e;
  --border:    #0f3460;
  --accent:    #e94560;
  --green:     #00d4aa;
  --yellow:    #f59e0b;
  --blue:      #60a5fa;
  --text:      #e0e0e0;
  --muted:     #888;
  --header-h:  56px;
  --sidebar-w: 220px;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-top: var(--header-h);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Top nav ─────────────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
}

.nav-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 6px 11px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover  { color: var(--text); background: var(--border); }
.nav-link.active { color: var(--accent); background: rgba(233,69,96,0.12); }

.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Nav user / logout ───────────────────────────────────────────────────── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.nav-username {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.nav-logout {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-logout:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(233,69,96,0.08);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #444;
  flex-shrink: 0;
}

/* ── App layout ──────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebars ────────────────────────────────────────────────────────────── */
.sidebar {
  display: none;
}

.sidebar-left  { border-right: 1px solid var(--border); }
.sidebar-right { border-left:  1px solid var(--border); }

.sidebar-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Stat rows ───────────────────────────────────────────────────────────── */
.stat-row { margin-bottom: 14px; }

.stat-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.stat-value {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.stat-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 3px;
}

.stat-updated {
  font-size: 0.65rem;
  color: #555;
  margin-top: 10px;
}

/* ── Progress bars ───────────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--green);
  transition: width 0.6s ease;
}

.progress-bar-fill.warn   { background: var(--yellow); }
.progress-bar-fill.danger { background: var(--accent); }

/* ── Claude usage ────────────────────────────────────────────────────────── */
.usage-section {
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(15,52,96,0.3);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.usage-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.usage-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.usage-reset {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}

.claude-edit-input {
  width: 100%;
  background: #0d0d1a;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 9px;
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  margin-bottom: 6px;
}

.claude-edit-input:focus { border-color: var(--accent); }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 22px; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.card + .card { margin-top: 16px; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-card-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 5px;
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

th {
  text-align: left;
  padding: 7px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(15,52,96,0.4);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td     { background: rgba(15,52,96,0.25); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
}

.badge-green  { background: rgba(0,212,170,0.15);  color: var(--green); }
.badge-red    { background: rgba(233,69,96,0.15);  color: var(--accent); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-blue   { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-gray   { background: rgba(136,136,136,0.15); color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn:hover    { opacity: 0.85; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm       { padding: 4px 10px; font-size: 0.75rem; }

/* ── Code ────────────────────────────────────────────────────────────────── */
code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: var(--green);
  background: rgba(0,212,170,0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green);
  color: #0d0d1a;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 1000;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ── Security checklist ──────────────────────────────────────────────────── */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15,52,96,0.4);
}

.check-item:last-child { border-bottom: none; }

.check-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.check-label { font-weight: 600; font-size: 0.875rem; }
.check-desc  { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* ── Commands page ───────────────────────────────────────────────────────── */
.search-wrap { position: relative; margin-bottom: 16px; }

.search-wrap .tt-input {
  width: 100%;
  background: #0d0d1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px 11px 40px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap .tt-input:focus { border-color: var(--accent); }
.search-wrap .tt-input::placeholder { color: #444; }

.search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: #555;
  pointer-events: none;
}

.tt-menu {
  width: 100%;
  background: #0f1b35;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 50;
}

.tt-suggestion {
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.tt-suggestion:last-child { border-bottom: none; }
.tt-suggestion:hover, .tt-suggestion.tt-cursor { background: var(--border); }

.sug-name { font-weight: 600; font-size: 0.85rem; color: #c0c0c0; display: block; }
.sug-cmd  { font-family: 'Courier New', monospace; font-size: 0.75rem; color: var(--green); display: block; }

.tt-highlight { color: var(--accent); font-style: normal; }

.command-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.command-list li { display: flex; align-items: center; gap: 8px; }

.row-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.row-label:hover { background: var(--border); border-color: var(--accent); }

.command-list input[type="radio"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.label-text { display: flex; flex-direction: column; gap: 1px; }
.cmd-name   { font-weight: 600; font-size: 0.875rem; color: #c0c0c0; }
.cmd-desc   { font-size: 0.72rem; color: #666; }

.command-list li:has(input[type="radio"]:checked) .row-label { background: var(--border); border-color: var(--accent); }
.command-list li:has(input[type="radio"]:checked) .cmd-name  { color: var(--accent); }

.tested-wrap input[type="checkbox"] { display: none; }

.tested-label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 20px;
  border: 1px solid #2a2a4a;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}

.tested-label:hover { border-color: var(--green); color: var(--green); }

.tested-wrap input[type="checkbox"]:checked + .tested-label {
  background: rgba(0,212,170,0.1);
  border-color: var(--green);
  color: var(--green);
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-input {
  background: #0d0d1a;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: #444; }

/* ── Log viewer ──────────────────────────────────────────────────────────── */
.log-entry { font-family: 'Courier New', monospace; font-size: 0.75rem; }
.log-200   { color: var(--green); }
.log-3xx   { color: var(--blue); }
.log-4xx   { color: var(--yellow); }
.log-5xx   { color: var(--accent); }

/* ── Loading state ───────────────────────────────────────────────────────── */
.loading-text { color: #555; font-size: 0.85rem; padding: 20px 0; text-align: center; }
