/* SharyX application. Light by default; dark follows the device unless the person picks a theme
   (data-theme on <html>, set by app.js). Every colour comes from these tokens. */
:root {
  --bg: #f3f2f8;
  --panel: #ffffff;
  --panel-2: #f7f6fb;
  --text: #15131f;
  --muted: #8a8799;
  --line: #ecebf3;
  --grid: #efedf6;
  --accent: #7c5cfc;
  --accent-2: #a78bfa;
  --accent-soft: #efeafe;
  --accent-text: #ffffff;
  --series: #8b6cfd;
  --series-top: #8b6cfd;
  --series-fade: rgba(167, 139, 250, 0.08);
  --tab-active: #15131f;
  --tab-active-text: #ffffff;
  --ok: #138a4b;
  --ok-bg: #e2f6ea;
  --bad: #c2362c;
  --bad-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff3d9;
  --shadow: 0 1px 2px rgba(21, 19, 31, 0.04), 0 6px 18px rgba(21, 19, 31, 0.04);
  --side-bg: #ffffff;
  --nav-hover: #f4f2fa;
  --radius: 14px;
  --side: 224px;
  --side-collapsed: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d15;
    --panel: #18161f;
    --panel-2: #1f1d29;
    --text: #f2f0fa;
    --muted: #9a96ad;
    --line: #2a2736;
    --grid: #24212f;
    --accent: #8f73ff;
    --accent-2: #b39dff;
    --accent-soft: #2a2342;
    --accent-text: #ffffff;
    --series: #9c82ff;
    --series-top: #b39dff;
    --series-fade: rgba(143, 115, 255, 0.06);
    --tab-active: #f2f0fa;
    --tab-active-text: #15131f;
    --ok: #5fd39a;
    --ok-bg: #133325;
    --bad: #ff8f86;
    --bad-bg: #3a1a18;
    --warn: #f3cd77;
    --warn-bg: #362c14;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.22);
    --side-bg: #13121a;
    --nav-hover: #1f1d29;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0d15;
  --panel: #18161f;
  --panel-2: #1f1d29;
  --text: #f2f0fa;
  --muted: #9a96ad;
  --line: #2a2736;
  --grid: #24212f;
  --accent: #8f73ff;
  --accent-2: #b39dff;
  --accent-soft: #2a2342;
  --accent-text: #ffffff;
  --series: #9c82ff;
  --series-top: #b39dff;
  --series-fade: rgba(143, 115, 255, 0.06);
  --tab-active: #f2f0fa;
  --tab-active-text: #15131f;
  --ok: #5fd39a;
  --ok-bg: #133325;
  --bad: #ff8f86;
  --bad-bg: #3a1a18;
  --warn: #f3cd77;
  --warn-bg: #362c14;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.22);
  --side-bg: #13121a;
  --nav-hover: #1f1d29;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
h2 { margin: 0 0 10px; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
h3 { margin: 0 0 8px; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

/* brand */
.wordmark { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tagline { font-size: 10.5px; letter-spacing: 0.28em; color: var(--muted); margin-top: 2px; }

/* sign in */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.login-card { width: min(400px, 100%); background: var(--panel); border-radius: 20px; padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); animation: rise 0.45s var(--ease) both; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card p { margin: -6px 0 6px; }
.login-card p.error { margin: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card button.primary { padding: 10px 16px; }

/* shell: sidebar menu + content */
.shell { min-height: 100%; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); transition: grid-template-columns 0.25s var(--ease); }
.shell.collapsed { grid-template-columns: var(--side-collapsed) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 20;
  display: flex; flex-direction: column; gap: 6px; padding: 12px 10px;
  background: var(--side-bg); border-right: 1px solid var(--line); overflow: hidden;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px 8px; min-height: 42px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; min-width: 0; }
.brand img { display: block; flex: none; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.nav-group { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; white-space: nowrap; }
.nav-group:first-child { padding-top: 2px; }
.nav a, .side-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease);
}
.nav a svg, .side-item svg, .icon-btn svg {
  width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.nav a:hover, .side-item:hover { background: var(--nav-hover); color: var(--text); }
.nav a:active { transform: scale(0.98); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -4px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent);
  animation: grow-y 0.25s var(--ease) both;
}
.side-bottom { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-item { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; font-size: 13.5px; }
.user-item { padding: 6px 8px; }
.user-text { display: grid; min-width: 0; line-height: 1.25; }
.who-name { font-weight: 600; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px;
  background: linear-gradient(160deg, #1fa4ff, #6a17ff); color: #fff;
}
.user-menu { position: relative; }
.user-pop {
  position: absolute; left: 4px; bottom: calc(100% + 6px); min-width: 200px; z-index: 30;
  background: var(--panel); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); border: 1px solid var(--line);
  display: grid; gap: 2px; animation: pop 0.16s var(--ease) both; transform-origin: bottom left;
}
.pop-link { display: block; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); text-decoration: none; font-size: 13.5px; width: 100%; }
.pop-link:hover { background: var(--panel-2); }
.icon-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 10px; border: 0; flex: none;
  display: grid; place-items: center; background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
.icon-btn.ghost { background: none; box-shadow: none; color: var(--muted); }
.icon-btn:hover { color: var(--accent); background: var(--nav-hover); }
#collapse svg { transition: transform 0.25s var(--ease); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* collapsed menu: icons only */
.shell.collapsed .sidebar { padding: 12px 8px; }
.shell.collapsed .side-top { flex-direction: column; padding: 2px 0 8px; }
.shell.collapsed .brand .wordmark,
.shell.collapsed .nav a span,
.shell.collapsed .side-item > span:not(.avatar),
.shell.collapsed .theme-label { display: none; }
.shell.collapsed .nav-group { font-size: 0; padding: 8px 0 4px; }
.shell.collapsed .nav-group::after { content: ""; display: block; height: 1px; background: var(--line); margin: 0 10px; }
.shell.collapsed .nav a, .shell.collapsed .side-item { justify-content: center; padding: 8px 0; }
.shell.collapsed #collapse svg { transform: rotate(180deg); }

.content { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.scrim { position: fixed; inset: 0; z-index: 15; background: rgba(10, 8, 20, 0.4); backdrop-filter: blur(2px); animation: fade 0.2s both; }
main { padding: 14px 22px 32px; width: 100%; max-width: 1680px; margin: 0 auto; min-width: 0; outline: none; }

/* phones and small tablets: the menu slides in from the left */
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(270px, 84vw); height: auto;
    transform: translateX(-102%); transition: transform 0.28s var(--ease); box-shadow: var(--shadow);
  }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.collapsed .sidebar { padding: 12px 10px; }
  .shell.collapsed .side-top { flex-direction: row; }
  .shell.collapsed .brand .wordmark, .shell.collapsed .nav a span, .shell.collapsed .side-item > span:not(.avatar), .shell.collapsed .theme-label { display: initial; }
  .shell.collapsed .user-text { display: grid; }
  .shell.collapsed .nav-group { font-size: 10.5px; padding: 12px 10px 4px; }
  .shell.collapsed .nav-group::after { display: none; }
  .shell.collapsed .nav a, .shell.collapsed .side-item { justify-content: flex-start; padding: 7px 10px; }
  .only-desktop { display: none; }
  .mobilebar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
  }
  main { padding: 12px 16px 28px; }
  h2 { font-size: 19px; }
}

/* controls */
button, select, input { font: inherit; }
button {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  cursor: pointer; font-weight: 500; font-size: 13.5px;
  transition: border-color 0.15s, background 0.15s, filter 0.15s, transform 0.12s var(--ease), box-shadow 0.15s;
}
button:hover { border-color: var(--muted); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 28%, transparent);
}
button.primary:hover { filter: brightness(1.07); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 34%, transparent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; border-radius: 0; box-shadow: none; }
button.link:hover { text-decoration: underline; }
input, select, textarea {
  width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
select { width: auto; border-radius: 999px; padding: 6px 12px; }
.head input[type="month"], .head input[type="date"] { width: auto; border-radius: 999px; padding: 6px 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.error { color: var(--bad); margin: 0; }
.head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 2px 0 14px; }
.head h2 { margin: 0; }

/* cards */
.panel { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; min-width: 0; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.panel > .head { margin: 0 0 10px; }
.panel > .head h2 { font-size: 17px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile {
  background: var(--panel); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(21, 19, 31, 0.05), 0 10px 24px color-mix(in srgb, var(--accent) 10%, transparent); }
.panel .tile { background: var(--panel-2); box-shadow: none; border: 0; }
.panel .tile:hover { transform: none; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 23px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .note { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

/* chips */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-bg); }
.chip.bad { color: var(--bad); background: var(--bad-bg); }
.chip.warn { color: var(--warn); background: var(--warn-bg); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: 0; }
tbody td { transition: background 0.12s; }
td.wrap { white-space: normal; min-width: 220px; }
td.num, th.num { text-align: right; }
td select { padding: 4px 10px; font-size: 13px; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
tbody tr.clickable:hover td { background: var(--panel-2); }
tbody tr:hover td:first-child { border-radius: 10px 0 0 10px; }
tbody tr:hover td:last-child { border-radius: 0 10px 10px 0; }
.empty { color: var(--muted); padding: 20px 8px; text-align: center; }

/* bar chart: one series in the accent, fading towards the baseline; value on hover and in the table view */
.chart {
  position: relative; height: 190px; display: flex; align-items: flex-end; gap: 6px; padding: 8px 0 0;
  background:
    linear-gradient(to top, transparent calc(50% - 1px), var(--grid) calc(50% - 1px), var(--grid) 50%, transparent 50%),
    linear-gradient(to top, transparent calc(100% - 1px), var(--grid) calc(100% - 1px));
}
.bar-slot { flex: 1 1 0; min-width: 4px; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: min(100%, 56px); min-height: 2px; border-radius: 4px 4px 0 0;
  background: linear-gradient(to bottom, var(--series) 0%, color-mix(in srgb, var(--series) 45%, transparent) 55%, var(--series-fade) 100%);
  border-top: 2px solid var(--series-top); transform-origin: bottom;
  animation: grow-y 0.6s var(--ease) both;
}
.bar-slot:nth-child(n+4) .bar { animation-delay: 0.04s; }
.bar-slot:nth-child(n+8) .bar { animation-delay: 0.08s; }
.bar-slot:nth-child(n+12) .bar { animation-delay: 0.12s; }
.bar-slot:nth-child(n+16) .bar { animation-delay: 0.16s; }
.bar-slot:hover .bar, .bar-slot:focus-visible .bar { filter: brightness(1.12) saturate(1.1); }
.axis { display: flex; gap: 6px; margin-top: 6px; }
.axis span { flex: 1 1 0; min-width: 4px; text-align: center; font-size: 11.5px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.tip { position: fixed; z-index: 40; pointer-events: none; background: var(--tab-active); color: var(--tab-active-text); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow); animation: pop 0.12s var(--ease) both; }

/* line chart (single series) */
.line { width: 100%; height: 200px; display: block; color: var(--muted); }
.line .grid { stroke: var(--grid); stroke-width: 1; }
.line .area { fill: url(#sx-area); stroke: none; animation: fade 0.8s 0.2s both; }
.line .path { fill: none; stroke: var(--series); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 0.9s var(--ease) both; }
.line .dot { fill: var(--series); stroke: var(--panel); stroke-width: 2; animation: fade 0.3s 0.7s both; }
.line .hit { fill: transparent; }
.line .target { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.line .area-top { stop-color: var(--series); stop-opacity: 0.35; }
.line .area-bottom { stop-color: var(--series); stop-opacity: 0; }

/* call detail */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.turns { display: grid; gap: 10px; }
.turn { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.turn .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 4px; }
.bubble { padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--panel-2); max-width: 760px; }
.turn.agent .bubble { background: var(--accent-soft); border-radius: 14px 14px 4px 14px; }
.who-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); display: block; }
pre.prompt { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel-2); border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12px; max-height: 360px; overflow: auto; margin: 8px 0 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details[open] > :not(summary) { animation: rise 0.25s var(--ease) both; }
.meter { height: 7px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; transform-origin: left; animation: grow-x 0.7s var(--ease) both; }
audio { width: 100%; }

/* forms */
.form { display: grid; gap: 12px; max-width: 880px; }
.form label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 640px) { .form .row2 { grid-template-columns: 1fr; } }
textarea { font: inherit; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.form select { width: 100%; border-radius: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 13.5px; }
.checks input { width: auto; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice { padding: 9px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); margin-bottom: 12px; animation: rise 0.3s var(--ease) both; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.hint { font-size: 12px; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
label.inline input { width: auto; }

/* reports: outcome summary beside the calls */
.filters { display: grid; gap: 8px; margin-bottom: 14px; }
.filters select { max-width: 260px; }
.outcome-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .outcome-grid { grid-template-columns: 1fr; } }
.tile-mini { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); margin-bottom: 8px; }
.tile-mini .label { font-size: 12px; color: var(--muted); }
.tile-mini .value { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.outcome-list { display: grid; gap: 2px; margin-bottom: 6px; }
.outcome-row {
  display: grid; grid-template-columns: minmax(0, 132px) 1fr 44px 46px; align-items: center; gap: 8px;
  width: 100%; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; background: none; text-align: left; font-weight: 400;
}
.outcome-row .chip { overflow: hidden; text-overflow: ellipsis; justify-self: start; max-width: 100%; }
.outcome-row .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.outcome-row:hover { background: var(--panel-2); border-color: transparent; }
.outcome-row.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.outcome-row.none { opacity: 0.55; }
.outcome-calls { min-width: 0; display: grid; gap: 6px; }
.outcome-calls td.wrap { min-width: 140px; }
.order { display: inline-flex; gap: 2px; }
.icon-mini { width: 24px; height: 24px; padding: 0; border-radius: 7px; font-size: 13px; line-height: 1; }
a.btn {
  display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  text-decoration: none; font-weight: 500; font-size: 13.5px; transition: border-color 0.15s, transform 0.12s var(--ease);
}
a.btn:hover { border-color: var(--muted); }
a.btn:active { transform: scale(0.97); }
.print-only { display: none; }
.param-rows { display: grid; gap: 6px; }
.param-row { display: grid; grid-template-columns: minmax(120px, 1fr) 100px minmax(180px, 2.5fr) auto auto; gap: 6px; align-items: center; }
.param-row select { width: 100%; border-radius: 10px; }
@media (max-width: 760px) { .param-row { grid-template-columns: 1fr 1fr; } }
.tool-test { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--panel-2); }
.tool-test label.inline input { width: 260px; }
.kb-entry { padding: 10px 14px; margin-bottom: 8px; }
.kb-entry.off { opacity: 0.6; }
.kb-title { border: 0; background: none; padding: 4px 0; text-align: left; font-weight: 400; flex: 1; min-width: 0; border-radius: 6px; }
.kb-title:hover { border: 0; color: var(--accent); }
.group-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.group-total { display: grid; gap: 1px; padding: 7px 9px; border-radius: 10px; background: var(--panel-2); font-size: 11.5px; border-top: 3px solid var(--line); }
.group-total strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.group-total.tone-good { border-top-color: var(--ok); }
.group-total.tone-warn { border-top-color: var(--warn); }
.group-total.tone-bad { border-top-color: var(--bad); }
.field { display: grid; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--muted); }
.outcome-picker { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); }
.outcome-checks label { cursor: pointer; }
.outcome-add { display: grid; grid-template-columns: minmax(140px, 1fr) 130px minmax(180px, 2fr) auto; gap: 6px; align-items: center; }
.outcome-add .error { grid-column: 1 / -1; }
.outcome-add select { width: 100%; border-radius: 10px; }
@media (max-width: 760px) { .outcome-add { grid-template-columns: 1fr; } }

/* loading: shimmering placeholders in the page's shape */
.skeleton { display: grid; gap: 14px; }
.sk-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.sk {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%) 0 0 / 300% 100%;
  animation: shimmer 1.2s linear infinite; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.sk-title { height: 26px; width: 180px; border-radius: 8px; }
.sk-tile { height: 74px; }
.sk-panel { height: 280px; }

/* a page rises in once when opened (see route() in app.js) */
main.enter > * { animation: rise 0.38s var(--ease) both; }
main.enter > :nth-child(2) { animation-delay: 0.04s; }
main.enter > :nth-child(3) { animation-delay: 0.08s; }
main.enter > :nth-child(4) { animation-delay: 0.12s; }
main.enter > :nth-child(n+5) { animation-delay: 0.16s; }
main.enter .tiles > .tile { animation: rise 0.4s var(--ease) both; }
main.enter .tiles > .tile:nth-child(2) { animation-delay: 0.05s; }
main.enter .tiles > .tile:nth-child(3) { animation-delay: 0.1s; }
main.enter .tiles > .tile:nth-child(n+4) { animation-delay: 0.15s; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* printing a statement: content only */
@media print {
  .sidebar, .mobilebar, .scrim, .noprint, #tip { display: none !important; }
  .print-only { display: block; }
  .outcome-grid { grid-template-columns: 1fr; }
  .outcome-row { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  th, td { white-space: normal; padding: 4px 6px; font-size: 11px; }
  .meter > i { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .chip { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  main { padding: 0; }
  main.enter > * { animation: none; }
  .panel, .tile { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
}
