/* ============================================================
   DESIGN TOKENS — "Ops Console"
   A mission-control feel: dense, legible, alert-driven.
   Not decorative — every color means a status.
   ============================================================ */
:root {
  /* Surfaces */
  --ink:        #12181F;   /* app background */
  --panel:      #1B232C;   /* card / row background */
  --panel-2:    #212B35;   /* raised / hover surface */
  --hairline:   #2A343F;   /* borders, dividers */

  /* Text */
  --text-hi:    #E7ECF1;
  --text-mid:   #AEB9C4;
  --text-low:   #7C8894;

  /* Status accents (the only saturated colors in the system) */
  --pending:    #E8A33D;   /* amber — needs attention */
  --completed:  #3FAE8C;   /* teal  — resolved */
  --danger:     #E1614D;   /* coral — locked / destructive */
  --info:       #5B8DEF;   /* blue  — neutral action / links */

  /* Type */
  --font-display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --font-body:    'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--ink);
  color: var(--text-hi);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#app-root {
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: max-width .25s ease, border-radius .25s ease;
}

/* ---- Side-panel dock vs fullscreen ---- */
body[data-panel="docked"] #app-root {
  max-width: 460px;
  margin-left: auto;
  border-left: 1px solid var(--hairline);
  box-shadow: -12px 0 40px rgba(0,0,0,.45);
}
body[data-panel="fullscreen"] #app-root {
  max-width: 100%;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel);
  flex-shrink: 0;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: 15px;
  letter-spacing: .02em;
  margin-right: auto;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--completed); box-shadow: 0 0 8px var(--completed); }

.icon-btn {
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  color: var(--text-mid);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { color: var(--text-hi); border-color: var(--info); }

.layout-switcher {
  display: flex; gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.layout-switcher button {
  background: transparent; border: none; color: var(--text-low);
  font-family: var(--font-mono); font-size: 11px;
  padding: 5px 8px; border-radius: 4px; cursor: pointer;
}
.layout-switcher button.active { background: var(--ink); color: var(--text-hi); }

/* ---- Status rail (signature element): a small tick-strip of pending density ---- */
.status-rail {
  display: flex; align-items: flex-end; gap: 2px; height: 18px;
}
.status-rail i {
  display: block; width: 3px; border-radius: 1px;
  background: var(--hairline);
}
.status-rail i.lit { background: var(--pending); }

/* ---- Generic section / card ---- */
.section {
  border: 1px solid var(--hairline);
  background: var(--panel);
  border-radius: var(--radius);
  margin: 10px 12px;
  overflow: hidden;
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.section-head .title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 13.5px;
  flex: 1;
}
.section-head .chevron {
  color: var(--text-low);
  transition: transform .18s ease;
  font-size: 11px;
}
.section.expanded .chevron { transform: rotate(90deg); }
.section-body { display: none; padding: 0 14px 14px; }
.section.expanded .section-body { display: block; }

.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-mid);
  border: 1px solid var(--hairline);
}
.badge.pending { color: var(--pending); border-color: var(--pending); }
.badge.completed { color: var(--completed); border-color: var(--completed); }

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.row:last-child { border-bottom: none; }
.row .label { color: var(--text-mid); min-width: 90px; font-size: 12px; }
.row .value { flex: 1; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .credential { letter-spacing: 2px; color: var(--text-low); }

.btn {
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--panel-2); color: var(--text-hi);
  cursor: pointer;
}
.btn:hover { border-color: var(--info); }
.btn.primary { background: var(--info); border-color: var(--info); color: #0B1220; }
.btn.tiny { padding: 4px 8px; font-size: 11px; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  border: 1px solid var(--hairline); cursor: pointer;
  background: var(--panel-2); color: var(--text-hi);
  margin: 3px 4px 3px 0;
}
.pill .count { font-family: var(--font-mono); font-size: 10px; background: var(--ink); padding: 1px 6px; border-radius: 10px; }

.empty-note { color: var(--text-low); font-size: 12.5px; padding: 10px 0; font-style: italic; }

/* ---- Lock screen ---- */
.lock-screen {
  position: fixed; inset: 0; z-index: 999;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px;
}
.lock-dial {
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--text-mid);
  position: relative;
}
.lock-dial::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 3px solid transparent;
  border-top-color: var(--pending);
  animation: spin 3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lock-form { display: flex; flex-direction: column; gap: 10px; width: 220px; }
.lock-form input {
  background: var(--panel); border: 1px solid var(--hairline); color: var(--text-hi);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px;
  font-family: var(--font-mono);
}
.lock-form input:focus { outline: none; border-color: var(--info); }
.lock-error { color: var(--danger); font-size: 12px; text-align: center; min-height: 16px; }
.lock-title { font-family: var(--font-display); font-weight: 600; color: var(--text-hi); font-size: 14px; }
.lock-sub { color: var(--text-low); font-size: 12px; margin-top: -12px; }

.content-scroll { flex: 1; overflow-y: auto; }

/* ---- Add/edit modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); width: 340px; max-width: 90vw;
  max-height: 85vh; overflow-y: auto;
  padding: 16px;
}
.modal-box h3 {
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  margin: 0 0 12px; color: var(--text-hi);
}
.modal-box label {
  display: block; font-size: 11px; color: var(--text-low);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 10px 0 4px;
}
.modal-box input, .modal-box select, .modal-box textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--hairline);
  color: var(--text-hi); padding: 8px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px;
}
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus { outline: none; border-color: var(--info); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;
}
.modal-note { font-size: 11px; color: var(--text-low); margin-top: 4px; }
.field-row { display: flex; gap: 8px; }
.field-row > div { flex: 1; }

.add-btn {
  background: transparent; border: 1px dashed var(--hairline);
  color: var(--text-low); width: 24px; height: 24px; border-radius: 6px;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.add-btn:hover { color: var(--text-hi); border-color: var(--info); }

.section-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .lock-dial::after { animation: none; }
  * { transition: none !important; }
}
