/* SHIFTLOG — SOC Shift Handover */
/* H3AD-SEC Design System — matched to TRACERULES */

:root {
  --bg: #080c14;
  --panel: #0d1117;
  --panel-alt: #111827;
  --surface: #18253a;
  --text: #e6edf3;
  --text-dim: #96b0cc;
  --muted: #6b7280;
  --muted-dim: #3a5470;
  --accent: #00d4ff;
  --primary: #00d4ff;
  --primary-dim: rgba(0, 212, 255, 0.08);
  --primary-glow: rgba(0, 212, 255, 0.18);
  --accent2: #4d94ff;
  --border: #1c2333;
  --border-dim: #121e30;
  --status-partial: #f59e0b;
  --nav-h: 48px;
  --topbar-h: 48px;
  --mono: 'Share Tech Mono', monospace;
}

body.light {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-alt: #f1f5f9;
  --surface: #ccd8ec;
  --text: #0d1117;
  --text-dim: #142540;
  --muted: #5c6b8a;
  --muted-dim: #5c7a9a;
  --accent: #0284c7;
  --primary: #0284c7;
  --primary-dim: rgba(2, 132, 199, 0.07);
  --accent2: #0ea5e9;
  --border: #e2e8f0;
  --border-dim: #c8d8ec;
  --status-partial: #d97706;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-input:focus-visible,
.notes-textarea:focus-visible,
.list-row textarea:focus-visible { outline: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(0, 212, 255, 0.055) 0%, transparent 100%),
    radial-gradient(ellipse 50% 35% at 5% 100%, rgba(88, 166, 255, 0.04) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}
body.light::before {
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(2, 132, 199, 0.05) 0%, transparent 100%),
    radial-gradient(ellipse 50% 35% at 5% 100%, rgba(37, 99, 235, 0.03) 0%, transparent 100%);
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  transition: background .3s, border-color .3s;
}

.nav-brand {
  font-family: 'Share Tech Mono', monospace;
  font-size: .78rem;
  color: var(--accent);
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
}
.nav-brand img { height: 22px; width: auto; vertical-align: middle; }

.xv-nav-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.xv-pill-name { font-family: 'Exo 2', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 4px; line-height: 1; }
.xv-pill-accent { color: var(--accent); }
.xv-pill-text { color: var(--text); }
.xv-pill-tagline { font-family: 'Exo 2', sans-serif; font-weight: 400; font-size: 8px; color: var(--muted); letter-spacing: 1.5px; }

.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: visible;
}
.nav-links a {
  font-family: 'Exo 2', sans-serif;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all .15s;
}
.nav-links a:hover { color: var(--accent); border-color: var(--border); background: var(--primary-dim); }
.nav-links a.nav-current { color: var(--accent); border: 1px solid var(--border); }
.nav-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.nav-right { margin-left: auto; flex-shrink: 0; padding-left: 1rem; }

.theme-toggle { cursor: pointer; }
.toggle-track { width: 44px; height: 22px; background: var(--border); border-radius: 50px; position: relative; }
.toggle-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform .3s;
  box-shadow: 0 0 6px var(--accent);
}
body.light .toggle-thumb { transform: translateX(22px); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px;
  margin-right: 8px;
  flex-shrink: 0;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--muted); border-radius: 2px; }

.nav-item { position: relative; display: flex; align-items: center; }
.nav-dropdown { display: none; position: absolute; top: 100%; left: 0; min-width: 130px; padding-top: 6px; z-index: 200; }
.nav-dropdown-inner { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.nav-item:hover .nav-dropdown { display: block; }
.nav-links .nav-dropdown a {
  display: block;
  padding: 7px 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  transition: .15s;
}
.nav-links .nav-dropdown a:hover,
.nav-links .nav-dropdown a.nav-current {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--primary-dim);
}

/* ── Mobile drawer ────────────────────────────────────────────────────────── */
.nav-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: .75rem 1.25rem 1rem;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: .15s;
}
.nav-drawer a:hover { color: var(--accent); border-left-color: var(--accent); background: var(--primary-dim); }
.nav-drawer a.nav-current { color: var(--accent); }
.drawer-sub { padding-left: 1.8rem !important; font-size: 11px !important; opacity: .8; }

body.nav-compact .nav-links { display: none; }
body.nav-compact .hamburger { display: flex; }

/* ── Page wrap ────────────────────────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  padding-top: var(--nav-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Scroll sentinel ──────────────────────────────────────────────────────── */
#scroll-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 10px; pointer-events: none; }

/* ── Top bar (sticky secondary bar) ──────────────────────────────────────── */
.sl-topbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--topbar-h);
  flex-wrap: nowrap;
}
.sl-topbar-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tb-breadcrumb {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.tb-breadcrumb a { color: var(--muted); text-decoration: none; transition: color .15s; }
.tb-breadcrumb a:hover { color: var(--accent); }
.tb-breadcrumb .tb-current { color: var(--accent); }
.tb-tagline {
  font-family: 'Exo 2', sans-serif;
  font-size: 10px;
  color: var(--muted-dim);
  letter-spacing: 0.06em;
  font-weight: 300;
}
.sl-topbar-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 20px 20px 40px;
}

/* ── Two-col layout ───────────────────────────────────────────────────────── */
.sl-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 16px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  background: var(--primary-dim);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--primary-glow); }

.btn-secondary {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover { color: var(--text); border-color: var(--muted); }

#log-count-badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}

/* ── Saved panel ──────────────────────────────────────────────────────────── */
.saved-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}
.saved-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
}
.close-panel-btn {
  background: none; border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: color .15s;
}
.close-panel-btn:hover { color: var(--text); }

.saved-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.saved-empty { padding: 20px; font-size: 0.75rem; color: var(--muted); text-align: center; }
.saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dim);
  gap: 16px;
  transition: background 0.12s;
}
.saved-item:hover { background: var(--primary-dim); }
.saved-item:last-child { border-bottom: none; }
.saved-item-meta { display: flex; flex-direction: column; gap: 2px; }
.saved-item-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.04em;
}
.saved-item-sub { font-size: 11px; color: var(--muted); }
.saved-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-action {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  transition: all .14s;
}
.icon-action:hover { color: var(--accent); border-color: var(--accent); background: var(--primary-dim); }
.icon-action.del:hover { color: var(--status-partial); border-color: var(--status-partial); background: rgba(245, 158, 11, 0.06); }

/* ── Form col ─────────────────────────────────────────────────────────────── */
.form-col { display: flex; flex-direction: column; gap: 12px; }

.form-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.18s;
}
.form-section:hover { border-color: var(--muted-dim); }

.section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
  border-left: 2px solid var(--accent2);
  border-top: 1px solid var(--border, #1c2333);
  border-right: 1px solid var(--border, #1c2333);
  border-bottom: 1px solid var(--border, #1c2333);
  padding: 2px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel, #0d1117);
}

.section-count {
  background: var(--accent2);
  color: var(--bg);
  font-size: 8px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  line-height: 16px;
}
.hint-text { font-size: 11px; color: var(--muted); line-height: 1.5; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.field-input {
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.field-input:focus { border-color: var(--accent); }
.field-input option { background: var(--panel); }

/* ── List items ───────────────────────────────────────────────────────────── */
.list-items { display: flex; flex-direction: column; gap: 6px; }
.list-row { display: flex; gap: 6px; align-items: flex-start; }
.list-row textarea {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  font-size: 12px;
  outline: none;
  resize: vertical;
  min-height: 36px;
  transition: border-color 0.15s;
  line-height: 1.55;
}
.list-row textarea:focus { border-color: var(--accent); }
.list-row textarea::placeholder { color: var(--muted); font-style: italic; }

.remove-row-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  min-width: 36px; min-height: 36px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all .14s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remove-row-btn:hover { color: var(--status-partial); border-color: var(--status-partial); }

.add-row-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: left;
  transition: all .14s;
  min-height: 36px;
}
.add-row-btn:hover { color: var(--accent); border-color: var(--accent); }

.list-items:empty::after {
  content: 'No items yet.';
  display: block;
  padding: 10px 12px;
  border: 1px dashed var(--border-dim);
  border-radius: 4px;
  color: var(--muted-dim);
  font-size: 11px;
  text-align: center;
}

.notes-textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  font-size: 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
  line-height: 1.6;
}
.notes-textarea:focus { border-color: var(--accent); }
.notes-textarea::placeholder { color: var(--muted); font-style: italic; }

.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 4px; }

.draft-indicator {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
  margin-right: auto;
  transition: color 0.2s, opacity 0.4s;
  opacity: 0;
}
.draft-indicator.visible { color: var(--accent2); opacity: 1; }

/* ── Preview col ──────────────────────────────────────────────────────────── */
.preview-col {
  position: sticky;
  top: calc(var(--nav-h) + var(--topbar-h) + 20px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s;
}
.preview-col:hover { border-color: var(--muted-dim); }

.preview-empty {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.preview-empty-icon { font-size: 1.6rem; color: var(--border); }
.preview-empty-text { font-size: 12px; color: var(--muted); }

.preview-content {
  overflow-y: auto;
  max-height: 70vh;
  scrollbar-width: thin;
  scrollbar-color: var(--muted-dim) transparent;
}
.preview-content::-webkit-scrollbar { width: 4px; }
.preview-content::-webkit-scrollbar-thumb { background: var(--muted-dim); border-radius: 2px; }

.preview-stats-strip {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.preview-stats-chip {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
}
.preview-stats-chip strong { color: var(--text); }
.preview-stats-chip.warn strong { color: var(--status-partial); }

.preview-meta-block {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preview-meta-row { display: flex; gap: 10px; align-items: baseline; }
.preview-meta-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-width: 72px;
  flex-shrink: 0;
}
.preview-meta-val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.preview-section {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-dim);
}
.preview-section:last-child { border-bottom: none; }
.preview-section-header {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent2);
  margin-bottom: 6px;
  border-left: 2px solid var(--accent2);
  padding-left: 6px;
}
.preview-section-items {
  list-style: decimal;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preview-section-items li {
  font-family: 'Exo 2', sans-serif;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.55;
}
.preview-empty-section { font-size: 11px; color: var(--muted); font-style: italic; }
.preview-notes {
  font-family: 'Exo 2', sans-serif;
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.6;
}

.preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.hidden { display: none !important; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
body.nav-compact .nav-links { display: none; }
body.nav-compact .hamburger { display: flex; }

@media (max-width: 768px) {
  .sl-topbar { height: auto; padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
  .sl-topbar-left { display: none; }
  .sl-topbar-right { flex: 1; justify-content: flex-end; }
  .main-content { padding: 14px 14px 32px; }
}

@media (max-width: 800px) {
  .sl-layout { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ── Small mobile (≤480px) ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .main-content { padding: 10px 10px 28px; }
  .form-section { padding: 10px 10px 10px; }
  .meta-grid { gap: 8px; }
  .form-actions { flex-direction: column; align-items: stretch; gap: 6px; }
  .form-actions .btn-primary,
  .form-actions .btn-secondary { width: 100%; text-align: center; justify-content: center; }
  .saved-item { padding: 8px 10px; gap: 8px; }
  .saved-item-actions { flex-shrink: 0; }
  .preview-actions { padding: 8px 10px; gap: 6px; }
  .preview-actions .btn-primary,
  .preview-actions .btn-secondary { flex: 1 1 auto; text-align: center; justify-content: center; }
  .sl-topbar { padding: 6px 10px; }
  .sl-topbar-right { gap: 6px; }
}

/* ── XS phones (≤375px) ──────────────────────────────────────────────────── */
@media (max-width: 375px) {
  .main-content { padding: 8px 8px 24px; }
  .field-input { font-size: 12px; padding: 6px 8px; }
  .btn-primary,
  .btn-secondary { padding: 7px 12px; font-size: 10px; }
  .section-label { font-size: 9px; padding: 2px 8px; }
  .site-footer { padding: 10px 14px; }
  .form-section { padding: 8px 8px 8px; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .nav, .sl-topbar, .form-col, .preview-actions, .saved-panel, .site-footer { display: none !important; }
  .page-wrap { padding-top: 0; }
  .sl-layout { grid-template-columns: 1fr; }
  .preview-col { border: none; position: static; max-height: none; border-radius: 0; }
  .preview-content { max-height: none; }
  .preview-stats-chip { border: 1px solid #999; color: #333; background: #f5f5f5; }
  .preview-stats-chip strong { color: #000; }
  .preview-section-header { color: #555; border-left-color: #555; }
  .preview-section-items li, .preview-meta-val, .preview-notes { color: #000; }
  .preview-meta-label { color: #555; }
  body { background: #fff; color: #000; }
}
