@import url("icons.css");
@font-face { font-family: "Moonty"; src: url("fonts/Moonty.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-Regular.ttf"); font-weight: 400; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-SemiBold.ttf"); font-weight: 600; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-ExtraBold.ttf"); font-weight: 800; }

/* ---------------------------------------------------------------- tokens */
:root {
  --primary: #263A59; --primary-light: #5278B8; --primary-soft: #E8EEF8; --accent: #F2A541;
  --bg: #F4F6F9; --surface: #FFFFFF; --surface-2: #FAFBFC; --muted: #EEF1F5; --text: #1D2435; --text-2: #6B7588; --text-3: #A0A8B7;
  --border: #E6E9EF; --success: #1F8A61; --success-soft: #E3F3EC; --error: #D14950; --error-soft: #FBE9EA;
  --warning: #B97A12; --warning-soft: #FCF2DF;
  --side-bg: #FFFFFF; --side-text: #4A5468; --side-hover: #F2F4F7; --side-active: #EDF1F7;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --grid: #EEF0F4;
  --shadow: 0 1px 2px rgba(20, 30, 50, .04), 0 4px 16px rgba(20, 30, 50, .05);
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --primary: #9DB8E6; --primary-light: #86A7E0; --primary-soft: #22314A; --bg: #0F1522; --surface: #171F2E; --surface-2: #1B2435;
  --muted: #222C3E; --text: #E6EAF2; --text-2: #97A2B6; --text-3: #667189; --border: #273246;
  --success: #4CC395; --success-soft: #16352A; --error: #F0767C; --error-soft: #3A1E24; --warning: #E6AE4E; --warning-soft: #3A2E17;
  --side-bg: #131A27; --side-text: #A3ADC0; --side-hover: #1C2536; --side-active: #222D42; --shadow: none;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --grid: #222C3E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Inter Tight", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-light); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- wordmark & loading */
.wordmark { font-family: "Moonty", "Inter Tight", sans-serif; font-weight: 400; font-size: 23px; letter-spacing: -0.2px; line-height: 1; color: var(--primary); display: inline-flex; align-items: flex-end; gap: 2px; }
.wordmark i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-bottom: 4px; }
.wordmark img { height: 28px; }
.dots { display: inline-flex; gap: 5px; padding: 32px; justify-content: center; width: 100%; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-light); animation: dot 1.1s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .35; } 50% { transform: translateY(-5px); opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.main > * { animation: rise .25s ease-out both; }
.backdrop { position: fixed; inset: 0; background: rgba(12, 18, 32, .35); z-index: 15; }
@media (prefers-reduced-motion: reduce) { .dots span, .main > * { animation: none; opacity: 1; } }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, 1fr); }
.login .hero { background: #1B2B45; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.login .hero > * { position: relative; }
.login .hero .wordmark { color: #fff; font-size: 28px; }
.login .hero h2 { font-size: 34px; line-height: 1.15; letter-spacing: -1px; margin: 0 0 14px; max-width: 460px; }
.login .hero p { color: #B9C4D8; max-width: 420px; margin: 0; }
.login .hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: #D5DDEA; }
.login .hero li { display: flex; gap: 10px; align-items: center; } .login .hero li [class^="ri-"] { color: var(--accent); }
.login .pane { display: grid; place-items: center; padding: 32px; }
.login form { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login h1 { margin: 0; font-size: 26px; letter-spacing: -.6px; }
.login form > p { margin: -8px 0 4px; color: var(--text-2); }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; min-height: 100vh; }
/* ---------------------------------------------------------------- sidebar
   full (256 px, labels) or rail (76 px, icons only – html[data-side="rail"]); off-canvas on phones */
:root { --side-w: 256px; --on-primary: #FFFFFF; }
:root[data-theme="dark"] { --on-primary: #0F1522; }
:root[data-side="rail"] { --side-w: 76px; }
.layout { grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns .25s ease; }
.side { background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 12px 0 22px; border-bottom: 1px solid var(--border); flex: none; }
.side-head .wordmark { min-width: 0; }
.side-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--primary); background: var(--primary-soft);
  border-radius: 6px; padding: 2px 6px; margin-top: 3px; }
.side-toggle { margin-left: auto; color: var(--text-3); }
.side-toggle:hover { color: var(--text); }
.side .close-menu { display: none; margin-left: auto; }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 8px; scrollbar-width: thin; }
.side-group + .side-group { margin-top: 14px; }
.side-label { padding: 4px 10px 6px; color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; white-space: nowrap; }
.nav { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 8px 0 6px; margin: 1px 0;
  border: 0; border-radius: 11px; background: none; color: var(--side-text); font: inherit; font-size: 14px; font-weight: 600; text-align: left;
  cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.nav-ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; color: var(--text-3);
  transition: background-color .2s, color .2s, transform .2s; }
.nav-ic [class^="ri-"] { font-size: 17px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav:hover { background: var(--side-hover); color: var(--text); }
.nav:hover .nav-ic { color: var(--text); }
.nav:active .nav-ic { transform: scale(.92); }
/* active entry: no tile, no row background – just the filled icon in the brand colour and a stronger label */
.nav[aria-current="page"] { color: var(--text); font-weight: 700; }
.nav[aria-current="page"]:hover { background: var(--side-hover); }
.nav[aria-current="page"] .nav-ic { color: var(--primary); }
.nav[aria-current="page"] .nav-ic [class^="ri-"] { font-size: 19px; }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px;
  background: var(--muted); color: var(--text); font-size: 11.5px; font-weight: 700; line-height: 1; }
.nav .count.alarm { background: var(--error); color: #fff; }
.nav:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.side-bottom { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.status-card { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); color: var(--side-text); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; transition: border-color .15s; }
.status-card:hover { border-color: var(--text-3); }
.status-ic { position: relative; width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--success-soft); color: var(--success); }
.status-card.is-warn .status-ic { background: var(--warning-soft); color: var(--warning); }
.status-ic [class^="ri-"] { font-size: 17px; }
.status-ic .dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid var(--side-bg); }
.status-card.is-warn .status-ic .dot { background: var(--warning); }
.status-body { display: grid; gap: 6px; min-width: 0; flex: 1; }
.status-body b { color: var(--text); font-size: 13px; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.status-card.is-warn .meter i { background: var(--warning); }
.status-meta { display: grid; gap: 1px; color: var(--text-2); }
.side .foot { text-align: center; color: var(--text-3); font-size: 11.5px; padding-top: 10px; }

/* rail: icons only, labels as tooltips, group headings become hairlines, counts become dots */
:root[data-side="rail"] .side-head { padding: 0; justify-content: center; }
:root[data-side="rail"] .side-head .wordmark, :root[data-side="rail"] .side-tag, :root[data-side="rail"] .nav-label,
:root[data-side="rail"] .status-body, :root[data-side="rail"] .side .foot { display: none; }
:root[data-side="rail"] .side-toggle { margin: 0; }
:root[data-side="rail"] .side-label { font-size: 0; padding: 0; height: 1px; background: var(--border); margin: 6px 10px 8px; }
:root[data-side="rail"] .side-group:first-child .side-label { display: none; }
:root[data-side="rail"] .nav { justify-content: center; padding: 0; }
:root[data-side="rail"] .nav .count { position: absolute; top: 4px; right: 10px; min-width: 9px; height: 9px; padding: 0; font-size: 0; border: 2px solid var(--side-bg); background: var(--primary); }
:root[data-side="rail"] .nav .count.alarm { background: var(--error); }
:root[data-side="rail"] .status-card { justify-content: center; padding: 10px 0; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: none; color: var(--text-2); cursor: pointer; flex: none; font-size: 17px; }
.icon-btn:hover { background: var(--muted); color: var(--text); }
.icon-btn.square { border-radius: var(--r-sm); border: 1px solid var(--border); width: 30px; height: 30px; font-size: 15px; }
.topbar { position: sticky; top: 0; z-index: 6; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.topbar .gsearch { position: relative; width: min(420px, 100%); }
.topbar .gsearch input { background: var(--surface); border: 1px solid var(--border); padding: 8px 64px 8px 38px; border-radius: var(--r-md); }
.topbar .gsearch > [class^="ri-"] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar .gsearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11.5px "Inter Tight", sans-serif; color: var(--text-3); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); }
.gresults { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 16px 40px rgba(15, 22, 40, .14); padding: 6px; display: grid; max-height: 420px; overflow: auto; }
.gresults small { padding: 8px 10px 4px; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.gresults button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.gresults button:hover, .gresults button.active { background: var(--muted); }
.gresults button span { color: var(--text-2); font-size: 13px; }
.topbar .grow { flex: 1; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-left: 1px solid var(--border); margin-left: 6px; }
.userchip div { line-height: 1.2; font-size: 14px; } .userchip b { display: block; font-weight: 600; } .userchip span { color: var(--text-2); font-size: 12.5px; }
.main { padding: 28px 28px 72px; max-width: 1320px; width: 100%; }
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.head .titles { flex: 1; min-width: 220px; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: -.6px; font-weight: 600; }
.head p { margin: 3px 0 0; color: var(--text-2); font-size: 14px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; font-size: 14px; margin-bottom: 10px; cursor: pointer; border: 0; background: none; padding: 0; }
.crumb:hover { color: var(--text); }
.sub { color: var(--text-2); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.seg button { border: 0; background: none; padding: 7px 12px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--muted); color: var(--text); }
.seg.compact { flex-wrap: wrap; flex-shrink: 0; max-width: 100%; }
.setting .control:has(.seg.compact) { flex-wrap: wrap; row-gap: 8px; }
.seg.compact button { padding: 7px 9px; gap: 5px; font-size: 12.5px; }
.seg .swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.seg .swatch.neutral { background: var(--text); }
.setting .control .own input[type=color] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary-light); }

/* ---------------------------------------------------------------- KPI & charts */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 18px 20px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.kpi header { display: flex; align-items: center; gap: 10px; min-height: 28px; color: var(--text); font-weight: 600; font-size: 14.5px; } /* same height with or without the link button */
.kpi header [class^="ri-"] { color: var(--text-2); font-size: 18px; } .kpi header .kpi-link { margin-left: auto; color: var(--text-3); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); }
.kpi header .kpi-link:hover { color: var(--text); background: var(--muted); text-decoration: none; }
.kpi .value { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpi .value b { font-size: 30px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.kpi footer { color: var(--text-2); font-size: 12.5px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; border: 1px solid; }
.trend.good { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.trend.bad { color: var(--error); background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.trend.flat { color: var(--text-2); background: var(--muted); border-color: var(--border); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.dash-grid.even { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.chart-card .card-head { margin-bottom: 4px; } .chart-card .card-head h2 { margin: 0; }
.chart-card .big { font-size: 28px; font-weight: 600; letter-spacing: -.8px; margin: 10px 0 2px; display: flex; gap: 10px; align-items: center; }
.chart { position: relative; height: 230px; margin-top: 18px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: 1fr auto; }
.chart .yaxis { position: relative; grid-row: 1; } .chart .yaxis span { position: absolute; right: 8px; transform: translateY(50%); font-size: 11.5px; color: var(--text-3); }
.chart .plot { position: relative; grid-row: 1; grid-column: 2; display: flex; align-items: flex-end; gap: var(--gap, 6px); border-bottom: 1px solid var(--border); }
.chart .gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--grid); pointer-events: none; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; position: relative; cursor: default; min-width: 2px; }
.chart .col::before { content: ""; position: absolute; inset: 0 -3px; border-radius: 6px; }
.chart .col:hover::before { background: color-mix(in srgb, var(--primary-light) 7%, transparent); }
.chart .seg-bar { width: 100%; max-width: 44px; margin: 0 auto; flex: none; border-radius: 2px; position: relative; }
.chart .col .seg-bar:last-child { border-radius: 4px 4px 2px 2px; }
.chart .col.single .seg-bar { border-radius: 4px 4px 0 0; }
.chart .xaxis { grid-column: 2; display: flex; gap: var(--gap, 6px); padding-top: 8px; }
.chart .xaxis span { flex: 1; text-align: center; font-size: 11.5px; color: var(--text-2); white-space: nowrap; min-width: 0; overflow: visible; }
.chart .peak { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -4px); font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tooltip { position: absolute; z-index: 4; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(15, 22, 40, .16); border-radius: var(--r-md); padding: 8px 10px; font-size: 12.5px; min-width: 150px; display: grid; gap: 3px; }
.tooltip b { font-size: 13px; } .tooltip div { display: flex; align-items: center; gap: 8px; } .tooltip div span:last-child { margin-left: auto; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.hbars { display: grid; gap: 12px; } .hbars > div { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.hbars .track { grid-column: 1 / -1; height: 8px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.hbars .track i { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.hbars b { font-weight: 600; }
.meter { display: inline-flex; align-items: center; gap: 10px; min-width: 140px; }
.meter i { flex: 1; height: 6px; background: var(--muted); border-radius: 99px; overflow: hidden; display: block; } .meter i i { height: 100%; background: var(--series-1); }

/* ---------------------------------------------------------------- data table */
.dt { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden; }
.card .dt { border: 0; box-shadow: none; border-radius: 0; margin: 0 -22px -20px; }
.dt-bar { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dt-bar .searchbox { max-width: 300px; } .dt-bar .searchbox input { padding-top: 8px; padding-bottom: 8px; }
.dt-bar .grow { flex: 1; }
.dt-scroll { overflow-x: auto; }
.dt th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.dt th button:hover { color: var(--text); } .dt th button:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; border-radius: 4px; }
.dt th .sort { opacity: .35; font-size: 13px; } .dt th[aria-sort] .sort { opacity: 1; color: var(--primary-light); }
.dt td.num, .dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.dt-foot select { width: auto; padding: 5px 8px; }
.dt-foot .pages { display: flex; gap: 4px; margin-left: auto; }
.dt-foot .pages button { min-width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.dt-foot .pages button[aria-current="page"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.dt-foot .pages button:disabled { opacity: .4; cursor: default; }
.dt .empty { border: 0; border-radius: 0; }

/* ---------------------------------------------------------------- controls */
.btn { border: 1px solid transparent; background: var(--primary); color: #fff; border-radius: var(--r-md); padding: 9px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: filter .12s, background .12s; }
:root[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger) { color: #0F1522; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--muted); filter: none; }
.btn.ghost { background: none; color: var(--primary-light); padding: 6px 10px; }
.btn.danger { background: var(--error); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn.block { width: 100%; padding: 11px 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 13px; cursor: pointer; font-weight: 600; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { font-size: 12px; opacity: .7; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1.5px solid var(--muted); background: var(--muted); border-radius: var(--r-md); padding: 10px 12px; font-weight: 400; transition: border-color .12s, background .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-light); background: var(--surface); outline: none; }
textarea { min-height: 76px; resize: vertical; }
input[type=color] { width: 48px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; background: var(--surface); }
.searchbox { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.searchbox [class^="ri-"] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.searchbox input { padding-left: 38px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: relative; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--text-3); border-radius: 99px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.error-text { color: var(--error); font-size: 13px; font-weight: 400; }
label.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }

/* ---------------------------------------------------------------- cards & data */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px 22px; box-shadow: var(--shadow); }
.card > h2, .card-head h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; }
.card > h2 [class^="ri-"], .card-head h2 [class^="ri-"] { color: var(--text-3); }
.card-head { display: flex; align-items: center; gap: 10px; } .card-head h2 { flex: 1; }
.card.flush { padding: 0; overflow: hidden; } .card.flush > h2 { padding: 18px 22px 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.side-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; box-shadow: var(--shadow); }
.stat .ico { grid-row: span 2; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-light); font-size: 18px; }
.stat b { font-size: 24px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.stat span { color: var(--text-2); font-size: 12.5px; line-height: 1.25; }
.stat.alarm { border-color: color-mix(in srgb, var(--error) 30%, var(--border)); } .stat.alarm .ico { background: var(--error-soft); color: var(--error); } .stat.alarm b { color: var(--error); }
.rows { display: grid; } .rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rows > div:last-child { border: 0; } .rows span { color: var(--text-2); display: inline-flex; gap: 8px; align-items: center; } .rows b { text-align: right; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.ok { background: var(--success); } .bad { background: var(--error); } .warn { background: var(--warning); } .info { background: var(--text-3); }
.bar { height: 8px; background: var(--muted); border-radius: 99px; overflow: hidden; margin: 12px 0; } .bar > i { display: block; height: 100%; background: var(--success); border-radius: 99px; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--muted); color: var(--text-2); white-space: nowrap; }
.badge.critical { background: var(--error-soft); color: var(--error); } .badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.success { background: var(--success-soft); color: var(--success); } .badge.primary { background: var(--primary-soft); color: var(--primary-light); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: auto; box-shadow: var(--shadow); }
.card .table-wrap { border: 0; box-shadow: none; border-radius: 0; margin: 0 -22px -20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 14px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-2); background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; } tr.link:hover td { background: var(--surface-2); }
tr.link td:last-child .ri-arrow-right-s-line { color: var(--text-3); }
td .muted, .muted { color: var(--text-2); font-size: 13px; }
.who-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; } .who-cell b { display: block; }
/* name over meta line (e-mail, @user …) – never run together in one line */
.who-cell > div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who-cell > div:last-child > .muted { white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis; } /* one line, long ones end in … */
/* grid/flex children may shrink below their content, so wide tables scroll inside their card instead of widening the page */
.grid > *, .dt { min-width: 0; }
.who-cell > div:last-child > a { font-weight: 600; text-decoration: none; } .who-cell > div:last-child > a:hover { text-decoration: underline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.empty { color: var(--text-2); padding: 36px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r-xl); display: grid; gap: 8px; justify-items: center; }
.empty [class^="ri-"] { font-size: 28px; color: var(--text-3); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.report { display: grid; gap: 10px; } .report q { color: var(--text); font-size: 15.5px; } .report .toolbar { margin: 0; }

/* ---------------------------------------------------------------- avatars & entity headers */
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary-light); font-weight: 800; font-size: 14px; object-fit: cover; overflow: hidden; }
.avatar.square { border-radius: 10px; }
.avatar.lg { width: 76px; height: 76px; font-size: 26px; } .avatar.lg.square { border-radius: 18px; }
.entity { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.entity .meta { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.entity h1 { margin: 0; font-size: 26px; letter-spacing: -.7px; display: flex; align-items: center; gap: 8px; }
.entity h1 .ri-verified-badge-fill { color: var(--primary-light); font-size: 22px; }
.entity .handle { color: var(--text-2); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2px 24px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 2px; }
.kv dt { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; } .kv dd { margin: 0; font-weight: 600; word-break: break-word; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
dl { margin: 0; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; font-size: 13.5px; background: var(--muted); padding: 2px 8px; border-radius: 6px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--text); font-size: 13.5px; }
.note [class^="ri-"] { color: var(--primary-light); margin-top: 1px; } .note.warn { background: var(--warning-soft); } .note.warn [class^="ri-"] { color: var(--warning); }
.note.bad { background: var(--error-soft); } .note.bad [class^="ri-"] { color: var(--error); }
.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.counts > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.counts b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.4px; } .counts span { color: var(--text-2); font-size: 12.5px; }
.list { display: grid; } .list > div { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list > div:last-child { border: 0; } .list .grow { flex: 1; min-width: 0; } .list .grow b { display: block; }
.cover { height: 140px; border-radius: var(--r-lg); background: var(--muted) center / cover no-repeat; margin-bottom: 16px; }
.timeline { display: grid; } .timeline > div { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: start; font-size: 14px; }
.timeline > div:last-child { border: 0; } .timeline .dot { margin-top: 6px; }

/* ---------------------------------------------------------------- settings */
.setting { display: grid; grid-template-columns: 1fr minmax(220px, 380px); gap: 18px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.setting:last-of-type { border: 0; }
.setting .label b { display: block; font-weight: 600; } .setting .label small { color: var(--text-2); }
.setting .control { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.setting.changed .label b::after { content: " •"; color: var(--accent); }
.logo-preview { height: 48px; max-width: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px; background: #fff; }
.logo-preview.on-dark { background: #0F131B; border-color: #262D3B; }
.settings-nav { position: sticky; top: 24px; display: grid; gap: 2px; }
.settings-nav button { text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.settings-nav button:hover { background: var(--muted); color: var(--text); }
.savebar { position: sticky; bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 12px 10px 18px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 8px; box-shadow: 0 10px 30px rgba(20, 30, 50, .12); }
.savebar .sub { flex: 1; }

/* ---------------------------------------------------------------- dialog & toast */
dialog { border: 0; border-radius: var(--r-xl); padding: 24px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 24px 64px rgba(10, 16, 30, .3); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(12, 18, 32, .45); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; } dialog p { white-space: pre-line; } dialog .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 10; }
#toast div { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: var(--r-md); font-weight: 600; box-shadow: 0 8px 24px rgba(20, 27, 43, .2); display: flex; gap: 8px; align-items: center; animation: rise .2s ease-out; }
#toast div.error { background: var(--error); color: #fff; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) { .grid.side-layout { grid-template-columns: 1fr; } .settings-nav { display: none; } }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; } .login .hero { display: none; }
  .layout { grid-template-columns: 1fr; }
  .side .close-menu { display: inline-grid; }
  .topbar { padding: 0 12px; } .topbar .menu-btn { display: inline-grid; } .userchip div, .topbar kbd { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .side .side-toggle { display: none; }
  :root[data-side="rail"] .layout { grid-template-columns: 1fr; }
  /* the off-canvas menu always shows labels */
  :root[data-side="rail"] .side .side-head { padding: 0 12px 0 22px; justify-content: flex-start; }
  :root[data-side="rail"] .side .side-head .wordmark { display: inline-flex; }
  :root[data-side="rail"] .side .side-tag, :root[data-side="rail"] .side .nav-label { display: inline; }
  :root[data-side="rail"] .side .status-body { display: grid; }
  :root[data-side="rail"] .side .foot { display: block; }
  :root[data-side="rail"] .side .nav .count { position: static; min-width: 20px; height: 20px; padding: 0 6px; border: 0; font-size: 11.5px; background: var(--muted); }
  :root[data-side="rail"] .side .nav .count.alarm { background: var(--error); }
  :root[data-side="rail"] .side .side-group:first-child .side-label { display: block; }
  :root[data-side="rail"] .side .status-card { justify-content: flex-start; padding: 12px; }
  :root[data-side="rail"] .side .side-label { font-size: 10.5px; padding: 4px 10px 6px; height: auto; background: none; margin: 0; }
  :root[data-side="rail"] .side .nav { justify-content: flex-start; padding: 0 8px 0 6px; }
  .side.open { transform: none; }
  .main { padding: 22px 16px 60px; }
  .setting { grid-template-columns: 1fr; } .setting .control { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- content & map */
:root { --series-5: #e87ba4; }
:root[data-theme="dark"] { --series-5: #d55181; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--muted); display: inline-grid; place-items: center; color: var(--text-3); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery a { display: block; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--muted); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-body { white-space: pre-line; font-size: 15.5px; margin: 14px 0 0; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.comment:last-child { border: 0; } .comment .grow { flex: 1; min-width: 0; } .comment.removed .grow { opacity: .55; }
.comment p { margin: 3px 0 0; white-space: pre-line; }
.map { position: relative; overflow: hidden; border-radius: var(--r-lg); background: #dfe6ee; touch-action: none; cursor: grab; user-select: none; border: 1px solid var(--border); }
:root[data-theme="dark"] .map { background: #1c2433; }
:root[data-theme="dark"] .map .map-tiles { filter: brightness(.75) contrast(1.05) saturate(.8); }
.map.dragging { cursor: grabbing; }
.map-tiles, .map-markers { position: absolute; inset: 0; }
.map-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.marker { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid #fff; color: #fff; display: grid; place-items: center; font-size: 14px; cursor: pointer; box-shadow: 0 2px 6px rgba(10, 18, 32, .35); padding: 0; }
.marker:hover, .marker:focus-visible { transform: scale(1.15); z-index: 2; }
.marker.reported { box-shadow: 0 0 0 3px var(--error), 0 2px 6px rgba(10, 18, 32, .35); }
.map-controls { position: absolute; top: 10px; right: 10px; display: grid; gap: 6px; z-index: 3; }
.map-controls button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.map-attrib { position: absolute; right: 0; bottom: 0; z-index: 3; background: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 11px; padding: 2px 6px; border-top-left-radius: 6px; color: var(--text-2); }
.map-popup { position: absolute; z-index: 4; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 12px 30px rgba(10, 18, 32, .22); padding: 10px 12px; width: 240px; transform: translate(-50%, calc(-100% - 22px)); cursor: default; display: grid; gap: 4px; font-size: 13.5px; }
.map-popup b { font-size: 14px; } .map-popup .close { position: absolute; top: 4px; right: 4px; border: 0; background: none; cursor: pointer; color: var(--text-3); }
.layer-chip .swatch { width: 12px; height: 12px; border-radius: 50%; }

.marker.outlined { background: var(--surface); border-width: 2.5px; }
.list .grow > .muted { display: block; }

/* ---------------------------------------------------------------- scrollable tables */
.dt-scroll { max-height: min(64vh, 640px); overflow: auto; overscroll-behavior: contain; }
.card .dt-scroll { max-height: 440px; }
.dt thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }

/* ---------------------------------------------------------------- custom dropdown */
.dd { position: relative; display: inline-block; min-width: 0; }
.dd-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 7px 10px 7px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; text-align: left; }
.dd-btn:hover { background: var(--surface-2); }
.dd-btn .dd-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-btn .ri-arrow-down-s-line { color: var(--text-3); transition: transform .15s; }
.dd.open .dd-btn { border-color: var(--primary-light); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-light) 18%, transparent); }
.dd.open .dd-btn .ri-arrow-down-s-line { transform: rotate(180deg); }
.dd.small .dd-btn { min-height: 30px; padding: 4px 8px; font-size: 13px; }
.dd-menu { position: absolute; z-index: 30; left: 0; min-width: 100%; max-width: 340px; max-height: 300px; overflow: auto; margin: 0; padding: 5px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 16px 40px rgba(15, 22, 40, .16); outline: none; top: calc(100% + 6px); }
.dd.up .dd-menu { top: auto; bottom: calc(100% + 6px); }
.dd.right .dd-menu { left: auto; right: 0; }
.dd-menu li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; white-space: nowrap; }
.dd-menu li.active { background: var(--muted); }
.dd-menu li[aria-selected="true"] { font-weight: 600; color: var(--primary-light); }
.dd-menu li .check { margin-left: auto; visibility: hidden; } .dd-menu li[aria-selected="true"] .check { visibility: visible; }
.setting .control .dd { width: 100%; }
.dt { overflow: visible; } /* let dropdown menus extend past short tables */
.dt-foot { border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }

/* ---------------------------------------------------------------- admin notifications */
.bell-wrap { position: relative; }
.icon-btn.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--error); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); line-height: 1; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 18px 48px rgba(15, 22, 40, .18); overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-list { max-height: 440px; overflow: auto; }
.bell-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.bell-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--muted); color: var(--text-2); }
.bell-ico.critical { background: var(--error-soft); color: var(--error); } .bell-ico.warning { background: var(--warning-soft); color: var(--warning); } .bell-ico.primary { background: var(--primary-soft); color: var(--primary-light); }
.bell-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13.5px; }
.bell-dot { width: 8px; height: 8px; margin-top: 6px; background: var(--primary-light); }

/* ---------------------------------------------------------------- e-mails (template builder) */
.email-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.email-card { display: flex; gap: 14px; align-items: center; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 18px; border: 1px solid var(--border); transition: border-color .15s, transform .15s; }
.email-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.email-card > [class^="ri-"] { margin-left: auto; color: var(--text-3); font-size: 20px; }
.email-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 22px; }
.email-main { display: grid; gap: 4px; min-width: 0; }
.email-main b { font-size: 15.5px; color: var(--text); }
.email-langs { display: flex; gap: 6px; margin-top: 4px; }
.email-langs .badge.on { background: var(--primary-soft); color: var(--primary); }
.small-note { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.email-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.email-form { display: grid; gap: 14px; }
.email-form h3 { margin: 6px 0 0; font-size: 15px; }
.email-form .sub.unsaved { color: var(--warning); font-weight: 600; }
.email-form textarea { min-height: 84px; resize: vertical; }
.var-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.var-chips .chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 4px 10px; }
.blocks { display: grid; gap: 10px; }
.block-card { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 12px 12px; background: var(--surface-2); display: grid; gap: 10px; }
.block-head { display: flex; align-items: center; gap: 8px; }
.block-type { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; color: var(--text); }
.block-type [class^="ri-"] { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 15px; }
.block-tools { margin-left: auto; display: flex; gap: 2px; }
.block-tools .icon-btn { width: 30px; height: 30px; }
.block-tools .icon-btn:disabled { opacity: .3; cursor: default; }
.block-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px; border: 1px dashed var(--border); border-radius: var(--r-lg); }
.grid.two { grid-template-columns: 1fr 1fr; }
.email-preview { position: sticky; top: 80px; display: grid; gap: 10px; }
.email-subject { font-size: 13.5px; padding: 8px 12px; background: var(--muted); border-radius: var(--r-md); min-height: 18px; overflow-wrap: anywhere; }
.email-frame-wrap { background: #F4F5F7; border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; transition: max-width .25s ease; }
.email-frame-wrap.mobile { max-width: 390px; margin: 0 auto; }
.email-frame { display: block; width: 100%; height: 640px; border: 0; background: #F4F5F7; }
.secret-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.secret-state.set { color: var(--success); font-weight: 600; }
.mail-test { display: grid; gap: 10px; padding: 0 0 6px; }
.mail-test p { margin: 0; }
@media (max-width: 1180px) { .email-editor { grid-template-columns: 1fr; } .email-preview { position: static; } }

/* ---------------------------------------------------------------- image checks (Bildprüfung) */
.seg .seg-count { margin-left: 6px; padding: 0 6px; border-radius: 99px; background: var(--muted); font-size: 11px; font-weight: 700; line-height: 18px; }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 12px; }
.scan-grid > .empty { grid-column: 1 / -1; }
.scan-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.scan-img { aspect-ratio: 4 / 3; background: var(--muted); display: grid; place-items: center; overflow: hidden; }
.scan-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-ph { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.scan-ph > [class^="ri-"] { font-size: 26px; }
.scan-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.scan-score-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 6px; }
.scan-bar { position: relative; height: 8px; border-radius: 99px; background: var(--muted); }
.scan-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--success); }
.scan-bar i.over { background: var(--error); }
.scan-bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); }
.scan-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.scan-meta a { color: var(--text); font-weight: 600; text-decoration: none; }
.scan-meta a:hover { text-decoration: underline; }
.scan-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.scan-more { justify-content: center; margin-top: 16px; }

/* Verifizierung → Kontotyp zuweisen: field, type, checkbox and button in one row */
.toolbar > input.assign-user { flex: 0 1 280px; width: auto; min-width: 180px; }

/* ---------------------------------------------------------------- control heights (pixel alignment)
   Text fields, dropdowns and buttons share one height, so a row of controls lines up exactly. */
:root { --control-h: 40px; --control-h-sm: 32px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select { height: var(--control-h); }
.btn { min-height: var(--control-h); padding-top: 0; padding-bottom: 0; }
.btn.small, .btn.ghost { min-height: var(--control-h-sm); }
.dd-btn { min-height: var(--control-h); }
.dd.small .dd-btn { min-height: var(--control-h-sm); }
.dt-bar .searchbox input { height: var(--control-h); }
.btn.small { padding-top: 0; padding-bottom: 0; }
.dt-bar .btn { min-height: var(--control-h); } /* CSV export next to the table search: same height */
.setting .control .own input[type=color], input[type=color] { width: var(--control-h); height: var(--control-h); } /* swatch as tall as the hex field */
