/* IT Asset — self-contained stylesheet (no external fonts/CDNs, CSP friendly). */

/* Viva Apotek palette: neutral surfaces, magenta #df1782 used as a precise accent. */
:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f8f8f9;
  --surface-3: #efeff1;
  --border: #e9e9ec;
  --border-strong: #dcdce0;
  --text: #17171c;
  --text-2: #3f3f46;
  --muted: #71717a;
  --ink: #16141a;
  --accent: #c2126c;          /* links, icons, active text (AA on white) */
  --accent-strong: #d0157a;   /* filled surfaces with white text */
  --accent-hover: #b51269;
  --accent-text: #ffffff;
  --accent-soft: #fdf0f6;
  --danger: #dc2626;
  --danger-soft: #fef1f1;
  --success: #059669;
  --success-soft: #ecf8f3;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --info: #0369a1;
  --info-soft: #ebf5fc;
  --violet: #7c3aed;
  --violet-soft: #f4f0fe;
  --neutral: #71717a;
  --neutral-soft: #f1f1f3;
  --focus: #df1782;

  --t-magenta: #d0157a;
  --t-violet: #7c3aed;
  --t-blue: #2563eb;
  --t-amber: #d97706;
  --t-green: #059669;
  --t-teal: #0d9488;
  --t-orange: #ea580c;
  --t-indigo: #4f46e5;
  --t-red: #dc2626;
  --tint: 11%;

  --side-bg: #15171c;
  --side-border: #23262d;
  --side-text: #c4c8d0;
  --side-muted: #6c717d;
  --side-hover: rgba(255, 255, 255, .05);
  --side-active: rgba(255, 255, 255, .08);
  --side-accent: #ff3d9a;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(23, 23, 28, .04);
  --shadow: 0 1px 2px rgba(23, 23, 28, .04), 0 2px 8px -2px rgba(23, 23, 28, .05);
  --shadow-lg: 0 12px 32px -8px rgba(23, 23, 28, .14), 0 2px 6px rgba(23, 23, 28, .04);
  --grad: linear-gradient(135deg, #df1782 0%, #b0105f 100%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --side-w: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0e;
    --surface: #141417;
    --surface-2: #19191d;
    --surface-3: #232328;
    --border: #25252b;
    --border-strong: #34343b;
    --text: #f4f4f5;
    --text-2: #d4d4d8;
    --muted: #9b9ba4;
    --ink: #1c1a21;
    --accent: #f472b6;
    --accent-strong: #d0157a;
    --accent-hover: #e01d86;
    --accent-text: #ffffff;
    --accent-soft: #2a1320;
    --danger: #f87171;
    --danger-soft: #2e1618;
    --success: #34d399;
    --success-soft: #0f2620;
    --warn: #fbbf24;
    --warn-soft: #2c2212;
    --info: #38bdf8;
    --info-soft: #0f2333;
    --violet: #c4b5fd;
    --violet-soft: #221c38;
    --neutral: #a1a1aa;
    --neutral-soft: #1f1f24;
    --focus: #f472b6;
    --t-magenta: #f472b6;
    --t-violet: #a78bfa;
    --t-blue: #60a5fa;
    --t-amber: #fbbf24;
    --t-green: #34d399;
    --t-teal: #2dd4bf;
    --t-orange: #fb923c;
    --t-indigo: #818cf8;
    --t-red: #f87171;
    --tint: 16%;
    --side-bg: #0f1013;
    --side-border: #1d1f24;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .01);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; margin: 0; line-height: 1.25; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
h2 > .icon {
  width: 1.95rem; height: 1.95rem; padding: .42rem; border-radius: 9px; flex: none;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) var(--tint), transparent);
}
.tone-magenta { --c: var(--t-magenta); }
.tone-violet { --c: var(--t-violet); }
.tone-blue { --c: var(--t-blue); }
.tone-amber { --c: var(--t-amber); }
.tone-green { --c: var(--t-green); }
.tone-teal { --c: var(--t-teal); }
.tone-orange { --c: var(--t-orange); }
.tone-indigo { --c: var(--t-indigo); }
.tone-red { --c: var(--t-red); }
h3 { font-size: .9rem; margin: 1.1rem 0 .3rem; color: var(--text-2); }
.lead { color: var(--muted); margin: .3rem 0 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .88em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; margin: 0; }
.sub { color: var(--muted); font-size: .84em; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.1rem; height: 1.1rem; flex: none; }

/* ---------- app shell: sidebar + content ---------- */
body.app {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--side-bg) var(--side-w), var(--bg) var(--side-w));
}

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.1rem .75rem;
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  color: var(--side-text);
  overflow-y: auto;
  z-index: 20;
  color-scheme: dark;
}
.brand {
  display: flex; align-items: center; gap: .7rem; padding: .25rem .55rem 1rem; color: #fff;
  border-bottom: 1px solid var(--side-border);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 8px;
  background: var(--accent-strong); color: #fff; flex: none;
}
.brand-mark .icon { width: 1.2rem; height: 1.2rem; }
.brand-mark.lg { width: 3.25rem; height: 3.25rem; border-radius: 12px; }
.brand-mark.lg .icon { width: 1.75rem; height: 1.75rem; }
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; line-height: 1.2; }
.brand-text small { font-weight: 500; font-size: .7rem; color: var(--side-muted); letter-spacing: .02em; }

.mainnav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-section { margin: 1.1rem .7rem .4rem; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); }
.nav-section:first-child { margin-top: 0; }
.mainnav a {
  position: relative; display: flex; align-items: center; gap: .7rem;
  padding: .5rem .7rem; border-radius: 6px;
  color: var(--side-text); font-weight: 500; font-size: .9rem; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-ic { display: grid; place-items: center; flex: none; color: var(--side-muted); transition: color .12s; }
.nav-ic .icon { width: 1.1rem; height: 1.1rem; }
.mainnav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.mainnav a:hover .nav-ic { color: var(--side-text); }
.mainnav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.mainnav a[aria-current="page"] .nav-ic { color: var(--side-accent); }
.mainnav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -.75rem; top: .4rem; bottom: .4rem; width: 3px; border-radius: 0 2px 2px 0;
  background: var(--side-accent);
}

.usermenu {
  display: flex; align-items: center; gap: .4rem;
  padding: .75rem .35rem 0; border-top: 1px solid var(--side-border);
}
.usermenu form { margin: 0; }
.who { display: flex; align-items: center; gap: .6rem; color: #fff; min-width: 0; flex: 1; border-radius: 6px; padding: .2rem; }
.who:hover { text-decoration: none; background: var(--side-hover); }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-text strong { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: .72rem; color: var(--side-muted); }
.avatar {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 6px; flex: none;
  background: #2a2d35; color: #fff; font-weight: 700; font-size: .82rem;
}
.icon-btn {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 6px;
  border: 0; background: transparent; color: var(--side-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--side-hover); color: #fff; }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 2rem 2.25rem 3.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.crumbs { margin: 0 0 .35rem; color: var(--muted); font-size: .85rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 3px 0 var(--c, var(--t-magenta)), var(--shadow);
  padding: 1.45rem 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
}
.narrow { max-width: 680px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 1.25rem; }

/* ---------- dashboard tiles ---------- */
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: .3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  overflow: hidden;
}
a.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tile-label { color: var(--muted); font-size: .84rem; font-weight: 500; }
.tile-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-value.small { font-size: 1.15rem; }
.tile-icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; flex: none; }
.tile-icon .icon { width: 1.25rem; height: 1.25rem; }

.tile-hero {
  padding: 1.35rem 1.5rem; border: 0; color: #fff; isolation: isolate;
  background: radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 55%), var(--accent-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -8px rgba(208, 21, 122, .45);
}
.tile-hero.alt {
  background: radial-gradient(90% 120% at 100% 0%, rgba(223, 23, 130, .45) 0%, rgba(223, 23, 130, 0) 60%), var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -8px rgba(0, 0, 0, .35);
}
.tile-hero .tile-icon { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .16); color: #fff; margin-bottom: .4rem; }
.tile-hero .tile-label { color: rgba(255, 255, 255, .8); }
.tile-hero .tile-value { font-size: 2.2rem; }
.tile-foot { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: rgba(255, 255, 255, .75); margin-top: .35rem; }
.tile-foot .icon { width: .95rem; height: .95rem; transition: transform .15s; }
a.tile-hero:hover { border-color: transparent; filter: brightness(1.05); }
a.tile-hero:hover .tile-foot .icon { transform: translateX(3px); }

.tile-status { flex-direction: row; align-items: center; gap: .85rem; }
.tile-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.tile-status .tile-value { font-size: 1.5rem; }
.tile-status {
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 8%, var(--surface)) 0%, var(--surface) 70%);
  border-color: color-mix(in srgb, var(--c) 22%, var(--border));
  box-shadow: inset 4px 0 0 var(--c), var(--shadow);
}
a.tile-status:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); box-shadow: inset 4px 0 0 var(--c), var(--shadow-lg); }
.tile-status .tile-icon { background: color-mix(in srgb, var(--c) var(--tint), transparent); color: var(--c); }
.st-in_stock { --c: var(--success); }
.st-assigned { --c: var(--info); }
.st-deployed { --c: var(--violet); }
.st-in_repair { --c: var(--warn); }
.st-retired { --c: var(--neutral); }
.st-lost { --c: var(--danger); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bars li { display: grid; grid-template-columns: minmax(0, 9rem) 1fr 2.75rem; gap: .85rem; align-items: center; }
.bars a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: 500; }
.bars .num { font-weight: 650; }
meter {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 100%; height: .55rem; border: 0; border-radius: 99px; background: var(--surface-3); overflow: hidden;
}
meter::-webkit-meter-bar { background: var(--surface-3); border: 0; border-radius: 99px; height: .55rem; }
meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--accent-strong)) 70%, #fff), var(--c, var(--accent-strong))); border-radius: 99px; }
meter::-moz-meter-bar { background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--accent-strong)) 70%, #fff), var(--c, var(--accent-strong))); border-radius: 99px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  position: relative; display: grid; grid-template-columns: 9.5rem 1fr auto; gap: .85rem;
  padding: .6rem 0 .6rem 1.1rem; border-top: 1px solid var(--border); align-items: baseline;
}
.activity li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); }
.activity li:first-child { border-top: 0; }
.activity time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }

/* ---------- tables ---------- */
.results { position: relative; }
.results .table-wrap, .card > .table-wrap { border-radius: var(--radius); }
.results > .table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead th:last-child { border-top-right-radius: var(--radius-lg); }
.card .table thead th { background: transparent; border-radius: 0; }
.table thead th a { color: inherit; }
.table thead th a:hover { color: var(--accent); text-decoration: none; }
.table thead th[aria-sort] { color: var(--accent); }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td a { font-weight: 550; }
.table.compact th, .table.compact td { padding: .5rem .6rem; }
.table .num { text-align: right; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin: 0; }
.diff { margin-top: .4rem; font-size: .85rem; }
.diff .old { color: var(--danger); text-decoration: line-through; }
.diff .new { color: var(--success); }
.results.htmx-request { opacity: .55; transition: opacity .15s; }
.result-count { color: var(--muted); font-size: .85rem; margin: 0 0 .6rem; font-weight: 500; }
tr.editing td { background: var(--accent-soft); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .75rem; font-weight: 600; padding: .18rem .6rem .18rem .5rem;
  border-radius: 99px; white-space: nowrap; line-height: 1.45; letter-spacing: .01em;
}
.badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.s-in_stock { background: var(--success-soft); color: var(--success); }
.s-assigned { background: var(--info-soft); color: var(--info); }
.s-deployed { background: var(--violet-soft); color: var(--violet); }
.s-in_repair { background: var(--warn-soft); color: var(--warn); }
.s-retired { background: var(--neutral-soft); color: var(--neutral); }
.s-lost { background: var(--danger-soft); color: var(--danger); }
.tile-label .badge { font-size: .72rem; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-neutral { background: var(--neutral-soft); color: var(--neutral); }
a.badge:hover { text-decoration: none; filter: brightness(.97); }
.over { color: var(--danger); font-weight: 700; }
.seat-big { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .5rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.seat-big .sub { font-size: .9rem; }
.seat-form { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
meter.over::-webkit-meter-optimum-value, meter.over::-webkit-meter-suboptimum-value { background: var(--danger); }
meter.over::-moz-meter-bar { background: var(--danger); }
.tag { font-family: var(--mono); font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); padding: .05rem .4rem; border-radius: 5px; }

/* ---------- forms ---------- */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  min-height: 2.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--accent); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .field .label { font-weight: 600; font-size: .85rem; color: var(--text-2); }
.field.check label { font-weight: 500; display: flex; gap: .55rem; align-items: center; }
.field p { margin: 0; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-size: .8rem; margin: 0; }
.field-error { color: var(--danger); font-size: .8rem; margin: 0; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.form-grid { display: grid; gap: 1.5rem; }
.form-grid fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem 1.15rem; }
.form-grid fieldset + fieldset { border-top: 1px solid var(--border); padding-top: 1.35rem; }
.form-grid legend { font-weight: 700; font-size: .95rem; margin-bottom: .75rem; padding: 0; }
.field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 1.1rem; }

.filters {
  display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; align-items: center;
  padding: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.filters .search { position: relative; flex: 1 1 280px; display: block; }
.filters .search .icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filters .search input { padding-left: 2.35rem; }
.filters input[type=search] { flex: 1 1 280px; width: 100%; }
.filters select { flex: 0 1 190px; width: auto; }
.inline-add { display: flex; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.inline-add .field { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; font-size: .875rem;
  padding: .5rem 1rem; min-height: 2.5rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, filter .15s;
}
.btn .icon { width: 1rem; height: 1rem; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost.danger { color: var(--danger); }
.btn.small { padding: .25rem .65rem; min-height: 2rem; font-size: .8rem; }
.btn.lg { min-height: 2.85rem; font-size: .95rem; }
.btn.block { width: 100%; }
.btn.htmx-request { opacity: .6; pointer-events: none; }

/* ---------- misc ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; border: 1px solid transparent; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.pager { display: flex; gap: .5rem; justify-content: center; align-items: center; margin: 1.25rem 0; color: var(--muted); font-size: .85rem; }
.pager a {
  padding: .4rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm);
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager span { padding: 0 .5rem; }
.props { display: grid; grid-template-columns: minmax(8.5rem, max-content) 1fr; gap: 0; margin: 0; }
.props dt, .props dd { padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.props dt { color: var(--muted); font-size: .88rem; padding-right: 1rem; }
.props dd { margin: 0; font-weight: 500; }
.props dt:last-of-type, .props dd:last-of-type { border-bottom: 0; }
.holder { margin: 0 0 1.1rem; padding: .85rem 1rem; border-radius: var(--radius); background: var(--info-soft); }
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state.small { padding: 2rem 1rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty-state .code {
  font-size: 4.5rem; font-weight: 800; letter-spacing: -.04em; margin: 0; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.empty-state h1 { justify-content: center; margin: .5rem 0; }

.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  padding: .8rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--danger); animation: toast-in .2s ease-out;
}
.toast.success { border-left-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- help ---------- */
.help-link { color: var(--muted); }
.help-link:hover { color: var(--accent); }
.help-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.help-toc {
  position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1px;
  padding: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.help-toc-title { margin: 0 .5rem .4rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.help-toc a { padding: .35rem .5rem; border-radius: 6px; color: var(--text-2); font-size: .86rem; }
.help-toc a:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.help { scroll-margin-top: 1.25rem; }
.help p, .help li { max-width: 78ch; }
.help ul, .help ol { padding-left: 1.25rem; margin: .4rem 0 .8rem; }
.help li { margin: .3rem 0; }
.help h3 { margin-top: 1.25rem; }
.help h2 .badge { margin-left: .25rem; }
.help .props { margin: .4rem 0 .8rem; }
.help .table-wrap { margin: .4rem 0 .8rem; }
.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 2.1rem; min-height: 1.5rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem; display: grid; place-items: center;
  width: 1.45rem; height: 1.45rem; border-radius: 50%; font-size: .75rem; font-weight: 700;
  background: color-mix(in srgb, var(--c, var(--accent)) var(--tint), transparent); color: var(--c, var(--accent));
}
.callout {
  padding: .7rem .9rem; border-radius: var(--radius-sm); margin: .8rem 0 0;
  background: color-mix(in srgb, var(--c, var(--accent)) 8%, transparent);
  border-left: 3px solid var(--c, var(--accent));
}
.callout .icon { width: 1rem; height: 1rem; vertical-align: -.15rem; }
.faq { border-top: 1px solid var(--border); padding: .7rem 0; }
.faq:first-of-type { border-top: 0; }
.faq summary { color: var(--text); font-weight: 600; font-size: .92rem; }
.faq p { margin: .5rem 0 0; color: var(--text-2); }

/* ---------- auth ---------- */
body.public { min-height: 100vh; }
main.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-shell {
  width: 100%; max-width: 920px; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-brand {
  position: relative; padding: 2.75rem 2.5rem; color: #fff; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(120% 90% at 100% 100%, rgba(223, 23, 130, .55) 0%, rgba(223, 23, 130, 0) 55%),
    radial-gradient(70% 60% at 0% 0%, rgba(223, 23, 130, .18) 0%, rgba(223, 23, 130, 0) 60%),
    var(--ink);
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 75%);
}
.auth-brand .brand-mark { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); box-shadow: none; }
.auth-brand h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 1.25rem 0 .5rem; }
.auth-brand p { color: rgba(255, 255, 255, .7); margin: 0 0 1.75rem; max-width: 34ch; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: .7rem; align-items: flex-start; color: rgba(255, 255, 255, .86); font-size: .9rem; }
.auth-points .icon { width: 1.15rem; height: 1.15rem; margin-top: .1rem; color: #ff7ab8; }
.auth-card { padding: 2.75rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.auth-card h1 { margin-bottom: .3rem; }
.auth-card > p { margin: 0 0 1.5rem; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .page { padding: 1.5rem 1.5rem 3rem; }
}
@media (max-width: 900px) {
  body.app { display: block; background: var(--bg); }
  .sidebar {
    position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: .5rem .75rem; padding: .6rem 1rem; overflow: visible;
  }
  .brand { padding: 0; order: 1; }
  .brand-text small { display: none; }
  .usermenu { order: 2; margin-left: auto; padding: 0; border: 0; }
  .brand { border-bottom: 0; }
  .who-text { display: none; }
  .mainnav { order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; gap: .25rem; padding-bottom: .15rem; }
  .nav-section { display: none; }
  .mainnav a { padding: .45rem .7rem; }
  .mainnav a[aria-current="page"]::before { display: none; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--side-border); }
  .grid-2, .hero-tiles, .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .page { padding: 1.25rem 1rem 2.5rem; }
  .activity li { grid-template-columns: 1fr; gap: .1rem; }
  .props { grid-template-columns: 1fr; }
  .props dt { border-bottom: 0; padding-bottom: 0; }
  .auth-shell { grid-template-columns: 1fr; max-width: 440px; }
  .auth-brand { padding: 1.75rem 1.75rem 1.5rem; }
  .auth-brand p, .auth-points { display: none; }
  .auth-brand h2 { margin: .75rem 0 0; }
  .auth-card { padding: 1.75rem; }
}
@media (max-width: 560px) {
  .filters select { flex: 1 1 140px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-status { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
