/* =========================================================================
   Darkport Docs – component library (buttons, forms, tables, cards, modals, editor, …).
   Colours, fonts and the app shell live in darkport.css, which is loaded after this file.
   ========================================================================= */
[hidden] { display: none !important; }   /* the hidden attribute always wins over component display rules */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
img { max-width: 100%; }
.icon { flex-shrink: 0; vertical-align: middle; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* utilities */
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: 13px; } .xsmall { font-size: 12px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.flex { display: flex; } .items-center { align-items: center; } .items-start { align-items: flex-start; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .gap-3 { gap: 20px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.text-right { text-align: right; } .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-sm { } .show-sm { display: none; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-2); }
code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }


/* ---------- Profile dropdown ---------- */
.profile { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 40px; background: transparent; border: 1px solid transparent; cursor: pointer; font: inherit; color: var(--text); transition: background .15s, border-color .15s; }
.profile-btn:hover, .profile-btn[aria-expanded="true"] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
.profile-btn .who { text-align: left; line-height: 1.2; }
.profile-btn .who b { font-size: 14px; font-weight: 600; display: block; }
.profile-btn .who span { font-size: 12px; color: var(--text-3); }
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; flex-shrink: 0; }
.avatar-initials { color: #fff !important; display: inline-grid; place-items: center; font-weight: 650; letter-spacing: .02em; }
.dropdown { position: absolute; right: 0; top: calc(100% + 10px); width: 290px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; z-index: 50; }
.dropdown-head { display: flex; gap: 12px; align-items: center; padding: 18px; background: linear-gradient(135deg, var(--accent-bg), var(--teal-bg)); }
.dropdown-head b { display: block; font-size: 15px; }
.dropdown-head > div > span { font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.dropdown a, .dropdown button.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.dropdown a:hover, .dropdown button.item:hover { background: var(--surface-3); }
.dropdown .sep { height: 1px; background: var(--border); }
.dropdown .danger { color: var(--red); }
.dropdown .theme-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.seg-mini { display: inline-flex; margin-left: auto; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-mini button { border: 0; background: none; color: var(--text-3); border-radius: 7px; width: 34px; height: 28px; display: grid; place-items: center; cursor: pointer; }
.seg-mini button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 6px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 10px; }
.card-body { padding: 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat { display: flex; gap: 14px; align-items: center; padding: 18px 20px; }
.stat .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.stat .val { font-family: var(--mono); font-size: 26px; font-weight: 650; line-height: 1; letter-spacing: -.03em; }
.stat .lbl { color: var(--text-2); font-size: 13px; margin-top: 5px; }
.tone-blue .ic { background: var(--accent-bg); color: var(--accent); }
.tone-green .ic { background: var(--green-bg); color: var(--green); }
.tone-amber .ic { background: var(--amber-bg); color: var(--amber); }
.tone-violet .ic { background: var(--violet-bg); color: var(--violet); }
.tone-red .ic { background: var(--red-bg); color: var(--red); }
.tone-teal .ic { background: var(--teal-bg); color: var(--teal); }

/* Module tiles */
.module-tile { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.module-tile::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent-tile, var(--accent)); }
.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); color: var(--text); }
.module-tile .mi { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: var(--accent-tile, var(--accent)); }
.module-tile p { color: var(--text-2); font-size: 13.5px; }
.module-tile .go { display: flex; align-items: center; justify-content: space-between; margin-top: auto; font-weight: 600; color: var(--accent); font-size: 13.5px; }
.mod-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }

/* Empty state */
.empty { text-align: center; padding: 40px 22px; color: var(--text-2); }
.empty .ic { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
.empty h3 { margin-bottom: 6px; }

/* Activity */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); align-items: flex-start; }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.activity .dot.security { background: var(--red-bg); color: var(--red); }
.activity .dot.warning { background: var(--amber-bg); color: var(--amber); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s, border-color .15s, color .15s; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: 0 0 22px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-icon { width: 38px; padding: 0; height: 38px; }
.btn-icon.btn-sm { width: 34px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.form-grid .full { grid-column: 1 / -1; }
.field label.lbl, .lbl { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 7px; color: var(--text); }
.field .req { color: var(--red); margin-left: 2px; }
.field .help { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.field .err { font-size: 13px; color: var(--red); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.field ul.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--red); font-size: 13px; }
.input { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 15px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input::placeholder { color: var(--text-3); }
.input-sm { height: 36px; font-size: 13.5px; }
.has-error .input { border-color: var(--red); }
select.input, .input.hs-trigger:not(.hs-multi) { appearance: none; padding-right: 38px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8a9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input[type=color].input { padding: 4px; width: 80px; }
input[type=date].input { font-family: var(--mono); font-size: 14px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.otp-input { font-family: var(--mono); text-align: center; letter-spacing: .5em; font-size: 22px; height: 56px; padding-left: calc(14px + .5em); }

.switch-input { appearance: none; width: 46px; height: 26px; border-radius: 26px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; vertical-align: middle; }
.switch-input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch-input:checked { background: var(--accent); }
.switch-input:checked::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.switch-row b { display: block; font-size: 14px; }
.switch-row > span > span { display: block; font-size: 12.5px; color: var(--text-3); }
.switch-row + .switch-row { margin-top: 10px; }

.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-3); border: 1px solid var(--border); border-radius: 14px; padding: 5px; gap: 5px; width: 100%; }
.segmented button, .segmented label { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .18s; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented button.on, .segmented label:has(input:checked) { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.file-input { font: inherit; font-size: 13.5px; color: var(--text-2); max-width: 100%; }
.file-input::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; padding: 11px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table.compact td { padding: 9px 14px; font-size: 13.5px; }
.table.compact th { padding: 9px 14px; }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; color: inherit; }
.user-cell:hover { color: inherit; }
.user-cell b { display: block; font-weight: 600; }
.user-cell > span > span { display: block; font-size: 12.5px; color: var(--text-3); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.badge-blue { background: var(--accent-bg); color: var(--accent); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-grey { background: var(--grey-bg); color: var(--text-2); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1; min-width: 220px; max-width: 380px; }
.toolbar select.input, .toolbar .hs-trigger { width: auto; min-width: 140px; height: 40px; }
.toolbar .input { height: 40px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--mono); background: var(--surface-3); border-radius: 20px; padding: 0 8px; font-size: 11.5px; }

/* ---------- Settings layout ---------- */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 84px; padding: 8px; }
.settings-nav .grp { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 12px 12px 6px; }
.settings-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 550; font-size: 14.5px; }
.settings-nav a:hover { background: var(--surface-3); color: var(--text); }
.settings-nav a.active { background: var(--accent-bg); color: var(--accent); }
.settings-nav .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

/* Module access grid */
.access-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.access-row + .access-row { margin-top: 8px; }
.access-row b { font-size: 14.5px; }
.pills { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 4px; gap: 3px; border: 1px solid var(--border); flex-shrink: 0; }
.pills label { position: relative; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills span { display: block; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .15s; white-space: nowrap; }
.pills input:checked + span { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.pills input:checked + span.lv-admin { color: var(--violet); }
.pills input:checked + span.lv-none { color: var(--text); }
.pills input:focus-visible + span { outline: 2px solid var(--accent); }
.level-legend { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.level-legend div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.level-legend b { display: block; color: var(--text); font-size: 13px; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* ---------- Alerts / toasts ---------- */
.toasts { position: fixed; top: 76px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: 380px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border: 1px solid var(--border); border-left: 4px solid var(--accent); font-size: 14px; }
.toast.success { border-left-color: var(--green); } .toast.success .icon { color: var(--green); }
.toast.error { border-left-color: var(--red); } .toast.error .icon { color: var(--red); }
.toast.warning { border-left-color: var(--amber); } .toast.warning .icon { color: var(--amber); }
.toast.info .icon { color: var(--accent); }
.toast button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-3); padding: 0; }
.alert { display: flex; gap: 12px; padding: 13px 16px; border-radius: 12px; font-size: 14px; align-items: flex-start; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--accent-bg); color: var(--text); border-color: color-mix(in srgb, var(--accent) 25%, transparent); } .alert-info > .icon { color: var(--accent); }
.alert-warn { background: var(--amber-bg); color: var(--text); border-color: color-mix(in srgb, var(--amber) 30%, transparent); } .alert-warn > .icon { color: var(--amber); }
.alert-ok { background: var(--green-bg); color: var(--text); border-color: color-mix(in srgb, var(--green) 25%, transparent); } .alert-ok > .icon { color: var(--green); }
.alert-err { background: var(--red-bg); color: var(--text); border-color: color-mix(in srgb, var(--red) 25%, transparent); } .alert-err > .icon { color: var(--red); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--scrim); z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); padding: 24px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.modal.wide { max-width: 640px; }
.modal .ic { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: var(--red-bg); color: var(--red); margin-bottom: 14px; }
.modal .ic.blue { background: var(--accent-bg); color: var(--accent); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.sheet-grip { display: none; }

/* ---------- Command palette ---------- */
.palette-back { position: fixed; inset: 0; background: var(--scrim); z-index: 95; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: 100%; max-width: 580px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; height: 56px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.palette li a.sel, .palette li a:hover { background: var(--accent-bg); color: var(--text); }
.palette li .grp { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.palette .foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 8px; }

/* ---------- 2FA ---------- */
.steps-v { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps-v > li { position: relative; padding: 0 0 22px 46px; counter-increment: s; }
.steps-v > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 13px; background: var(--accent-bg); color: var(--accent); }
.steps-v > li::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 6px; width: 2px; background: var(--border); }
.steps-v > li:last-child::after { display: none; }
.steps-v h3 { margin-bottom: 4px; }
.qr-box { display: inline-grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.qr-box svg { width: 196px; height: 196px; display: block; }
.secret-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--code-bg); border: 1px dashed var(--border-strong); }
.secret-box .key { font-family: var(--mono); font-size: 17px; letter-spacing: .06em; word-break: break-all; flex: 1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 16px; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--border); }
.codes span { font-family: var(--mono); font-size: 16px; letter-spacing: .05em; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; }
.link-btn:hover { color: var(--accent-hover); }

/* ---------- Logs ---------- */
.log-table td { font-size: 13.5px; }
.log-table .ts { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.log-table .ip { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.log-table .act { font-family: var(--mono); font-size: 12.5px; }
.log-details { font-family: var(--mono); font-size: 12px; color: var(--text-2); background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.lvl-security { color: var(--red); } .lvl-warning { color: var(--amber); }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filters .input { height: 38px; font-size: 13.5px; }

/* Placeholder module page */
.plan-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.plan-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.plan-list li .icon { color: var(--accent); margin-top: 2px; }

.timeline-step { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-bg); color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .w-3 { grid-column: span 2; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .settings-nav .grp { display: none; }
  .settings-nav a { white-space: nowrap; }
  .settings-nav .count { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .content { padding: 18px 16px 70px; }
  .topbar { padding: 0 12px; height: 58px; gap: 8px; }
  .toasts { top: 66px; right: 16px; }
  .crumbs .crumb-hide-sm { display: none; }
  .grid-2, .grid-3, .grid-4, .form-grid, .level-legend { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; gap: 16px; }
  .w-1, .w-2, .w-3 { grid-column: span 1; }
  .profile-btn .who { display: none; }
  .hide-sm { display: none !important; }
  .show-sm { display: initial; }
  .hero { padding: 22px 20px; border-radius: 16px; }
  .hero h1 { font-size: 23px; }
  .hero .waves { display: none; }
  h1 { font-size: 23px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .toolbar { padding: 12px; }
  .toolbar .input-icon { max-width: none; min-width: 100%; }
  .toolbar select.input, .toolbar .hs-trigger { flex: 1; min-width: 0; }
  .filters { grid-template-columns: 1fr 1fr; padding: 12px; }
  .btn { height: 44px; }
  .btn-sm { height: 38px; }
  .input { height: 46px; font-size: 16px; }   /* 16px stops iOS zooming into inputs */
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .access-row { flex-wrap: wrap; }
  .access-row .pills { width: 100%; justify-content: space-between; }
  .access-row .pills label { flex: 1; text-align: center; }
  .stat .val { font-size: 22px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  /* tables turn into stacked cards */
  table.table-cards thead { display: none; }
  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
  table.table-cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.table-cards tr:last-child { border-bottom: 0; }
  table.table-cards td { padding: 4px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
  table.table-cards td[data-label]::before { content: attr(data-label); font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); text-align: left; flex-shrink: 0; }
  table.table-cards td.cell-main { display: block; text-align: left; padding-bottom: 8px; }
  table.table-cards td.cell-actions { justify-content: flex-end; padding-top: 8px; }
  table.table-cards td.cell-actions .btn { flex: 1; }
  /* modals become bottom sheets */
  .modal-back { place-items: end center; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-width: none; padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 88dvh; }
  .sheet-grip { display: block; width: 44px; height: 5px; border-radius: 5px; background: var(--border-strong); margin: 0 auto 14px; }
  .modal-actions .btn { flex: 1; }
  .palette-back { padding: 10px; align-items: flex-start; }
  .codes { grid-template-columns: 1fr; }
  .edit-bar { top: 66px; }
}
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 35; }

/* Print (recovery codes) */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; color: #000; }
}
.segmented label { position: relative; }
.htmx-indicator { opacity: 0; transition: opacity .2s; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
a.card.stat { color: var(--text); } a.card.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
@media (max-width: 720px) { .toolbar select.input, .toolbar .hs-trigger { flex: 1 1 40%; } }
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .stats-grid .stat { padding: 14px; gap: 10px; }
  .stats-grid .stat .ic { width: 36px; height: 36px; border-radius: 10px; }
  .tiles-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .tiles-grid .module-tile { padding: 14px; gap: 8px; }
  .tiles-grid .module-tile p, .tiles-grid .module-tile .badge, .tiles-grid .module-tile .go { display: none; }
  .tiles-grid .module-tile h3 { font-size: 14.5px; }
  .tiles-grid .module-tile .mi { width: 38px; height: 38px; border-radius: 11px; }
}

/* ---------- Documentation ---------- */
.docs { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.docs-tree { position: sticky; top: 84px; max-height: calc(100vh - 104px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.docs-tree .dt-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 8px; border-bottom: 1px solid var(--border); }
.docs-tree .dt-scroll { overflow-y: auto; padding: 8px 8px 14px; scrollbar-width: thin; }
.dt-list { list-style: none; margin: 0; padding: 0; }
.dt-list .dt-list { padding-left: 14px; margin-left: 9px; border-left: 1px solid var(--border); }
.dt-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; color: var(--text-2); font-size: 14px; min-width: 0; cursor: pointer; }
.dt-row:hover { background: var(--surface-3); color: var(--text); }
.dt-row.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.dt-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.dt-row .tg { width: 18px; height: 18px; display: grid; place-items: center; flex-shrink: 0; border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0; border-radius: 5px; transition: transform .15s; }
.dt-row .tg.open { transform: rotate(90deg); }
.dt-row .tg:hover { background: var(--border); }
.dt-row .fic { flex-shrink: 0; color: var(--fc, var(--text-3)); display: inline-flex; }
.dt-row .emo { width: 18px; text-align: center; flex-shrink: 0; font-size: 14px; }
.dt-row .lk { color: var(--text-3); flex-shrink: 0; display: inline-flex; }
.dt-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 12px 8px 6px; }
.dt-list .sortable-ghost { opacity: .4; }
.dt-drop-root { min-height: 6px; }
.docs-main { min-width: 0; }
.doc-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.doc-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.doc-crumbs a { color: var(--text-2); } .doc-crumbs a:hover { color: var(--accent); }
.doc-title { font-size: 32px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.doc-title .emo { margin-right: 8px; }
.doc-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-3); margin-top: 8px; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; align-items: start; }
.doc-paper { padding: 34px 40px 44px; }
.doc-toc { position: sticky; top: 84px; font-size: 13px; }
.doc-toc a { display: block; padding: 4px 0 4px 10px; color: var(--text-2); border-left: 2px solid var(--border); line-height: 1.35; }
.doc-toc a:hover { color: var(--accent); border-color: var(--accent); }
.doc-toc a.l2 { padding-left: 24px; } .doc-toc a.l3 { padding-left: 38px; } .doc-toc a.l4 { padding-left: 52px; font-size: 12.5px; }

/* page typography (view + editor) */
.doc-body { font-size: 16px; line-height: 1.7; color: var(--text); overflow-wrap: break-word; }
.doc-body > * + * { margin-top: .85em; }
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; margin: 1.5em 0 .5em; scroll-margin-top: 90px; }
.doc-body h1 { font-size: 1.85em; } .doc-body h2 { font-size: 1.45em; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
.doc-body h3 { font-size: 1.2em; } .doc-body h4 { font-size: 1.05em; color: var(--text-2); }
.doc-body > :first-child { margin-top: 0; }
.doc-body p { margin: 0; } .doc-body p + p { margin-top: .75em; }
.doc-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doc-body ul, .doc-body ol { padding-left: 1.5em; margin: .6em 0; } .doc-body li + li { margin-top: .25em; } .doc-body li > p { margin: 0; }
.doc-body blockquote { margin: 1em 0; padding: .3em 1.1em; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.doc-body img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 1em 0; }
.doc-body img.ProseMirror-selectednode { outline: 3px solid var(--accent); }
.doc-body code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.doc-body mark { border-radius: 3px; padding: 0 2px; color: inherit; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .94em; table-layout: auto; }
.doc-body th, .doc-body td { border: 1px solid var(--border-strong); padding: 7px 10px; vertical-align: top; text-align: left; min-width: 60px; }
.doc-body th { background: var(--surface-3); font-weight: 650; }
.doc-body td > p, .doc-body th > p { margin: 0; }
.doc-body .table-scroll, .doc-body .tableWrapper { overflow-x: auto; }
.doc-body ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
.doc-body ul[data-type="taskList"] li { display: flex; gap: 10px; align-items: flex-start; }
.doc-body ul[data-type="taskList"] li > label { margin-top: .3em; flex-shrink: 0; }
.doc-body ul[data-type="taskList"] li > label input { width: 16px; height: 16px; accent-color: var(--accent); }
.doc-body ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
.doc-body ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--text-3); text-decoration: line-through; }
/* callouts */
.callout { --cc: var(--accent); --cb: var(--accent-bg); position: relative; margin: 1.1em 0; padding: 12px 16px 12px 48px; border-radius: 12px;
  background: var(--cb); border: 1px solid color-mix(in srgb, var(--cc) 28%, transparent); }
.callout::before { content: ""; position: absolute; left: 16px; top: 15px; width: 20px; height: 20px; background: var(--cc);
  -webkit-mask: var(--ci) center / contain no-repeat; mask: var(--ci) center / contain no-repeat; }
.callout > * + * { margin-top: .5em; }
.callout-info { --cc: var(--accent); --cb: var(--accent-bg);
  --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.callout-warning { --cc: var(--amber); --cb: var(--amber-bg);
  --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.callout-error { --cc: var(--red); --cb: var(--red-bg);
  --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.callout-success { --cc: var(--green); --cb: var(--green-bg);
  --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
/* code blocks */
.doc-body pre { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; background: #0d0f14; color: #e9ecf2; border-radius: 12px; padding: 16px 18px;
  overflow-x: auto; white-space: pre; tab-size: 4; margin: 1.1em 0; }
.doc-body pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.code-wrap.wrapped pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.code-wrap { position: relative; margin: 1.1em 0; } .code-wrap pre { margin: 0; padding-top: 38px; }
.code-tools { position: absolute; top: 6px; right: 8px; left: 14px; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.code-tools .code-lang { margin-right: auto; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8a909c; }
.code-tools button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #c9ced8;
  border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.code-tools button:hover { background: rgba(255,255,255,.14); color: #fff; } .code-tools button.ok { color: #6ee7a8; border-color: rgba(110,231,168,.4); }
.code-wrap.wrapped .code-tools [data-a="wrap"] { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.hljs-comment, .hljs-quote { color: #8a909c; font-style: italic; } .hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #ff9ac1; }
.hljs-string, .hljs-attr-value, .hljs-regexp { color: #a5e3a0; } .hljs-number, .hljs-literal { color: #f8c27a; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: #e9ecf2; } .hljs-variable, .hljs-template-variable, .hljs-attr { color: #c3b4ff; }
.hljs-meta, .hljs-symbol { color: #6fd2d0; } .hljs-addition { color: #a5e3a0; } .hljs-deletion { color: #ff9a9a; } .hljs-params { color: #e9ecf2; }
/* editor */
.he-toolbar { position: sticky; top: 64px; z-index: 15; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 6px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.he-btn { display: inline-flex; align-items: center; gap: 3px; height: 34px; min-width: 34px; padding: 0 7px; border: 0; background: none; border-radius: 8px;
  color: var(--text-2); cursor: pointer; position: relative; font: inherit; font-size: 13.5px; }
.he-btn:hover { background: var(--surface-3); color: var(--text); } .he-btn.on { background: var(--accent-bg); color: var(--accent); }
.he-btn:disabled { opacity: .35; cursor: default; background: none; }
.he-btn.he-wide { min-width: 104px; justify-content: space-between; font-weight: 600; }
.he-swatch { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; border-radius: 2px; }
.he-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.he-ctx { display: contents; }
.he-lang { height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 6px; font: inherit; font-size: 13px; }
.he-content { outline: none; min-height: 50vh; }
.he-content .is-editor-empty:first-child::before, .he-content p.is-empty:only-child::before { content: attr(data-placeholder); color: var(--text-3); float: left; height: 0; pointer-events: none; }
.he-content .selectedCell { background: var(--accent-bg); }
.he-pop { position: absolute; z-index: 1100; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 180px; }
.he-pop button:not(.btn) { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 8px; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.he-pop button:not(.btn):hover, .he-pop button:not(.btn).on { background: var(--surface-3); }
.he-pop .he-empty { padding: 8px 10px; color: var(--text-3); font-size: 13px; }
.he-slash { max-height: 330px; overflow-y: auto; width: 230px; }
.he-blk-h1 { font-size: 20px !important; font-weight: 700; } .he-blk-h2 { font-size: 17px !important; font-weight: 700; } .he-blk-h3 { font-weight: 700; }
.he-swatches { display: grid; grid-template-columns: repeat(4, 30px); gap: 6px; padding: 4px; }
.he-swatches button { width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid var(--border); background: var(--c); }
.he-swatches button.none { background: linear-gradient(135deg, transparent 45%, var(--red) 46%, var(--red) 54%, transparent 55%), var(--surface); }
.he-co-info { color: var(--accent) !important; } .he-co-warning { color: var(--amber) !important; } .he-co-error { color: var(--red) !important; } .he-co-success { color: var(--green) !important; }
.he-link { width: 320px; } .he-link-res { display: grid; margin-top: 4px; } .he-link-res span { display: grid; min-width: 0; }
.he-link-res small { color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title-input { width: 100%; border: 0; background: none; font: inherit; font-size: 32px; font-weight: 750; letter-spacing: -.02em; color: var(--text); padding: 0; outline: none; }
.doc-status { font-size: 12.5px; color: var(--text-3); font-family: var(--mono); }
.doc-status.err { color: var(--red); }
.folder-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.folder-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); }
.folder-card:hover { border-color: var(--accent); }
.folder-card .fi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--fc, var(--accent)) 14%, transparent); color: var(--fc, var(--accent)); flex-shrink: 0; }
.page-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.page-row:last-child { border-bottom: 0; } .page-row:hover { background: var(--surface-2); }
.page-row .pi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); flex-shrink: 0; font-size: 17px; color: var(--text-3); }
.page-row .ex { font-size: 13px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.search-hit mark { background: #fff3a3; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] .search-hit mark { background: rgba(255, 220, 90, .3); }
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.share-row:last-child { border-bottom: 0; }
.people-res { display: grid; gap: 2px; margin-top: 4px; max-height: 220px; overflow-y: auto; }
.people-res button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.people-res button:hover, .people-res button.on { background: var(--surface-3); }
.version-list a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; }
.version-list a:hover { background: var(--surface-3); } .version-list a.active { background: var(--accent-bg); color: var(--accent); }
.docs-tree-toggle { display: none; }
@media (max-width: 1200px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } .doc-toc { display: none; } }
@media (max-width: 1023px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-tree { position: fixed; inset: 0 auto 0 0; top: 0; width: min(320px, 86vw); max-height: none; z-index: 60; border-radius: 0; transform: translateX(-105%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .docs-tree.open { transform: none; }
  .docs-tree-toggle { display: inline-flex; }
  .docs-shade { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
}
@media (max-width: 720px) {
  .doc-paper { padding: 20px 16px 28px; } .doc-title, .doc-title-input { font-size: 25px; }
  .he-toolbar { top: 56px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 10px; }
  .doc-body { font-size: 15.5px; }
}
.color-dot { position: relative; display: inline-flex; cursor: pointer; }
.color-dot input { position: absolute; opacity: 0; pointer-events: none; }
.color-dot span { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.color-dot input:checked + span { box-shadow: 0 0 0 2px var(--accent); }
.color-dot input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-ic.tone-green { background: var(--green-bg); color: var(--green); }
.star-on svg { fill: currentColor; }
.doc-head > .actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
.he-content pre:not([data-wrap="true"]) { white-space: pre; }
.doc-body .table-scroll table { margin: 0; }
.doc-body .table-scroll { margin: 1.2em 0; }
@media (max-width: 1440px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } .doc-toc { display: none; } }
:root[data-theme="dark"] .doc-body pre { background: #08090d; border: 1px solid var(--border); }
.mb-4 { margin-bottom: 32px; }

/* editor v2: code block header, images, bubbles, table tools */
.he-code { margin: 1.1em 0; border-radius: 12px; overflow: hidden; background: #0d0f14; }
:root[data-theme="dark"] .he-code { background: #08090d; border: 1px solid var(--border); }
.he-code pre { margin: 0 !important; border-radius: 0; border: 0 !important; padding-top: 10px; }
.he-code.wrapped pre { white-space: pre-wrap !important; overflow-wrap: anywhere; word-break: break-word; }
.he-code-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0 10px; user-select: none; }
.he-code-bar .grow { flex: 1; }
.he-code-bar select { height: 28px; border-radius: 7px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #c9ced8;
  font: inherit; font-size: 12px; padding: 0 6px; }
.he-code-bar select option { color: #142235; background: #fff; }
.he-code-bar button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #c9ced8;
  border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.he-code-bar button:hover { background: rgba(255,255,255,.14); color: #fff; }
.he-code-bar button.on { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.he-code-bar button.ok, .code-tools button.ok { color: #6ee7a8; border-color: rgba(110,231,168,.4); }

.doc-body img[data-align="left"] { margin-left: 0; margin-right: auto; }
.doc-body img[data-align="center"], .doc-body img:not([data-align]) { margin-left: auto; margin-right: auto; }
.doc-body img[data-align="right"] { margin-left: auto; margin-right: 0; }
.he-img { position: relative; width: fit-content; max-width: 100%; margin: 1em auto; line-height: 0; }
.he-img[data-align="left"] { margin-left: 0; } .he-img[data-align="right"] { margin-right: 0; }
.he-img img { margin: 0 !important; max-width: 100%; height: auto; }
.he-img.on img { outline: 3px solid var(--accent); outline-offset: 2px; }
.he-img-h { position: absolute; top: 50%; width: 10px; height: 46px; margin-top: -23px; border-radius: 6px; background: var(--accent);
  border: 2px solid var(--surface); box-shadow: var(--shadow-sm); cursor: ew-resize; opacity: 0; transition: opacity .15s; touch-action: none; }
.he-img-l { left: -6px; } .he-img-r { right: -6px; }
.he-img:hover .he-img-h, .he-img.on .he-img-h { opacity: 1; }

.he-bubble { position: absolute; z-index: 1050; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg); visibility: hidden; }
.he-bubble .he-btn { height: 32px; min-width: 32px; }
.he-bubble .he-btn span { font-size: 13px; }
.he-btn span:not(.he-swatch):not(.he-block) { font-size: 13px; }
.he-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.he-pop button.danger { color: var(--red); }
.he-pop button:disabled { opacity: .4; cursor: default; background: none; }
.he-table-menu { min-width: 220px; }
.he-slash-h { font-size: 11.5px; color: var(--text-3); padding: 4px 10px 6px; }
.he-slash-h kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.he-emoji { display: grid; grid-template-columns: repeat(9, 34px); gap: 2px; max-width: 330px; }
.he-emoji button { width: 34px !important; height: 34px; padding: 0 !important; justify-content: center; font-size: 19px !important; }

.he-content .tableWrapper { overflow-x: auto; margin: 1.2em 0; }
.he-content .tableWrapper table { margin: 0; }
.he-content table td, .he-content table th { position: relative; }
.he-content .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: -2px; width: 4px; background: var(--accent); pointer-events: none; z-index: 2; }
.he-content.resize-cursor, .he-content .resize-cursor { cursor: col-resize; }
.he-content .selectedCell::after { content: ""; position: absolute; inset: 0; background: var(--accent); opacity: .12; pointer-events: none; }
.doc-body table col[style] { min-width: 0; }
.doc-crumbs a { color: var(--accent); font-weight: 550; }
.doc-crumbs a:hover { text-decoration: underline; color: var(--accent); }
.doc-crumbs .crumb-home { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; background: var(--accent-bg); }
.doc-crumbs .crumb-home:hover { text-decoration: none; filter: brightness(.97); }
.dt-home { margin-bottom: 4px; }
.dt-home .fic { width: 18px; justify-content: center; }
.pg-icon { position: relative; display: inline-block; }
.pg-icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: calc(var(--s) + 14px); min-height: calc(var(--s) + 14px);
  border: 1px dashed transparent; background: none; border-radius: 12px; cursor: pointer; color: var(--accent); padding: 4px; line-height: 1; }
.pg-icon-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.pg-icon-btn.empty { min-height: 0; padding: 4px 10px; color: var(--text-3); font-size: 13.5px; }
.pg-icon-add { display: inline-flex; align-items: center; gap: 6px; }
@media (hover: hover) { .doc-head .pg-icon-btn.empty { opacity: 0; } .doc-head:hover .pg-icon-btn.empty, .pg-icon-btn.empty:focus-visible { opacity: 1; } }
.pg-icon-pop { top: calc(100% + 6px); left: 0; width: 340px; max-width: calc(100vw - 32px); padding: 10px; }
.pg-icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 230px; overflow-y: auto; }
.pg-icon-grid button { height: 36px; display: grid; place-items: center; padding: 0 !important; font-size: 20px !important; justify-content: center; border-radius: 8px; color: var(--text-2) !important; }
.pg-icon-grid button.on { background: var(--accent-bg) !important; color: var(--accent) !important; }
.pg-icon-static { display: inline-flex; color: var(--accent); margin-bottom: 4px; }
.fic .emo { font-size: 15px !important; line-height: 1; }
.pi .pg-ic, .site-ic .pg-ic, .fic .pg-ic { color: var(--accent); }
.dt-row .fic .pg-ic { color: var(--fc, var(--accent)); }

/* popover swatches / grids keep their own look (beat the generic .he-pop button rule) */
.he-pop .he-swatches button:not(.btn) { width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid var(--border); background: var(--c); }
.he-pop .he-swatches button:not(.btn):hover { background: var(--c); box-shadow: 0 0 0 2px var(--accent); }
.he-pop .he-swatches button.none:not(.btn) { background: linear-gradient(135deg, transparent 45%, var(--red) 46%, var(--red) 54%, transparent 55%), var(--surface); }
/* collapsible long code blocks */
.code-wrap.folded pre, .he-code.folded pre { max-height: 300px; overflow: hidden; }
.code-wrap.folded::after, .he-code.folded::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; pointer-events: none;
  border-radius: 0 0 12px 12px; background: linear-gradient(transparent, #0d0f14 85%); }
.he-code { position: relative; }
:root[data-theme="dark"] .code-wrap.folded::after, :root[data-theme="dark"] .he-code.folded::after { background: linear-gradient(transparent, #08090d 85%); }
.code-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: -1px; padding: 8px; border: 0;
  border-radius: 0 0 12px 12px; background: #171a21; color: #c9ced8; font: inherit; font-size: 13px; cursor: pointer; position: relative; z-index: 1; }
:root[data-theme="dark"] .code-more { background: #0d0f14; border: 1px solid var(--border); border-top: 0; }
.code-more:hover { color: #fff; background: #1c1f27; }
.code-wrap.folded .code-more .icon { transform: none; } .code-wrap:not(.folded) .code-more .icon { transform: rotate(180deg); }
.code-wrap:has(.code-more) pre { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.code-wrap.folded::after { bottom: 37px; border-radius: 0; }
.code-tools .code-lines, .he-code-lines { font-family: var(--mono); font-size: 11px; color: #8a909c; margin-right: auto; }
.code-tools .code-lang + .code-lines { margin-left: 10px; }
.code-tools .code-lang:has(+ .code-lines) { margin-right: 0; }
.code-tools button.on { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }

/* ---------- Styled dropdowns, multi-selects and date picker (static/js/select.js) ---------- */
.hs-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important;
  overflow: hidden !important; clip-path: inset(50%) !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.hs-trigger { text-align: left; min-width: 0; }
button.hs-trigger { line-height: 1.2; }
.input.hs-trigger:not(.hs-multi) { padding-right: 38px; }
.hs-trigger .hs-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-trigger.hs-placeholder .hs-label { color: var(--text-3); }
.hs-trigger.hs-open { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.hs-trigger:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.hs-trigger:disabled, .hs-multi.hs-disabled { opacity: .55; cursor: not-allowed; }
.has-error .hs-trigger, .has-error .hs-date-text { border-color: var(--red); }
.hs-multi { display: flex; align-items: center; height: auto; min-height: 44px; padding: 6px 40px 6px 8px; flex-wrap: wrap; gap: 6px; cursor: pointer; position: relative; }
.hs-multi .hs-ph { color: var(--text-3); padding-left: 6px; }
.hs-multi .hs-caret { position: absolute; right: 12px; top: 13px; color: var(--text-3); display: inline-flex; }
.hs-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 8px; background: var(--accent-bg);
  color: var(--accent); font-size: 13px; font-weight: 550; line-height: 1.3; }
.hs-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-chip button { border: 0; background: none; color: inherit; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; padding: 0; opacity: .75; }
.hs-chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); opacity: 1; }
.hs-more { font-size: 12.5px; color: var(--text-3); align-self: center; }

.hs-pop { position: fixed; z-index: 1200; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(7,26,51,.22), 0 2px 6px rgba(7,26,51,.08); display: flex; flex-direction: column; overflow: hidden;
  animation: hs-in .12s ease-out; outline: 0; }
:root[data-theme="dark"] .hs-pop { box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.02); background: #14171d; }
@keyframes hs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.hs-pop.hs-up { animation-name: hs-in-up; } @keyframes hs-in-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hs-search { position: relative; padding: 8px; border-bottom: 1px solid var(--border); }
.hs-search .icon { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.hs-search input { width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px; padding: 0 10px 0 32px; outline: 0; }
.hs-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.hs-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.hs-tools button { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.hs-tools button:hover { background: var(--accent-bg); }
.hs-tools .hs-n { margin-left: auto; color: var(--text-3); }
.hs-list { max-height: 300px; overflow-y: auto; padding: 5px; overscroll-behavior: contain; scrollbar-width: thin; }
.hs-group { padding: 10px 10px 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.hs-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; user-select: none; }
.hs-opt.in-group { padding-left: 14px; }
.hs-opt.hi { background: var(--surface-3); }
.hs-opt.on { color: var(--accent); font-weight: 600; }
.hs-single-pop .hs-opt.on { background: var(--accent-bg); }
.hs-opt.hs-empty .hs-text { color: var(--text-3); }
.hs-opt.dis { opacity: .45; cursor: default; }
.hs-opt .hs-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hs-opt .hs-tick { display: inline-flex; color: var(--accent); }
.hs-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; color: transparent; background: var(--surface); }
.hs-opt.on .hs-box { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
:root[data-theme="dark"] .hs-opt.on .hs-box { color: #08090d; }
.hs-none { padding: 14px 12px; color: var(--text-3); font-size: 13.5px; }
.hs-foot { padding: 8px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.hs-title { padding: 14px 16px 6px; font-weight: 700; font-size: 16px; }
.hs-back { position: fixed; inset: 0; background: var(--scrim); z-index: 1199; animation: hs-fade .15s; }
@keyframes hs-fade { from { opacity: 0; } }
.hs-pop.hs-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; max-height: 78vh; border-radius: 18px 18px 0 0;
  animation: hs-sheet .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
.hs-pop.hs-sheet .hs-list { max-height: none; flex: 1; }
.hs-pop.hs-sheet .hs-opt { padding: 12px; font-size: 15.5px; }
@keyframes hs-sheet { from { transform: translateY(100%); } to { transform: none; } }

.hs-date { position: relative; width: 100%; }
.hs-date .hs-date-text { padding-right: 44px; font-variant-numeric: tabular-nums; }
.hs-date.hs-bad .hs-date-text { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 15%, transparent); }
.hs-cal-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; border-radius: 8px;
  color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.hs-cal-btn:hover { background: var(--surface-3); color: var(--accent); }
.hs-date.hs-open .hs-cal-btn { color: var(--accent); }
.hs-cal-pop { padding: 10px; }
.hs-cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.hs-cal-head button { border: 0; background: none; color: var(--text-2); height: 34px; min-width: 34px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; gap: 4px; cursor: pointer; font: inherit; }
.hs-cal-head button:hover { background: var(--surface-3); color: var(--text); }
.hs-cal-head .hs-cal-title { flex: 1; font-weight: 700; font-size: 15px; color: var(--text); }
.hs-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.hs-cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 4px 0; letter-spacing: .04em; }
.hs-cal-grid button { height: 36px; border: 0; background: none; border-radius: 9px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
  font-variant-numeric: tabular-nums; }
.hs-cal-grid button:hover { background: var(--surface-3); }
.hs-cal-grid button.we { color: var(--text-2); }
.hs-cal-grid button.out { color: var(--text-3); opacity: .55; }
.hs-cal-grid button.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); font-weight: 700; }
.hs-cal-grid button.on { background: var(--accent); color: var(--accent-contrast); font-weight: 700; box-shadow: none; }
:root[data-theme="dark"] .hs-cal-grid button.on { color: #08090d; }
.hs-cal-grid button:disabled { opacity: .25; cursor: not-allowed; background: none; }
.hs-cal-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.hs-cal-months button { height: 44px; border: 1px solid var(--border); background: none; border-radius: 10px; font: inherit; color: var(--text); cursor: pointer; }
.hs-cal-months button:hover { background: var(--surface-3); } .hs-cal-months button.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 700; }
.hs-cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.hs-cal-foot button { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.hs-cal-foot button:hover { background: var(--accent-bg); }
.hs-pop.hs-sheet.hs-cal-pop { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.hs-sheet .hs-cal-grid button { height: 44px; }
/* selectable tags (radio) – e.g. asset type IT / OT */
.choice-tags { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.choice-tag { position: relative; cursor: pointer; }
.choice-tag input { position: absolute; opacity: 0; pointer-events: none; }
.choice-tag > span { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 9px 14px; border-radius: 12px;
  border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 650; color: var(--text-2); transition: all .15s; min-height: 44px; }
.choice-tag > span .icon { grid-row: span 2; color: var(--text-3); }
.choice-tag > span small { grid-column: 2; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.choice-tag:hover > span { border-color: var(--accent); }
.choice-tag input:checked + span { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.choice-tag input:checked + span .icon { color: var(--accent); }
.choice-tag input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
/* save bar that stays in view on long forms */
.form-actions { position: sticky; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px;
  padding: 12px 14px; border-radius: 14px 14px 0 0; border: 1px solid var(--border); border-bottom: 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); box-shadow: 0 -8px 24px rgba(7,26,51,.08); }
:root[data-theme="dark"] .form-actions { box-shadow: 0 -8px 24px rgba(0,0,0,.35); }
@media (max-width: 720px) { .form-actions { margin-left: -16px; margin-right: -16px; border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); } }
.input.flash { animation: flash-in .9s; } @keyframes flash-in { 0% { background: var(--accent-bg); border-color: var(--accent); } }
.pages { display: inline-flex; align-items: center; gap: 3px; }
.pages .pg { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.pages a.pg:hover { background: var(--surface-3); color: var(--text); }
.pages .pg.on { background: var(--accent); color: var(--accent-contrast); }
:root[data-theme="dark"] .pages .pg.on { color: #08090d; }
.pages .pg.dis { opacity: .35; } .pages .pg.gap { min-width: 18px; padding: 0; color: var(--text-3); }
.pager { flex-wrap: wrap; gap: 8px; }
.cert-pill { vertical-align: middle; font-size: 11.5px; } h1 .cert-pill { font-size: 12.5px; position: relative; top: -3px; }
/* location cards with a photo: name and deck as solid pills on the picture, always readable */
.loc-card:not(.no-photo) .thumb { height: 150px; }
.loc-card .meta.on-photo { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.loc-card .pill-name { max-width: 100%; padding: 4px 10px; border-radius: 9px; background: var(--surface); color: var(--text); font-size: 13.5px;
  box-shadow: 0 2px 8px rgba(7, 26, 51, .28); line-height: 1.3; }
/*unused*/.x-loc-card .pill-deck { padding: 2px 8px; border-radius: 7px; background: var(--navy-800, #0b0c10); color: #fff; font-size: 11.5px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(7, 26, 51, .25); }
:root[data-theme="dark"] /*unused*/.x-loc-card .pill-deck { background: var(--accent); color: #08090d; }
.hs-time-pop { padding: 10px; }
.hs-time-head { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 2px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); text-align: center; }
.hs-time-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hs-time-col { height: 232px; overflow-y: auto; display: grid; align-content: start; gap: 2px; padding: 2px; scrollbar-width: thin; overscroll-behavior: contain;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.hs-time-col button { height: 34px; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 15px; color: var(--text); cursor: pointer;
  font-variant-numeric: tabular-nums; }
.hs-time-col button:hover { background: var(--surface-3); }
.hs-time-col button.on { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
:root[data-theme="dark"] .hs-time-col button.on { color: #08090d; }
.hs-sheet .hs-time-col { height: 280px; } .hs-sheet .hs-time-col button { height: 42px; }

/* ---------- The bell (in-app notices) ---------- */
.bell { position: relative; }
.bell > .btn { position: relative; }
.bell-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.bell-badge[hidden] { display: none; }
.dropdown.bell-drop { width: 360px; max-width: calc(100vw - 24px); }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--border); }
.bell-items { max-height: min(460px, 70dvh); overflow-y: auto; }
.dropdown a.bell-item { align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.bell-item .ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.bell-item.unread .ic { background: var(--accent-bg); color: var(--accent); }
.bell-item .tx { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.bell-item .tx b { font-weight: 600; }
.bell-item.unread .tx b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.bell-item .tx span { color: var(--text-2); }
.bell-item .tx small { color: var(--text-3); font-size: 12px; }
.bell-empty { padding: 28px 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.bell-empty p { margin-top: 8px; }
a.toast.bell-toast { color: var(--text); text-decoration: none; transition: opacity .4s; }
.bell-toast b { display: block; }
.bell-toast span { color: var(--text-2); font-size: 13px; }
@media (max-width: 640px) { .dropdown.bell-drop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }


/* small pieces used by the share dialog (kept from the old module styles) */
.site-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--grey-bg); color: var(--text-2); }
.site-ic.tone-amber { background: var(--amber-bg); color: var(--amber); }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--border); font-size: 13.5px; font-weight: 550; }
.pchip button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.pchip button:hover { background: var(--border); color: var(--text); }

/* dialogs, checkboxes, file drop (restored from the shared component set) */
input.check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
dialog.modal-dlg { padding: 0; border: 0; background: transparent; width: min(520px, calc(100vw - 32px)); max-width: none; color: var(--text); }
dialog.modal-dlg .modal { max-width: none; }
dialog.modal-dlg::backdrop { background: var(--scrim); }
.bk-run .spin { animation: bk-spin 1s linear infinite; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
.bk-err { white-space: pre-wrap; font-size: 11.5px; max-height: 240px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 8px; }
.fdrop { position: relative; display: block; border: 2px dashed var(--border-strong, var(--border)); border-radius: 14px; background: var(--surface-2); padding: 18px; cursor: pointer; transition: border-color .15s, background .15s; }
.fdrop:hover, .fdrop.over { border-color: var(--accent); background: var(--accent-bg); }
.fdrop.has { border-style: solid; border-color: color-mix(in srgb, var(--green) 45%, var(--border)); background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.fdrop input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.fdrop-empty { display: flex; align-items: center; gap: 14px; }
.fdrop-empty b { display: block; font-size: 14.5px; } .fdrop-empty u { color: var(--accent); text-decoration: none; font-weight: 600; }
.fdrop-empty small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.fdrop-ic { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent); border: 1px solid var(--border); }
.fdrop-files { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.fdrop-file { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.fdrop-file svg { color: var(--green); flex: none; } .fdrop-file small { color: var(--text-3); }
.fdrop-files .btn { align-self: flex-start; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
