/* NavigateCyber CMS — admin panel styles (aiComply Design System) */

/* ── aiComply Design Tokens ─────────────────────────────────────── */
:root {
  /* Core brand */
  --ac-blue-main:       #254267;
  --ac-blue-secondary:  #355e93;
  --ac-blue-deep:       #15263b;
  --ac-blue-mist:       #718eb3;
  --ac-blue-fog:        #c2cede;
  --ac-red:             #A21015;
  --ac-red-soft:        #C8232A;
  --ac-teal:            #00E5E5;
  --ac-teal-deep:       #007F7F;
  --ac-success:         #1E8E55;
  /* Surfaces (light) */
  --ac-bg-canvas:       #F5F7FA;
  --ac-bg-surface:      #FFFFFF;
  --ac-bg-sunken:      #ECEFF3;
  --ac-border-subtle:   #E3E7ED;
  --ac-border-default:  #C9CFD7;
  --ac-fg-primary:      #0B1320;
  --ac-fg-secondary:    #435162;
  --ac-fg-muted:        #6C7785;
  --ac-fg-link:         #007F7F;
  /* Typography */
  --ac-font-display:    "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --ac-font-sans:     "Roboto", "Helvetica Neue", Arial, sans-serif;
  --ac-font-mono:     "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  /* Scale */
  --ac-fs-14: 0.875rem;
  --ac-fs-15: 0.9375rem;
  --ac-fs-18: 1.125rem;
  --ac-fs-24: 1.5rem;
  /* Radius */
  --ac-rad-2: 4px;
  --ac-rad-3: 6px;
  /* Motion */
  --ac-dur-fast: 160ms;
  --ac-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  /* Legacy admin aliases */
  --blue:   var(--ac-blue-main);
  --blue-d: var(--ac-blue-deep);
  --red:    var(--ac-red);
  --green:  var(--ac-success);
  --gray-0: var(--ac-bg-canvas);
  --gray-1: var(--ac-bg-sunken);
  --gray-2: var(--ac-border-subtle);
  --gray-3: var(--ac-border-default);
  --gray-5: var(--ac-fg-muted);
  --gray-7: var(--ac-fg-secondary);
  --gray-9: var(--ac-fg-primary);
  --radius: var(--ac-rad-3);
  --shadow: 0 1px 2px rgba(11, 19, 32, 0.06), 0 1px 1px rgba(11, 19, 32, 0.04);
}

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

html, body { height: 100%; }
html { font-size: 16px; }
body {
  font-family: var(--ac-font-sans);
  font-size: var(--ac-fs-15);
  line-height: 1.55;
  color: var(--ac-fg-primary);
  background: var(--ac-bg-canvas);
  -webkit-font-smoothing: antialiased;
}

/* ── Auth pages (Login / Setup) — aiComply Design System ─────────── */
.auth-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--ac-blue-deep);
  background-image:
    radial-gradient(ellipse 70% 60% at 20% 80%, rgba(0, 229, 229, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 15%, rgba(37, 66, 103, 0.35) 0%, transparent 50%);
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--ac-bg-surface);
  border: 1px solid var(--ac-border-subtle);
  border-radius: var(--ac-rad-3);
  padding: 2.5rem;
  box-shadow: 0 24px 48px rgba(11, 19, 32, 0.25), 0 8px 16px rgba(11, 19, 32, 0.15);
}
.auth-card-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2rem;
  font-family: var(--ac-font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ac-fg-primary);
  letter-spacing: 0.01em;
}
.auth-card-brand .ac-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--ac-rad-2);
  background: var(--ac-blue-main);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.auth-card-brand .ac-logo svg { width: 18px; height: 18px; }
.auth-card-brand .ac-logo-tag {
  font-family: var(--ac-font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ac-blue-mist);
  margin-left: 4px;
}
.auth-card-title {
  font-family: var(--ac-font-display);
  font-size: var(--ac-fs-24);
  font-weight: 700;
  color: var(--ac-fg-primary);
  margin-bottom: 0.4rem;
  text-align: center;
  letter-spacing: -0.01em;
}
.auth-card-sub {
  font-size: var(--ac-fs-14);
  color: var(--ac-fg-secondary);
  margin-bottom: 1.75rem;
  text-align: center;
  line-height: 1.6;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ac-fg-secondary);
  margin-bottom: 1rem;
}
.auth-card label:last-of-type { margin-bottom: 1.5rem; }
.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  background: var(--ac-bg-canvas);
  border: 1px solid var(--ac-border-subtle);
  border-radius: var(--ac-rad-2);
  padding: 0.65rem 0.85rem;
  font-family: var(--ac-font-sans);
  font-size: var(--ac-fs-15);
  color: var(--ac-fg-primary);
  transition: border-color var(--ac-dur-fast) var(--ac-ease-standard),
              box-shadow var(--ac-dur-fast) var(--ac-ease-standard);
}
.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus {
  outline: none;
  border-color: var(--ac-teal);
  box-shadow: 0 0 0 3px rgba(0, 229, 229, 0.18);
}
.auth-card .btn {
  width: 100%;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  font-size: var(--ac-fs-15);
  font-weight: 600;
  background: var(--ac-blue-deep);
  border-radius: var(--ac-rad-2);
  transition: background var(--ac-dur-fast) var(--ac-ease-standard);
}
.auth-card .btn:hover { background: var(--ac-blue-main); }
.auth-card .err {
  margin-bottom: 1rem;
  background: var(--ac-red-soft);
  color: #fff;
  border: none;
  border-radius: var(--ac-rad-2);
  padding: 0.6rem 0.85rem;
  font-size: var(--ac-fs-14);
}

@media (max-width: 520px) {
  .auth-center { padding: 1rem; }
  .auth-card   { padding: 1.75rem; }
}

/* ── Shell: sidebar + content column ────────────────────────────── */
.cms-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.cms-sidebar {
  background: #0f1f35;   /* same deep navy as design system */
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.cms-brand {
  display: block;
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  text-decoration: none;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.cms-brand b { color: #22d3ee; }

/* ── Page-level nav groups ───────────────────────────────────────── */
.cms-nav { flex: 1; padding: .5rem 0; }
.cms-group { border-bottom: 1px solid rgba(255,255,255,.05); }
.cms-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1.25rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #64748b;
  text-decoration: none;
  transition: color .15s;
}
.cms-page:hover { color: #94a3b8; }
.cms-page.is-open { color: #e2e8f0; }
.cms-arr { font-size: .7rem; opacity: .6; }

/* ── Section-level items ─────────────────────────────────────────── */
.cms-sec {
  display: block;
  padding: .45rem 1.25rem .45rem 1.75rem;
  font-size: .875rem;
  color: #64748b;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.cms-sec:hover { color: #cbd5e1; background: rgba(255,255,255,.04); }
.cms-sec.is-active {
  color: #f1f5f9;
  background: rgba(0,229,229,.07);
  border-left-color: #22d3ee;
}

/* ── Utility links (Images / Account / View / Logout) ────────────── */
.cms-util {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: .75rem 0;
  flex-shrink: 0;
}
.cms-util-link {
  display: block;
  padding: .45rem 1.25rem;
  font-size: .875rem;
  color: #64748b;
  text-decoration: none;
  transition: color .12s;
}
.cms-util-link:hover, .cms-util-link.is-util-active { color: #e2e8f0; }
.cms-logout { margin-top: .25rem; color: #475569; }
.cms-logout:hover { color: #fca5a5; }

/* ── Main content column ─────────────────────────────────────────── */
.cms-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.wrap {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}
.wrap h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; }
.wrap h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .25rem; }

/* ── Dashboard welcome state ─────────────────────────────────────── */
.dash-welcome {
  padding: 3rem 0 1rem;
  color: var(--gray-7);
}
.dash-welcome h1 { margin-bottom: .4rem; }

/* ── Footer ──────────────────────────────────────────────────────── */
.foot {
  text-align: center;
  font-size: .8rem;
  color: var(--gray-5);
  padding: 1rem;
  border-top: 1px solid var(--gray-2);
}

/* ── Utility ─────────────────────────────────────────────────────── */
.muted { color: var(--gray-5); font-size: .875rem; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.narrow { max-width: 440px; }

/* ── Flash / error messages ──────────────────────────────────────── */
.flash {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.err {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .5rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background .15s;
}
.btn:hover { background: var(--blue-d); }
.btn.ghost {
  background: transparent;
  color: var(--gray-7);
  border: 1px solid var(--gray-3);
}
.btn.ghost:hover { background: var(--gray-1); }
button.link, a.link {
  background: none;
  border: none;
  color: var(--blue);
  font-size: .875rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 4px;
  text-decoration: none;
  line-height: 1.4;
  font-family: inherit;
}
button.link:hover, a.link:hover { background: var(--gray-1); }
button.link:disabled { color: var(--gray-3); cursor: default; }
button.link.danger { color: var(--red); }
button.link.danger:hover { background: #fef2f2; }

/* ── Dashboard page grid ─────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.tile {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow .15s, border-color .15s;
}
.tile:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: var(--blue); }
.tile h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; color: var(--gray-9); }

/* ── Section list (page → section rows) ─────────────────────────── */
.seclist { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.secrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s;
}
a.secrow:hover { border-color: var(--blue); }
.secname { font-weight: 600; flex: 1; min-width: 0; }

/* ── Row header (title + action on same line) ────────────────────── */
.rowhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.rowhead h1 { margin-bottom: 0; }

/* ── Collection item rows ────────────────────────────────────────── */
.itemrow { cursor: default; }
.itemrow .secname { color: var(--blue); text-decoration: none; cursor: pointer; }
.itemrow .secname:hover { text-decoration: underline; }
.itemtools { display: flex; align-items: center; gap: .1rem; flex-shrink: 0; }

/* ── Collection box (link to a collection from section editor) ───── */
.collbox {
  display: block;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  margin-top: 1rem;
  transition: border-color .15s;
}
.collbox:hover { border-color: var(--blue); }
.collbox h2 { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; color: var(--gray-9); }

/* ── Forms ───────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field:last-of-type { margin-bottom: 1.5rem; }
label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-7);
  margin-bottom: 1rem;
}
input[type=text],
input[type=password],
input[type=email],
textarea {
  width: 100%;
  border: 1px solid var(--gray-3);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .9375rem;
  font-family: inherit;
  color: var(--gray-9);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input[type=file] { font-size: .875rem; color: var(--gray-7); }
.help {
  font-size: .8rem;
  color: var(--gray-5);
  font-weight: 400;
}

/* ── Image thumbnail preview ─────────────────────────────────────── */
.thumb {
  display: block;
  max-width: 200px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--gray-2);
  margin-bottom: .5rem;
}

/* ── Rich text editor (TipTap) ───────────────────────────────────── */
.rte-source { display: none; }
.rte-wrap {
  border: 1px solid var(--gray-3);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.rte-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.rte-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem;
  padding: .45rem .6rem;
  background: var(--gray-0);
  border-bottom: 1px solid var(--gray-2);
}
.rte-group {
  display: flex;
  align-items: center;
  gap: .05rem;
}
.rte-group + .rte-group {
  margin-left: .3rem;
  padding-left: .45rem;
  border-left: 1px solid var(--gray-2);
}
.rte-group--end { margin-left: auto; border-left: none !important; }
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--gray-7);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  transition: background .12s, color .12s;
}
.rte-btn:hover { background: var(--gray-1); color: var(--gray-9); }
.rte-btn.is-active { background: #dbeafe; color: var(--blue); }
.rte-btn svg { width: 14px; height: 14px; }
.rte-editor { cursor: text; }
.rte-editor .ProseMirror {
  min-height: 280px;
  padding: .75rem 1rem;
  outline: none;
  font-size: .9375rem;
  line-height: 1.65;
  color: var(--gray-9);
}
.rte-editor .ProseMirror > * + * { margin-top: .4rem; }
.rte-editor .ProseMirror p { margin: 0; }
.rte-editor .ProseMirror h1 { font-size: 1.5rem; font-weight: 700; margin: 1.1rem 0 .3rem; }
.rte-editor .ProseMirror h2 { font-size: 1.2rem; font-weight: 700; margin: 1rem 0 .2rem; }
.rte-editor .ProseMirror h3 { font-size: 1rem;   font-weight: 700; margin: .75rem 0 .15rem; }
.rte-editor .ProseMirror h4 { font-size: .9rem;  font-weight: 700; margin: .6rem 0 .1rem; }
.rte-editor .ProseMirror ul,
.rte-editor .ProseMirror ol { margin: .35rem 0 .35rem 1.4rem; }
.rte-editor .ProseMirror blockquote {
  border-left: 3px solid var(--gray-3);
  margin: .5rem 0 .5rem .5rem;
  padding-left: .75rem;
  color: var(--gray-5);
  font-style: italic;
}
.rte-editor .ProseMirror a { color: var(--blue); text-decoration: underline; }
.rte-editor .ProseMirror p.is-empty::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--gray-3);
  pointer-events: none;
  height: 0;
}

/* ── Media library ───────────────────────────────────────────────── */
.media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.media figure {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.media figure img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gray-2);
  background: var(--gray-1);
}
.path {
  width: 100%;
  font-size: .7rem;
  font-family: ui-monospace, monospace;
  color: var(--gray-7);
  border: 1px solid var(--gray-2);
  border-radius: 4px;
  padding: .3rem .4rem;
  cursor: pointer;
  background: var(--gray-0);
}
.path:focus { outline: 2px solid var(--blue); }

/* ── Breadcrumb ──────────────────────────────────────────────────── */
.crumb {
  font-size: .875rem;
  color: var(--gray-5);
  margin-bottom: .75rem;
}
.crumb a { color: var(--blue); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ── Revision history ────────────────────────────────────────────── */
.revs {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: .875rem;
}
.revs summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-7);
  user-select: none;
}
.revs ul { margin-top: .75rem; display: flex; flex-direction: column; gap: .4rem; list-style: none; }
.revs li { display: flex; align-items: center; gap: .75rem; }

/* ── Inline forms (up/down/delete inside a row) ──────────────────── */
form.inline { display: inline; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 780px) {
  /* Sidebar stacks above content on small screens */
  .cms-shell { grid-template-columns: 1fr; }
  .cms-sidebar { position: static; height: auto; }
  .cms-nav { display: flex; flex-wrap: wrap; padding: .25rem; }
  .cms-group { border-bottom: none; border-right: 1px solid rgba(255,255,255,.05); }
  .cms-page { font-size: .7rem; padding: .5rem .75rem; }
  .cms-sec  { padding: .35rem .75rem; font-size: .8rem; }
  .cms-util { display: flex; flex-wrap: wrap; padding: .25rem; border-top: 1px solid rgba(255,255,255,.07); }
  .cms-util-link { padding: .4rem .65rem; }
  .wrap { padding: 1.25rem .75rem; }
  .media { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .rowhead { flex-direction: column; align-items: flex-start; }
}

/* ── Icon picker field ────────────────────────────────────────────── */
.icon-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.icon-cur {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-3);
  border-radius: 6px;
  background: #fff;
  flex-shrink: 0;
  color: var(--gray-7);
}
.icon-cur svg { width: 20px; height: 20px; }
.icon-row input[type=text] { flex: 1; font-family: ui-monospace, monospace; font-size: .875rem; }

/* ── Icon picker modal ───────────────────────────────────────────── */
#icon-picker {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#icon-picker.is-open { display: flex; }
#icon-picker-inner {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: min(640px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
#icon-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-2);
  flex-shrink: 0;
}
#icon-picker-head b { font-size: 1rem; }
#icon-picker-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 4px;
  color: var(--gray-5);
  font-family: inherit;
}
#icon-picker-close:hover { background: var(--gray-1); color: var(--gray-9); }
#icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: .4rem;
  padding: 1rem;
  overflow-y: auto;
}
.icon-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .6rem .3rem .5rem;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: .65rem;
  color: var(--gray-5);
  font-family: ui-monospace, monospace;
  word-break: break-all;
  text-align: center;
  line-height: 1.2;
  transition: border-color .1s, background .1s, color .1s;
}
.icon-opt:hover { border-color: var(--blue); background: #eff6ff; color: var(--blue); }
.icon-opt svg { width: 20px; height: 20px; color: var(--gray-7); flex-shrink: 0; }
.icon-opt:hover svg { color: var(--blue); }

/* ── Visibility toggle switch ────────────────────────────────────── */
.vis-form { display: inline-flex; align-items: center; flex-shrink: 0; }
.vis-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  user-select: none;
}
.vis-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.vis-track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  background: var(--gray-3);
  border-radius: 999px;
  transition: background .18s;
  flex-shrink: 0;
}
.vis-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s;
}
.vis-toggle-input:checked ~ .vis-track { background: var(--green); }
.vis-toggle-input:checked ~ .vis-track::after { transform: translateX(16px); }
.vis-status {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-5);
  min-width: 40px;
  transition: color .18s;
}
.vis-toggle-input:checked ~ .vis-status { color: var(--green); }

/* Section list row — changed from <a> to <div> for sections with toggles */
div.secrow { cursor: default; }
div.secrow a.secname {
  color: var(--gray-9);
  text-decoration: none;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  transition: color .12s;
}
div.secrow a.secname:hover { color: var(--blue); }
div.secrow:hover { border-color: var(--blue); }
div.secrow .vis-form { margin-left: .5rem; }

/* ── Section editor bar (direct child of .cms-main — no margin hacks) */
.section-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--gray-2);
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sbar-left { min-width: 0; overflow: hidden; }
.sbar-crumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  color: var(--gray-5);
  white-space: nowrap;
  overflow: hidden;
}
.sbar-crumb a { color: var(--blue); text-decoration: none; }
.sbar-crumb a:hover { text-decoration: underline; }
.sbar-crumb span:last-child {
  color: var(--gray-9);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sbar-sep { color: var(--gray-3); flex-shrink: 0; font-size: .75rem; }
.sbar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}
.vis-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1.5px solid;
  border-radius: 999px;
  padding: .28rem .85rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: none;
  font-family: inherit;
  line-height: 1.4;
  transition: background .15s;
  white-space: nowrap;
}
.vis-pill.is-on  { color: var(--green); border-color: var(--green); background: #f0fdf4; }
.vis-pill.is-on:hover  { background: #dcfce7; }
.vis-pill.is-off { color: var(--gray-5); border-color: var(--gray-3); }
.vis-pill.is-off:hover { background: var(--gray-1); }
@media (max-width: 780px) {
  .section-bar { padding: .5rem .75rem; }
}

/* ── Submissions inbox ───────────────────────────────────────────── */
.sub-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: .35rem;
}
.sub-filters {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.sub-filter {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-6);
  text-decoration: none;
  padding: .35rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--gray-2);
  background: #fff;
  transition: background .12s, border-color .12s, color .12s;
}
.sub-filter:hover { border-color: var(--blue); color: var(--blue); }
.sub-filter.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }

.itemrow.is-unread .secname { font-weight: 700; color: var(--blue-deep); }
.itemrow.is-unread::before {
  content: '';
  display: block;
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: .5rem;
}
.itemrow.is-archived { opacity: .65; }
.sub-snippet {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
  margin-left: .5rem;
}
.sub-date {
  font-size: .8rem;
  white-space: nowrap;
  margin-right: .35rem;
}

.sub-detail { background: #fff; border: 1px solid var(--gray-2); border-radius: var(--radius); padding: 1.25rem; }
.sub-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  font-size: .875rem;
  color: var(--gray-6);
}
.sub-badge {
  background: var(--blue);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 4px;
}
.sub-ip { font-family: ui-monospace, monospace; font-size: .8rem; }
.sub-kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--gray-1);
  font-size: .9375rem;
}
.sub-kv:last-child { border-bottom: none; }
.sub-kv b { color: var(--gray-7); font-weight: 600; }
.sub-kv a { color: var(--blue); text-decoration: none; }
.sub-kv a:hover { text-decoration: underline; }
.sub-msg {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}
.sub-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.btn.danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn.danger:hover { background: #b91c1c; }
