/* ==========================================================================
   Helpdesk — mobile-app design system
   Soft sage canvas, floating white cards, teal + amber accents.
   Mobile first: bottom tab bar + FAB. From 1024px a floating rail takes over.
   ========================================================================== */

/* Colour, gloss and gradient tokens live in themes.css, which is loaded first.
   This file owns layout, shape and behaviour, and never hard-codes a colour. */
:root {
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  --shadow:    0 2px 10px rgba(16, 44, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 44, 40, .08);
  --shadow-lg: 0 18px 44px rgba(16, 44, 40, .14);

  --rail: 250px;
  --tabbar: 76px;

  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* The dark palette and the accent overrides live in themes.css. */


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
img { max-width: 100%; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ============================================================== app shell */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}
.topbar .menu-btn {
  width: 38px; height: 38px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--text); flex: none; padding: 0;
}
.topbar .title { min-width: 0; flex: 1; }
.topbar h1 { font-size: 20px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub {
  font-size: 12px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .actions { display: flex; align-items: center; gap: 8px; flex: none; }

.bell {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background-color: var(--surface); background-image: var(--gloss-wash);
  background-repeat: no-repeat; background-size: 100% 100%; border: 0;
  box-shadow: var(--shadow), var(--gloss-rim);
  display: grid; place-items: center; cursor: pointer; color: var(--text); font-size: 17px;
  transition: transform .12s ease;
}
.bell:active { transform: scale(.94); }
.bell .dot {
  position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px;
  border-radius: var(--r-pill); background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  padding: 0 5px; border: 2px solid var(--bg);
}
.top-avatar {
  position: relative; width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex: none;
  border: 0; padding: 0; cursor: pointer; background: var(--brand-soft);
  box-shadow: var(--shadow), var(--gloss-rim); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: var(--brand);
  transition: transform .12s ease;
}
.top-avatar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 55%;
  background: var(--gloss-wash); pointer-events: none;
}
.top-avatar:active { transform: scale(.94); }
.top-avatar img { width: 100%; height: 100%; object-fit: cover; }

.content {
  flex: 1; padding: 4px 16px calc(var(--tabbar) + 34px + var(--safe-b));
  width: 100%; max-width: 720px; margin: 0 auto;
}

/* ---------------------------------------------------------- bottom tabs */

.tabbar {
  position: fixed; z-index: 45;
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  height: var(--tabbar);
  background-color: var(--surface);
  background-image: var(--gloss-wash);
  background-repeat: no-repeat; background-size: 100% 100%;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), var(--gloss-rim);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  align-items: center; padding: 0 6px;
  backdrop-filter: saturate(1.4) blur(8px);
}
.tabbar a {
  display: grid; place-items: center; gap: 3px; height: 100%;
  color: var(--faint); font-size: 10px; font-weight: 600; text-decoration: none;
  border-radius: var(--r-lg);
}
.tabbar a .ico {
  width: 46px; height: 32px; display: grid; place-items: center;
  border-radius: var(--r-pill); transition: background .16s, color .16s;
}
.tabbar a .ico svg { width: 21px; height: 21px; }
.rail nav a .ico svg, .sheet-list .ico svg { width: 19px; height: 19px; }
.bell .ico { display: grid; place-items: center; }
.bell .ico svg { width: 19px; height: 19px; }
.tabbar a.active { color: var(--brand); }
.tabbar a.active .ico {
  background-color: var(--brand-soft);
  background-image: var(--gloss-wash);
  box-shadow: var(--gloss-rim), 0 1px 3px rgba(var(--brand-rgb), .14);
}
.tabbar a .tab-dot {
  position: absolute; margin: -22px 0 0 20px; min-width: 16px; height: 16px;
  background: var(--warn); color: #fff; border-radius: var(--r-pill);
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px;
}

.fab {
  position: fixed; z-index: 46; overflow: hidden;
  right: 20px; bottom: calc(var(--tabbar) + 22px + var(--safe-b));
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background-image: var(--grad-brand);
  color: #fff; font-size: 25px; line-height: 1;
  box-shadow: var(--gloss-btn-rim), 0 10px 26px rgba(var(--brand-rgb), .45);
  cursor: pointer; display: grid; place-items: center;
  transition: transform .12s ease, box-shadow .16s ease;
}
.fab::after {
  content: ""; position: absolute; left: 12%; right: 12%; top: 4px; height: 44%;
  border-radius: 999px 999px 60% 60% / 999px 999px 14px 14px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.06));
}
.fab:hover { box-shadow: var(--gloss-btn-rim), 0 12px 30px rgba(var(--brand-rgb), .5); }
.fab:active { transform: scale(.94); box-shadow: inset 0 2px 8px rgba(0,0,0,.3); }

/* --------------------------------------------------------- desktop rail */

.rail { display: none; }

@media (min-width: 1024px) {
  .app { flex-direction: row; gap: 22px; padding: 22px; align-items: flex-start; }
  .rail {
    display: flex; flex-direction: column; width: var(--rail); flex: none;
    position: sticky; top: 22px; max-height: calc(100vh - 44px);
    background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-md);
    overflow: hidden;
  }
  .rail .brand-row {
    display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px;
  }
  .rail .brand-row .logo {
    width: 40px; height: 40px; border-radius: var(--r-md); background: var(--brand);
    color: #fff; display: grid; place-items: center; font-size: 19px; flex: none;
  }
  .rail .brand-row b { display: block; font-size: 15px; line-height: 1.2; }
  .rail .brand-row span { font-size: 11.5px; color: var(--muted); }
  .rail nav { padding: 4px 12px 12px; overflow-y: auto; flex: 1; }
  .rail nav .group-label {
    font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--faint); padding: 12px 10px 6px;
  }
  .rail nav a {
    display: flex; align-items: center; gap: 11px; padding: 10px 12px;
    border-radius: var(--r-md); color: var(--text); font-size: 14px; font-weight: 550;
    margin-bottom: 2px;
  }
  .rail nav a .ico { width: 22px; text-align: center; font-size: 16px; }
  .rail nav a:hover { background: var(--surface-2); }
  .rail nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
  .rail nav a .count {
    margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px;
    border-radius: var(--r-pill); background: var(--warn); color: #fff;
  }
  .rail .rail-foot { border-top: 1px solid var(--border); padding: 12px; }

  .main { flex: 1; min-width: 0; }
  .topbar {
    background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow);
    padding: 14px 18px; margin-bottom: 18px; top: 22px;
  }
  .topbar .menu-btn { display: none; }
  .content { padding: 0 0 40px; max-width: 1180px; }
  .tabbar { display: none; }
  .fab { right: 34px; bottom: 34px; }
  .grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 700px) and (max-width: 1023px) {
  .content { max-width: 860px; }
  .grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================================================================ cards */

.card {
  position: relative; isolation: isolate;
  background-color: var(--surface);
  background-image: var(--gloss-wash);
  background-repeat: no-repeat; background-size: 100% 130px;
  border-radius: var(--r-xl);
  border: var(--card-hairline);
  box-shadow: var(--shadow), var(--gloss-rim); overflow: hidden;
}
/* The sheen sits behind the content and is never interactive. */
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit; background: var(--gloss-sheen);
}
.card > header {
  padding: 16px 18px 10px; display: flex; align-items: center; gap: 10px;
}
.card > header h3 { font-size: 15.5px; }
.card > header .spacer { flex: 1; }
.card .body { padding: 6px 18px 18px; }
.card .body.tight { padding: 0; }
.card > header + .body.tight { padding-top: 0; }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sep { height: 1px; background: var(--border); margin: 14px 0; }

/* =========================================================== stat tiles */

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  position: relative; isolation: isolate;
  background-color: var(--surface);
  background-image: var(--gloss-wash);
  background-repeat: no-repeat; background-size: 100% 70px;
  border-radius: var(--r-lg); padding: 15px 16px;
  border: var(--card-hairline);
  box-shadow: var(--shadow), var(--gloss-rim); min-width: 0; overflow: hidden;
  transition: transform .12s ease, box-shadow .16s ease;
}
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-md), var(--gloss-rim); }
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit; background: var(--gloss-sheen);
}
.tile .k {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); line-height: 1.4;
}
.tile .v {
  font-size: 25px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15;
  margin-top: 5px; overflow-wrap: anywhere;
}
.tile .d { font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.tile.ok .v { color: var(--ok); }
.tile.warn .v { color: var(--warn); }
.tile.bad .v { color: var(--danger); }
.tile.brand .v { color: var(--brand); }

/* Big coloured summary blocks, as in the reference "Task Summary". */
.summary-row { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.summary-block {
  border-radius: var(--r-lg); padding: 14px; position: relative; min-height: 96px;
  color: var(--sb-ink, var(--text));
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--sb-rim, transparent);
  transition: transform .12s ease, box-shadow .16s ease;
}
/* Curved specular highlight across the top — the classic "glossy button" arc. */
.summary-block::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 3px; height: 46%;
  pointer-events: none;
  border-radius: 18px 18px 60% 60% / 18px 18px 26px 26px;
  background: linear-gradient(180deg, var(--sb-sheen), var(--sb-sheen-2));
  opacity: var(--gloss-highlight, 1);
}
.summary-block:hover { transform: translateY(-2px); }
.summary-block > * { position: relative; z-index: 1; }
.summary-block b { font-size: 13px; font-weight: 600; opacity: .85; }
.summary-block .n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.summary-block .corner {
  position: absolute; right: 12px; bottom: 12px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--sb-corner); display: grid; place-items: center;
  font-size: 13px; box-shadow: inset 0 0 0 1px var(--sb-rim, transparent);
}
/* Each tile names its own ink and rim; the fill comes from the gradient level. */
.sb-amber { --sb-ink: var(--ink-amber); --sb-rim: var(--rim-amber);
            background: var(--grad-amber);
            box-shadow: inset 0 0 0 1px var(--sb-rim), var(--grad-shadow); }
.sb-blue  { --sb-ink: var(--ink-blue);  --sb-rim: var(--rim-blue);
            background: var(--grad-blue);
            box-shadow: inset 0 0 0 1px var(--sb-rim), var(--grad-shadow); }
.sb-teal  { --sb-ink: var(--ink-teal);  --sb-rim: var(--rim-teal);
            background: var(--grad-teal);
            box-shadow: inset 0 0 0 1px var(--sb-rim), var(--grad-shadow); }

/* =============================================================== controls */

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--r-pill); border: 1px solid var(--border-2);
  background-color: var(--surface);
  background-image: var(--gloss-wash);
  color: var(--text); font: inherit; font-size: 13.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px;
  box-shadow: var(--gloss-rim), 0 1px 2px rgba(16,44,40,.06);
  transition: background-color .14s, border-color .14s, transform .1s, box-shadow .16s;
}
/* Specular highlight sitting in the top half, with a gently curved bottom edge
   — that curve is what makes a surface read as glossy rather than merely
   gradient-filled. */
.btn::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 46%;
  pointer-events: none;
  border-radius: 999px 999px 70% 70% / 999px 999px 16px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(255,255,255,.14) 100%);
}
.btn:hover { background-color: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: inset 0 2px 5px rgba(16,44,40,.14); }
.btn:active::after { opacity: .45; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn:disabled::after { display: none; }

.btn.primary {
  border-color: transparent; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.22);
  background-image: var(--grad-brand);
  box-shadow: var(--gloss-btn-rim), 0 5px 14px rgba(var(--brand-rgb), .34);
}
.btn.primary::after { background: linear-gradient(180deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.05) 100%); }
.btn.primary:hover {
  background-image: var(--grad-brand);
  box-shadow: var(--gloss-btn-rim), 0 7px 18px rgba(var(--brand-rgb), .4);
}
.btn.primary:active { box-shadow: inset 0 2px 6px rgba(0,0,0,.3); }

.btn.danger {
  border-color: transparent; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.22);
  background-image: linear-gradient(180deg, #f0796e 0%, var(--danger) 46%, #b8342a 100%);
  box-shadow: var(--gloss-btn-rim), 0 5px 14px rgba(224, 72, 60, .32);
}
.btn.danger::after { background: linear-gradient(180deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.05) 100%); }
.btn.danger:active { box-shadow: inset 0 2px 6px rgba(0,0,0,.3); }

.btn.ghost {
  border-color: transparent; background-color: transparent; background-image: none;
  box-shadow: none;
}
.btn.ghost::after { display: none; }
.btn.ghost:hover { background-color: var(--surface-2); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; min-height: 32px; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 22px; font-size: 15px; min-height: 52px; }

input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-2);
  border-radius: var(--r-md); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 15px; /* 15px+ stops iOS zooming on focus */
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236f8380' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--muted); margin-bottom: 6px;
}
label.field small { font-weight: 500; color: var(--faint); }
.row { display: grid; gap: 12px; grid-template-columns: 1fr; }
.row-3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: repeat(3, 1fr); }
}
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.switch-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .txt { flex: 1; min-width: 0; }
.switch-row .txt b { display: block; font-size: 14px; font-weight: 600; }
.switch-row .txt span { font-size: 12px; color: var(--muted); }

/* ================================================================ tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); padding: 10px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:active, tbody tr.clickable:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tno { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--brand); }

/* Stacked list rows — the mobile-native alternative to a table. */
.list-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:active { background: var(--surface-2); }
.list-row .lead { flex: none; }
.list-row .mid { flex: 1; min-width: 0; }
.list-row .mid b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.list-row .mid .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row .tail { flex: none; text-align: right; display: grid; gap: 5px; justify-items: end; }

/* ================================================================ badges */

.badge {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  white-space: nowrap; border: 1px solid transparent; letter-spacing: .01em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.badge::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 55%;
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0));
  pointer-events: none;
}
[data-theme="dark"] .badge { box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
[data-theme="dark"] .badge::after { opacity: .18; }
/* Solid badges keep their strong colour — they are small, and the definitive
   fill for each is set further down with the rest of the badge palette. */
.b-solid-amber, .b-solid-teal { box-shadow: var(--gloss-btn-rim); }
.b-solid-teal  { background-image: var(--grad-brand); }
.b-open      { background: var(--brand-soft); color: var(--brand); }
.b-progress  { background: var(--accent-soft); color: var(--brand-dk); }
.b-hold      { background: var(--warn-soft); color: var(--warn); }
.b-resolved  { background: var(--ok-soft); color: var(--ok); }
.b-closed    { background: var(--surface-3); color: var(--muted); }
.b-reopened  { background: var(--violet-soft); color: var(--violet); }
.b-cancelled { background: var(--surface-3); color: var(--faint); }
.b-low       { background: var(--surface-3); color: var(--muted); }
.b-medium    { background: var(--accent-soft); color: var(--brand-dk); }
.b-high      { background: var(--warn-soft); color: var(--warn); }
.b-critical  { background: var(--danger-soft); color: var(--danger); }
.b-esc1      { background: var(--warn-soft); color: var(--warn); }
.b-esc2      { background: var(--danger-soft); color: var(--danger); }
.b-role      { background: var(--surface-3); color: var(--muted); }
.b-ok        { background: var(--ok-soft); color: var(--ok); }
.b-bad       { background: var(--danger-soft); color: var(--danger); }
.b-pending   { background: var(--warn-soft); color: var(--warn); }
.b-approved  { background: var(--ok-soft); color: var(--ok); }
.b-rejected  { background: var(--danger-soft); color: var(--danger); }
.b-solid-amber { background: var(--warn); color: #fff; }
.b-solid-teal  { background: var(--brand); color: #fff; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono  { font-family: var(--mono); font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; font-weight: 700;
  font-size: 13px; flex: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 84px; height: 84px; font-size: 26px; }
.avatar.a1 { background: #fde3c8; color: #b45f06; }
.avatar.a2 { background: #d9e6ff; color: #2657f0; }
.avatar.a3 { background: #ffe0dd; color: #c33a2e; }
.avatar.a4 { background: #ddf3e6; color: #0f9d76; }
.avatar.a5 { background: #e9e2ff; color: #6b46e5; }

/* ========================================================= ticket detail */

.detail { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .detail { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }

.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.msg .bubble {
  flex: 1; background: var(--surface-2); border-radius: var(--r-lg);
  border-top-left-radius: 6px; padding: 12px 14px; min-width: 0;
}
.msg.internal .bubble { background: var(--warn-soft); }
.msg .bubble .head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 5px; flex-wrap: wrap; }
.msg .bubble .head b { font-size: 13.5px; }
.msg .bubble .head span { font-size: 11.5px; color: var(--faint); }
.msg .bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); margin-top: 7px; flex: none; }
.timeline .dot.b { background: var(--brand); }
.timeline .dot.r { background: var(--danger); }
.timeline .dot.g { background: var(--ok); }

.kv { display: grid; grid-template-columns: 112px 1fr; gap: 9px 12px; font-size: 14px; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.sla-bar { height: 7px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.sla-bar > i { display: block; height: 100%; background: var(--ok); border-radius: var(--r-pill); }
.sla-bar.warn > i { background: var(--warn); }
.sla-bar.bad > i { background: var(--danger); }

.stars { display: inline-flex; gap: 2px; font-size: 15px; color: #f0a92c; letter-spacing: 1px; }
.star-pick { font-size: 32px; cursor: pointer; color: var(--border-2); background: none; border: 0; padding: 0 3px; line-height: 1; }
.star-pick.on { color: #f0a92c; }

.composer {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border-radius: var(--r-pill); padding: 6px 6px 6px 16px;
}
.composer input, .composer textarea {
  border: 0; background: transparent; padding: 8px 0; min-height: 0;
}
.composer input:focus, .composer textarea:focus { box-shadow: none; background: transparent; }
.composer .send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent);
  color: #fff; font-size: 17px; display: grid; place-items: center; cursor: pointer; flex: none;
}

/* ================================================================ charts */

.chart { width: 100%; overflow: visible; }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .b-row { display: grid; grid-template-columns: 104px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
@media (min-width: 560px) { .bars .b-row { grid-template-columns: 160px 1fr 58px; } }
.bars .track { background: var(--surface-3); border-radius: var(--r-pill); height: 22px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: var(--r-pill); background: var(--accent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }

/* =========================================================== auth pages */

.auth-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 18px calc(28px + var(--safe-b));
  background: radial-gradient(120% 80% at 50% 0%, var(--surface-2) 0%, var(--bg) 55%, var(--bg-2) 100%);
}
[data-theme="dark"] .auth-page { background: radial-gradient(120% 80% at 50% 0%, var(--surface) 0%, var(--bg) 60%); }
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 28px 24px;
}
.auth-card .logo-lg {
  width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 25px; margin: 0 auto 18px;
}
.auth-card h2 { font-size: 23px; text-align: center; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin: 6px 0 22px; text-align: center; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.demo-hint {
  margin-top: 20px; padding: 14px 16px; background: var(--surface-2);
  border-radius: var(--r-md); font-size: 12.5px; color: var(--muted); line-height: 1.9;
}
.demo-hint b { color: var(--text); }
.demo-hint code { font-family: var(--mono); font-size: 11.5px; }

/* ------------------------------------------------------ signup wizard */

.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.steps .step { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--border-2); }
.steps .step.done { background: var(--accent); }
.steps .step.now { background: var(--brand); }
.step-label { font-size: 12px; font-weight: 650; color: var(--brand); letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 6px; }

.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.pick {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%;
  border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; text-align: left; font: inherit;
}
.pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.pick.on { border-color: var(--brand); background: var(--brand-soft); }
.pick .mid { flex: 1; min-width: 0; }
.pick .mid b { display: block; font-size: 14.5px; font-weight: 600; }
.pick .mid span { font-size: 12px; color: var(--muted); }

.selfie-frame {
  width: 190px; height: 190px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--surface-2); border: 3px dashed var(--border-2);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.selfie-frame.filled { border-style: solid; border-color: var(--brand); }
.selfie-frame img, .selfie-frame video { width: 100%; height: 100%; object-fit: cover; }
.selfie-frame .hint { text-align: center; color: var(--faint); font-size: 12.5px; padding: 0 20px; }

.result-icon {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; font-size: 34px;
}
.result-icon.ok { background: var(--ok-soft); color: var(--ok); }
.result-icon.pending { background: var(--warn-soft); color: var(--warn); }
.ref-box {
  background: var(--surface-2); border-radius: var(--r-md); padding: 14px;
  text-align: center; margin: 16px 0;
}
.ref-box .ref { font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: .05em; }

/* ================================================================ modal */

.modal-back {
  position: fixed; inset: 0; background: rgba(10, 30, 27, .5);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal-back { align-items: center; padding: 24px; } }
.modal {
  background: var(--surface); width: 100%; max-width: 620px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: sheet-up .22s cubic-bezier(.2,.8,.3,1);
  padding-bottom: var(--safe-b);
}
@media (min-width: 700px) {
  .modal { border-radius: var(--r-xl); max-height: 88vh; animation: pop .18s ease-out; padding-bottom: 0; }
  .modal.wide { max-width: 820px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal .grabber {
  width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--border-2);
  margin: 10px auto 0;
}
@media (min-width: 700px) { .modal .grabber { display: none; } }
.modal > header { padding: 14px 20px; display: flex; align-items: center; gap: 10px; }
.modal > header h3 { font-size: 16.5px; flex: 1; }
.modal > .body { padding: 4px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal > footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal > footer .btn { flex: 1; }
@media (min-width: 700px) { .modal > footer .btn { flex: 0 0 auto; } }

/* Bottom "More" sheet used for secondary navigation on phones. */
.sheet-list { display: flex; flex-direction: column; }
.sheet-list a, .sheet-list button {
  display: flex; align-items: center; gap: 14px; padding: 15px 4px;
  border: 0; border-bottom: 1px solid var(--border); background: none;
  font: inherit; font-size: 15px; color: var(--text); cursor: pointer; text-align: left; width: 100%;
}
.sheet-list a:last-child, .sheet-list button:last-child { border-bottom: 0; }
.sheet-list .ico {
  width: 40px; height: 40px; border-radius: var(--r-md); background: var(--surface-2);
  display: grid; place-items: center; font-size: 17px; flex: none;
}
.sheet-list .count {
  margin-left: auto; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: var(--r-pill); padding: 2px 8px;
}

/* ==================================================== auth: brand layout */

.auth-page.split { padding: 0; display: block; }
.auth-page.split .auth-card {
  margin: 0 auto; max-width: 440px;
}
@media (min-width: 900px) {
  .auth-page.split {
    display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; align-items: stretch;
  }
  .auth-page.split .auth-card {
    margin: auto; max-width: 460px; width: 100%;
  }
  .auth-page.split > .auth-card { grid-column: 2; }
  .auth-brand { display: flex !important; }
  .auth-brand-sm { display: none; }
}

.auth-brand {
  display: none; align-items: center; justify-content: center;
  padding: 48px; color: #fff; position: relative; overflow: hidden;
  background: var(--grad-brand);
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 60% at 20% 0%, rgba(255,255,255,.22), rgba(255,255,255,0) 60%);
  opacity: var(--gloss-highlight, 1);
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 420px; }
.auth-brand h1 { font-size: 38px; letter-spacing: -.03em; margin-bottom: 10px; }
.auth-brand > .auth-brand-inner > p { font-size: 17px; opacity: .88; margin: 0 0 34px; }
.brand-mark {
  width: 60px; height: 60px; border-radius: var(--r-lg); margin-bottom: 24px;
  background: rgba(255,255,255,.2); display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.brand-points li { display: flex; gap: 14px; align-items: flex-start; }
.brand-points .pt-icon {
  width: 36px; height: 36px; border-radius: var(--r-md); flex: none;
  background: rgba(255,255,255,.18); display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
}
.brand-points b { display: block; font-size: 15px; margin-bottom: 2px; }
.brand-points span { font-size: 13.5px; opacity: .82; line-height: 1.5; }

.auth-brand-sm { text-align: center; }
.auth-brand-sm .logo-lg { margin: 0 auto 18px; }

/* Password field with a reveal button. */
.input-affix { position: relative; }
.input-affix input { padding-right: 46px; }
.reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: none; border-radius: 50%;
  color: var(--faint); cursor: pointer; display: grid; place-items: center;
}
.reveal:hover { background: var(--surface-3); color: var(--muted); }
.reveal.on { color: var(--brand); }

.signup-cta {
  display: flex; align-items: center; gap: 12px; margin-top: 20px;
  padding: 14px; border-radius: var(--r-md); background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
[data-theme="dark"] .signup-cta { box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.signup-cta b { display: block; font-size: 14px; }
.signup-cta span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.signup-icon {
  width: 40px; height: 40px; border-radius: var(--r-md); flex: none;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
}

/* Account menu header. */
.account-head {
  display: flex; align-items: center; gap: 14px; padding: 4px 0 16px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.account-head b { display: block; font-size: 16px; }
.account-head span { display: block; font-size: 12.5px; color: var(--muted); }
.sheet-list .danger-row { color: var(--danger); }
.sheet-list .danger-row .ico { background: var(--danger-soft); color: var(--danger); }

/* ========================================================= theme pickers */

.swatch-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.swatch {
  border: 2px solid var(--border-2); background: var(--surface); border-radius: var(--r-md);
  padding: 8px; cursor: pointer; font: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 7px; align-items: stretch;
  transition: border-color .14s, transform .1s;
}
.swatch:active { transform: scale(.97); }
.swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.chip-preview {
  height: 42px; border-radius: var(--r-sm); display: grid; place-items: end center;
  padding-bottom: 6px;
  /* A hairline, not just a highlight — white and off-white swatches would
     otherwise vanish into the card behind them. */
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 0 0 1px rgba(16,24,26,.12);
}
.chip-preview i {
  display: block; width: 62%; height: 14px; border-radius: 4px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(16,24,26,.08);
}
.swatch-name { font-size: 12px; font-weight: 600; text-align: center; }

.accent-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
}
.accent-dot {
  border: 2px solid transparent; background: none; cursor: pointer; font: inherit;
  color: var(--muted); border-radius: var(--r-md); padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.accent-dot .dot {
  width: 34px; height: 34px; border-radius: 50%; background: var(--dot);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), var(--shadow);
}
.accent-dot.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.accent-dot.on .dot { box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 0 0 3px var(--surface), 0 0 0 5px var(--dot); }
.accent-name { font-size: 11px; font-weight: 600; }

.field-label {
  font-size: 12.5px; font-weight: 650; color: var(--muted); margin-bottom: 8px;
}

.theme-preview {
  background: var(--bg); border-radius: var(--r-lg); padding: 14px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.05);
}

/* Switch control used by appearance and feature settings. */
.toggle {
  width: 50px; height: 30px; border-radius: var(--r-pill); border: 0; flex: none;
  background: var(--border-2); cursor: pointer; padding: 3px; position: relative;
  transition: background .18s ease;
}
.toggle .knob {
  display: block; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s cubic-bezier(.3,1.4,.5,1);
}
.toggle.on { background: var(--brand); }
.toggle.on .knob { transform: translateX(20px); }

/* ============================================================== version */

.version-chip {
  display: block; margin-top: 10px; text-align: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2);
  border-radius: var(--r-pill); padding: 6px 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.version-chip:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
[data-theme="dark"] .version-chip { box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }

.version-line {
  display: block; margin-top: 14px; padding: 13px 15px; border-radius: var(--r-md);
  background: var(--surface-2); text-align: center; color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.version-line:hover { text-decoration: none; background: var(--brand-soft); }
.version-line b { display: block; font-size: 14px; }
.version-line span { font-size: 12px; color: var(--muted); }
[data-theme="dark"] .version-line { box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }

.build-stamp {
  text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--faint);
}
.build-stamp a { color: var(--faint); }

/* Marks release notes this browser has not read yet. */
.new-pill {
  display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--warn); color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  vertical-align: 1px;
}
.version-line.fresh { background: var(--warn-soft); }
.version-chip .new-pill { margin-left: 5px; }

/* =============================================================== toasts */

.toasts {
  position: fixed; z-index: 200; left: 12px; right: 12px;
  bottom: calc(var(--tabbar) + 22px + var(--safe-b));
  display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none;
}
@media (min-width: 1024px) { .toasts { left: auto; right: 24px; bottom: 24px; align-items: flex-end; } }
.toast {
  background: #12332f; color: #f2fbf9; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 13px 17px; font-size: 13.5px;
  max-width: 460px; animation: slide-in .2s ease-out; pointer-events: auto;
}
.toast.error { background: #8e2b22; }
.toast.ok { background: #0c6b52; }
@keyframes slide-in { from { opacity: 0; transform: translateY(10px); } }

/* ================================================================ misc */

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }

.filters {
  display: flex; gap: 9px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 16px; background: var(--surface-2); scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters select, .filters input {
  width: auto; min-width: 132px; font-size: 13px; padding: 8px 12px;
  min-height: 38px; border-radius: var(--r-pill); background: var(--surface);
}
.filters select { padding-right: 32px; }
.filters .check { white-space: nowrap; font-size: 13px; }
.filters > * { flex: none; }

.tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0 14px; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: var(--surface); padding: 9px 16px; border-radius: var(--r-pill);
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap; flex: none; box-shadow: var(--shadow);
}
.tabs button.on { background: var(--brand); color: #fff; }

.seg {
  display: flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 4px; gap: 4px;
}
.seg button {
  flex: 1; border: 0; background: none; padding: 9px 10px; border-radius: var(--r-pill);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

.notif-list { max-height: 60vh; overflow-y: auto; }
.notif { padding: 13px 20px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif:last-child { border-bottom: 0; }
.notif:active { background: var(--surface-2); }
.notif.unread { background: var(--brand-soft); }
.notif b { font-size: 14px; display: block; }
.notif span { font-size: 12.5px; color: var(--muted); }

.file-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  background: var(--surface-2); border-radius: var(--r-pill); font-size: 12.5px;
  margin: 4px 5px 0 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.cat-chip { cursor: pointer; gap: 7px; }
.cat-chip:hover { background: var(--brand-soft); }
.cat-chip.off { opacity: .55; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--r-pill); background: var(--surface-2); font-size: 13px;
  font-weight: 550; cursor: pointer; border: 1px solid transparent;
}
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

.banner {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px;
  border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5;
}
.banner.info { background: var(--brand-soft); color: #0a5b58; }
.banner.warn { background: var(--warn-soft); color: #8a5806; }
.banner.bad  { background: var(--danger-soft); color: #97281f; }
.banner.ok   { background: var(--ok-soft); color: #0a6b51; }
.banner .ico { font-size: 16px; line-height: 1.3; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-2);
  border-top-color: var(--brand); animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================== gloss extras */

/* Every remaining raised surface gets the same treatment, so the sheen reads
   as one lighting model rather than a per-component effect. */
.rail, .modal, .auth-card, .toast, .pop {
  background-image: var(--gloss-wash);
  background-repeat: no-repeat;
  background-size: 100% 180px;
}
.rail, .auth-card { box-shadow: var(--shadow-md), var(--gloss-rim); }
.modal { box-shadow: var(--shadow-lg), var(--gloss-rim); }
@media (min-width: 1024px) { .topbar { box-shadow: var(--shadow), var(--gloss-rim); background-image: var(--gloss-wash); background-repeat: no-repeat; background-size: 100% 100px; } }

.tabs button, .chip, .seg button.on {
  background-image: var(--gloss-wash);
  background-repeat: no-repeat; background-size: 100% 100%;
  box-shadow: var(--shadow), var(--gloss-rim);
}
.tabs button.on {
  position: relative; overflow: hidden; text-shadow: 0 1px 1px rgba(0,0,0,.2);
  background-image: var(--grad-brand);
  box-shadow: var(--gloss-btn-rim), 0 4px 12px rgba(var(--brand-rgb), .3);
}
.tabs button.on::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 46%;
  border-radius: 999px 999px 70% 70% / 999px 999px 14px 14px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,.05));
}
.chip.on {
  background-image: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.1));
}

.composer .send {
  background-image: var(--grad-accent);
  box-shadow: var(--gloss-btn-rim), 0 4px 12px rgba(var(--brand-rgb), .35);
  position: relative; overflow: hidden;
}
.composer .send::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, rgba(255,255,255,.48), rgba(255,255,255,0));
}
.composer .send:active { transform: scale(.94); box-shadow: inset 0 2px 6px rgba(0,0,0,.25); }

.avatar {
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 1px 2px rgba(16,44,40,.07);
}
.avatar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0) 58%);
}
[data-theme="dark"] .avatar { box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
[data-theme="dark"] .avatar::after { opacity: .16; }
[data-theme="dark"] .card, [data-theme="dark"] .tile { background-size: 100% 100%; }
[data-theme="dark"] .pick, [data-theme="dark"] .btn { background-size: 100% 100%; }

/* Filled progress runs get a lengthwise highlight, like coated glass. */
.bars .fill, .sla-bar > i {
  background-image: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.06) 55%, rgba(0,0,0,.06) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.bars .track, .sla-bar { box-shadow: inset 0 1px 3px rgba(16,44,40,.09); }
[data-theme="dark"] .bars .track, [data-theme="dark"] .sla-bar { box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }

.summary-block, .result-icon, .logo-lg, .rail .brand-row .logo {
  position: relative; overflow: hidden;
}
.logo-lg, .rail .brand-row .logo {
  background-image: var(--grad-brand);
  box-shadow: var(--gloss-btn-rim), 0 6px 16px rgba(var(--brand-rgb), .3);
}
.logo-lg::after, .rail .brand-row .logo::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0));
}
.result-icon::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 60%);
}

.ref-box, .banner, .demo-hint, .msg .bubble, .filters, .seg, .file-chip {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
[data-theme="dark"] .ref-box, [data-theme="dark"] .banner, [data-theme="dark"] .demo-hint,
[data-theme="dark"] .msg .bubble, [data-theme="dark"] .filters, [data-theme="dark"] .seg,
[data-theme="dark"] .file-chip { box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }

input, select, textarea { box-shadow: inset 0 1px 2px rgba(16,44,40,.05); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px var(--brand-soft), inset 0 1px 2px rgba(16,44,40,.05);
}

.pick { background-image: var(--gloss-wash); background-repeat: no-repeat; background-size: 100% 100%; }
.pick:hover, .pick.on { box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.9); }

/* =============================================================== print */

@media print {
  .rail, .topbar, .tabbar, .fab, .filters, .btn, .tabs, .toasts { display: none !important; }
  body { background: #fff; }
  .app { display: block; padding: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; background-image: none; }
  .card::before, .tile::before, .badge::after { display: none; }
  .print-head { display: block !important; margin-bottom: 18px; }
  th { background: #f1f1f1 !important; }
}
.print-head { display: none; }

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