/* ── IntegrityAI additions on top of the extracted admin (Nexus) design system ── */
:root {
  --teal: #0f766e;
  --teal-fg: #ccfbf1;
  --teal-bg: #f0fdfa;
}
[data-theme="dark"] {
  --teal: #2dd4bf;
  --teal-bg: #042f2e;
  --teal-fg: #99f6e4;
}

/* Brand icon → dark teal accent (PPTX: "Use Font Colour: Dark Teal Accent 25%") */
.sidebar-brand .brand-icon { background: var(--teal); color: #fff; }
.brand-sub { font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; }

/* Brand logo image (login header + dashboard sidebar) with text fallback if it fails to load */
.brand-logo { height: 48px; width: auto; max-width: 300px; display: block; }
.sidebar-logo { width: 300px; height: auto; max-width: 100%; display: block; }
.brand-fallback { display: none; align-items: center; gap: 10px; }
/* Indian flag shown next to the LOGIN label on the public/login header */
.flag-india { width: 30px; height: 20px; border: 1px solid var(--border); border-radius: 3px; display: block; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* PPTX header panel nav (Home · Solutions · Standards · Compliance · Security · Integration) */
.header-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.header-nav .menu-item { position: relative; }
.header-nav .menu-item > a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
  text-decoration: none; padding: 6px 9px; border-radius: 6px;
}
.header-nav .menu-item > a:hover,
.header-nav .menu-item > a.active { color: var(--text); background: var(--bg-3); }
.header-nav .menu-dd {
  position: absolute; top: calc(100% + 2px); left: 0; min-width: 230px; max-width: 360px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 1050;
}
/* Whole menu is click-driven: every level toggles its own dropdown via the .open class (app.js). */
.header-nav .menu-item.open > .menu-dd { display: block; }
.header-nav .menu-dd .menu-item.open > a .submenu-caret { transform: rotate(90deg); }
.header-nav > .menu-item.open > a .bi-chevron-down { transform: rotate(180deg); }
.header-nav .menu-item > a .bi-chevron-down { transition: transform .15s ease; }
.header-nav .menu-dd .menu-item > a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px; font-size: 13px; color: var(--text-2);
  text-decoration: none; border-radius: 6px; line-height: 1.35;
}
.header-nav .menu-dd .menu-item > a:hover { background: var(--bg-3); color: var(--text); }
/* Sub-levels fly out to the right, top-aligned with their parent row. */
.header-nav .menu-dd .submenu { top: -7px; left: calc(100% + 5px); }
.header-nav .submenu-caret { font-size: 10px; color: var(--text-3); flex: 0 0 auto; transition: transform .15s ease; }

/* Content/Articles admin — one tab per section, each panel shows only its section's data */
.content-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.content-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--text-2); font-size: 13.5px; font-family: inherit; border-radius: 6px 6px 0 0;
}
.content-tab:hover { background: var(--bg-3); color: var(--text); }
.content-tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }
.content-tab .tab-count {
  font-size: 11px; background: var(--bg-3); color: var(--text-2); border-radius: 999px;
  padding: 1px 7px; min-width: 18px; text-align: center; line-height: 1.5;
}
.content-tab.active .tab-count { background: var(--teal-bg); color: var(--teal); }
.content-panel { display: none; }
.content-panel.active { display: block; }
.content-panel .drag-handle { cursor: grab; width: 30px; text-align: center; color: var(--text-3); }
.content-panel .drag-handle:active { cursor: grabbing; }
.content-panel tr.row-dragging { opacity: .5; background: var(--bg-3); }
.reorder-note { font-size: 12.5px; min-height: 16px; margin: 0 0 8px 2px; font-weight: 600; }

/* Content edit — Body / File-Attachment tabs */
.body-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.body-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--text-2); font-size: 13.5px; font-family: inherit; border-radius: 6px 6px 0 0; }
.body-tab:hover { background: var(--bg-3); color: var(--text); }
.body-tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }
.body-panel { display: none; }
.body-panel.active { display: block; }
.attach-current { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; flex-wrap: wrap; }

/* Attachment pop-up viewer (image / PDF) */
.attach-modal { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.62);
  align-items: center; justify-content: center; padding: 24px; }
.attach-modal-box { background: var(--card-bg); border-radius: 12px; width: min(960px, 96vw);
  height: min(90vh, 940px); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.45); }
.attach-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); }
.attach-modal-body { flex: 1; min-height: 0; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center; }
.attach-modal-body iframe { width: 100%; height: 100%; border: 0; }
.attach-modal-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Article (CMS page) rendering */
.article-body { font-size: 15px; line-height: 1.75; color: var(--text); max-width: 820px; }
.article-body h1 { font-size: 24px; margin: 18px 0 10px; }
.article-body h2 { font-size: 20px; margin: 16px 0 8px; }
.article-body h3 { font-size: 17px; margin: 14px 0 6px; }
.article-body p { margin: 0 0 12px; }
.article-body ul, .article-body ol { margin: 0 0 12px 22px; }
.article-body a { color: var(--teal); }
.article-body blockquote { border-left: 3px solid var(--teal); margin: 0 0 12px; padding: 4px 14px; color: var(--text-2); }
.article-body pre, .article-body .ql-code-block-container {
  background: var(--bg-3); border-radius: 8px; padding: 12px; overflow: auto; font-family: 'Geist Mono', monospace; font-size: 13px;
}
.article-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }

/* ── Rich body editor (Quill) — Word-like formatting facilities ──── */
.ql-editor { font-family: 'Geist', -apple-system, sans-serif; font-size: 14px; min-height: 240px; }
.ql-toolbar.ql-snow { border-color: var(--border); border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); background: var(--bg-2); }
.ql-container.ql-snow { border-color: var(--border); border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }

/* "Badge" highlight — any background-coloured run (Quill highlight) renders as a rounded pill,
   both inside the editor and on the published article page. */
.ql-editor span[style*="background-color"],
.article-body span[style*="background-color"] {
  padding: 0.12em 0.5em;
  border-radius: 1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Render Quill indent levels on the published page (indent stays class-based) */
.article-body .ql-indent-1 { padding-left: 3em; }
.article-body .ql-indent-2 { padding-left: 6em; }
.article-body .ql-indent-3 { padding-left: 9em; }
.article-body .ql-indent-4 { padding-left: 12em; }
.article-body .ql-indent-5 { padding-left: 15em; }
.article-body .ql-indent-6 { padding-left: 18em; }

/* R10 — deep fly-out submenus flip LEFT when they would run off the right edge (toggled by app.js) */
.header-nav .menu-dd .submenu.flip-left { left: auto; right: calc(100% + 5px); }

/* ── Footer panel (PPTX slides 8–14): site | logged-in identity | D-Code + IST ── */
.app-footer {
  position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; height: 38px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 18px; background: var(--topnav-bg); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); z-index: 1020;
}
.app-footer .foot-mid { font-family: 'Geist Mono', monospace; color: var(--text); font-weight: 400; }
.app-footer .dcode { color: var(--teal); font-weight: 700; font-family: 'Geist Mono', monospace; }
.main-content { padding-bottom: 56px; }
@media (max-width: 992px) { .app-footer { left: 0; } }

/* ── Login / landing page ── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--teal-bg), transparent),
    var(--bg-2);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .brand-icon {
  width: 34px; height: 34px; background: var(--teal); color: #fff; border-radius: 8px;
  display: grid; place-items: center; font-size: 17px;
}
.login-title { font-size: 20px; font-weight: 700; }
.login-tag { font-size: 12.5px; color: var(--text-2); margin: 6px 0 20px; }
.login-foot { margin-top: 18px; font-size: 11px; color: var(--text-3); text-align: center; }
.alert-soft { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.alert-soft.err { background: var(--red-bg); color: var(--red-fg); }
.alert-soft.ok  { background: var(--green-bg); color: var(--green-fg); }
.alert-soft.info{ background: var(--blue-bg); color: var(--blue-fg); }

/* Verdict badges (CLEAR / FLAG / BLOCK) */
.verdict { font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.verdict.success { background: var(--green-bg); color: var(--green-fg); }
.verdict.warning { background: var(--amber-bg); color: var(--amber-fg); }
.verdict.danger  { background: var(--red-bg); color: var(--red-fg); }
.verdict.secondary { background: var(--bg-3); color: var(--text-2); }

/* Form grid helper */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }

/* required marker */
.req { color: var(--red); }
.muted { color: var(--text-3); }
.code-mono { font-family: 'Geist Mono', monospace; }

/* ════════════════════════════════════════════════════════════════
   LOGIN PAGE — faithful to PPTX slides 8–12
   Header Panel (nav + LOGIN) · Body (AUP Cat/Sub-Cat + credentials) · Footer Panel
   Font: Calibri Light · Colour: Dark Teal Accent
   ════════════════════════════════════════════════════════════════ */
:root { --dark-teal: #1f6f6b; --dark-teal-25: #3a8a86; }
[data-theme="dark"] { --dark-teal: #2dd4bf; --dark-teal-25: #5eead4; }

.lp { font-family: 'Calibri Light', Calibri, 'Segoe UI', system-ui, sans-serif; font-size: 16px; }
.lp-header {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 1050;
  display: flex; align-items: center; gap: 18px; padding: 0 26px;
  background: var(--card-bg); border-bottom: 2px solid var(--dark-teal);
}
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--dark-teal); }
.lp-brand .brand-icon { width: 32px; height: 32px; background: var(--dark-teal); color: #fff;
  border-radius: 7px; display: grid; place-items: center; font-size: 16px; }
/* Login/public header menu — centered, bold and larger than the dashboard's. */
.lp-header .header-nav { flex: 1 1 auto; justify-content: center; margin-left: 0; gap: 12px; }
.lp-header .header-nav > .menu-item > a { font-weight: 400; font-size: 16px; }
@media (max-width: 720px) { .lp-header .header-nav { display: none; } }
.lp-header-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.lp-login-label { font-size: 20px; font-weight: 700; letter-spacing: .14em; color: var(--dark-teal); }

/* Login chrome fits the viewport exactly — it must never scroll the page.
   The global 1440-design canvas applies zoom = innerWidth/1440 on <html>, which
   magnifies a plain 100vh block to (zoom × viewport) and forces a scrollbar on
   wide (zoom>1) screens. Dividing the shell height by --zoom (published by the
   same scaler) cancels the magnification so it maps back to one full screen. */
/* Scope the no-scroll lock to the login shell (.lp-main) only — NOT the public
   article pages, which also get body.lp when logged-out but use .lp-article-main
   and must stay scrollable. */
html:has(.lp-main) { height: 100%; overflow: hidden; }
body:has(.lp-main) { height: 100%; overflow: hidden; }
.lp-main { min-height: calc(100vh / var(--zoom, 1)); height: calc(100vh / var(--zoom, 1));
  display: grid; place-items: center; padding: 88px 20px 70px;
  background: radial-gradient(1100px 520px at 82% -8%, var(--teal-bg), transparent), var(--bg-2); }
/* Public content-article page (opened by clicking the landing menu — no admin sidebar). */
.lp-article-main { min-height: 100vh; max-width: 980px; margin: 0 auto; padding: 84px 22px 64px; }
.lp-panel { width: 100%; max-width: 460px; background: var(--card-bg);
  border: 1px solid var(--border); border-top: 4px solid var(--dark-teal);
  border-radius: 12px; padding: 26px 28px; box-shadow: 0 14px 44px rgba(0,0,0,.10); }
.lp-title { font-size: 20px; font-weight: 700; color: var(--dark-teal); letter-spacing: .12em; margin-bottom: 2px; }
.lp-tag { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

.lp-field { margin-bottom: 14px; }
.lp-field > label { display: block; font-size: 16px; font-weight: 600; color: var(--dark-teal); margin-bottom: 5px; }
.lp-field label abbr { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.lp-input, .lp-select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
}
.lp-input:focus, .lp-select:focus { outline: none; border-color: var(--dark-teal); box-shadow: 0 0 0 3px var(--teal-bg); }
.lp-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.lp-aup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lp-bsr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lp-btn {
  width: 100%; margin-top: 6px; padding: 11px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--dark-teal); color: #fff; font-family: inherit; font-size: 18px; font-weight: 700;
  letter-spacing: .14em; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.lp-btn:hover { filter: brightness(1.07); }
/* Remember me + Forgot password row */
.lp-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; font-size: 13px; }
.lp-remember { display: flex; align-items: center; gap: 7px; color: var(--text-2); cursor: pointer; user-select: none; }
.lp-remember input { width: 15px; height: 15px; accent-color: var(--dark-teal); cursor: pointer; }
.lp-forgot { color: var(--dark-teal-25); text-decoration: none; }
.lp-forgot:hover { text-decoration: underline; }

.lp-footer {
  position: fixed; left: 0; right: 0; bottom: 0; height: 40px; z-index: 1020;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 26px;
  background: var(--card-bg); border-top: 2px solid var(--dark-teal); font-size: 13px; color: var(--text-2);
}
.lp-footer .dcode { color: var(--dark-teal); font-weight: 700; font-family: 'Geist Mono', monospace; }
.lp-alert { border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 14px; }
.lp-alert.err  { background: var(--red-bg); color: var(--red-fg); }
.lp-alert.ok   { background: var(--green-bg); color: var(--green-fg); }
.lp-alert.info { background: var(--teal-bg); color: var(--dark-teal); }
@media (max-width: 560px) { .lp-aup-row, .lp-bsr-row { grid-template-columns: 1fr; } }
