:root {
  color-scheme: light dark;
  --tenant-accent: #1496d4;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --surface-3: #e5edf5;
  --text: #122033;
  --muted: #607086;
  --border: #d7e0ea;
  --border-strong: #bcc9d7;
  --brand: #0f82c4;
  --brand-2: #12b9c9;
  --success: #137a55;
  --warning: #a9670d;
  --danger: #b93838;
  --shadow: 0 16px 45px rgba(16, 32, 51, .09);
  --shadow-soft: 0 8px 24px rgba(16, 32, 51, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --header-height: 68px;
  --sidebar-width: 320px;
  --reading-width: 860px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"],
html[data-theme="system"] { color-scheme: dark; }
@media (prefers-color-scheme: light) {
  html[data-theme="system"] { color-scheme: light; }
}

html[data-theme="dark"] {
  --bg: #07101c;
  --surface: #0d1928;
  --surface-2: #122236;
  --surface-3: #172a41;
  --text: #edf6ff;
  --muted: #9eb0c4;
  --border: #243850;
  --border-strong: #35506d;
  --brand: #4cbdea;
  --brand-2: #32d6d3;
  --success: #48c58c;
  --warning: #f1b85d;
  --danger: #ff7777;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .18);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #07101c;
    --surface: #0d1928;
    --surface-2: #122236;
    --surface-3: #172a41;
    --text: #edf6ff;
    --muted: #9eb0c4;
    --border: #243850;
    --border-strong: #35506d;
    --brand: #4cbdea;
    --brand-2: #32d6d3;
    --success: #48c58c;
    --warning: #f1b85d;
    --danger: #ff7777;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, .18);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.58; }
a { color: var(--tenant-accent, var(--brand)); text-decoration: none; }
a:hover { text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--tenant-accent, var(--brand)); font-size: .76rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }

.app-header { position: sticky; top: 0; z-index: 60; height: var(--header-height); display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; color: var(--text); }
.brand-symbol { width: 38px; height: 38px; }
.brand-wordmark { font-size: 1.08rem; letter-spacing: -.02em; white-space: nowrap; }
.header-divider { width: 1px; height: 30px; background: var(--border); }
.tenant-lockup { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; background: var(--surface-2); padding: 3px; }
.header-search { flex: 1 1 480px; max-width: 720px; margin-inline: auto; display: flex; align-items: center; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.header-search:focus-within { border-color: var(--tenant-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-accent) 18%, transparent); }
.header-search input { width: 100%; border: 0; background: transparent; color: var(--text); padding: 10px 16px; outline: none; }
.header-search button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font-size: 1.35rem; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--text); font-size: 1.35rem; }
.icon-link:hover { background: var(--surface-2); }
.user-menu { position: relative; }
.user-menu summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 5px 8px; border-radius: 12px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--tenant-accent, var(--brand)); color: white; font-weight: 800; }
.user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 260px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.user-menu-panel > a, .menu-button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.user-menu-panel > a:hover, .menu-button:hover { background: var(--surface-2); }
.user-menu-meta { display: flex; flex-direction: column; padding: 8px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-meta small { color: var(--muted); }
.theme-picker { margin: 8px 0; border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 8px; }
.theme-picker legend { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.theme-picker button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: .78rem; }
.theme-picker button.is-active { border-color: var(--tenant-accent); color: var(--tenant-accent); }

.page-shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 80px; }
.message-stack { position: fixed; top: calc(var(--header-height) + 12px); right: 20px; z-index: 120; width: min(420px, calc(100% - 40px)); }
.message { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 15px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-soft); opacity: 1; transform: translateY(0); transition: opacity .22s ease, transform .22s ease; }
.message.is-leaving { opacity: 0; transform: translateY(-7px); pointer-events: none; }
.message-close { flex: 0 0 auto; width: 28px; height: 28px; margin: -4px -6px -4px 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.message-close:hover { background: var(--surface-2); color: var(--text); }
.message-success { border-left: 4px solid var(--success); }
.message-error { border-left: 4px solid var(--danger); }
.message-warning { border-left: 4px solid var(--warning); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: .88rem; cursor: pointer; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--tenant-accent, var(--brand)); color: white; box-shadow: 0 8px 18px color-mix(in srgb, var(--tenant-accent) 22%, transparent); }
.button-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.button-success { background: var(--success); color: white; }
.button-quiet { background: transparent; color: var(--muted); border-color: transparent; }
.button-wide { width: 100%; }
.text-link { font-weight: 700; }
.inline-form { display: inline; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.stack-form { display: grid; gap: 16px; }
.stack-form p { margin: 0; }
.stack-form label, .form-grid label { display: grid; gap: 6px; font-weight: 700; font-size: .88rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="url"], select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); padding: 10px 12px; outline: none; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--tenant-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-accent) 16%, transparent); }
.errorlist { margin: 5px 0 0; padding: 0; color: var(--danger); list-style: none; font-size: .82rem; }
.form-error { padding: 10px 12px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.narrow-card { width: min(720px, 100%); margin: 40px auto; padding: 34px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }

.login-page { overflow-x: hidden; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(420px, .9fr); }
.login-brand-panel { position: relative; display: flex; align-items: flex-end; padding: clamp(46px, 7vw, 100px); color: white; overflow: hidden; background: radial-gradient(circle at 20% 15%, rgba(38, 210, 218, .28), transparent 30%), linear-gradient(145deg, #071426 0%, #0b2442 55%, #0f6fa1 130%); }
.login-brand-panel::before { content: ""; position: absolute; inset: 10% -10% auto auto; width: 70%; aspect-ratio: 1; border: 1px solid rgba(85, 222, 255, .18); transform: rotate(38deg); border-radius: 28px; box-shadow: 0 0 0 50px rgba(85, 222, 255, .035), 0 0 0 100px rgba(85, 222, 255, .025); }
.login-brand-copy { position: relative; z-index: 1; max-width: 680px; }
.login-mark { width: 88px; height: 88px; margin-bottom: 28px; }
.login-brand-copy h1 { margin: 0; font-size: clamp(2.6rem, 5vw, 5.2rem); line-height: .98; letter-spacing: -.05em; }
.login-brand-copy > p:not(.eyebrow) { max-width: 620px; font-size: 1.14rem; color: #cce9fb; }
.company-line { margin-top: 50px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.18); color: #d8effb; }
.login-form-panel { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: min(440px, 100%); padding: 36px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font-size: 2.1rem; }
.login-help { margin-top: 18px; color: var(--muted); font-size: .82rem; }
.mobile-login-brand { display: none; align-items: center; gap: 8px; margin-bottom: 30px; }
.mobile-login-brand img { width: 38px; }

.dashboard-hero { padding: 24px 0 28px; }
.dashboard-hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.04em; }
.dashboard-hero p:last-child { color: var(--muted); }
.sms-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 22px; }
.sms-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.sms-card:hover, .sms-card:focus-visible { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tenant-accent) 55%, var(--border)); box-shadow: var(--shadow); outline: none; }
.sms-card-cover { min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px; color: white; background: linear-gradient(135deg, #0b1a2e, #0e789f); background-size: cover; background-position: center; }
.sms-card-cover h2 { margin: 6px 0 0; line-height: 1.12; font-size: 1.55rem; }
.sms-card-ref { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #b7e9ff; }
.sms-card-body { padding: 20px 22px; }
.sms-card-body p { margin: 0 0 12px; color: var(--muted); }
.sms-card-body small { color: var(--muted); }
.dashboard-columns { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 34px; }
.dashboard-panel, .admin-panel { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.compact-list, .admin-list { display: grid; gap: 4px; }
.compact-list-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px; border-radius: 10px; color: var(--text); }
.compact-list-item:hover { background: var(--surface-2); }
.compact-list-item span:last-child { min-width: 0; display: grid; }
.compact-list-item strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-list-item small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-icon { color: var(--tenant-accent); font-size: 1.1rem; }

.sms-front-cover { position: relative; min-height: 360px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; overflow: hidden; padding: clamp(34px, 6vw, 72px); border-radius: 24px; color: white; background: radial-gradient(circle at 80% 20%, rgba(50, 220, 215, .3), transparent 24%), linear-gradient(135deg, #08162a, #0d436a); background-size: cover; background-position: center; box-shadow: var(--shadow); }
.sms-front-cover h1 { max-width: 880px; margin: 0; font-size: clamp(2.3rem, 5vw, 4.6rem); line-height: 1; letter-spacing: -.05em; }
.sms-front-cover p:last-child { max-width: 720px; color: #d3edf9; }
.cover-ref { align-self: flex-start; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 7px 12px; font-size: .72rem; letter-spacing: .08em; }
.content-section { margin-top: 44px; }
.featured-document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.featured-document-card { display: flex; flex-direction: column; min-height: 210px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); transition: .18s ease; }
.featured-document-card:hover { transform: translateY(-3px); border-color: var(--tenant-accent); }
.featured-document-card h3 { margin: 8px 0; font-size: 1.3rem; }
.featured-document-card p { color: var(--muted); }
.document-number { color: var(--tenant-accent); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.card-arrow { margin-top: auto; font-weight: 800; color: var(--tenant-accent); }
.contents-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.contents-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 30px; gap: 18px; align-items: center; padding: 18px 22px; color: var(--text); border-bottom: 1px solid var(--border); }
.contents-row:last-child { border-bottom: 0; }
.contents-row:hover { background: var(--surface-2); }
.contents-row span:nth-child(2) { display: grid; }
.contents-row small { color: var(--muted); }
.contents-number { color: var(--tenant-accent); font-weight: 850; }

.reader-layout { min-height: calc(100vh - var(--header-height)); display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.reader-sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); border-right: 1px solid var(--border); background: var(--surface); overflow: visible; z-index: 35; }
.sidebar-inner { height: 100%; overflow-y: auto; padding: 14px 14px 40px; }
.sidebar-resize-handle { position: absolute; right: -5px; top: 0; width: 10px; height: 100%; cursor: col-resize; z-index: 3; }
.sidebar-resize-handle:hover::after { content: ""; position: absolute; left: 4px; width: 2px; height: 100%; background: var(--tenant-accent); }
.sidebar-section { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.sidebar-section.is-collapsed > nav { display: none; }
.sidebar-section-heading { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 9px 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.page-navigation { display: grid; gap: 2px; }
.page-navigation a { padding: 7px 10px; border-left: 2px solid transparent; color: var(--muted); font-size: .84rem; line-height: 1.3; }
.page-navigation a.level-3 { padding-left: 24px; font-size: .79rem; }
.page-navigation a.is-active { color: var(--text); border-left-color: var(--tenant-accent); background: color-mix(in srgb, var(--tenant-accent) 9%, transparent); }
.sms-home-link { display: block; padding: 9px 10px; color: var(--text); font-weight: 750; border-radius: 8px; }
.sms-home-link:hover { background: var(--surface-2); }
.tree-document, .tree-section { margin: 2px 0; }
.tree-document summary, .tree-section summary { display: flex; gap: 7px; align-items: flex-start; padding: 8px 9px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: .84rem; list-style: none; }
.tree-document summary::-webkit-details-marker, .tree-section summary::-webkit-details-marker { display: none; }
.tree-document summary::before, .tree-section summary::before { content: "›"; color: var(--muted); transform: rotate(0deg); transition: transform .15s; }
.tree-document[open] > summary::before, .tree-section[open] > summary::before { transform: rotate(90deg); }
.tree-document summary:hover, .tree-section summary:hover { background: var(--surface-2); }
.tree-document-number { color: var(--tenant-accent); font-weight: 800; white-space: nowrap; }
.tree-children { margin-left: 10px; border-left: 1px solid var(--border); padding-left: 8px; }
.tree-page { display: block; margin: 2px 0; padding: 7px 10px; color: var(--muted); border-left: 3px solid transparent; border-radius: 0 8px 8px 0; font-size: .82rem; line-height: 1.3; }
.tree-page:hover { background: var(--surface-2); color: var(--text); }
.tree-page.is-current { color: var(--text); border-left-color: var(--tenant-accent); background: color-mix(in srgb, var(--tenant-accent) 10%, transparent); font-weight: 750; }
.reader-main { min-width: 0; }
.document-reader { width: min(var(--reading-width), calc(100% - 64px)); margin: 0 auto; padding: 40px 0 90px; }
.mobile-nav-button { display: none; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: .78rem; }
.breadcrumbs a { color: var(--muted); }
.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0 18px; border-bottom: 1px solid var(--border); }
.page-toolbar > div { display: flex; gap: 7px; }
.toolbar-button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; }
.toolbar-button:hover, .toolbar-button.is-active { background: var(--surface-2); color: var(--tenant-accent); }
.search-match-controls { align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.search-match-controls button { border: 0; background: var(--surface-2); padding: 5px 9px; cursor: pointer; }
.search-match-controls span { min-width: 68px; text-align: center; font-size: .78rem; }
.back-to-results { display: inline-block; margin-bottom: 14px; font-weight: 750; }
.document-heading { padding: 42px 0 28px; }
.document-parent-title { margin: 0 0 8px; color: var(--tenant-accent); font-weight: 800; }
.document-heading h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.04; letter-spacing: -.045em; }
.document-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: var(--muted); font-size: .78rem; }
.document-meta span { position: relative; }
.document-meta span + span::before { content: "·"; position: absolute; left: -11px; }
.change-summary { margin: 18px 0 0; padding: 13px 16px; border-left: 3px solid var(--tenant-accent); background: color-mix(in srgb, var(--tenant-accent) 8%, var(--surface)); border-radius: 0 9px 9px 0; color: var(--muted); font-size: .88rem; }
.document-body { font-size: 1rem; line-height: 1.72; }
.document-body h2 { margin: 2.25em 0 .65em; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.025em; scroll-margin-top: calc(var(--header-height) + 24px); }
.document-body h3 { margin: 1.8em 0 .55em; font-size: 1.28rem; scroll-margin-top: calc(var(--header-height) + 24px); }
.document-body h4 { margin-top: 1.5em; }
.document-body p { margin: 0 0 1.15em; }
.document-body ul, .document-body ol { padding-left: 1.5em; }
.document-body a { font-weight: 650; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .14em; }
.content-block { margin-bottom: 1.25rem; }
.content-divider { border: 0; border-top: 1px solid var(--border); margin: 42px 0; }
.glossary-term { display: inline; padding: 0; border: 0; background: transparent; color: inherit; cursor: help; font-weight: 750; line-height: inherit; }
.glossary-term:hover, .glossary-term:focus { text-decoration: underline dotted; text-underline-offset: .18em; outline: none; }
.internal-link-unavailable { color: var(--muted); }
.callout { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; margin: 24px 0; padding: 18px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 12px; background: var(--surface-2); }
.callout-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
.callout-icon::before { content: "i"; }
.callout-title { margin-bottom: 5px; font-weight: 850; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-note { border-left-color: #6f7f91; }
.callout-note .callout-icon { background: #6f7f91; color: white; }
.callout-information { border-left-color: #178ac7; }
.callout-information .callout-icon { background: #178ac7; color: white; }
.callout-warning { border-left-color: #dc8d19; }
.callout-warning .callout-icon { background: #dc8d19; color: #15100a; }
.callout-warning .callout-icon::before { content: "!"; }
.callout-danger { border-left-color: #c94545; }
.callout-danger .callout-icon { background: #c94545; color: white; }
.callout-danger .callout-icon::before { content: "!"; }
.doc-image { margin: 30px auto; text-align: center; }
.doc-image.image-small { max-width: 340px; }
.doc-image.image-medium { max-width: 560px; }
.doc-image.image-large { max-width: 760px; }
.doc-image.image-full { max-width: 100%; }
.image-lightbox-trigger { display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: transparent; cursor: zoom-in; }
.image-lightbox-trigger img { display: block; width: 100%; height: auto; }
.doc-image figcaption { margin-top: 8px; color: var(--muted); font-size: .82rem; }
.attachment-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 22px 0; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.attachment-symbol { width: 38px; height: 44px; border: 2px solid var(--tenant-accent); border-radius: 5px; position: relative; }
.attachment-symbol::after { content: ""; position: absolute; right: -2px; top: -2px; width: 12px; height: 12px; border-left: 2px solid var(--tenant-accent); border-bottom: 2px solid var(--tenant-accent); background: var(--surface-2); }
.attachment-copy { display: grid; min-width: 0; }
.attachment-copy p { margin: 3px 0; color: var(--muted); }
.attachment-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.embedded-tool { margin: 28px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.embedded-tool-title { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.embedded-tool iframe { display: block; width: 100%; border: 0; background: white; }
.table-scroll { margin: 24px 0; overflow-x: auto; border-radius: 10px; }
.doc-table { min-width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
.doc-table th, .doc-table td { border-bottom: 1px solid var(--border); padding: 12px 14px; vertical-align: top; }
.doc-table th { text-align: left; background: var(--surface-2); font-weight: 800; }
.doc-table.table-compact th, .doc-table.table-compact td { padding: 7px 9px; }
.doc-table.table-bordered th, .doc-table.table-bordered td { border: 1px solid var(--border); }
.doc-table.table-header-emphasis th { background: color-mix(in srgb, var(--tenant-accent) 16%, var(--surface)); color: var(--text); }
.previous-next { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--border); }
.previous-next a { display: grid; gap: 2px; padding: 14px; border-radius: 10px; color: var(--text); }
.previous-next a:hover { background: var(--surface-2); }
.previous-next small { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.next-page { text-align: right; }
.search-hit { background: color-mix(in srgb, var(--tenant-accent) 32%, transparent); border-radius: 3px; padding: 0 .08em; }
.search-hit.is-current { outline: 2px solid var(--tenant-accent); }

.glossary-popover { position: fixed; z-index: 150; width: min(360px, calc(100% - 28px)); padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.glossary-popover strong { display: block; margin-bottom: 5px; }
.glossary-popover p { margin: 0 0 10px; color: var(--muted); }
.definition-panel { position: fixed; z-index: 170; top: 0; right: 0; width: min(520px, 92vw); height: 100vh; transform: translateX(102%); transition: transform .22s ease; border-left: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.definition-panel.is-open { transform: translateX(0); }
.panel-header { display: flex; justify-content: space-between; gap: 20px; padding: 24px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; }
.panel-header small { color: var(--tenant-accent); text-transform: uppercase; letter-spacing: .08em; }
.panel-header button { border: 0; background: transparent; font-size: 2rem; cursor: pointer; }
.panel-body { padding: 24px; overflow-y: auto; height: calc(100vh - 100px); }
.collective-definition-list { display: grid; gap: 20px; }
.collective-definition-item { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.collective-definition-item:last-child { padding-bottom: 0; border-bottom: 0; }
.collective-definition-item h3 { margin: 0 0 10px; color: var(--tenant-accent); }
.collective-definition-abbreviation { color: var(--muted); font-size: .82em; }
.collective-definition-body > :first-child { margin-top: 0; }
.collective-definition-body > :last-child { margin-bottom: 0; }
.collective-definition-warning { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.panel-backdrop { position: fixed; inset: 0; z-index: 160; background: rgba(1, 8, 16, .58); }
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: auto 1fr; background: rgba(1, 7, 14, .96); color: white; }
.lightbox-toolbar { display: flex; justify-content: space-between; gap: 20px; padding: 12px 18px; background: rgba(10, 20, 34, .95); }
.lightbox-toolbar button { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: white; border-radius: 7px; padding: 5px 9px; cursor: pointer; }
.lightbox-stage { display: grid; place-items: center; overflow: auto; padding: 24px; }
.lightbox-stage img { max-width: none; transform-origin: center; transition: transform .12s ease; }

.search-page { width: min(980px, 100%); margin: 0 auto; }
.search-page h1 { margin: 0; font-size: 2.8rem; letter-spacing: -.04em; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.filter-pills a { padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
.filter-pills a.is-active { background: var(--tenant-accent); border-color: var(--tenant-accent); color: white; }
.search-results-list { display: grid; gap: 4px; }
.search-result { display: grid; width: 100%; padding: 18px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.search-result:hover { background: var(--surface-2); border-radius: 10px; }
.search-result small { color: var(--muted); }
.search-result p { margin: 7px 0 0; color: var(--muted); }
.result-type { width: max-content; margin-bottom: 5px; color: var(--tenant-accent); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
mark { background: color-mix(in srgb, var(--tenant-accent) 28%, transparent); color: inherit; border-radius: 3px; }
.empty-state { padding: 34px; border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; background: var(--surface); }

.manage-layout { min-height: calc(100vh - var(--header-height)); display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.manage-sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); display: flex; flex-direction: column; padding: 24px 14px; border-right: 1px solid var(--border); background: var(--surface); }
.manage-sidebar-heading { display: grid; margin: 0 10px 20px; }
.manage-sidebar-heading small { color: var(--tenant-accent); text-transform: uppercase; letter-spacing: .08em; }
.app-version { margin-left: 5px; color: var(--muted); font-size: .72rem; letter-spacing: .02em; text-transform: none; }
.manage-sidebar nav { display: grid; gap: 4px; }
.manage-sidebar nav a { padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.manage-sidebar nav a:hover, .manage-sidebar nav a.is-active { background: var(--surface-2); color: var(--text); }
.manage-back-link { margin-top: auto; padding: 10px; color: var(--muted); }
.manage-main { min-width: 0; padding: 34px; }
.admin-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.admin-page-heading h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.04em; }
.admin-page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.admin-page-heading > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { display: grid; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.stat-card strong { font-size: 2rem; }
.stat-card span { color: var(--muted); }
.admin-panel { margin-bottom: 22px; }
.admin-panel h2 { margin-top: 0; }
.admin-list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 10px; border-bottom: 1px solid var(--border); }
.admin-list-row:last-child { border-bottom: 0; }
.admin-list-row > span { min-width: 0; display: grid; }
.admin-list-row small { color: var(--muted); }
.admin-list-row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.is-archived { opacity: .6; }
.admin-two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .65fr); gap: 22px; }
.admin-document-grid { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .65fr); }
.admin-tab-links { display: flex; gap: 6px; margin-bottom: 18px; }
.admin-tab-links a { padding: 8px 12px; border-radius: 9px; color: var(--muted); }
.admin-tab-links a.is-active { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.sortable-list { display: grid; gap: 8px; }
.sortable-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.sortable-row.is-dragging { opacity: .45; }
.sortable-row > span:nth-child(2) { display: grid; }
.sortable-row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; }
.content-tree-editor { display: grid; gap: 8px; }
.tree-edit-row, .tree-edit-section > header { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.tree-edit-row > span:nth-child(2), .tree-edit-section > header > span:nth-child(2) { display: grid; }
.tree-edit-row > div, .tree-edit-section header > div { display: flex; flex-wrap: wrap; gap: 5px; }
.tree-edit-section { padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.tree-edit-section > header { background: color-mix(in srgb, var(--tenant-accent) 6%, var(--surface-2)); }
.tree-edit-children { display: grid; gap: 6px; margin: 8px 0 0 28px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-list span { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: .78rem; }
.history-list { display: grid; }
.history-list a { display: grid; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.history-list small { color: var(--muted); }
.edit-lock-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding: 9px 13px; border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border)); border-radius: 9px; background: color-mix(in srgb, var(--success) 8%, var(--surface)); font-size: .84rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) 120px 220px; gap: 12px; align-items: end; }
.checkbox-label { display: flex !important; align-items: center; grid-auto-flow: column; justify-content: start; }
.checkbox-label input { width: auto; }
.checkbox-label > span { display: grid; gap: 2px; }
.checkbox-label small { color: var(--muted); font-weight: 500; }
.sms-assignment-fieldset { margin: 0; padding: 0; border: 0; }
.sms-assignment-fieldset legend { margin-bottom: 4px; font-size: .92rem; font-weight: 800; }
.sms-assignment-list { display: grid; gap: 8px; margin-top: 12px; }
.sms-assignment-option, .collective-term-option { display: flex !important; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); cursor: pointer; font-weight: 700; }
.sms-assignment-option:hover, .collective-term-option:hover { border-color: color-mix(in srgb, var(--tenant-accent) 55%, var(--border)); }
.sms-assignment-option input, .collective-term-option input { flex: 0 0 auto; width: auto; margin: 0; }
.helptext { margin: 4px 0 0; color: var(--muted); font-size: .8rem; font-weight: 500; }
.field-errors, .form-errors { color: var(--danger); }
.glossary-form-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(180px, .7fr) 110px; gap: 14px; }
.form-field { display: grid; gap: 6px; }
.form-field > label { font-size: .88rem; font-weight: 750; }
.collective-toggle-card { padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.collective-term-fields { padding: 18px; border: 1px solid color-mix(in srgb, var(--tenant-accent) 30%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--tenant-accent) 5%, var(--surface)); }
.collective-term-options { display: grid; gap: 8px; }
.compact-heading { margin-bottom: 14px; }
.compact-heading h2 { margin: 0; }
.compact-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.form-richtext-editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.form-richtext-toolbar { margin: 0; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.form-richtext-surface { min-height: 260px; border: 0; border-radius: 0; background: var(--surface-2); }
.form-richtext-surface:focus { box-shadow: inset 0 0 0 2px var(--tenant-accent); }
.status-chip { display: inline-flex; align-items: center; margin-left: 7px; padding: 2px 7px; border: 1px solid color-mix(in srgb, var(--tenant-accent) 45%, var(--border)); border-radius: 999px; color: var(--tenant-accent); font-size: .66rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.editor-toolbar-row { position: sticky; top: var(--header-height); z-index: 25; display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 14px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); }
.block-add-menu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.block-add-menu span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.block-add-menu button, .richtext-toolbar button { border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); padding: 5px 8px; cursor: pointer; font-size: .78rem; }
.save-status { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.block-editor-canvas { display: grid; gap: 12px; }
.editor-block { border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.editor-block-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor-block-header strong { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
.editor-block-header > div { display: flex; gap: 4px; }
.editor-block-header button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.editor-block-body { padding: 14px; }
.richtext-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.richtext-editor { min-height: 180px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); outline: none; }
.richtext-editor:focus { border-color: var(--tenant-accent); }
.markdown-editor-grid, .code-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.markdown-preview, .code-preview { min-height: 220px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow: auto; }
.code-tabs { display: flex; gap: 5px; margin-bottom: 8px; }
.code-tabs button { border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); padding: 5px 9px; cursor: pointer; }
.code-tab-panel[hidden] { display: none; }
.code-editor-grid textarea { min-height: 300px; font-family: var(--mono); }
.code-preview iframe { width: 100%; min-height: 300px; border: 0; background: white; }
.table-editor-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.table-editor-controls button, .table-editor-controls select { width: auto; padding: 5px 8px; }
.table-editor-wrap { overflow-x: auto; }
.table-editor-table { border-collapse: collapse; min-width: 100%; table-layout: fixed; }
.table-editor-table td, .table-editor-table th { position: relative; min-width: 80px; border: 1px solid var(--border); padding: 7px; }
.table-editor-table [contenteditable="true"] { min-height: 24px; outline: none; }
.table-resize-handle { position: absolute; right: -3px; top: 0; width: 7px; height: 100%; cursor: col-resize; }
.sticky-save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-soft); }
.asset-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.asset-admin-card { display: grid; grid-template-rows: 150px auto auto; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.asset-admin-card img { width: 100%; height: 150px; object-fit: cover; }
.asset-admin-card > div { padding: 12px; display: grid; }
.asset-admin-card > a { margin: 0 12px 12px; }
.asset-file-icon { display: grid !important; place-items: center; font-size: 1.5rem; color: var(--muted); }
.admin-search { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-tenant-logo { max-width: 180px; max-height: 90px; object-fit: contain; }
.colour-swatch { display: inline-block; width: 18px; height: 18px; vertical-align: middle; border-radius: 50%; border: 1px solid var(--border); }
.snapshot-view pre { max-height: 70vh; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: .8rem; }

pre, code { font-family: var(--mono); }
pre { overflow-x: auto; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.codehilite { overflow-x: auto; border-radius: 9px; background: #081220; color: #d5e8f5; }
.codehilite pre { margin: 0; border: 0; background: transparent; color: inherit; }
.codehilite .k, .codehilite .kd, .codehilite .kn { color: #70d6ff; }
.codehilite .s, .codehilite .s1, .codehilite .s2 { color: #9ee493; }
.codehilite .c, .codehilite .c1 { color: #7e91a7; font-style: italic; }
.codehilite .nf, .codehilite .nb { color: #f0b76e; }
.codehilite .mi, .codehilite .mf { color: #d9a6ff; }


/* v0.1.2 — controlled ordered lists, SMS-owned content and full glossary */
.ordered-list-control { display: inline-flex; align-items: stretch; gap: 3px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ordered-list-control select { width: auto; min-width: 92px; border: 0; border-radius: 6px; padding: 3px 6px; background: var(--surface); font-size: .75rem; }
.ordered-list-control button { border: 0 !important; background: transparent !important; }
.markdown-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 7px; }
.markdown-list-toolbar select { width: auto; min-width: 118px; padding: 6px 8px; }
.markdown-list-help { display: block; margin: 0 0 8px; line-height: 1.35; }

.document-body ul,
.document-body ol,
.richtext-editor ul,
.richtext-editor ol,
.markdown-preview ul,
.markdown-preview ol,
.form-richtext-surface ul,
.form-richtext-surface ol,
.glossary-full-definition ul,
.glossary-full-definition ol,
.glossary-panel-body ul,
.glossary-panel-body ol {
  margin: .75em 0 1.15em;
  padding-inline-start: 2.15em;
}
.document-body li,
.richtext-editor li,
.markdown-preview li,
.form-richtext-surface li,
.glossary-full-definition li,
.glossary-panel-body li {
  padding-inline-start: .25em;
  margin: .32em 0;
}
.document-body li > ul,
.document-body li > ol,
.richtext-editor li > ul,
.richtext-editor li > ol,
.markdown-preview li > ul,
.markdown-preview li > ol,
.form-richtext-surface li > ul,
.form-richtext-surface li > ol,
.glossary-full-definition li > ul,
.glossary-full-definition li > ol,
.glossary-panel-body li > ul,
.glossary-panel-body li > ol {
  margin: .45em 0 .6em;
}
ol.list-decimal { list-style-type: decimal; }
ol.list-lower-alpha { list-style-type: lower-alpha; }
ol.list-upper-alpha { list-style-type: upper-alpha; }
ol.list-lower-roman { list-style-type: lower-roman; }
ol.list-upper-roman { list-style-type: upper-roman; }
ol.list-decimal > li::marker,
ol.list-lower-alpha > li::marker,
ol.list-upper-alpha > li::marker,
ol.list-lower-roman > li::marker,
ol.list-upper-roman > li::marker { font-weight: 700; color: color-mix(in srgb, var(--text) 78%, var(--muted)); }

.sms-home-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.contents-section-group { border-bottom: 1px solid var(--border); }
.contents-section-group:last-child { border-bottom: 0; }
.contents-section-group .contents-row { border-bottom: 1px solid var(--border); }
.contents-section-pages { display: grid; padding: 4px 18px 12px 108px; background: color-mix(in srgb, var(--surface-2) 62%, transparent); }
.contents-section-pages a { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.contents-section-pages a:hover { background: var(--surface-2); color: var(--text); }
.tree-sms-direct-page { margin: 4px 0; }
.tree-sms-section { margin-block: 5px; }

.featured-settings-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 150px minmax(260px, 1fr); gap: 12px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.featured-settings-grid > label { display: grid; gap: 6px; font-weight: 700; font-size: .88rem; }
.content-tree-editor > .is-dragging,
.content-tree-editor .is-dragging { opacity: .42; outline: 2px dashed var(--tenant-accent); }
.tree-edit-row[data-type="sms_page"] { border-left: 3px solid color-mix(in srgb, var(--tenant-accent) 65%, var(--border)); }
.tree-edit-section[data-type="sms_section"] { border-left: 3px solid color-mix(in srgb, var(--brand-2) 68%, var(--border)); }
.tree-edit-row[data-type="shared_document"] { border-left: 3px solid var(--border-strong); }

.publication-type-options { display: grid; gap: 10px; }
.publication-type-option { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.publication-type-option input { width: auto; margin-top: 4px; }
.publication-type-option span { display: grid; gap: 3px; }
.publication-type-option small, .publication-type-hint { color: var(--muted); }
.change-summary-field label.is-optional::after { content: " (optional internal note)"; color: var(--muted); font-weight: 500; }

.glossary-page-header { width: min(1080px, 100%); margin: 0 auto 28px; }
.glossary-page-header h1 { margin: 0; font-size: clamp(2.2rem, 4vw, 3.6rem); letter-spacing: -.045em; }
.glossary-index { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.glossary-index a { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 800; }
.glossary-index a:hover { border-color: var(--tenant-accent); color: var(--tenant-accent); }
.glossary-full-list { width: min(1080px, 100%); margin: 0 auto; display: grid; gap: 34px; }
.glossary-letter-group { scroll-margin-top: calc(var(--header-height) + 24px); }
.glossary-letter-group > h2 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--tenant-accent); color: var(--tenant-accent); font-size: 1.6rem; }
.glossary-definition-list { display: grid; gap: 12px; }
.glossary-definition-card { padding: 22px 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-soft); scroll-margin-top: calc(var(--header-height) + 24px); }
.glossary-definition-card header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.glossary-definition-card h3 { margin: 0; font-size: 1.28rem; }
.glossary-definition-card h3 span { color: var(--muted); font-size: .85em; font-weight: 600; }
.glossary-definition-card header small { color: var(--tenant-accent); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.glossary-full-definition > :first-child { margin-top: 0; }
.glossary-full-definition > :last-child { margin-bottom: 0; }
.glossary-nav-link { color: var(--tenant-accent); }

@media (max-width: 860px) {
  .featured-settings-grid { grid-template-columns: 1fr; }
  .contents-section-pages { padding-left: 28px; }
}
@media (max-width: 640px) {
  .ordered-list-control { width: 100%; }
  .ordered-list-control select { flex: 1; }
  .document-body ul, .document-body ol, .richtext-editor ul, .richtext-editor ol, .markdown-preview ul, .markdown-preview ol, .form-richtext-surface ul, .form-richtext-surface ol, .glossary-full-definition ul, .glossary-full-definition ol { padding-inline-start: 1.55em; }
  .glossary-definition-card { padding: 17px 16px; }
  .contents-section-pages { padding: 4px 10px 10px 18px; }
}

@media (max-width: 1100px) {
  .dashboard-columns { grid-template-columns: 1fr; }
  .admin-two-column, .admin-document-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .glossary-form-grid { grid-template-columns: 1fr 1fr; }
  .user-name { display: none; }
}
@media (max-width: 860px) {
  .app-header { padding: 0 12px; gap: 8px; }
  .brand-wordmark, .header-divider, .tenant-lockup span { display: none; }
  .header-search { flex-basis: auto; }
  .page-shell { width: min(100% - 24px, 1480px); padding-top: 24px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { min-height: 100vh; padding: 20px; }
  .mobile-login-brand { display: flex; }
  .reader-layout { display: block; }
  .reader-sidebar { position: fixed; top: var(--header-height); left: 0; width: min(360px, 90vw) !important; height: calc(100vh - var(--header-height)); transform: translateX(-103%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .reader-sidebar.is-open { transform: translateX(0); }
  .sidebar-resize-handle { display: none; }
  .reader-mobile-backdrop { position: fixed; inset: var(--header-height) 0 0; z-index: 30; background: rgba(1, 8, 16, .58); }
  .mobile-nav-button { position: fixed; z-index: 28; left: 12px; bottom: 18px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); padding: 10px 14px; box-shadow: var(--shadow); }
  .document-reader { width: min(100% - 30px, var(--reading-width)); padding-top: 24px; }
  .manage-layout { display: block; }
  .manage-sidebar { position: static; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .manage-sidebar-heading { display: none; }
  .manage-sidebar nav { display: flex; overflow-x: auto; }
  .manage-sidebar nav a { white-space: nowrap; }
  .manage-back-link { display: none; }
  .manage-main { padding: 20px 12px; }
  .markdown-editor-grid, .code-editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .header-search input { padding-inline: 10px; font-size: .86rem; }
  .icon-link { display: none; }
  .page-shell { width: min(100% - 18px, 1480px); }
  .sms-front-cover { min-height: 300px; padding: 28px 22px; align-items: flex-end; }
  .sms-front-cover .cover-ref { display: none; }
  .contents-row { grid-template-columns: 62px minmax(0,1fr) 18px; padding: 15px 12px; gap: 8px; }
  .attachment-card { grid-template-columns: 34px minmax(0, 1fr); }
  .attachment-card > a { grid-column: 1 / -1; }
  .page-toolbar { align-items: flex-start; }
  .toolbar-button span { display: none; }
  .document-heading h1 { font-size: 2.2rem; }
  .previous-next { grid-template-columns: 1fr; }
  .next-page { text-align: left; }
  .admin-page-heading { flex-direction: column; }
  .admin-list-row, .sortable-row, .tree-edit-row, .tree-edit-section > header { align-items: flex-start; grid-template-columns: 24px minmax(0, 1fr); }
  .admin-list-row > div, .sortable-row > div, .tree-edit-row > div, .tree-edit-section header > div { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .glossary-form-grid { grid-template-columns: 1fr; }
  .sticky-save-bar { flex-direction: column; align-items: stretch; }
}
@media print {
  body::before { content: "SMS Studio content is view-only in this release."; display: block; padding: 2rem; font-family: sans-serif; }
  body > * { display: none !important; }
}

/* v0.1.3: readable SMS introductions, flexible references and searchable selectors. */
.sms-introduction { max-width: 760px; margin-top: 18px; color: #d3edf9; line-height: 1.65; }
.sms-introduction p { margin: 0 0 1em; color: inherit; }
.sms-introduction p:last-child { margin-bottom: 0; }
.contents-child-reference { color: var(--tenant-accent); font-size: .76rem; font-weight: 850; white-space: nowrap; }
.contents-section-pages a { grid-template-columns: minmax(72px, auto) minmax(0, 1fr); }
.tree-page-reference { margin-right: .42rem; color: var(--tenant-accent); font-size: .78em; font-weight: 850; white-space: nowrap; }
.publication-state { font-weight: 800; }
.publication-state-live { color: var(--success); }
.publication-state-draft { color: var(--warning); }

.searchable-select { position: relative; width: 100%; }
.searchable-select-native { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.searchable-select-input { width: 100%; }
.searchable-select-list { position: absolute; z-index: 90; top: calc(100% + 5px); left: 0; right: 0; max-height: 310px; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.searchable-select-option { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.searchable-select-option:hover, .searchable-select-option.is-active { background: color-mix(in srgb, var(--tenant-accent) 12%, var(--surface-2)); }
.searchable-select-option[aria-selected="true"] { color: var(--tenant-accent); font-weight: 800; }
.searchable-select-empty { padding: 10px; color: var(--muted); font-size: .85rem; }
.option-filter-input { margin: 10px 0 4px; }

.embedded-tool iframe, .code-preview iframe { min-height: 240px; transition: height .16s ease; }
.embedded-tool iframe.is-height-clamped, .code-preview iframe.is-height-clamped { overflow-y: auto; }
.code-preview { overflow: visible; }

/* v0.1.3 refinements: reference-only contents, live pickers and auto-sized tools. */
.contents-row.no-reference { grid-template-columns: minmax(0, 1fr) 30px; }
.contents-child-reference.is-empty { opacity: 0; }

.editor-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 8, 16, .68);
  backdrop-filter: blur(4px);
}
.editor-picker-panel {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, 1fr) auto;
  gap: 14px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}
.editor-picker-panel h3 { margin: 0; }
.editor-picker-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); gap: 10px; }
.editor-picker-search, .editor-picker-scope { width: 100%; }
.editor-picker-status { margin: 0; }
.editor-picker-list { display: grid; gap: 6px; overflow-y: auto; padding: 2px; }
.editor-picker-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.editor-picker-result:hover, .editor-picker-result:focus-visible {
  border-color: color-mix(in srgb, var(--tenant-accent) 55%, var(--border));
  background: color-mix(in srgb, var(--tenant-accent) 9%, var(--surface-2));
}
.editor-picker-result small { color: var(--muted); }
.editor-picker-footer { display: flex; justify-content: flex-end; }

.embedded-tool iframe.is-auto-sized, .code-preview iframe.is-auto-sized { overflow-y: hidden; }

@media (max-width: 640px) {
  .contents-row.no-reference { grid-template-columns: minmax(0, 1fr) 18px; }
  .editor-picker-backdrop { padding: 10px; }
  .editor-picker-panel { max-height: calc(100vh - 20px); padding: 16px; }
  .editor-picker-controls { grid-template-columns: 1fr; }
}

/* v0.1.3.1: cross-browser calculator iframe sizing hardening. */
.code-preview iframe[data-tool-frame], .embedded-tool iframe[data-tool-frame] { display: block; width: 100%; }

/* v0.1.4: tenant user limits and account-access management. */
.button.is-disabled {
  opacity: .48;
  cursor: not-allowed;
  pointer-events: none;
  filter: saturate(.65);
}
.seat-summary {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}
.seat-summary > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.seat-summary-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.seat-summary strong { font-size: 1.25rem; }
.seat-summary p { margin: 0; color: var(--muted); }
.seat-summary.is-at-limit {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
}
.seat-summary.is-over-limit {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}
.account-role-summary {
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}
.account-role-summary span,
.account-role-summary small { color: var(--muted); }
.form-warning {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
}
.form-warning p { margin: 5px 0 0; color: var(--muted); }
.access-audit-row {
  display: grid;
  gap: 3px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.access-audit-row:last-child { border-bottom: 0; }
.access-audit-row span,
.access-audit-row small { color: var(--muted); }

@media (max-width: 720px) {
  .seat-summary > div { align-items: flex-start; flex-direction: column; gap: 3px; }
}
