:root {
  --pri: #B341FF;
  --pri-hover: #9B2DE0;
  --pri-subtle: #F5ECFF;
  --bg: #f5f6f8;
  --surface: #fff;
  --border: #dde0e4;
  --border-light: #eceef1;
  --text: #53565A;
  --text-secondary: #78787B;
  --text-muted: #B3B5BA;
  --hover-bg: #f7f8fa;
  --active-bg: #eef0f3;
  --radius: 4px;
  --green: #1a7f37;
  --red: #cf222e;
  --blue: #0969da;
  --orange: #bf8700;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
code, .mono { font-family: "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace; font-size: 12px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ── */
.header { background: #580F8B; height: 48px; display: flex; align-items: center; padding: 0 20px; position: sticky; top: 0; z-index: 100; }
.header-brand { color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.header-brand span { font-weight: 400; opacity: .7; margin-left: 6px; }
.header-spacer { flex: 1; }
.header-meta { display: flex; align-items: center; gap: 16px; color: rgba(255,255,255,.75); font-size: 12px; }
.header-meta strong { color: #fff; font-weight: 500; }
.header-meta a { color: inherit; text-decoration: none; }
.header-meta a:hover { text-decoration: underline; color: #fff; }
.auth-btn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 4px 10px; border-radius: 3px; font-size: 11px; font-weight: 500; cursor: pointer; transition: background .15s; }
.auth-btn:hover { background: rgba(255,255,255,.2); }
.auth-btn.admin { background: rgba(207,34,46,.5); border-color: rgba(207,34,46,.6); }
.auth-btn.viewer { background: rgba(26,127,55,.4); border-color: rgba(26,127,55,.5); }

/* ── TOOLBAR ── */
.toolbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; align-items: center; gap: 0; position: sticky; top: 48px; z-index: 99; }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: color .1s; background: none; border-top: none; border-left: none; border-right: none; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--pri); border-bottom-color: var(--pri); }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
.tb-dd-wrap { position: relative; }
.tb-dd-btn { padding: 7px 10px; font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; background: none; border: none; white-space: nowrap; display: flex; align-items: center; gap: 4px; transition: color .1s; }
.tb-dd-btn:hover, .tb-dd-btn.open { color: var(--text); background: var(--hover-bg); border-radius: var(--radius); }
.tb-dd-btn svg { flex-shrink: 0; }
.tb-panel { display: none; position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200; min-width: 280px; max-height: 80vh; overflow-y: auto; }
.tb-panel.open { display: block; }
.tb-dd-wrap:hover .tb-panel { display: block; }
.tb-dd-wrap:hover .tb-dd-btn { color: var(--text); background: var(--hover-bg); border-radius: var(--radius); }
.tb-panel::before { content: ''; position: absolute; top: -8px; left: 0; right: 0; height: 8px; }
.tb-panel .panel-header { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); background: var(--hover-bg); }
.tb-panel .tbl { font-size: 12px; width: max-content; min-width: 100%; }
.tb-panel .tbl th { padding: 6px 10px; font-size: 10px; white-space: nowrap; }
.tb-panel .tbl td { padding: 5px 10px; white-space: nowrap; }
.tb-panel .nato-grid { padding: 8px 10px; gap: 1px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
#tbEpic { min-width: 440px; }
.toolbar-spacer { flex: 1; }
.search-box { position: relative; width: 280px; }
.search-box input { width: 100%; padding: 6px 10px 6px 30px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg); outline: none; transition: border-color .15s, background .15s; }
.search-box input:focus { border-color: var(--pri); background: var(--surface); box-shadow: 0 0 0 2px rgba(179,65,255,.1); }
.search-box input::placeholder { color: var(--text-muted); }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-box kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; line-height: 18px; background: var(--hover-bg); }

/* ── DROPDOWN ── */
.dropdown { display: none; position: absolute; top: calc(100% + 4px); right: 0; width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 400px; overflow-y: auto; z-index: 200; }
.dropdown.open { display: block; }
.dd-item { display: flex; align-items: center; padding: 8px 12px; gap: 10px; cursor: pointer; border-bottom: 1px solid var(--border-light); font-size: 13px; text-decoration: none; color: inherit; }
.dd-item:last-child { border-bottom: none; }
.dd-item:hover, .dd-item.active { background: var(--hover-bg); }
.dd-type { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border-radius: 2px; background: var(--active-bg); color: var(--text-secondary); flex-shrink: 0; white-space: nowrap; min-width: 64px; text-align: center; }
.dd-body { flex: 1; min-width: 0; }
.dd-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
mark { background: #fff3bf; color: inherit; border-radius: 1px; padding: 0; }

/* ── LAYOUT ── */
.main { max-width: 1800px; margin: 0 auto; padding: 16px 24px; }
.section { display: none; }
.section.visible { display: block; }

/* ── FILTER BAR (replaces jump nav) ── */
.filter-bar-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-items: center; }
.filter-bar .badge { font-size: 10px; padding: 0 5px; margin-left: -2px; }
.filter-bar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.filter-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; white-space: nowrap; line-height: 1.3; }
.filter-btn svg { flex-shrink: 0; opacity: .7; }
.filter-btn:hover { border-color: var(--filter-color, var(--pri)); color: var(--filter-color, var(--pri)); background: var(--hover-bg); }
.filter-btn.active { background: var(--filter-color, var(--pri)); border-color: var(--filter-color, var(--pri)); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.filter-btn.active svg { opacity: 1; }
.filter-btn.active .badge { background: rgba(255,255,255,.25); color: #fff; }
.manage-sections-btn { flex-shrink: 0; white-space: nowrap; }

/* ── CONTACT STRIP (reference tab bottom) ── */
.contact-strip { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 16px; padding: 10px 14px; background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.contact-strip-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.contact-strip-label { color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; font-size: 10px; }
.contact-strip-val { color: var(--text); font-weight: 500; cursor: pointer; padding: 1px 4px; border-radius: 2px; transition: background .1s, color .1s; }
.contact-strip-val:hover { background: var(--pri-subtle); color: var(--pri); }
.contact-strip-addr { flex-basis: 100%; }
.contact-strip-addr .contact-strip-val { cursor: default; }
.contact-strip-addr .contact-strip-val:hover { background: none; color: var(--text); }
a.contact-strip-val { text-decoration: none; color: var(--text); }
a.contact-strip-val:hover { text-decoration: none; background: var(--pri-subtle); color: var(--pri); }

/* ── PAGE LAYOUT (sidebar TOC + content — shared across tabs) ── */
.page-search-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.page-search-bar .section-search { width: 260px; }
.page-search-bar .section-search:focus { width: 300px; }
.page-layout { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; }
.page-toc { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 2px; }
.page-toc-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; text-decoration: none; color: var(--text-secondary); font-size: 12px; font-weight: 500; transition: background .1s, color .1s; border-left: 2px solid transparent; }
.page-toc-link:hover { background: var(--hover-bg); color: var(--text); text-decoration: none; }
.page-toc-link.active { background: var(--pri-subtle); color: var(--pri); border-left-color: var(--pri); font-weight: 600; }
.page-toc-icon { display: flex; align-items: center; color: var(--toc-color, var(--text-muted)); flex-shrink: 0; }
.page-toc-link.active .page-toc-icon { color: var(--pri); }
.page-toc-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-toc .badge { font-size: 10px; padding: 0 5px; }
.page-content { min-width: 0; }

/* ── SECTION SEARCH INPUT (unified) ── */
.section-search { width: 180px; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; outline: none; background: var(--surface); transition: border-color .15s, width .2s; font-family: inherit; }
.section-search:focus { border-color: var(--pri); box-shadow: 0 0 0 2px rgba(179,65,255,.1); width: 220px; }

/* ── QUICK ACCESS ── */
.quick-access { margin-bottom: 16px; }
.quick-access-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.quick-access-label svg { color: var(--pri); }
.qa-manage-btn { margin-left: auto; font-size: 10px; padding: 2px 8px; }
.quick-access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.qa-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; }
.qa-card:hover { border-color: var(--pri); box-shadow: 0 2px 8px rgba(179,65,255,.1); transform: translateY(-1px); }
.qa-card-icon { width: 32px; height: 32px; border-radius: var(--radius); background: var(--pri-subtle); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--pri); flex-shrink: 0; overflow: hidden; }
.qa-card-icon img { width: 22px; height: 22px; object-fit: contain; border-radius: 2px; }
.qa-card-body { flex: 1; min-width: 0; }
.qa-card-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-card:hover .qa-card-name { color: var(--pri); }
.qa-card-desc { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── LINK SECTIONS ── */
.sections-grid { column-count: 4; column-gap: 16px; }
.link-section { margin-bottom: 14px; break-inside: avoid; }
.link-section-header { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); padding: 8px 10px; background: var(--hover-bg); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; justify-content: space-between; gap: 5px; cursor: pointer; transition: background .1s; }
.link-section-header:hover { background: var(--active-bg); }
.link-section-header .sec-icon { flex-shrink: 0; color: var(--text-muted); }
.link-section-header .sec-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-section-header .count { font-size: 10px; color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.link-section-header .sec-expand { color: var(--text-muted); flex-shrink: 0; transition: color .1s; }
.link-section-header:hover .sec-expand { color: var(--text); }

/* ── SECTION DETAIL VIEW ── */
.sec-detail { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sec-detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.sec-detail-back { background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 10px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; transition: background .1s, color .1s; }
.sec-detail-back:hover { background: var(--hover-bg); color: var(--text); }
.sec-detail-title { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.sec-detail-count { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; cursor: pointer; transition: border-color .1s, box-shadow .1s; }
.detail-card:hover { border-color: var(--pri); box-shadow: 0 2px 8px rgba(179,65,255,.08); }
.detail-card-icon { width: 36px; height: 36px; border-radius: var(--radius); background: var(--active-bg); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; overflow: hidden; }
.detail-card-icon img { width: 24px; height: 24px; object-fit: contain; border-radius: 2px; }
.detail-card-body { flex: 1; min-width: 0; }
.detail-card-name { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.detail-card:hover .detail-card-name { color: var(--pri); }
.detail-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 6px; }
.detail-card-url { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; font-family: "Cascadia Code", "SF Mono", Consolas, monospace; }
.detail-card-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.detail-tag { font-size: 10px; padding: 1px 6px; border-radius: 2px; background: var(--active-bg); color: var(--text-secondary); font-weight: 500; }
.detail-cat { font-size: 10px; padding: 1px 6px; border-radius: 2px; background: var(--pri-subtle); color: var(--pri); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.link-section-body { background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.link-row { display: flex; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border-light); gap: 8px; transition: background .08s; cursor: pointer; }
.link-row:hover { background: var(--hover-bg); }
.link-row:last-child { border-bottom: none; }
.link-initial { width: 24px; height: 24px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; background: var(--active-bg); color: var(--text-secondary); overflow: hidden; }
.link-icon { width: 16px; height: 16px; border-radius: 2px; object-fit: contain; display: block; }
.link-info { flex: 1; min-width: 0; }
.link-name { font-weight: 500; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row:hover .link-name { color: var(--pri); }
.link-desc { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; opacity: 0; transition: opacity .1s; }
.link-row:hover .link-actions { opacity: 1; }
.link-ext { color: var(--text-muted); flex-shrink: 0; }
.link-row:hover .link-ext { color: var(--pri); }
.link-prereq-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; background: var(--pri-subtle); color: var(--pri); border: 1px solid rgba(179,65,255,.2); border-radius: 3px; padding: 1px 5px; flex-shrink: 0; }
.qa-prereq-badge { position: absolute; top: 6px; right: 6px; }
.qa-card { position: relative; }
.reorder-btn { padding: 2px 5px !important; min-width: 22px; color: var(--text-muted) !important; }
.reorder-btn:hover { color: var(--pri) !important; }

/* ── PINS MANAGER MODAL ── */
.pins-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.pins-section-group { display: flex; flex-direction: column; gap: 2px; }
.pins-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.pin-toggle-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.pin-toggle-row:hover { background: var(--hover-bg); }
.pin-toggle-row input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; accent-color: var(--pri); }

/* ── SECTIONS MANAGER MODAL ── */
.sections-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.section-list-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.section-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.section-list-label { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.section-list-count { font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 40px; text-align: right; }
.section-list-actions { display: flex; gap: 4px; flex-shrink: 0; }
.section-list-no-del { font-size: 11px; color: var(--text-muted); padding: 2px 8px; cursor: not-allowed; opacity: .45; }
.add-section-form { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--hover-bg); margin-top: 8px; }

/* ── LAUNCH SEQUENCE ── */
.launch-steps { display: flex; flex-direction: column; gap: 0; }
.launch-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.launch-step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--pri); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.launch-step-icon { width: 30px; height: 30px; border-radius: var(--radius); background: var(--active-bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; overflow: hidden; }
.launch-step-icon img { width: 20px; height: 20px; object-fit: contain; border-radius: 2px; }
.launch-step-body { flex: 1; min-width: 0; }
.launch-step-name { font-weight: 600; font-size: 13px; color: var(--text); }
.launch-step-desc { font-size: 12px; color: var(--text-muted); }
.launch-step-btn { flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.launch-step-arrow { display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 44px; font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ── TABLES ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); background: var(--hover-bg); border-bottom: 1px solid var(--border); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.tbl tbody tr:hover td { background: var(--hover-bg); }
.tbl .actions { text-align: right; white-space: nowrap; }

/* ── PANELS ── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.panel-header { padding: 10px 14px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 13px; font-weight: 600; color: var(--text); }
.panel-body { padding: 0; }
.panel-body.padded { padding: 14px; }
.badge { font-size: 11px; background: var(--active-bg); color: var(--text-secondary); padding: 1px 7px; border-radius: 10px; font-weight: 500; }

/* ── COLLAPSIBLE SECTIONS (shared) ── */
.coll-section { margin-bottom: 12px; }
.coll-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: background .1s; user-select: none; }
.coll-head:hover { background: var(--active-bg); }
.coll-icon { color: var(--sec-color, var(--text-muted)); flex-shrink: 0; display: flex; align-items: center; }
.coll-label { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.coll-chevron { color: var(--text-muted); flex-shrink: 0; transition: transform .2s; }
.coll-chevron.rotated { transform: rotate(-90deg); }
.coll-body { overflow: hidden; transition: max-height .25s ease, opacity .2s ease; max-height: 2000px; opacity: 1; padding-top: 6px; }
.coll-body.collapsed { max-height: 0; opacity: 0; padding-top: 0; overflow: hidden; }

/* ── REFERENCE 2-COLUMN LAYOUT ── */
.ref-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }

/* ── COMMANDS ── */
.cmd-row { display: flex; align-items: center; padding: 5px 14px; border-bottom: 1px solid var(--border-light); gap: 10px; cursor: pointer; font-size: 13px; transition: background .08s; }
.cmd-row:last-child { border-bottom: none; }
.cmd-row:hover { background: var(--hover-bg); }
.cmd-code { font-family: "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 3px; color: var(--text); word-break: break-all; }
.cmd-desc { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.cmd-copy { opacity: 0; color: var(--text-muted); font-size: 11px; flex-shrink: 0; transition: opacity .1s; display: flex; align-items: center; }
.cmd-row:hover .cmd-copy { opacity: 1; }

/* ── AD GROUPS ── */
.ag-row { display: flex; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border-light); gap: 12px; }
.ag-row:last-child { border-bottom: none; }
.ag-row:hover { background: var(--hover-bg); }
.ag-group { font-family: "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 12px; font-weight: 500; color: var(--text); min-width: 240px; flex-shrink: 0; }
.ag-arrow { color: var(--text-muted); flex-shrink: 0; font-size: 12px; }
.ag-apps { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.ag-apps span { background: var(--pri-subtle); color: var(--pri); padding: 1px 8px; border-radius: 2px; font-size: 12px; font-weight: 500; }
.ag-platform { font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 70px; text-align: right; }
.ag-actions { flex-shrink: 0; }

/* ── ESCALATION ── */
.esc-row { display: flex; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border-light); gap: 12px; font-size: 13px; }
.esc-row:last-child { border-bottom: none; }
.esc-row:hover { background: var(--hover-bg); }
.esc-issue { font-weight: 500; flex: 1; }
.esc-team { background: var(--active-bg); color: var(--text); padding: 2px 8px; border-radius: 2px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.esc-notes { font-size: 12px; color: var(--text-muted); flex-shrink: 1; min-width: 0; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── CREDENTIAL ── */
.cred-val { font-family: "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 3px; cursor: pointer; user-select: all; }
.cred-val:hover { background: var(--pri-subtle); color: var(--pri); }
.cred-locked { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.cred-locked svg { margin-bottom: 8px; }

/* ── NATO ── */
.nato-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 2px; padding: 4px 14px 14px; }
.nato-item { font-size: 12px; padding: 2px 6px; color: var(--text-secondary); }
.nato-item strong { color: var(--text); }

/* ── EPIC TABLE ── */
.check { color: var(--green); font-weight: 600; }
.dash { color: var(--text-muted); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer; transition: background .1s, border-color .1s; line-height: 1.4; }
.btn:hover { background: var(--hover-bg); border-color: #c5c9cf; }
.btn-primary { background: var(--pri); color: #fff; border-color: var(--pri); }
.btn-primary:hover { background: var(--pri-hover); }
.btn-danger { color: var(--red); border-color: rgba(207,34,46,.3); }
.btn-danger:hover { background: rgba(207,34,46,.04); border-color: rgba(207,34,46,.5); }
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; transition: color .1s; font-size: 16px; line-height: 1; }
.btn-icon:hover { color: var(--text); }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; justify-content: center; align-items: flex-start; padding: 64px 20px 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 16px 48px rgba(0,0,0,.16); max-width: 520px; width: 100%; max-height: calc(100vh - 100px); overflow-y: auto; }
.modal-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 14px; font-weight: 600; }
.modal-body { padding: 16px; }
.modal-foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 6px; }

/* ── FORM ── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 3px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; outline: none; font-family: inherit; transition: border-color .15s; background: var(--surface); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--pri); box-shadow: 0 0 0 2px rgba(179,65,255,.1); }
.form-group textarea { resize: vertical; min-height: 56px; }
.form-group .help { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pin-input { font-size: 24px; text-align: center; letter-spacing: 10px; font-weight: 600; -webkit-text-security: disc; }
.pin-error { color: var(--red); font-size: 12px; text-align: center; margin-top: 6px; min-height: 18px; }

/* ── TOAST ── */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; z-index: 9999; opacity: 0; transition: opacity .25s; pointer-events: none; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 12px 20px; color: var(--text-muted); font-size: 11px; border-top: 1px solid var(--border); margin-top: 16px; }

/* ── RESPONSIVE ── */
@media (max-width: 1400px) {
  .sections-grid { column-count: 3; }
}
@media (max-width: 1100px) {
  .sections-grid { column-count: 2; }
}
@media (max-width: 768px) {
  .sections-grid { column-count: 1; }
  .ref-columns { grid-template-columns: 1fr; }
  .page-layout { grid-template-columns: 1fr; }
  .page-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
  .page-toc-link { border-left: none; border-bottom: 2px solid transparent; padding: 5px 8px; font-size: 11px; }
  .page-toc-link.active { border-left-color: transparent; border-bottom-color: var(--pri); }
  .page-search-bar .section-search { width: 100%; }
  .page-search-bar .section-search:focus { width: 100%; }
  .header-meta .meta-phone { display: none; }
  .search-box { width: 200px; }
  .ag-group { min-width: 120px; font-size: 11px; }
  .dropdown { width: calc(100vw - 24px); right: 0; left: auto; }
  .filter-bar { gap: 4px; }
  .filter-btn { font-size: 11px; padding: 4px 9px; }
  .main { padding: 12px 12px; }
  .filter-bar-row { flex-direction: column; }
  .filter-bar-right { width: 100%; }
  .section-search { width: 100%; }
  .section-search:focus { width: 100%; }
  .contact-strip { gap: 4px 12px; padding: 8px 10px; }
}
