/* Blya Panel: one stylesheet, no build step, no external fonts. Dark only.
   Layout: phone first (bottom tab bar), sidebar from 900px.
   Palette: navy-tinted neutrals and one muted blue accent, used sparingly (logo, current tab, unread count,
   links, focus, chart). Status colours are muted and kept apart from the accent. */

:root {
  color-scheme: dark;

  --bg: #0d0f13;
  --surface: #14171d;
  --surface-2: #1a1e26;
  --surface-3: #232833;
  --line: #242933;
  --line-2: #323945;
  --log-bg: #0a0c10;

  --text: #e8eaef;
  --text-2: #a8afbc;
  --text-3: #707886;

  --accent: #8fb0ff;
  --accent-hover: #a5c0ff;
  --accent-ink: #0c1222;
  --accent-soft: rgba(143, 176, 255, 0.13);
  /* Chart marks: the accent's hue, one step deeper so a whole series sits in the dark-mode lightness band
     (dataviz validator: L 0.48-0.67, chroma >= 0.1, >= 3:1 on --surface). Hover lifts a bar to the accent. */
  --chart: #6b8de0;

  --ok: #56c993;
  --ok-soft: rgba(86, 201, 147, 0.12);
  --warn: #e9ad4f;
  --warn-soft: rgba(233, 173, 79, 0.12);
  --danger: #f07070;
  --danger-soft: rgba(240, 112, 112, 0.12);
  --muted: #8d95a3;
  --muted-soft: rgba(141, 149, 163, 0.12);

  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", "Roboto Mono", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;

  --bar-h: 56px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --side-w: 240px;
}

/* ---- Base ---------------------------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--accent); text-decoration: none; }

a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm { width: 16px; height: 16px; }

.num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
}

.skip:focus { top: 12px; }

/* ---- App shell ----------------------------------------------------------------------------------------------- */

.app { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--bar-h);
  padding: 0 8px 0 16px;
  background: rgba(13, 15, 19, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px; }

.brand:hover { text-decoration: none; }

.brand-mark { width: 26px; height: 26px; flex: none; }

/* "Blya" bold, "Panel" muted. */
.brand-name { letter-spacing: -0.01em; }

.brand-name b { font-weight: 680; }

.brand-name span { color: var(--text-3); font-weight: 500; }

.appbar .brand { margin-right: auto; }

/* Where space is tight, just "Blya". */
@media (max-width: 359px) { .appbar .brand-name span { display: none; } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Navigation: a bottom tab bar on phones, a sidebar on wide screens. */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: var(--safe-b);
  background: rgba(17, 19, 24, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.nav .brand, .nav-foot { display: none; }

.nav-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--nav-h);
  margin: 0;
  padding: 0 2px;
  list-style: none;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav-item:hover { text-decoration: none; color: var(--text-2); }

.nav-item .icon { width: 22px; height: 22px; }

.nav-item[aria-current="page"], .nav-item.is-current { color: var(--text); }

.nav-item[aria-current="page"] .icon, .nav-item.is-current .icon { color: var(--accent); }

/* Phones: four tabs and «Ещё»; the desktop sidebar shows every section instead of «Ещё». */
.nav-wide { display: none; }

.nav-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.more-list { margin: 4px 0 14px; padding: 0; list-style: none; }

.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 0 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  font-size: 16px;
  text-align: left;
  text-decoration: none;
}

.more-item:hover { text-decoration: none; color: var(--text); }

.more-item .icon { color: var(--text-3); }

.more-item[aria-current="page"] .icon { color: var(--accent); }

.more-list li:last-child .more-item { border-bottom: 0; color: var(--text-2); }

.nav-item.is-soon { opacity: 0.5; }

.nav-item.is-soon[aria-current="page"] { opacity: 1; }

.nav-soon {
  display: none;
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.content { width: 100%; max-width: 1040px; margin: 0 auto; padding: 18px 16px 28px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 14px;
}

.page-head h1 { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; line-height: 1.2; }

.page-meta { color: var(--text-3); font-size: 13px; text-align: right; }

@media (min-width: 900px) {
  .app { padding-bottom: 0; padding-left: var(--side-w); }

  .appbar { display: none; }

  .nav {
    top: 0;
    right: auto;
    width: var(--side-w);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 18px;
    background: #101217;
    border-top: 0;
    border-right: 1px solid var(--line);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav .brand { display: flex; padding: 0 10px 26px; }

  .nav-list { display: flex; flex-direction: column; gap: 2px; height: auto; padding: 0; }

  .nav-wide { display: list-item; }

  .nav-more { display: none; }

  .nav-badge { position: static; margin-left: auto; }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14.5px;
    letter-spacing: 0;
    color: var(--text-2);
  }

  .nav-item .icon { width: 20px; height: 20px; }

  .nav-item:hover { background: var(--surface-2); color: var(--text); }

  .nav-item[aria-current="page"] { background: var(--surface-2); color: var(--text); }

  .nav-item.is-soon { opacity: 0.55; }

  .nav-soon { display: inline-block; }

  .nav-foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .nav-foot .nav-item { color: var(--text-3); }

  .nav-note { padding: 6px 12px 0; color: var(--text-3); font-size: 12px; line-height: 1.45; }

  .content { padding: 34px 40px 48px; }

  .page-head { margin-bottom: 20px; }

  .page-head h1 { font-size: 28px; }
}

/* ---- Components ---------------------------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card-title {
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }

.card-head .card-title { margin: 0; }

/* A card whose data isn't available yet: no fill, dashed edge, dimmer text. It stays in place but steps back. */
.card.is-quiet { background: transparent; border-style: dashed; border-color: var(--line-2); }

/* Tone variables, used by chips, status dots, notices and the hero. */
.tone-ok { --c: var(--ok); --c-soft: var(--ok-soft); }
.tone-warn { --c: var(--warn); --c-soft: var(--warn-soft); }
.tone-danger { --c: var(--danger); --c-soft: var(--danger-soft); }
.tone-muted { --c: var(--muted); --c-soft: var(--muted-soft); }
.tone-accent { --c: var(--accent); --c-soft: var(--accent-soft); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: var(--c-soft, var(--muted-soft));
  color: var(--c, var(--muted));
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
}

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }

.is-busy .dot {
  width: 11px;
  height: 11px;
  background: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.is-live .dot { animation: pulse 2.4s ease-in-out infinite; }

.hero.tone-muted .chip:not([class*="tone-"]) .dot, .chip.tone-muted:not(.is-busy) .dot, .status.tone-muted .dot {
  background: none;
  border: 2px solid currentColor;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

.status { display: inline-flex; align-items: center; gap: 8px; color: var(--c, var(--text)); font-weight: 600; }

.status .dot { width: 7px; height: 7px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15.5px;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
  touch-action: manipulation;
}

.btn:hover { background: var(--surface-3); text-decoration: none; }

.btn:active { transform: translateY(1px); }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn .icon { width: 18px; height: 18px; }

.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }

.btn-primary:hover { background: var(--accent-hover); }

.btn-danger { background: var(--danger); border-color: transparent; color: #200808; }

.btn-danger:hover { background: #f58888; }

.btn-quiet-danger { color: #f49292; border-color: rgba(240, 112, 112, 0.32); background: transparent; }

.btn-quiet-danger:hover { background: var(--danger-soft); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }

.btn-block { width: 100%; }

.btn .spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.notice {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 26%, transparent);
  border-radius: 12px;
  background: var(--c-soft, var(--muted-soft));
}

.notice > .icon { margin-top: 1px; color: var(--c, var(--muted)); }

.notice-title { font-size: 15px; font-weight: 640; line-height: 1.4; }

.notice-text { margin-top: 2px; color: var(--text-2); font-size: 14px; line-height: 1.5; }

.notice-text code, .hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--mono);
  font-size: 0.9em;
}

.notice .link-btn { margin-top: 8px; }

/* The "panel unreachable" bar sits under the app bar on phones and on top of the content on wide screens. */
.banner {
  position: sticky;
  top: var(--bar-h);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #2a2112;
  border-bottom: 1px solid rgba(233, 173, 79, 0.3);
  color: #f3cf91;
  font-size: 14px;
}

.banner .icon { color: var(--warn); }

@media (min-width: 900px) { .banner { top: 0; padding: 10px 40px; } }

/* Confirm step: a bottom sheet on phones (buttons under the thumb), a centred dialog on wide screens. */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.sheet::backdrop { background: rgba(4, 5, 7, 0.62); }

.sheet[open] .sheet-panel { animation: sheet-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); }

.sheet-panel {
  padding: 10px 20px calc(20px + var(--safe-b));
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface-2);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

.sheet-grab { width: 38px; height: 4px; margin: 0 auto 18px; border-radius: 2px; background: var(--line-2); }

.sheet-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--c-soft);
  color: var(--c);
}

.sheet-icon .icon { width: 22px; height: 22px; }

.sheet-title { font-size: 20px; font-weight: 680; letter-spacing: -0.01em; }

.sheet-body { margin-top: 8px; color: var(--text-2); font-size: 15px; line-height: 1.55; }

.sheet-body p + p { margin-top: 8px; }

.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 900px) {
  .sheet { inset: 0; width: min(460px, calc(100% - 48px)); margin: auto; }

  .sheet-panel { padding: 24px 24px 22px; border-bottom: 1px solid var(--line-2); border-radius: 18px; }

  .sheet-grab { display: none; }

  .sheet-actions { display: flex; justify-content: flex-end; }

  .sheet-actions .btn { min-width: 128px; }
}

.toasts {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 11px 15px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 14.5px;
  animation: sheet-up 0.2s ease-out;
}

.toast .icon { color: var(--c, var(--text-2)); }

@media (min-width: 900px) {
  .toasts { left: auto; right: 28px; bottom: 28px; align-items: flex-end; }
}

/* Inputs */
.field-label { display: block; margin-bottom: 8px; color: var(--text-2); font-size: 14px; font-weight: 600; }

.field { position: relative; }

.input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 16px; /* 16px keeps iOS from zooming in */
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: var(--text-3); }

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.input[aria-invalid="true"] { border-color: rgba(240, 112, 112, 0.7); }

.input:disabled { opacity: 0.5; }

.field .input { padding-right: 52px; }

.field-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-3);
}

.field-btn:hover { color: var(--text); }

.field-error { display: flex; gap: 8px; margin-top: 10px; color: #f49292; font-size: 14px; line-height: 1.45; }

.field-error .icon { margin-top: 1px; }

/* Segmented control */
.seg {
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.seg button {
  min-width: 64px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.seg button:hover { color: var(--text); }

.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }

.seg-sm { border-radius: 10px; }

.seg-sm button { height: 30px; min-width: 0; padding: 0 10px; border-radius: 7px; font-size: 13px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 16px;
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
}

.empty .icon { width: 24px; height: 24px; margin-bottom: 4px; }

.empty-title { color: var(--text-2); font-size: 15px; font-weight: 600; }

.empty.is-compact { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 8px 0 4px; text-align: left; }

.empty.is-compact .icon { width: 20px; height: 20px; margin: 0; }

/* ---- Login --------------------------------------------------------------------------------------------------- */

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 20px calc(24px + var(--safe-b));
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(143, 176, 255, 0.10), transparent 70%),
    var(--bg);
}

.login { width: 100%; max-width: 380px; }

.login-head { margin-bottom: 28px; text-align: center; }

.login-head .brand-mark { display: block; width: 52px; height: 52px; margin: 0 auto 18px; }

.login-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

.login-title span { color: var(--text-3); font-weight: 550; }

.login-sub { margin-top: 6px; color: var(--text-2); font-size: 15px; }

.login-card { padding: 22px 20px 20px; border-radius: 18px; }

.login-card .btn { margin-top: 18px; }

.login-card .notice { margin-bottom: 18px; }

/* Setup and 2FA steps: stacked fields, small hints, a quiet text button. */
.login-card .input + .field-label, .login-card .field + .field-label,
.sec-card .input + .field-label, .sec-card .field + .field-label { margin-top: 14px; }

.login-hint { margin-top: 8px; color: var(--text-3); font-size: 13px; line-height: 1.45; }

.login-hint.is-first { margin: 0 0 16px; color: var(--text-2); }

.login-hint code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

.input-code { font-family: var(--mono); letter-spacing: 0.08em; }

.btn-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  text-align: center;
}

.btn-link:hover { text-decoration: underline; }

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

@media (min-width: 900px) {
  .login-page { padding-bottom: 12vh; }

  .login-card { padding: 28px 28px 26px; }
}

/* ---- Overview ------------------------------------------------------------------------------------------------ */

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; transition: opacity 0.2s; }

.is-stale .ov-grid, .is-stale .st-grid { opacity: 0.45; }

/* The hero: a soft glow of the state's colour in the top-left corner. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(130% 120% at 0% 0%, var(--c-soft), transparent 58%),
    var(--surface);
}

.hero-main { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.hero-big {
  margin-top: 4px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.hero-big .u { margin: 0 0.32em 0 0.12em; color: var(--text-2); font-size: 0.55em; font-weight: 600; letter-spacing: 0; }

.hero-big .u:last-child { margin-right: 0; }

.hero-big.is-text { font-size: 30px; }

.hero-meta { color: var(--text-2); font-size: 14.5px; }

.hero-note { display: flex; gap: 8px; color: #f0c98a; font-size: 14px; line-height: 1.45; }

.hero-note .icon { margin-top: 1px; width: 18px; height: 18px; }

.hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Russian labels are long: tighter buttons on phones so "Перезапустить" fits next to "Остановить". */
.hero-actions .btn { min-width: 0; padding: 0 10px; gap: 7px; font-size: 15px; }

.hero-actions[data-count="1"] { grid-template-columns: 1fr; }

/* Phones: the third tile ("Непрочитанные", the longest label) gets a little more room. */
.stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.32fr); gap: 10px; }

.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 13px 14px 12px; }

.stat-label { overflow: hidden; color: var(--text-2); font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-value .cur { margin-left: 0.15em; color: var(--text-2); font-size: 0.62em; font-weight: 600; }

.stat-sub { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.stat.is-hot .stat-value { color: var(--accent); }

.stat.is-na .stat-value { color: var(--text-3); }

.rows { display: grid; margin: 0; }

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.row:first-child { border-top: 0; }

.row dt { flex: none; color: var(--text-2); font-size: 14.5px; }

.row dd { min-width: 0; margin: 0; font-size: 14.5px; font-weight: 550; text-align: right; overflow-wrap: anywhere; }

.row dd .sub { display: block; margin-top: 1px; color: var(--text-3); font-size: 12.5px; font-weight: 450; }

.na { color: var(--text-3); font-weight: 450; }

.card .notice { margin: 4px 0 10px; }

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font: 650 12.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
}

/* Balance and active orders: below the cards that always have data. */
.money-big { margin-top: 2px; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }

.money-big .cur { margin-left: 0.14em; color: var(--text-2); font-size: 0.6em; font-weight: 600; }

.money-meta { margin-top: 2px; color: var(--text-3); font-size: 12.5px; }

.money-card .rows, .money-card .orders { margin-top: 12px; border-top: 1px solid var(--line); }

.money-card .orders .order:first-child { border-top: 0; }

.is-quiet .money-big, .is-quiet .card-title { color: var(--text-3); }

.is-quiet .money-meta { color: var(--text-3); }

.orders { display: grid; margin: 0; padding: 0; list-style: none; }

.order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.order:first-child { border-top: 0; }

.order-main { min-width: 0; font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.order-id { color: var(--text-3); font: 500 12.5px/1.5 var(--mono); }

.order-price { font-size: 14.5px; font-weight: 650; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.order-sub { min-width: 0; color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.order-age { color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }

.orders-more { padding-top: 10px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }

@media (min-width: 900px) {
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  .hero, .stats { grid-column: 1 / -1; }

  .hero { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 26px 28px; }

  .hero-big { font-size: 44px; }

  .hero-big.is-text { font-size: 36px; }

  .hero-actions { display: flex; flex: none; }

  .hero-actions .btn { min-width: 150px; padding: 0 18px; font-size: 15.5px; }

  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

  .stat { padding: 16px 20px; }

  .stat-value { font-size: 32px; }

  .card { padding: 18px 22px; }

  .money-big { font-size: 36px; }
}

/* ---- Statistics ---------------------------------------------------------------------------------------------- */

.st-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; transition: opacity 0.2s; }

.st-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }

.st-filters .seg { flex: 1; max-width: 520px; }

/* Five periods on a phone: the switch gets its own row (the source note goes below it), columns are sized by their
   labels and never narrower than them; on very narrow screens the row scrolls instead of overlapping. */
@media (max-width: 520px) {
  .st-filters .seg { flex: 1 1 100%; max-width: none; grid-auto-columns: auto; overflow-x: auto; }
  .st-filters .seg button { min-width: max-content; padding: 0 8px; font-size: 13px; }
  .st-source { flex-basis: 100%; }
}

.st-source { color: var(--text-3); font-size: 12.5px; }

.st-grid .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.st-grid .stat-sub, .st-grid .delta { white-space: normal; }

.delta { font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.delta.up { color: var(--ok); }

.delta.down { color: #f49292; }

.delta.flat { color: var(--text-3); }

.chart-card .card-head { margin-bottom: 12px; }

.chart { position: relative; }

.chart svg { display: block; width: 100%; overflow: visible; }

.chart .grid line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }

.chart .axis text { fill: var(--text-3); font: 11px var(--font); font-variant-numeric: tabular-nums; }

.chart .bar { fill: var(--chart); }

.chart .hit { fill: transparent; outline: none; }

.chart .hit:hover + .bar, .chart .hit:focus-visible + .bar { fill: var(--accent); }

.chart .peak-label { fill: var(--text-2); font: 600 11px var(--font); }

.tip {
  position: absolute;
  z-index: 5;
  min-width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}

.tip-value { font-size: 15px; font-weight: 700; }

.tip-label { color: var(--text-3); font-size: 12px; }

.table-toggle { margin-top: 12px; }

.table-toggle summary { color: var(--text-3); font-size: 13px; cursor: pointer; }

.data-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13.5px; }

.data-table th { padding: 6px 8px 6px 0; color: var(--text-3); font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; }

.data-table td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }

.data-table .r { text-align: right; padding-right: 0; }

.top-lots { display: grid; margin: 0; padding: 0; list-style: none; }

.top-lot { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }

.top-lot:first-child { border-top: 0; }

.top-rank { color: var(--text-3); font: 600 12.5px/1.6 var(--mono); }

.top-title { min-width: 0; overflow: hidden; font-size: 14.5px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }

.top-sum { font-size: 14.5px; font-weight: 650; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.top-bar { grid-column: 2 / -1; display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12.5px; }

.top-bar .track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }

.top-bar .fill { display: block; height: 100%; border-radius: 3px; background: var(--chart); }

/* Refunds: their own card, in neutral ink. They are never part of revenue. */
.refund-sum { color: var(--text-2); }

@media (min-width: 900px) {
  .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  .st-grid .stats, .st-grid .chart-card, .st-grid > .notice { grid-column: 1 / -1; }

  .st-grid .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Chats ------------------------------------------------------------------------------------------------- */

.ch-layout { display: grid; gap: 12px; }

.ch-list-card { padding: 0; overflow: hidden; }

.chat-list { margin: 0; padding: 0; list-style: none; }

.chat-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "ava name time" "ava last unread";
  gap: 2px 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chat-row:first-child { border-top: 0; }

.chat-row:hover, .chat-row:focus-visible { background: var(--surface-2); outline: none; }

.chat-row.is-pinned { background: rgba(255, 255, 255, 0.02); }

.chat-row.is-open { background: var(--accent-soft); }

.chat-row.is-gone { opacity: 0.5; }

.chat-row.is-gone .chat-last { font-style: italic; }

.chat-ava { grid-area: ava; align-self: center; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-weight: 650; }

.chat-name { grid-area: name; display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }

.chat-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-pin-mark .icon, .chat-name .icon { width: 14px; height: 14px; color: var(--accent); }

.chat-time { grid-area: time; color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }

.chat-last { grid-area: last; min-width: 0; overflow: hidden; color: var(--text-3); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }

.chat-unread { grid-area: unread; justify-self: end; align-self: center; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.chat-pin-btn { position: absolute; top: 50%; right: 10px; display: none; transform: translateY(-50%); background: var(--surface-3); }

.chat-row.is-pinned .chat-pin-btn { color: var(--accent); }

.chat-row.show-actions .chat-pin-btn { display: grid; }

@media (hover: hover) { .chat-row:hover .chat-pin-btn { display: grid; } }

.ch-foot { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }

.ch-view {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--bar-h) - var(--nav-h) - var(--safe-b) - 40px);
  min-height: 360px;
  padding: 0;
  overflow: hidden;
}

.ch-view[hidden] { display: none; }

.ch-layout.has-open .ch-list-card { display: none; }

.ch-view-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }

.ch-view-head .chat-ava { width: 34px; height: 34px; }

.ch-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; font-size: 16px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.ch-pin[aria-pressed="true"] { color: var(--accent); }

.ch-body { flex: 1; padding: 12px; overflow-y: auto; overscroll-behavior: contain; }

.ch-body .ch-foot { border-top: 0; padding: 12px 4px 0; text-align: center; }

.msgs { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }

.msg { align-self: flex-start; max-width: 84%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface-3); }

.msg.is-mine { align-self: flex-end; border: 1px solid rgba(143, 176, 255, 0.22); border-radius: 14px 14px 4px 14px; background: var(--accent-soft); }

.msg.is-system { align-self: center; max-width: 92%; padding: 4px 8px; background: transparent; color: var(--text-3); font-size: 12.5px; text-align: center; }

.msg-author { display: block; margin-bottom: 2px; color: var(--text-2); font-size: 12px; font-weight: 600; }

.msg-text { margin: 0; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }

.msg-tag { display: inline-block; margin-top: 3px; color: var(--text-3); font-size: 11.5px; }

.msg-image { color: var(--accent); font-size: 14.5px; }

.ch-note { display: grid; justify-items: center; gap: 12px; padding: 28px 12px; color: var(--text-2); text-align: center; }

.ch-note-text { max-width: 420px; margin: 0; font-size: 14.5px; }

.ch-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }

.ch-input { min-height: 44px; max-height: 160px; padding: 11px 12px; font-size: 16px; line-height: 1.35; resize: none; }

.ch-send { width: 44px; min-width: 44px; height: 44px; padding: 0; }

.ch-send.is-busy { opacity: 0.6; }

.ch-limit { grid-column: 1 / -1; margin: 0; color: var(--text-3); font-size: 12px; }

.ch-limit:empty { display: none; }

.ch-limit.is-error { color: var(--danger); }

@media (min-width: 900px) {
  .ch-layout.has-open { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: start; }

  .ch-layout.has-open .ch-list-card { display: block; max-height: calc(100dvh - 150px); overflow-y: auto; }

  .ch-view { height: calc(100dvh - 150px); }

  .ch-back { display: none; }
}

/* ---- Plugins ----------------------------------------------------------------------------------------------- */

.pl-grid { display: grid; gap: 12px; }

.pl-hint { margin: 6px 0 12px; color: var(--text-3); font-size: 13.5px; }

.pl-hint code, .pl-filename { font-family: var(--mono); font-size: 12.5px; }

.pl-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }

.pl-upload-row label.btn { cursor: pointer; }

.pl-file { flex: 1; min-width: 120px; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }

.pl-pending { margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }

.pl-pending-item { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; }

.pl-state { color: var(--warn); font-weight: 600; }

.pl-pending-item.is-warn .pl-state { color: var(--danger); }

.pl-list { margin: 0; padding: 0; list-style: none; }

.pl-item { padding: 14px 0; border-top: 1px solid var(--line); }

.pl-item:first-child { border-top: 0; padding-top: 4px; }

.pl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.pl-name { min-width: 0; font-size: 15.5px; font-weight: 650; overflow-wrap: anywhere; }

.pl-item.is-off .pl-name { color: var(--text-2); }

.pl-ver { margin-left: 8px; color: var(--text-3); font-family: var(--mono); font-size: 12.5px; font-weight: 500; }

.pl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 0; color: var(--text-3); font-size: 13px; }

.pl-tag { padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; line-height: 20px; }

.pl-tag.tone-muted { background: var(--muted-soft); color: var(--muted); }

.pl-desc { margin: 8px 0 0; color: var(--text-2); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }

.pl-desc.is-clamped { display: -webkit-box; overflow: hidden; cursor: pointer; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.switch { position: relative; flex: none; width: 50px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background 0.15s; }

.switch::after { content: ""; position: absolute; inset: -8px; } /* a 46 px touch target */

.switch-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-2); transition: transform 0.15s, background 0.15s; }

.switch[aria-checked="true"] { border-color: transparent; background: var(--accent); }

.switch[aria-checked="true"] .switch-knob { background: var(--accent-ink); transform: translateX(20px); }

.switch:disabled { cursor: not-allowed; opacity: 0.5; }

.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Logs ---------------------------------------------------------------------------------------------------- */

.logs-page .content {
  display: flex;
  flex-direction: column;
  max-width: none;
  height: calc(100dvh - var(--bar-h) - var(--nav-h) - var(--safe-b));
  padding: 14px 0 0;
}

.logs-page .page-head, .log-tools { padding: 0 16px; }

.logs-page .page-head { margin-bottom: 12px; }

.log-tools { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }

.log-tools-row { display: flex; align-items: center; gap: 12px; }

.log-tools-row .log-count { margin-left: auto; }

.search { position: relative; display: block; }

.search > .icon { position: absolute; top: 13px; left: 13px; color: var(--text-3); pointer-events: none; }

.search .input { height: 46px; padding-left: 42px; padding-right: 46px; }

.search .input::-webkit-search-cancel-button { display: none; }

.search .field-btn { top: 1px; right: 1px; }

.log-count { color: var(--text-3); font-size: 13px; white-space: nowrap; }

.log-wrap { position: relative; flex: 1; min-height: 0; }

.log-view {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 96px;
  background: var(--log-bg);
  border-top: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.log-view:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); border-radius: 0; }

/* Phones: messages in the UI font (more words per line, easier to read); time and level stay monospace. */
.ln {
  display: grid;
  grid-template-columns: 8ch 1.2ch minmax(0, 1fr);
  column-gap: 9px;
  padding: 2px 12px 2px 10px;
  border-left: 2px solid transparent;
  font: 12px/1.7 var(--mono);
}

.ln-t { color: var(--text-3); font-variant-numeric: tabular-nums; }

.ln-l { color: var(--text-3); font-weight: 700; text-align: center; }

.ln-m { color: #d5d9e0; font: 13.5px/1.5 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; }

.ln.lv-I .ln-l { color: var(--ok); }

.ln.lv-W { background: rgba(233, 173, 79, 0.05); border-left-color: rgba(233, 173, 79, 0.65); }

.ln.lv-W .ln-l, .ln.lv-W .ln-m { color: #f0c27a; }

.ln.lv-E, .ln.lv-C { background: rgba(240, 112, 112, 0.065); border-left-color: rgba(240, 112, 112, 0.8); }

.ln.lv-E .ln-l, .ln.lv-E .ln-m, .ln.lv-C .ln-l, .ln.lv-C .ln-m { color: #f6a3a3; }

.ln.lv-x .ln-m { color: var(--text-2); }

.ln mark { padding: 0 1px; border-radius: 3px; background: rgba(143, 176, 255, 0.32); color: #fff; }

/* Identical lines in a row collapse into one: "×N" plus when the run started. */
.ln-rep {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font: 700 11px/18px var(--mono);
  vertical-align: 1px;
  white-space: nowrap;
}

.ln-rep-since { margin-left: 6px; color: var(--text-3); font: 500 11.5px var(--font); white-space: nowrap; }

/* systemd's own lines for the unit (Started, Stopping, ...) are shown as dividers. */
.ln-sys {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  padding: 0 12px;
  color: var(--text-3);
  font: 600 11.5px/1.4 var(--font);
  letter-spacing: 0.01em;
}

.ln-sys::before, .ln-sys::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.ln-sys span { max-width: 80%; text-align: center; overflow-wrap: anywhere; }

.log-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-3);
  font-size: 14.5px;
  text-align: center;
}

.jump {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px 0 13px;
  border: 1px solid rgba(143, 176, 255, 0.35);
  border-radius: 999px;
  background: #1c2436;
  color: #c9d8ff;
  font-size: 14px;
  font-weight: 620;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  animation: sheet-up 0.18s ease-out;
  white-space: nowrap;
}

.jump .icon { width: 18px; height: 18px; }

.paused-bar {
  position: absolute;
  left: 12px;
  right: 80px;
  bottom: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 6px 0 14px;
  border: 1px solid rgba(233, 173, 79, 0.3);
  border-radius: 14px;
  background: #261f12;
  color: #f0c98a;
  font-size: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.paused-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pause/resume: a thumb-reach round button on phones, a toolbar button on wide screens. */
.pause-btn {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 25;
  width: 54px;
  height: 54px;
  min-height: 0;
  padding: 0;
  border-radius: 18px;
  background: var(--surface-3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.pause-btn .icon { width: 22px; height: 22px; }

.pause-btn .label { display: none; }

.pause-btn[aria-pressed="true"] { background: var(--warn); border-color: transparent; color: #241703; }

.logs-page .toasts { bottom: calc(var(--nav-h) + var(--safe-b) + 84px); }

@media (min-width: 900px) {
  .logs-page .content { height: 100dvh; padding: 34px 40px 28px; }

  .logs-page .page-head, .log-tools { padding: 0; }

  .logs-page .page-head { margin-bottom: 18px; }

  .log-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

  .log-tools .search { width: 340px; }

  .log-tools-row { flex: 1; }

  .log-view { border: 1px solid var(--line); border-radius: 14px; padding: 10px 0 60px; }

  /* Wide screens: one monospace column, like the terminal. */
  .ln { padding: 1px 18px 1px 14px; font: 13px/1.6 var(--mono); }

  .ln-m { font: inherit; }

  .ln:hover { background-color: rgba(255, 255, 255, 0.025); }

  .pause-btn {
    position: static;
    width: auto;
    height: auto;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 11px;
    background: var(--surface-2);
    box-shadow: none;
    font-size: 14.5px;
  }

  .pause-btn .icon { width: 18px; height: 18px; }

  .pause-btn .label { display: inline; }

  .paused-bar { left: 50%; right: auto; width: 440px; transform: translateX(-50%); }

  .logs-page .toasts { bottom: 28px; }
}

/* ---- Settings ------------------------------------------------------------------------------------------------ */

.sec-grid { display: grid; gap: 12px; max-width: 640px; }

.sec-state {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
}

.sec-state.is-on { background: var(--ok-soft); color: var(--ok); }

.sec-text { margin: 6px 0 12px; color: var(--text-2); font-size: 14px; line-height: 1.5; }

.sec-step { margin: 14px 0 10px; color: var(--text); font-size: 14.5px; }

.sec-qr { width: min(240px, 100%); margin: 4px 0 12px; border-radius: 10px; overflow: hidden; }

.sec-qr svg { display: block; width: 100%; height: auto; }

.sec-secret code {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  user-select: all;
}

.sec-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.sec-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 12px 0 0;
  padding-left: 1.6em;
  font-family: var(--mono);
  font-size: 15px;
  user-select: all;
}

.sec-facts { margin: 8px 0 0; padding-left: 1.1em; color: var(--text-2); font-size: 14px; line-height: 1.5; }

.sec-facts li + li { margin-top: 8px; }

.sec-facts code { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }

/* ---- Session 05: shared bits ----------------------------------------------------------------------------- */

.input-sm { height: 40px; font-size: 16px; }

.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.lots-meta { margin: -6px 0 12px; text-align: left; }

.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-2); font-size: 14px; cursor: pointer; }

.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.sheet-hint { margin: 8px 0; color: var(--text-3); font-size: 13.5px; line-height: 1.45; }

.sheet-tall { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }

.copy-btn { width: 44px; height: 44px; color: var(--text-3); }

.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 10px 0; font-size: 14px; }

.facts dt { color: var(--text-3); }

.facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.is-muted { color: var(--text-3); }

@media (min-width: 900px) {
  .sheet-wide { width: min(760px, calc(100% - 48px)); }
}

/* ---- Chats (Session 05) ---------------------------------------------------------------------------------- */

.ch-search { position: relative; margin: 0 0 8px; }

.ch-search .icon { position: absolute; top: 10px; left: 12px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }

.ch-search .input { padding-left: 38px; }

.chat-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px; }

.chat-row.is-unread .chat-name { font-weight: 700; }

.chat-row.is-unread .chat-last { color: var(--text); }

.ch-who { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--text); text-align: left; }

.ch-who-text { display: flex; flex-direction: column; min-width: 0; }

.ch-title { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ch-sub { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ch-view { position: relative; }

.ch-new-pill {
  position: absolute;
  left: 50%;
  bottom: 86px;
  z-index: 2;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.ch-compose { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 6px; padding: 8px 10px; }

.ch-tool { width: 40px; height: 44px; color: var(--text-2); }

.ch-limit { grid-column: 1 / -1; }

.ch-attach { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface); }

.ch-attach[hidden] { display: none; }

.ch-attach-img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }

.ch-attach-text { flex: 1; min-width: 0; font-size: 13.5px; }

.ch-attach-text p:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ch-attach-hint { color: var(--text-3); font-size: 12px; }

.msg.is-auto { border-style: dashed; background: rgba(143, 176, 255, 0.06); }

.msg.is-staff { border: 1px solid rgba(233, 173, 79, 0.35); }

.msg-tag { display: block; margin-top: 3px; color: var(--text-3); font-size: 11px; text-align: right; }

.msg-thumb { display: block; padding: 0; border: 0; border-radius: 10px; background: none; cursor: zoom-in; overflow: hidden; }

.msg-img { display: block; max-width: min(240px, 60vw); max-height: 260px; min-height: 60px; border-radius: 10px; background: var(--surface-2); object-fit: cover; }

.msg-img-failed { color: var(--text-3); font-size: 13px; }

.viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: rgba(4, 5, 7, 0.94); }

.viewer[open] { display: grid; place-items: center; }

.viewer::backdrop { background: rgba(4, 5, 7, 0.9); }

.viewer-img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }

.viewer-close { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); right: 8px; z-index: 1; background: rgba(23, 26, 32, 0.8); color: var(--text); }

.quick-list { margin: 8px 0 0; padding: 0; list-style: none; }

.quick-item { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 52px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); text-align: left; }

.quick-title { font-size: 15px; font-weight: 600; }

.quick-preview { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-row { display: flex; align-items: center; gap: 2px; min-height: 52px; border-bottom: 1px solid var(--line); }

.quick-row .quick-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-form .input + .field-label { margin-top: 12px; }

.quick-text { min-height: 110px; padding: 10px 12px; resize: vertical; }

.buyer-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.buyer-note .input + .field-label { margin-top: 12px; }

.buyer-note textarea.input { height: auto; padding: 10px 12px; }

/* (Session 05's buyer order rows were replaced in Session 06, below.) */

/* Phones: an open chat covers the screen and follows the visual viewport, so the keyboard never hides the input. */
@media (max-width: 899px) {
  body.chat-open { overflow: hidden; }

  body.chat-open .ch-view {
    position: fixed;
    top: var(--vvtop, 0px);
    left: 0;
    right: 0;
    z-index: 50;
    height: var(--vvh, 100dvh);
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  body.chat-open .ch-view-head { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }

  body.chat-open .ch-compose { padding-bottom: calc(8px + var(--safe-b)); }
}

/* ---- Lots (Session 05) ------------------------------------------------------------------------------------- */

.raise-card { margin-bottom: 12px; }

.raise-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.raise-text { min-width: 0; }

.raise-text .card-title { margin-bottom: 2px; }

.raise-state { color: var(--text-2); font-size: 13.5px; }

.job-card { margin-bottom: 12px; border-color: rgba(143, 176, 255, 0.35); }

.job-card.tone-danger { border-color: rgba(240, 112, 112, 0.45); }

.job-card.tone-ok { border-color: rgba(86, 201, 147, 0.4); }

.job-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.job-text { font-size: 14px; line-height: 1.45; }

.job-bar { height: 4px; margin-top: 10px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }

.job-bar span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 0.3s; }

.lots-tools { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 12px; }

.lots-tools .ch-search { flex: 1; min-width: 200px; margin: 0; }

.lot-groups { display: grid; gap: 10px; margin-bottom: 14px; }

.lot-cat { margin: 8px 2px 0; color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }

.lot-group { padding: 6px 12px 4px; }

.lot-sub { display: flex; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--line); }

.lot-sub-name { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lot-sub-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.lot-list { margin: 0; padding: 0; list-style: none; }

.lot-row { display: flex; align-items: stretch; gap: 4px; border-top: 1px solid var(--line); }

.lot-row:first-child { border-top: 0; }

.lot-row.is-selected { background: var(--accent-soft); }

.lot-check-wrap { display: grid; place-items: center; flex: none; width: 44px; min-height: 44px; cursor: pointer; }

.lot-check { width: 20px; height: 20px; accent-color: var(--accent); }

.lot-main { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 4px; border: 0; background: none; color: var(--text); text-align: left; }

.lot-title { font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }

.lot-row.is-off .lot-title { color: var(--text-2); }

.lot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-3); font-size: 12.5px; }

.lot-price { color: var(--text); font-weight: 650; }

.lot-state { padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 20px; }

.lot-state.is-on { background: var(--ok-soft); color: var(--ok); }

.lot-state.is-off { background: var(--surface-3); color: var(--text-3); }

.bulk-bar {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: rgba(23, 26, 32, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.bulk-bar[hidden] { display: none; }

.bulk-count { flex: 1; min-width: 90px; font-size: 14px; font-weight: 650; }

body.has-bulk .content { padding-bottom: 120px; }

.sched-list { margin: 8px 0 0; padding: 0; list-style: none; }

.sched-item { display: flex; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid var(--line); }

.sched-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.sched-name { font-weight: 600; }

.sched-meta { color: var(--text-3); font-size: 12.5px; }

.sched-log { margin-top: 10px; color: var(--text-2); font-size: 13px; }

.sched-log summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }

.sched-log ul { margin: 0; padding-left: 1.1em; }

.sched-log li + li { margin-top: 4px; }

.sched-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

#sched-form .input + .field-label { margin-top: 12px; }

.ed-link { color: var(--accent); font-size: 13.5px; white-space: nowrap; }

.ed-pair { display: grid; gap: 10px; margin-top: 12px; }

.ed-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }

.ed-label-row .field-label { margin: 0; }

.ed-label-row .btn { min-height: 40px; padding: 0 8px; font-size: 13px; }

.ed-text { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.4; resize: vertical; }

.ed-hint { margin-top: 6px; color: var(--text-3); font-size: 12.5px; }

.ed-check { display: flex; align-items: flex-start; margin-top: 10px; }

.ed-check span { display: flex; flex-direction: column; }

.ed-check b { color: var(--text); font-weight: 600; }

.ed-check small { color: var(--warn); font-size: 12px; }

.ed-extra { margin-top: 12px; color: var(--text-2); font-size: 13.5px; }

.ed-extra summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

.ed-actions { grid-template-columns: repeat(3, 1fr); }

.ed-field select.input { padding-right: 10px; }

.price-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }

.price-value { width: 130px; }

.price-list { margin: 8px 0 0; padding: 0; list-style: none; max-height: 40dvh; overflow-y: auto; }

.price-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 2px 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }

.price-title { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.price-old { color: var(--text-3); text-decoration: line-through; }

.price-arrow { color: var(--text-3); }

.price-new { font-weight: 650; }

.price-buyer { grid-column: 1 / -1; color: var(--text-3); font-size: 12px; }

.price-row.is-bad .price-new { color: var(--danger); }

@media (min-width: 900px) {
  .bulk-bar { left: calc(var(--side-w) + 24px); right: 24px; bottom: 20px; max-width: 760px; margin: 0 auto; }

  .ed-pair { grid-template-columns: 1fr 1fr; }
}

/* ---- Reviews, bot settings, statistics, overview (Session 05) -------------------------------------------- */

.rv-list { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }

.rv-item.is-low { border-color: rgba(233, 173, 79, 0.35); }

.rv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }

.rv-stars { color: var(--warn); letter-spacing: 1px; }

.rv-buyer { font-weight: 650; }

.rv-date { margin-left: auto; color: var(--text-3); font-size: 12.5px; }

.rv-lot { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--text-3); font-size: 12.5px; }

.rv-lot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rv-text { margin-top: 8px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

.rv-reply { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.rv-reply textarea.input { height: auto; padding: 10px 12px; }

.rv-reply .btn { justify-self: end; }

.rv-reply-text { color: var(--text-2); font-size: 14px; white-space: pre-wrap; }

.bot-grid { display: grid; gap: 12px; }

.sw-group + .sw-group { margin-top: 10px; }

.sw-group-title { margin: 12px 0 4px; color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }

.sw-list { margin: 0; padding: 0; list-style: none; }

.sw-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--line); }

.sw-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.sw-label { font-size: 14.5px; }

.sw-help { color: var(--text-3); font-size: 12.5px; line-height: 1.4; }

.bl-add { display: flex; gap: 8px; margin: 8px 0; }

.bl-add .input { flex: 1; min-width: 0; }

.bl-list, .st-list, .pls-list { margin: 0; padding: 0; list-style: none; }

.bl-row, .st-row, .pls-row { display: flex; align-items: center; gap: 10px; min-height: 48px; border-top: 1px solid var(--line); }

.bl-name { flex: 1; min-width: 0; color: var(--text); font-weight: 600; }

.st-name, .pls-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.st-row.is-low .st-count { color: var(--warn); font-weight: 700; }

.pls-note { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }

#stock-items { height: auto; min-height: 160px; padding: 10px 12px; font-family: var(--mono); font-size: 14px; }

.lot-filter { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 6px 6px 6px 12px; border: 1px solid rgba(143, 176, 255, 0.3); border-radius: 12px; background: var(--accent-soft); font-size: 14px; }

.lot-filter[hidden] { display: none; }

.lot-filter span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.all-lots { margin-top: 12px; color: var(--text-2); font-size: 13.5px; }

.all-lots summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }

.table-wrap { overflow-x: auto; }

.data-table tr.is-link, .top-lot.is-link { cursor: pointer; }

.data-table tr.is-link:hover td { background: var(--surface-2); }

.order-copy { padding: 0; border: 0; background: none; cursor: copy; }

.order-buyer { margin-left: 4px; color: var(--text); font-weight: 600; }

@media (min-width: 900px) {
  .bot-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* Touch screens: every control at least 44 px tall (Session 05 review). */
@media (pointer: coarse) {
  .btn-sm, .ed-label-row .btn, .seg button, .seg-sm button { min-height: 44px; }

  .order-copy { display: inline-flex; align-items: center; min-height: 44px; }

  .data-table tr.is-link td { padding-top: 12px; padding-bottom: 12px; }

  .sched-log summary, .all-lots summary, .ed-extra summary { min-height: 48px; }
}

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

/* ==== Session 06 =============================================================================================== */
/* Design plan (DECISIONS.md, Session 06): every screen leads with its main job; one muted blue accent; status
   colours only for status; spacing on a 4/8/12/16/24 scale; type 11.5/12.5/13.5/14.5/16/20/24/28. */

:root { --gold: #e9b85a; --gold-soft: rgba(233, 184, 90, 0.13); }

.tone-gold { --c: var(--gold); --c-soft: var(--gold-soft); }

/* ---- Chats: layout ---------------------------------------------------------------------------------------------- */

.ch-placeholder { display: none; }

.ch-filters { display: grid; grid-template-columns: auto 1fr 1fr; width: 100%; margin: 0 0 8px; }

.ch-filters button { min-width: 0; padding: 0 8px; font-size: 13.5px; }

.seg-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.seg-count[hidden] { display: none; }

.ch-list-card { padding: 10px 0 0; }

.ch-list-card .ch-search, .ch-list-card .ch-filters { margin-left: 10px; margin-right: 10px; width: auto; }

.chat-last { display: flex; align-items: center; gap: 5px; }

.chat-last > :last-child { min-width: 0; }

.chat-last-icon { flex: none; width: 15px; height: 15px; color: var(--c, var(--text-3)); }

.chat-last.is-system { color: var(--text-2); }

.chat-last-by { flex: none; color: var(--text-3); }

.chat-draft { flex: none; color: var(--warn); font-weight: 600; }

@media (min-width: 900px) {
  .chats-page .content { max-width: 1680px; padding-left: 24px; padding-right: 24px; }

  .ch-layout, .ch-layout.has-open {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    align-items: stretch;
    height: calc(100dvh - 120px);
    min-height: 480px;
  }

  .ch-layout .ch-list-card, .ch-layout.has-open .ch-list-card {
    display: flex;
    flex-direction: column;
    max-height: none;
    overflow: hidden;
  }

  .ch-list-card .chat-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

  .ch-view, .ch-layout.has-open .ch-view { height: auto; min-height: 0; }

  .ch-layout:not(.has-open) .ch-placeholder {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 6px;
    padding: 24px;
    color: var(--text-3);
    text-align: center;
  }

  .ch-placeholder .icon { width: 40px; height: 40px; margin-bottom: 6px; color: var(--line-2); }

  .ch-placeholder-title { color: var(--text-2); font-size: 16px; font-weight: 650; }

  .ch-placeholder-text { max-width: 340px; font-size: 13.5px; }

  .ch-view-head { min-height: 64px; padding: 10px 14px; }

  .ch-view-head .chat-ava { width: 40px; height: 40px; }

  .ch-title { font-size: 17px; }

  .ch-body { padding: 16px 20px; }

  .msg { max-width: min(78%, 640px); }

  .ch-compose { padding: 12px 16px; gap: 8px; }

  .ch-input { min-height: 52px; padding: 14px 14px; font-size: 15px; }

  .ch-send { width: 52px; min-width: 52px; height: 52px; border-radius: 14px; }

  .ch-tool { width: 44px; height: 52px; }
}

.ch-side { display: none; }

@media (min-width: 1280px) {
  .ch-layout.has-open { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(280px, 340px); }

  .ch-layout.has-open .ch-side { display: block; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }

  .ch-card-btn { display: none; }
}

.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

.side-title { min-width: 0; overflow: hidden; font-size: 17px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }

.ch-side .buyer-note { display: grid; gap: 6px; margin-top: 8px; }

.ch-side .buyer-note .btn { justify-self: start; }

/* ---- Chats: messages ------------------------------------------------------------------------------------------- */

.msg-foot { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; margin-top: 3px; }

.msg-foot:empty { display: none; }

.msg-foot .msg-tag { display: inline; margin: 0; }

.msg-time { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.msg:not(.is-mine) .msg-foot { justify-content: flex-start; }

.msg-day { display: flex; justify-content: center; margin: 10px 0 4px; }

.msg-day span {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
}

.msgs.is-skeleton .sk-msg {
  height: 38px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  border: 0;
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk-w38 { width: 38%; } .sk-w45 { width: 45%; } .sk-w55 { width: 55%; } .sk-w62 { width: 62%; } .sk-w70 { width: 70%; }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* FunPay's system messages: a card with an icon, the event in words, FunPay's own text, and the order as a button. */
.sys-card {
  align-self: center;
  width: min(100%, 520px);
  margin: 4px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--c) 32%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 7%, var(--surface));
}

.sys-head { display: flex; align-items: center; gap: 8px; }

.sys-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--c-soft);
  color: var(--c);
}

.sys-icon .icon { width: 16px; height: 16px; }

.sys-title { flex: 1; min-width: 0; color: var(--c); font-size: 14px; font-weight: 680; }

.sys-head .msg-time { margin-left: auto; }

.sys-text { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }

.sys-order {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.sys-order:hover { background: var(--surface-3); }

.sys-order .icon { width: 16px; height: 16px; color: var(--text-3); }

.sys-order .money-badge { margin-left: auto; font-family: var(--font); }

.sys-order .sys-chev { margin-left: 0; }

.sys-order span:nth-child(2) { flex: 1; }

.sys-order .money-badge + .sys-chev, .sys-order span:nth-child(2) + .sys-chev { margin-left: auto; }

.stars { color: var(--gold); font-size: 14px; letter-spacing: 1px; white-space: nowrap; }

.stars-off { color: var(--line-2); }

/* ---- Money, status and role badges --------------------------------------------------------------------------- */

.money-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-badge.is-small { height: 20px; padding: 0 7px; font-size: 12px; }

.money-badge.is-big { height: 30px; padding: 0 12px; font-size: 15px; }

.money-badge.is-refund { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }

.money-badge.is-paid { background: var(--muted-soft); color: var(--text-2); }

.status-chip, .role-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip { background: var(--c-soft); color: var(--c); }

.role-chip { border: 1px solid var(--line-2); color: var(--text-2); }

.role-chip.is-buyer { border-color: rgba(233, 184, 90, 0.45); color: var(--gold); }

/* ---- The order strip (top of an open chat) -------------------------------------------------------------------- */

.order-strip { padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }

.order-strip[hidden] { display: none; }

.strip-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 6px 10px;
  border: 1px solid rgba(143, 176, 255, 0.3);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
}

.strip-btn.is-quiet { border-color: var(--line); background: var(--surface-2); }

.strip-btn:hover { filter: brightness(1.08); }

.strip-icon { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--accent); }

.strip-btn.is-quiet .strip-icon { color: var(--text-3); }

.strip-text { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }

.strip-title { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.strip-title b { font-family: var(--mono); font-size: 13px; }

.strip-sub { overflow: hidden; color: var(--text-3); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }

.strip-sub b { color: var(--c, var(--text-2)); font-weight: 650; }

.strip-chev { flex: none; width: 18px; height: 18px; color: var(--text-3); }

/* ---- The order sheet ---------------------------------------------------------------------------------------- */

.sheet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }

.order-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.order-money {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--ok-soft);
}

.order-money-label { color: var(--text-2); font-size: 14px; font-weight: 600; }

.order-money-value { color: var(--ok); font-size: 26px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.order-money.is-refund { background: var(--danger-soft); }

.order-money.is-refund .order-money-value { color: var(--danger); }

.order-money.is-paid { background: var(--surface-3); }

.order-money.is-paid .order-money-value { color: var(--text); }

.order-facts { grid-template-columns: 110px minmax(0, 1fr); }

.order-review { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.order-review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.order-review-text { margin-top: 6px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }

.order-review-reply { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }

.order-actions { display: grid; gap: 8px; margin-top: 14px; }

.order-actions .btn { justify-content: flex-start; width: 100%; }

.btn-danger-soft { border-color: rgba(240, 112, 112, 0.4); color: var(--danger); }

.btn-danger-soft:hover { background: var(--danger-soft); }

@media (min-width: 600px) {
  .order-actions { grid-template-columns: 1fr 1fr; }
}

.star-picker { display: flex; gap: 4px; margin: 10px 0; }

.star-pick {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--line-2);
  font-size: 24px;
  line-height: 1;
}

.star-pick.is-on { color: var(--gold); }

#review-text { min-height: 110px; resize: vertical; }

/* ---- The buyer panel -------------------------------------------------------------------------------------------- */

.buyer-stats { display: grid; gap: 0; margin: 8px 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.buyer-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 10px; padding: 9px 12px; }

.buyer-stat + .buyer-stat { border-top: 1px solid var(--line); }

.buyer-stat-label { color: var(--text-2); font-size: 13.5px; }

.buyer-stat-value { min-width: 22px; color: var(--c, var(--text)); font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; text-align: right; }

.buyer-stat-sub { min-width: 76px; color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.buyer-dates { grid-template-columns: auto minmax(0, 1fr); margin: 6px 0 4px; }

.buyer-h { margin: 14px 0 6px; color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }

.buyer-orders { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }

.buyer-order {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.buyer-order:hover { background: var(--surface-2); }

.buyer-order-top, .buyer-order-sub { display: flex; align-items: center; gap: 8px; min-width: 0; }

.buyer-order-top code { flex: none; font-family: var(--mono); font-size: 12.5px; }

.buyer-order-lot { flex: 1; min-width: 0; overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.buyer-order-top .money-badge { flex: none; margin-left: auto; }

.buyer-order-sub { color: var(--text-3); font-size: 12px; }

/* ---- Alerts sheet ------------------------------------------------------------------------------------------------- */

.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.alert-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.alert-text small { color: var(--text-3); font-size: 13px; line-height: 1.35; }

.alert-switch {
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: pointer;
  transition: background 0.15s;
}

.alert-switch::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 3px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.15s;
}

.alert-switch:checked { background: var(--accent); }

.alert-switch:checked::before { background: var(--accent-ink); transform: translateX(18px); }

.alert-switch:disabled { opacity: 0.4; }

.alert-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-block-sm { width: 100%; }

@media (min-width: 900px) { .btn-block-sm { width: auto; } }

/* ---- Поднятие лотов (Обзор and Лоты) --------------------------------------------------------------------------- */

.raise-card { padding: 16px 18px; }

.raise-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

.raise-head .card-title { margin: 0; }

.raise-head .chip { height: 26px; font-size: 12.5px; }

.raise-cats { display: grid; gap: 12px; margin: 0 0 14px; padding: 0; list-style: none; }

.raise-cat-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.raise-cat-name { font-size: 15px; font-weight: 650; }

.raise-cat-when { color: var(--text-2); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.raise-cat.is-due .raise-cat-when { color: var(--ok); font-weight: 650; }

.raise-bar { height: 6px; margin: 7px 0 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }

.raise-fill { display: block; height: 100%; border-radius: 3px; background: var(--chart); transition: width 0.4s; }

.raise-cat.is-due .raise-fill { background: var(--ok); }

.raise-cat-last { color: var(--text-3); font-size: 12.5px; }

.raise-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.raise-why { flex: 1; min-width: 200px; color: var(--text-3); font-size: 13px; line-height: 1.4; }

/* ---- Обзор: new orders ------------------------------------------------------------------------------------------- */

.card-meta { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }

.new-order-list { display: grid; margin: 6px -18px -16px; padding: 0; list-style: none; }

.new-order {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

a.new-order:hover { background: var(--surface-2); text-decoration: none; }

.no-time { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }

.no-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.no-buyer { overflow: hidden; font-size: 14.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.no-lot { overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.no-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.new-order-empty, .new-order-more { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13.5px; }

.stat-link { color: inherit; text-decoration: none; }

.stat-link:hover { border-color: var(--line-2); text-decoration: none; }

@media (min-width: 900px) {
  .new-orders { grid-column: 1 / -1; }

  .ov-grid .raise-card { grid-column: 1 / -1; }
}

/* ---- Лоты: rows, schedules, editor ------------------------------------------------------------------------------ */

.lot-row { align-items: center; }

.lot-edit { flex: none; margin-right: 10px; }

.lot-sched { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }

.lot-sched .icon { width: 13px; height: 13px; }

@media (max-width: 599px) {
  .lot-row { flex-wrap: wrap; }

  .lot-main { flex-basis: calc(100% - 60px); padding-bottom: 4px; }

  .lot-edit { margin: 0 12px 10px auto; }
}

.sched-intro { margin: 2px 0 10px; color: var(--text-2); font-size: 14px; line-height: 1.45; }

.sched-item { display: block; min-height: 0; padding: 12px 0; }

.sched-item.is-paused .sched-name, .sched-item.is-paused .sched-say { color: var(--text-3); }

.sched-top { display: flex; align-items: center; gap: 6px; }

.sched-say { color: var(--text-2); font-size: 13.5px; line-height: 1.4; }

.sched-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 8px 0 0; font-size: 13px; }

.sched-facts dt { color: var(--text-3); }

.sched-facts dd { margin: 0; color: var(--text-2); }

.sched-facts dd.is-error { color: var(--danger); }

.sched-lots { margin-top: 6px; font-size: 13px; }

.sched-lots summary { display: flex; align-items: center; min-height: 36px; color: var(--accent); cursor: pointer; }

.sched-lots ul { margin: 0; padding-left: 1.1em; color: var(--text-2); }

.sched-lots li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sched-empty { padding: 12px 0; color: var(--text-3); font-size: 13.5px; }

.sched-sentence { margin: 4px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 14.5px; }

.sched-pick { display: grid; gap: 2px; max-height: 220px; margin: 4px 0 8px; padding: 0; overflow-y: auto; list-style: none; }

.sched-pick .check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ed-actions .ed-delete { margin-right: auto; }

@media (pointer: coarse) {
  .sched-lots summary { min-height: 44px; }
}

/* ---- Статистика: calendar --------------------------------------------------------------------------------------- */

.cal-card { padding: 16px 18px 18px; }

.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

.cal-head .card-title { margin: 0; }

.cal-nav { display: flex; align-items: center; gap: 4px; }

.cal-month { min-width: 150px; font-size: 16px; font-weight: 680; text-align: center; }

.cal-totals { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 10px 0 12px; }

.cal-totals div { display: flex; flex-direction: column; }

.cal-totals dt { color: var(--text-3); font-size: 12px; }

.cal-totals dd { margin: 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }

.cal-wd { padding: 2px 0 4px; color: var(--text-3); font-size: 12px; font-weight: 650; text-align: center; }

.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  min-height: 58px;
  padding: 6px 6px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.cal-cell.is-pad { border-color: transparent; background: none; }

.cal-cell:not(.is-pad):not(:disabled):hover { border-color: var(--line-2); }

.cal-cell:disabled { opacity: 0.35; cursor: default; }

.cal-cell.heat-1 { background: color-mix(in srgb, var(--chart) 12%, var(--surface)); }
.cal-cell.heat-2 { background: color-mix(in srgb, var(--chart) 22%, var(--surface)); }
.cal-cell.heat-3 { background: color-mix(in srgb, var(--chart) 34%, var(--surface)); }
.cal-cell.heat-4 { background: color-mix(in srgb, var(--chart) 48%, var(--surface)); }

.cal-cell.is-today .cal-day { color: var(--accent); }

.cal-cell.is-today { border-color: rgba(143, 176, 255, 0.5); }

.cal-cell.is-picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.cal-day { color: var(--text-2); font-size: 12.5px; font-weight: 650; }

.cal-sum { max-width: 100%; overflow: hidden; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }

.cal-n { color: var(--text-2); font-size: 11px; white-space: nowrap; }

.cal-refund { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }

.cal-day-box { margin-top: 14px; }

.cal-hint { color: var(--text-3); font-size: 13.5px; }

.cal-day-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

.cal-day-head b { font-size: 15px; }

.cal-day-head b::first-letter { text-transform: uppercase; }

.cal-day-head span { color: var(--text-2); font-size: 13.5px; }

.cal-orders { margin: 0; padding: 0; list-style: none; }

.cal-order {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

a.cal-order:hover { background: var(--surface-2); text-decoration: none; }

.cal-o-time { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }

.cal-o-main { display: flex; flex-direction: column; min-width: 0; }

.cal-o-lot { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.cal-o-sub { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.cal-o-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

@media (max-width: 420px) {
  .cal-grid { gap: 3px; }

  .cal-cell { min-height: 50px; padding: 5px 4px; border-radius: 8px; }

  .cal-sum { font-size: 11.5px; }

  .cal-n { display: none; }
}

@media (min-width: 900px) {
  .st-grid .cal-card { grid-column: 1 / -1; }

  .cal-cell { min-height: 72px; padding: 8px; }

  .cal-sum { font-size: 14.5px; }
}

/* ---- Отзывы ---------------------------------------------------------------------------------------------------- */

.rv-list { grid-template-columns: minmax(0, 1fr); }

.rv-list > li { min-width: 0; }

.rv-lot span { flex: 1; min-width: 0; }

.rv-filters { margin: 0 0 12px; }

.rv-filters button { min-width: 0; }

.no-time { display: flex; flex-direction: column; line-height: 1.3; }

.no-day { color: var(--text-2); font-size: 12px; }

.lot-groups { grid-template-columns: minmax(0, 1fr); }

.lot-sub-meta { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.sched-log { margin-top: 4px; }

.cal-short { display: none; }

@media (max-width: 600px) {
  .cal-long { display: none; }

  .cal-short { display: inline; }
}
textarea, input, select, button { font-family: inherit; }
.sheet-actions > :only-child { grid-column: 1 / -1; }

/* Touch screens: the Session 06 audit's 44 px targets. (.switch keeps its 46 px ::after hit area.) */
@media (pointer: coarse) {
  .brand { min-height: 44px; }

  .input-sm { min-height: 44px; }

  .seg button { min-width: 44px; }

  .table-toggle summary { display: flex; align-items: center; min-height: 44px; }

  .order-buyer { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }

  .new-order-more a { display: inline-flex; align-items: center; min-height: 44px; }

  .new-order-more { padding-top: 4px; padding-bottom: 4px; }
}

@media (max-width: 420px) {
  .cal-card { padding-left: 12px; padding-right: 12px; }

  .cal-grid { gap: 2px; }
}
@media (pointer: coarse) { .link-btn { display: inline-flex; align-items: center; min-height: 44px; } }
