/* ================================================================
   ClearCommand — Shared UI Components
   Unified button, spinner, badge, and common component styles.
   Include this BEFORE page-specific <style> blocks.
   ================================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }

/* ---- CSS Variables (design tokens) ----
   Single source of truth for the ClearCommand palette. Every page that
   needs a colour should reference one of these tokens rather than
   hard-coding a hex. When new pages introduce a semantic shade that
   is not yet covered here, add a token and use it across the
   codebase — do not paste a raw hex into a page's <style> block.
*/
:root {
  /* ── Brand / neutrals ── */
  --navy:       #0A1628;
  --blue:       #0066FF;
  --blue-dark:  #0052cc;
  --blue-tint:  #eff6ff;   /* faint blue wash behind hover / selected */
  --blue-soft:  #dbeafe;   /* chips, inline info highlights */
  --white:      #FFFFFF;
  --slate:      #64748B;
  --slate-dark: #475569;
  --text:       #1e293b;   /* primary body text */
  --text-soft:  #334155;   /* secondary body text */
  --bg:         #F8FAFC;   /* page background, table zebra */
  --bg-soft:    #f1f5f9;   /* code backgrounds, subtle containers */
  --border:     #E2E8F0;
  --border-strong: #cbd5e1;

  /* ── Semantic status shades ── Used by badges, banners, risk pills.
     Light-bg + dark-fg pairs are chosen so they pass WCAG AA when
     used as coloured tags against the default surface. */
  --success-bg:  #d1fae5;
  --success-fg:  #065f46;
  --success-strong: #16a34a;
  --warning-bg:  #fef3c7;
  --warning-fg:  #92400e;
  --warning-strong: #f59e0b;
  --danger-bg:   #fee2e2;
  --danger-fg:   #991b1b;
  --danger-strong: #dc2626;
  --info-bg:     #dbeafe;
  --info-fg:     #1e40af;

  /* Accent blue used in heading text and nav hovers. */
  --heading-accent: #1e3a5f;
}

/* ================================================================
   BUTTON DESIGN SYSTEM
   ----------------------------------------------------------------
   One base class (``.btn``) + five semantic modifiers tied to
   intent, not colour name:

     .btn-primary    — main action / CTA (blue, filled)
     .btn-secondary  — cancel / tertiary toolbar op (white, bordered)
     .btn-success    — constructive action (publish, approve — green)
     .btn-warning    — cautionary flip-off (unpublish, pause — amber)
     .btn-danger     — destructive action (delete, remove — red)

   Every variant is solid-filled so a row of buttons reads as one
   toolbar — never mix filled + outline for buttons of equivalent
   weight. Disabled state and hover lift are shared.

   Size: default is ~10×20. Add ``.btn-sm`` in dense contexts (rows).

   Several legacy class names are kept as aliases so existing markup
   keeps working; **do not introduce new legacy names**. Eventually
   every legacy alias should be migrated to the canonical modifier.
   ================================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-sizing: border-box; height: 38px; line-height: 1;
  padding: 0 20px; font-size: 0.875rem; font-weight: 600;
  font-family: inherit; border: 1px solid transparent; border-radius: 7px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled,
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; pointer-events: none; box-shadow: none; }
.btn svg { width: 15px; height: 15px; }

/* Primary — blue filled. Default for save/submit/create/open/continue. */
.btn-primary,
.btn-draft,
.btn-upload,
.btn-cta,
.btn-save,
.btn-login,
.btn-submit,
.btn-browse-blue,
.btn-browse-purple {
  background: var(--blue); color: var(--white); border-color: var(--blue);
}
.btn-primary:hover,
.btn-draft:hover,
.btn-upload:hover,
.btn-cta:hover,
.btn-save:hover,
.btn-login:hover,
.btn-submit:hover,
.btn-browse-blue:hover,
.btn-browse-purple:hover {
  background: var(--blue-dark); border-color: var(--blue-dark);
  box-shadow: 0 4px 10px rgba(0,102,255,0.2);
}

/* Secondary — white filled, bordered. Cancel/back/toolbar utilities. */
.btn-secondary,
.btn-ghost,
.btn-cta-secondary {
  background: var(--white); color: var(--text); border-color: var(--border);
}
.btn-secondary:hover,
.btn-ghost:hover,
.btn-cta-secondary:hover {
  border-color: var(--text); background: var(--bg);
}

/* Success — solid green. Constructive flip-on actions (publish, approve). */
.btn-success,
.btn-confirm,
.btn-confirm-all {
  background: #059669; color: var(--white); border-color: #059669;
}
.btn-success:hover,
.btn-confirm:hover,
.btn-confirm-all:hover {
  background: #047857; border-color: #047857;
  box-shadow: 0 4px 10px rgba(5,150,105,0.2);
}
/* ``confirmed`` is a sticky pressed state used by the review screens. */
.btn-confirm.confirmed { background: #065f46; border-color: #065f46; }

/* Warning — solid amber. Cautionary flip-off (unpublish, pause). */
.btn-warning {
  background: #f59e0b; color: var(--white); border-color: #f59e0b;
}
.btn-warning:hover {
  background: #d97706; border-color: #d97706;
  box-shadow: 0 4px 10px rgba(217,119,6,0.2);
}

/* Danger — solid red. Destructive ops (delete, remove). */
.btn-danger {
  background: #dc2626; color: var(--white); border-color: #dc2626;
}
.btn-danger:hover {
  background: #b91c1c; border-color: #b91c1c;
  box-shadow: 0 4px 10px rgba(220,38,38,0.25);
}

/* Outline-only danger — same colour family as ``.btn-danger`` but
   with the white fill of ``.btn-secondary``, so it pairs visually
   with neutral outline buttons in the same row. */
.btn-danger-outline {
  background: var(--white); color: #b91c1c; border-color: #dc2626;
}
.btn-danger-outline:hover {
  background: #fef2f2; color: #991b1b; border-color: #b91c1c;
}

/* Size variants */
.btn-sm { height: 30px; padding: 0 14px; font-size: 0.8rem; }

/* Legacy overrides — keep these neutralised so they don't override the
   canonical variants the element also has. A caller writing
   ``class="btn btn-login"`` picks up the primary style above; make sure
   a stray width override doesn't leak. */
.btn.btn-login,
.btn.btn-submit { width: auto; }

/* ---- Back / "Back link" (plain text navigation — not a button) ---- */
.back-link {
  color: var(--blue); text-decoration: none;
  font-size: 0.8125rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; font-family: inherit; padding: 0;
}
.back-link:hover { color: var(--blue-dark); text-decoration: underline; }

/* ---- ICON-ONLY BUTTONS ----------------------------------------
   These are the single exception to the solid-filled rule: they
   are small affordances inside dense rows (policy table, member
   list, upload queue) where a full-size filled button would
   dominate the row. Keep them minimal. */

.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--slate); padding: 4px 6px; border-radius: 4px;
  line-height: 1; font-family: inherit; font-size: 0.8rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.btn-icon-danger:hover { background: #fee2e2; color: #991b1b; }
.btn-icon svg { width: 16px; height: 16px; }

/* Legacy aliases for the icon button — keep until markup is migrated. */
.btn-delete-doc,
.btn-remove-member {
  background: none; border: none; cursor: pointer;
  color: var(--slate); padding: 4px 6px; border-radius: 4px;
  font-family: inherit; font-size: 0.8rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.btn-delete-doc:hover,
.btn-remove-member:hover { background: #fee2e2; color: #991b1b; }
.btn-delete-doc svg { width: 16px; height: 16px; }

/* Refresh — icon-only utility, not a primary action. */
.btn-refresh {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 5px 7px; color: var(--slate);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-refresh:hover { color: var(--blue); border-color: var(--blue); background: #eff6ff; }
.btn-refresh svg { width: 15px; height: 15px; display: block; }
.btn-refresh.spinning svg { animation: cc-spin 0.7s linear infinite; }

/* ---- DEPRECATED --------------------------------------------------
   ``.btn-back`` / ``.btn-browse`` / ``.btn-back-disabled`` used to
   live here. New markup should use ``.btn .btn-secondary`` (plus
   ``.btn-sm`` where the context is tight). These aliases guarantee
   existing HTML picks up the canonical secondary look until it's
   migrated. */
.btn-back,
.btn-browse {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-sizing: border-box; height: 38px; line-height: 1;
  padding: 0 20px; font-size: 0.875rem; font-weight: 600;
  font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--white); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.btn-back:hover,
.btn-browse:hover { border-color: var(--text); background: var(--bg); transform: translateY(-1px); }
.btn-back-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---- Violation Confirm Button ---- */
/* Green confirmation palette — matches .btn-confirm / .btn-confirm-all used
   elsewhere in the app so the button reads as a confirm action at rest.
   Sized to match .btn-view-article so the two buttons line up side-by-side. */
.btn-violation-confirm {
  display: inline-flex; align-items: center;
  font-size: 0.75rem; font-weight: 600; padding: 4px 9px; border-radius: 6px;
  border: 1px solid #059669 !important;
  background: #a7f3d0 !important;
  color: #064e3b !important;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-violation-confirm:hover {
  background: #6ee7b7 !important;
  border-color: #047857 !important;
  color: #064e3b !important;
}
.btn-violation-confirm.confirmed {
  background: #059669 !important;
  color: var(--white) !important;
  border-color: #059669 !important;
}
.btn-violation-confirm.confirmed:hover {
  background: #047857 !important;
  border-color: #047857 !important;
}

/* ================================================================
   SPINNERS & LOADING
   ================================================================ */

/* Standard spinner (20px — used in spinner-wrap, general loading) */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Large spinner (36px — used for full-page/section loading) */
.spinner-lg {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
}

/* Inline list spinner (11px — used inside table rows, list items) */
.list-spinner {
  display: inline-block;
  width: 11px; height: 11px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Job queue spinners (13px — colored variants for document processing) */
.job-spinner-blue {
  width: 13px; height: 13px;
  border: 2px solid #bfdbfe;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.job-spinner-purple {
  width: 13px; height: 13px;
  border: 2px solid #ddd6fe;
  border-top-color: #5b21b6;
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Spinner + text wrapper */
.spinner-wrap {
  display: flex; align-items: center; gap: 12px;
  color: var(--slate); font-size: 0.9rem; padding: 20px 0;
}

/* Unified spin keyframe */
@keyframes cc-spin { to { transform: rotate(360deg); } }

/* Pulse dot (live indicators) */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue);
  animation: cc-pulse 1.2s ease-in-out infinite;
}
.pulse-dot-blue { background: var(--blue); }
.pulse-dot-purple { background: #8b5cf6; }

@keyframes cc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}

/* Loading overlay (full-page) */
.loading-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: var(--slate); z-index: 999;
}

/* ================================================================
   MARKDOWN EDITOR — Rich editable content with table support
   ================================================================ */

/* ── Toast UI Editor wrapper ── */
.md-editor {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* Compact toolbar sizing */
.md-editor .toastui-editor-toolbar {
  border-bottom: 1px solid var(--border);
}

/* Editor body font */
.md-editor .toastui-editor-contents,
.md-editor .ProseMirror {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
}

/* Make tables inside the editor match our design */
.md-editor .toastui-editor-contents table {
  border-collapse: collapse;
  font-size: 0.82rem;
}
.md-editor .toastui-editor-contents th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--slate-dark);
}
.md-editor .toastui-editor-contents th,
.md-editor .toastui-editor-contents td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* ================================================================
   LAYOUT — Header, Sidebar, App Body, Main Content
   Shared layout styles used across all pages with the standard shell.
   ================================================================ */

/* ---- Base body (common across all pages) ---- */
.cc-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* ---- Header ---- */
:root { --sidebar-w: 220px; }

header {
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 4px 24px;
  display: flex; align-items: center; gap: 16px;
  flex-shrink: 0; z-index: 100;
}
.header-logo { height: 64px; width: auto; display: block; cursor: pointer; }
.header-badge {
  background: var(--navy); color: var(--white);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}
.header-divider {
  width: 1px; height: 28px; background: var(--border); flex-shrink: 0;
}
.header-spacer { flex: 1; }

/* ---- User menu ---- */
.user-menu { position: relative; }
.user-menu-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: var(--white);
  border: none; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}
.user-menu-btn:hover { opacity: 0.85; }
.user-menu-btn svg { width: 18px; height: 18px; }
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  min-width: 190px; overflow: hidden; z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown-name {
  padding: 11px 14px 9px; font-size: 0.8125rem; font-weight: 600;
  color: var(--slate); border-bottom: 1px solid var(--border);
}
.user-dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 14px; font-size: 0.875rem; font-family: inherit;
  background: none; border: none; cursor: pointer; color: var(--text);
  text-decoration: none; transition: background 0.12s;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-item.danger { color: #991b1b; }
.user-dropdown-item.danger:hover { background: #fee2e2; }

/* ---- Layout ---- */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ---- Sidebar (collapsible overlay on all screen sizes) ---- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 150; width: 260px;
  background: var(--navy);
  display: flex; flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.sidebar.mobile-open { transform: translateX(0); }
.sidebar-section-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.35);
  padding: 8px 18px 4px; margin-top: 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; font-size: 0.85rem; font-weight: 500;
  color: rgba(255,255,255,0.7); text-decoration: none;
  border-radius: 6px; margin: 1px 8px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer; border: none; background: none;
  width: calc(100% - 16px); font-family: inherit;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar-link.active { background: rgba(0,102,255,0.25); color: var(--white); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Main content ---- */
.main-content {
  flex: 1; overflow-y: auto;
  padding: 36px 40px 60px;
}

/* ---- Common page headings ---- */
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; }
.page-subtitle { color: var(--slate); font-size: 0.9rem; margin: 0 0 28px; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 12px; }

/* ---- Tables ---- */
.cc-table { width: 100%; border-collapse: collapse; }
.cc-table th {
  text-align: left; padding: 10px 14px; font-size: 0.75rem; font-weight: 700;
  color: var(--slate); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.cc-table td { padding: 12px 14px; font-size: 0.875rem; border-bottom: 1px solid var(--bg); }
.cc-table tr:hover td { background: rgba(0,102,255,0.02); }

/* ---- Alert / Banner messages ---- */
.banner {
  padding: 10px 16px; border-radius: 8px; font-size: 0.84rem;
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.banner-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.banner-warn    { background: #fefce8; border: 1px solid #fde047; color: #854d0e; }
.banner-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.banner-success { background: #d1fae5; border: 1px solid #6ee7b7; color: #065f46; }
.banner-msg { flex: 1; }
.banner-dismiss { background: none; border: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; opacity: 0.6; color: inherit; }
.banner-dismiss:hover { opacity: 1; }

/* ---- Drop Zone ---- */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 28px 20px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.drop-zone:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,255,0.06); }
.drop-zone.drag-over { border-color: var(--blue); background: rgba(0,102,255,0.03); box-shadow: 0 0 0 3px rgba(0,102,255,0.1); }
.drop-zone.drop-zone-purple:hover { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,0.06); }
.drop-zone.drop-zone-purple.drag-over { border-color: #8b5cf6; background: rgba(139,92,246,0.03); box-shadow: 0 0 0 3px rgba(139,92,246,0.1); }
.drop-zone.disabled { opacity: 0.5; pointer-events: none; }
.drop-zone-icon {
  width: 40px; height: 40px; margin: 0 auto 12px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.drop-zone-icon-blue { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%); }
.drop-zone-icon-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.drop-zone-icon svg { width: 20px; height: 20px; color: white; }
.drop-zone p { margin: 5px 0; color: var(--slate-dark); font-size: 0.875rem; }
.drop-zone strong { color: var(--text); }
.drop-zone .hint { font-size: 0.78rem; color: var(--slate); margin-top: 3px; }

/* ---- Forms ---- */
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.9375rem; font-family: inherit;
  background: var(--white); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,255,0.12); }

/* ---- Collapsible sections ---- */
.collapsible-toggle {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px;
  cursor: pointer; background: none; border: none; width: 100%;
  font-family: inherit; font-size: inherit; color: inherit;
}
.collapsible-toggle svg { transition: transform 0.2s; }
.collapsible-toggle.open svg { transform: rotate(180deg); }
.collapsible-content { display: none; }
.collapsible-content.open { display: block; }

/* ---- Section headings (uppercase divider) ---- */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 0.8125rem; font-weight: 700; color: var(--slate-dark);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ================================================================
   STATUS SYSTEM — Single-axis urgency encoding.
   Shared across dashboard, policy library, compliance review, etc.
   Tiers: critical | urgent | warn | ok | muted
   Use these instead of ad-hoc colours so "what to pay attention to"
   is encoded the same way app-wide.
   ================================================================ */

.status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; vertical-align: middle;
}
.status-dot-critical { background: var(--danger-strong); box-shadow: 0 0 0 2px rgba(220,38,38,0.15); }
.status-dot-urgent   { background: #ea580c; }
.status-dot-warn     { background: var(--warning-strong); }
.status-dot-ok       { background: var(--success-strong); }
.status-dot-muted    { background: #94a3b8; }

/* Status cell — compact two-line cell used in data tables.
   Leading dot + bold label on row 1, next-step link on row 2. */
.status-cell {
  display: inline-flex; flex-direction: column; gap: 2px;
  line-height: 1.25; min-width: 0;
}
.status-cell-main {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.84rem; font-weight: 600; color: var(--text);
}
/* Status text colours mirror the command-strip pill ``--*-fg`` tokens
   so triage colours read consistently across pills and table cells. */
.status-cell-main.critical { color: var(--danger-fg); }
.status-cell-main.urgent   { color: #9a3412; }
.status-cell-main.warn     { color: var(--warning-fg); }
.status-cell-main.ok       { color: var(--success-fg); }
.status-cell-main.muted    { color: var(--slate); }
/* Inline SVG that replaces the dot — inherits ``currentColor`` from
   the tier rule above so the icon is tier-coloured. */
.status-cell-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex-shrink: 0;
}
.status-cell-icon svg { width: 14px; height: 14px; }
.status-cell-sub {
  font-size: 0.72rem; color: var(--slate); font-weight: 500;
  padding-left: 16px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 240px;
}
.status-cell-sub a { color: var(--blue); text-decoration: none; }
.status-cell-sub a:hover { text-decoration: underline; }

/* ================================================================
   COMMAND STRIP — Saved-filter pills above list views.
   "What am I on the hook for?" workload triage surface.
   ================================================================ */

.command-strip {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px;
}
.cmd-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--white); border: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.cmd-pill:hover { border-color: var(--slate); }
.cmd-pill.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.cmd-pill.active .cmd-pill-count { background: rgba(255,255,255,0.18); color: var(--white); }
.cmd-pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
  background: var(--bg-soft); color: var(--text);
}
.cmd-pill.tier-critical .cmd-pill-count { background: var(--danger-bg); color: var(--danger-fg); }
.cmd-pill.tier-urgent   .cmd-pill-count { background: #ffedd5; color: #9a3412; }
.cmd-pill.tier-warn     .cmd-pill-count { background: var(--warning-bg); color: var(--warning-fg); }
.cmd-pill.tier-ok       .cmd-pill-count { background: var(--success-bg); color: var(--success-fg); }
.cmd-pill.tier-muted    .cmd-pill-count { background: var(--bg-soft); color: var(--slate); }
.cmd-pill.active.tier-critical .cmd-pill-count,
.cmd-pill.active.tier-urgent   .cmd-pill-count,
.cmd-pill.active.tier-warn     .cmd-pill-count,
.cmd-pill.active.tier-ok       .cmd-pill-count,
.cmd-pill.active.tier-muted    .cmd-pill-count { background: rgba(255,255,255,0.18); color: var(--white); }

/* ================================================================
   TAB STRIP — Segmented tab bar above tables (Active | Archived | …)
   ================================================================ */
.tab-strip {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--bg-soft); border-radius: 8px;
  margin-bottom: 14px;
}
.tab-strip-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 6px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--slate-dark);
  transition: background 0.12s, color 0.12s;
}
.tab-strip-btn:hover { color: var(--text); }
.tab-strip-btn.active { background: var(--white); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.tab-strip-btn .tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 0 6px; height: 18px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700;
  background: var(--bg); color: var(--slate);
}
.tab-strip-btn.active .tab-count { background: var(--bg-soft); color: var(--text); }

/* ================================================================
   KEBAB / OVERFLOW MENU — Row-level action overflow.
   ================================================================ */
.kebab-wrap { position: relative; display: inline-block; }
.kebab-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--slate-dark); font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.kebab-btn:hover { background: var(--bg); border-color: var(--slate); color: var(--text); }
.kebab-btn[aria-expanded="true"] { background: var(--bg); border-color: var(--slate); color: var(--text); }
.kebab-btn svg { width: 18px; height: 18px; display: block; }
.kebab-menu {
  display: none;
  /* Fixed so we escape scrolling/overflow-hidden ancestors (e.g. a table
     card with overflow:auto). JS computes left/top at open time. */
  position: fixed;
  z-index: 1000; min-width: 220px;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px; overflow: hidden;
}
.kebab-menu.open { display: block; }
.kebab-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 5px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.82rem; font-weight: 500;
  color: var(--text); text-align: left; text-decoration: none;
  transition: background 0.1s;
}
.kebab-menu-item:hover { background: var(--bg); }
.kebab-menu-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.kebab-menu-item[disabled]:hover { background: none; }
.kebab-menu-item.danger { color: var(--danger-fg); }
.kebab-menu-item.danger:hover { background: var(--danger-bg); }
.kebab-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.kebab-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ================================================================
   LIST TABLE — Higher-contrast grid than .cc-table, used in library.
   ================================================================ */
.list-table { width: 100%; border-collapse: collapse; }
.list-table th {
  text-align: left; padding: 10px 14px;
  font-size: 0.72rem; font-weight: 700; color: var(--slate);
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg); border-bottom: 1px solid var(--border-strong);
  position: sticky; top: 0; z-index: 1;
}
.list-table td {
  padding: 12px 14px; font-size: 0.88rem; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: var(--blue-tint); }
.list-table.density-compact td { padding: 7px 14px; font-size: 0.82rem; }

/* Source chip inline with policy title */
.source-chip {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; vertical-align: middle;
  margin-left: 6px;
}
.source-chip-template { background: var(--info-bg); color: var(--info-fg); }
.source-chip-imported { background: #f3e8ff; color: #7c3aed; }

/* ClearCommand-framework logo prefixed to policy titles in the
   library. The card ancestor uses overflow:auto so the tooltip
   bubble is rendered by a shared floating element appended to
   <body> (.floating-tooltip) and positioned via JS — that escapes
   the overflow clip. */
.policy-source-logo-wrap {
  display: inline-block; margin-right: 6px; vertical-align: -1px;
}
.policy-source-logo {
  height: 12px; width: auto; display: block; cursor: default;
}
.floating-tooltip {
  position: fixed; z-index: 10000; pointer-events: none;
  background: #1f2937; color: #fff;
  font-size: 0.72rem; line-height: 1.3; font-weight: 400;
  padding: 6px 8px; border-radius: 4px;
  max-width: 260px; box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  opacity: 0; transition: opacity 0.08s ease-in;
  top: 0; left: 0;
}
.floating-tooltip.visible { opacity: 1; }

/* ---- Page heading row ---- */
.page-heading-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 4px;
}

/* ================================================================
   MARKDOWN EDITOR — Rich editable content with table support
   ================================================================ */

/* ── Read-only markdown renderer (Toast UI Viewer) ── */
.md-readonly {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--slate-dark);
}
.md-readonly .toastui-editor-contents {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--slate-dark);
}
.md-readonly .toastui-editor-contents table {
  border-collapse: collapse;
  font-size: 0.82rem;
}
.md-readonly .toastui-editor-contents th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--slate-dark);
}
.md-readonly .toastui-editor-contents th,
.md-readonly .toastui-editor-contents td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* ================================================================
   HAMBURGER BUTTON (always visible)
   ================================================================ */
.hamburger-btn {
  display: flex;
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text); flex-shrink: 0;
}
.hamburger-btn svg { width: 24px; height: 24px; display: block; }

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

/* ================================================================
   RESPONSIVE — MOBILE BREAKPOINTS
   ================================================================ */
@media (max-width: 768px) {
  /* Header: tighter padding */
  header { padding: 4px 12px; gap: 8px; }
  .header-logo { height: 44px; }
  .header-badge { font-size: 0.6rem; padding: 2px 6px; }
  .header-divider { display: none; }

  /* Main content: less padding */
  .main-content { padding: 20px 16px 40px; }

  /* Cards */
  .card { padding: 16px; }

  /* Tables: horizontal scroll */
  .cc-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Page titles */
  .page-title { font-size: 1.15rem; }
  .page-subtitle { font-size: 0.82rem; margin-bottom: 20px; }

  /* Buttons: larger touch targets */
  .btn { height: 42px; padding: 0 20px; font-size: 0.9rem; }
  .btn-sm { height: 34px; padding: 0 14px; font-size: 0.82rem; }

  /* Forms */
  .form-input { padding: 12px 14px; font-size: 1rem; }

  /* Section titles */
  .section-title { font-size: 0.75rem; }

  /* User menu dropdown — ensure it stays on-screen */
  .user-dropdown { right: 0; min-width: 170px; }

  /* Banners — stack vertically if needed */
  .banner { font-size: 0.8rem; padding: 10px 12px; }

  /* Drop zones */
  .drop-zone { padding: 20px 14px; }
}

/* Small phones */
@media (max-width: 400px) {
  .main-content { padding: 14px 10px 32px; }
  header { padding: 4px 8px; }
  .header-logo { height: 36px; }
}

/* Publish button (green with borders) */
.btn-publish {
  background: var(--success-bg); /* Light green */
  color: var(--success-fg); /* Dark green text */
  border: 1px solid var(--success-strong); /* Strong green border */
}
.btn-publish:hover {
  background: var(--success-strong); /* Darker green */
  color: var(--white); /* White text */
  border-color: var(--success-strong); /* Strong green border */
}

/* Edit button (white with borders) */
.btn-edit {
  background: var(--white); /* White background */
  color: var(--text); /* Default text color */
  border: 1px solid var(--border); /* Default border */
}
.btn-edit:hover {
  background: var(--bg-soft); /* Slightly darker background */
  color: var(--text); /* Default text color */
  border-color: var(--text); /* Darker border */
}

/* Reuse existing .btn-success for publish button */
.btn-publish {
  @extend .btn-success;
}

/* Reuse existing .btn-secondary for edit button */
.btn-edit {
  @extend .btn-secondary;
}
