/* P2P Price Bot — Design Set V1 tokens from boards 01–02. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ink: #0f172a;
  --mut: #4b5565;
  --line: #e2e6ee;
  --soft: #f6f8fb;
  --soft2: #edf0f5;
  --bg: #f3f5f9;
  --acc: #2f5bea;
  --acc-d: #2447c4;
  --acc-soft: #e8eeff;
  --dng: #b42318;
  --ok: #067647;
  --side: #0b1730;
  --side-t: #b8c4da;
  --side-muted: #8a99b5;
  --sh: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);

  --warning: #8a6d00;
  --warning-soft: #fff4db;
  --warning-border: #f6d58e;
  --danger-soft: #fde8e8;
  --danger-border: #f3b4b0;
  --success-soft: #e4f7ec;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --sidebar-width: 260px;

  /* Semantic surface, text and status tokens. Light values match the original
     colours, so light mode looks the same; the dark block below overrides them. */
  --surf: #fff;
  --surf-2: #fafbfd;
  --row-new: #f8faff;
  --bd2: #cbd2de;
  --mut-2: #98a2b3;
  --mut-3: #64748b;
  --mut-4: #94a3b8;
  --ink-2: #334155;
  --acc-solid: #2563eb;
  --acc-btn: #2f5bea;
  --acc-btn-d: #2447c4;
  --acc-text: #1a3fa8;
  --acc-line: #c3d3ff;
  --acc-3: #7f9cf5;
  --ok-soft: #ecfdf3;
  --ok-line: #b7e4c7;
  --ok-solid: #12b76a;
  --dng-btn: #b42318;
  --dng-solid: #f04438;
  --orange-soft: #fff7ed;
  --orange-line: #fdba74;
  --orange-text: #c2410c;
  --warn-solid: #ca8a04;
  --neutral-seg: #c9d0dc;
  --bg-glass: rgba(243, 245, 249, 0.92);
}

/* Dark theme: js/theme.js sets <html data-theme="dark">. Colours come from the
   "P2P Price Bot - Admin Panel Design (Dark)" board. Every token defined in :root
   must also have a value here (tests/unit/test_theme.py enforces it). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eaf2;
  --ink-2: #c9d1e0;
  --mut: #9aa6bc;
  --mut-2: #8791a8;
  --mut-3: #8a99b5;
  --mut-4: #7a85a0;
  --line: #2a3347;
  --soft: #1a2132;
  --soft2: #232c40;
  --bg: #0d121c;
  --surf: #141b29;
  --surf-2: #0f1522;
  --row-new: #182033;
  --bd2: #36405a;
  --acc: #6c8eff;
  --acc-d: #8faaff;
  --acc-btn: #3a5fe0;
  --acc-btn-d: #2f4fc4;
  --acc-solid: #3a5fe0;
  --acc-soft: #1b2850;
  --acc-line: #2f4690;
  --acc-text: #a9beff;
  --acc-3: #a9beff;
  --dng: #f97066;
  --dng-btn: #d92d20;
  --dng-solid: #f97066;
  --danger-soft: #3b1714;
  --danger-border: #7a271a;
  --ok: #47cd89;
  --ok-soft: #0f2e22;
  --ok-line: #1f6b4a;
  --ok-solid: #32d583;
  --success-soft: #0f2e22;
  --warning: #fedf89;
  --warning-soft: #3a2a0a;
  --warning-border: #7a5a12;
  --warn-solid: #fec84b;
  --orange-soft: #3a2210;
  --orange-line: #7a4a1a;
  --orange-text: #fdb022;
  --neutral-seg: #44506c;
  --bg-glass: rgba(13, 18, 28, 0.92);
  --side: #090d16;
  --side-t: #b8c4da;
  --side-muted: #8a99b5;
  --sh: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 0.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 0.75rem;
}

button,
.button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bd2);
  background: var(--surf);
  color: var(--ink);
  padding: 0 1rem;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.05);
  text-decoration: none;
}

button:hover,
.button:hover,
.button-link:hover {
  background: var(--soft);
  text-decoration: none;
}

button.primary,
.button.primary {
  background: var(--acc-btn);
  border-color: var(--acc-btn);
  color: #fff;
}

button.primary:hover,
.button.primary:hover {
  background: var(--acc-btn-d);
  border-color: var(--acc-btn-d);
}

button.danger,
.button.danger {
  background: var(--dng-btn);
  border-color: var(--dng-btn);
  color: #fff;
}

button.danger:hover,
.button.danger:hover {
  filter: brightness(0.95);
  background: var(--dng-btn);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--mut);
  font-weight: 500;
}

button.ghost:hover {
  background: var(--soft2);
}

button:disabled,
.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input,
select,
textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--bd2);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--surf);
  color: var(--ink);
  min-height: 42px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(47, 91, 234, 0.2);
  border-color: var(--acc-btn);
}

input.invalid {
  border-color: var(--dng-btn);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
  color: var(--ink);
}

.hint,
.mut,
.sub {
  color: var(--mut);
  font-size: 0.88rem;
}

.mono {
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.errors,
.field-error {
  color: var(--dng);
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1.5rem;
}

.inline {
  display: inline;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  background: var(--soft2);
  color: var(--mut);
}

.chip-live {
  background: var(--success-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.chip-critical {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--dng);
}

.chip-warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.chip-info {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-text);
}

/* ——— Auth (board 01) ——— */

body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh);
  padding: 1.35rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--acc-btn);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.auth-card h1 {
  margin-bottom: 0.15rem;
  font-size: 1.45rem;
}

.auth-card .subtitle {
  color: var(--mut);
  margin-bottom: 0.85rem;
}

.auth-alert {
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.auth-alert.warning {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.auth-alert.info {
  background: var(--acc-soft);
  border: 1px solid var(--acc-line);
  color: var(--acc-text);
}

.auth-card button.primary,
.auth-card .button.primary {
  width: 100%;
  margin-top: 1rem;
  min-height: 46px;
  font-size: 0.95rem;
}

.password-row {
  position: relative;
}

.password-row .linkish {
  position: absolute;
  right: 0.65rem;
  top: 2.45rem;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--acc-d);
  padding: 0;
  min-height: auto;
  font-size: 0.85rem;
  font-weight: 600;
}

.linkish {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--acc-d);
  cursor: pointer;
  padding: 0;
  min-height: auto;
  font-weight: 600;
}

.auth-footer-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
}

.otp-boxes {
  display: flex;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

.otp-boxes input {
  text-align: center;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  padding: 0.65rem 0;
  min-height: 46px;
}

.backup-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.backup-list li {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  text-align: center;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0.75rem 0;
}

.qr {
  image-rendering: pixelated;
  width: 220px;
  height: 220px;
}

.secret {
  font-size: 1rem;
  letter-spacing: 0.04em;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
}

.lock-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surf);
  padding: 1rem;
  text-align: center;
  margin: 0.75rem 0;
}

.lock-box strong {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

/* ——— App shell (board 02) ——— */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  background: var(--side);
  color: var(--side-t);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar .brand-row {
  margin: 0;
  padding: 4px 10px 16px;
  color: #fff;
}

.sidebar .brand-name {
  color: #fff;
  font-size: 15px;
}

.nav-group {
  margin: 0;
  padding: 16px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--side-muted);
}

.sidebar a.nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--side-t);
  text-decoration: none;
  min-height: 38px;
  font-weight: 500;
}

.sidebar a.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.sidebar a.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #7c9bff;
}

.nav-count {
  font-size: 11px;
  background: var(--dng-solid);
  color: #fff;
  border-radius: 10px;
  padding: 0 7px;
  font-weight: 700;
  line-height: 18px;
  min-width: 18px;
  text-align: center;
}

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

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(184, 196, 218, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-footer .hint {
  color: var(--side-t);
  font-size: 0.82rem;
}

.sidebar-footer a {
  color: var(--side-t);
  font-size: 0.85rem;
}

.sidebar-footer button.ghost {
  color: var(--side-t);
  justify-content: flex-start;
  padding: 0.35rem 0;
  min-height: auto;
}

.sidebar-footer button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.shell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surf);
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left,
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

/* Top bar (design board: Dashboard > top bar) */
.topbar-title {
  font-size: 15px;
  color: var(--ink);
}

.topbar-bots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mut);
  white-space: nowrap;
}

.topbar-bots .status-dot {
  margin: 0;
}

.topbar-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.topbar-filter {
  margin: 0;
}

.topbar-filter select {
  width: 150px;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  font-size: 13px;
}

.topbar-stop {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.shell-pill {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  color: var(--mut);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}

.status-dot.warn {
  background: #f79009;
}

.status-dot.crit {
  background: var(--dng-btn);
}

.shell-banners {
  padding: 0.65rem 28px 0;
}

.banner {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surf);
}

.banner-critical {
  background: var(--dng-btn);
  border-color: var(--dng-btn);
  color: #fff;
}

.banner-warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.banner-info {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-text);
}

.content {
  padding: 1.15rem 28px 2rem;
}

/* ——— Dashboard (board 02) ——— */

.dash-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}

.pair-filter {
  margin: 0;
  font-size: 0.82rem;
  color: var(--mut);
}

.pair-filter select {
  margin-top: 0.25rem;
  min-width: 140px;
  min-height: 38px;
  padding: 0.35rem 0.65rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surf);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tile-label {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--mut);
  font-weight: 500;
}

.tile-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.tile-sub {
  font-size: 12px;
  color: var(--mut);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surf);
  box-shadow: var(--sh);
  padding: 1.1rem 1.15rem 1.15rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin-bottom: 0.85rem;
}

.attention-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.attention-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--side-muted);
  font-weight: 650;
  padding: 0.35rem 0.5rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

.attention-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.attention-table tr:last-child td {
  border-bottom: none;
}

.attention-table tbody tr:hover td {
  background: var(--surf-2);
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
}

.pair-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--surf);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pair-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.15rem;
}

.pair-card h3 {
  margin: 0;
  font-size: 1rem;
}

.pair-card p {
  margin: 0;
  font-size: 0.9rem;
}

.pair-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

/* Pair cards — design board: Dashboard */
#dash-grid.dash-grid {
  /* Every card has the same height: dashboard.js sets the row height to the tallest card. */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

#bots-grid.bots-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

#bots-grid > .hint {
  grid-column: 1 / -1;
}

#bots-grid .dash-pair-card .pc-actions {
  margin-top: auto;
}

/* The pair cards are direct grid items: the wrapper only groups the rendered HTML. */
.dash-pairs-wrap {
  display: contents;
}

.dash-pairs-wrap > .hint {
  grid-column: 1 / -1;
}

/* Keep the action buttons on the same line across cards of different content. */
.dash-pair-card .pc-actions {
  margin-top: auto;
}

.dash-activity {
  overflow-y: auto;
}

.dash-activity .tl {
  flex: 0 0 auto;
}

/* Recent activity card (design board: timeline) */
.dash-activity .sec-h a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dash-activity .tl {
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-activity .tl li {
  position: relative;
  font-size: 13px;
  line-height: 1.45;
}

.dash-activity .tl li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surf);
  border: 2px solid var(--acc);
}

.dash-activity .tl .t {
  display: block;
  color: var(--mut);
  font-size: 12px;
  margin-top: 2px;
}

.dash-activity .tl b {
  font-weight: 650;
}

.dash-pair-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: var(--surf);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dash-pair-card.hl {
  border: 1.5px solid var(--acc);
  box-shadow: 0 0 0 4px rgba(47, 91, 234, 0.1);
}

.dash-pair-card .pc-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.dash-pair-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.dash-pair-card .chip {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  line-height: 1.6;
  white-space: nowrap;
}

.dash-pair-card .chip {
  text-transform: uppercase;
}

.dash-pair-card .chip.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-line);
}

.dash-pair-card .chip.warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-border);
}

.dash-pair-card .chip.crit {
  background: var(--danger-soft);
  color: var(--dng);
  border-color: var(--danger-border);
}

.dash-pair-card .chip.mut {
  background: var(--soft2);
  color: var(--mut);
  border-color: var(--line);
}

.dash-pair-card .pc-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dash-pair-card .pc-run {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.dash-pair-card .pc-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok-solid);
  margin-right: 6px;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.dash-pair-card .pc-dot.off {
  background: var(--surf);
  border: 2px solid var(--mut-2);
  box-shadow: none;
}

.dash-pair-card .pc-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dash-pair-card .pc-tiles .tile {
  padding: 12px 14px;
}

.dash-pair-card .pc-tiles .tile-value {
  font-size: 22px;
  white-space: nowrap;
}

.dash-pair-card .pc-tiles .tile-sub {
  overflow-wrap: anywhere;
}

.dash-pair-card .pc-kv {
  display: grid;
  grid-template-columns: minmax(110px, 40%) 1fr;
  gap: 8px 12px;
  font-size: 13px;
  margin: 0;
}

.dash-pair-card .pc-kv dt {
  color: var(--mut);
}

.dash-pair-card .pc-kv dd {
  margin: 0;
  font-weight: 600;
  min-width: 0;
}

.dash-pair-card .pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dash-pair-card .pc-actions .button-link,
.dash-pair-card .pc-actions button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.activity-list ul {
  margin: 0;
  padding-left: 1.1rem;
}

.activity-list li {
  margin-bottom: 0.45rem;
}

.usage-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--soft2);
  overflow: hidden;
  margin-top: 0.45rem;
}

.usage-bar > span {
  display: block;
  height: 100%;
  background: var(--acc-btn);
  border-radius: 4px;
}

/* ——— Users (board 15) ——— */

.chip-active {
  background: var(--success-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.chip-invited {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-text);
}

.chip-deactivated {
  background: var(--soft2);
  color: var(--mut);
}

.chip-locked {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--dng);
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.users-main-col,
.users-side-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.users-main h2,
.invite-box h2,
.users-detail h2,
.role-matrix-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.users-footnote {
  margin: 0.25rem 0 0;
}

.chip-2fa-missing {
  background: var(--orange-soft);
  border-color: var(--orange-line);
  color: var(--orange-text);
}

.user-detail-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.user-detail-head h2 {
  margin: 0;
}

.user-meta {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.user-meta div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.user-meta dt {
  margin: 0;
  color: var(--mut);
  font-weight: 500;
}

.user-meta dd {
  margin: 0;
}

.detail-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.detail-actions-row form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.reset-2fa-form input[type="password"] {
  min-height: 38px;
  max-width: 10rem;
}

.deactivate-block {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.deactivate-block .danger {
  width: 100%;
  margin-top: 0.5rem;
}

.detail-audit-note {
  margin: 0.85rem 0 0;
}

.invite-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.role-matrix th {
  width: 7.5rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--ink);
  vertical-align: top;
}

.role-matrix td {
  color: var(--mut);
}

.users-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.users-filters label {
  margin: 0;
}

.users-filters select,
.users-filters input {
  min-height: 38px;
  margin-top: 0.25rem;
}

.users-search {
  flex: 1 1 180px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.users-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--side-muted);
  padding: 0.35rem 0.5rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

.users-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.users-table tr.is-selected td {
  background: var(--acc-soft);
}

.users-table tbody tr:hover td {
  background: var(--surf-2);
}

.invite-form {
  max-width: 420px;
  display: grid;
  gap: 0.65rem;
}

.invite-form label {
  margin: 0;
}

.detail-block {
  margin: 1rem 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.detail-block h3 {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.detail-actions .stacked label {
  margin-top: 0;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}

.role-summary {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--soft);
  border-radius: var(--radius-sm);
}

/* ——— Account (board 18) ——— */

.account-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}

.account-page .kv {
  margin: 0;
}

.account-page .kv > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.account-page .kv dt {
  color: var(--mut);
  font-weight: 500;
}

.account-page .kv dd {
  margin: 0;
}

.stacked.narrow {
  max-width: 360px;
}

.stacked label {
  display: block;
  margin: 0.75rem 0 0.35rem;
}

.sidebar-footer a.active {
  color: #fff;
  font-weight: 600;
}

/* ——— Pair / bots (board 03) ——— */

.bot-bar {
  margin-bottom: 1rem;
}

.bot-bar-card {
  padding: 0.85rem 1rem;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh);
}

.bot-bar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.bot-switcher {
  margin: 0;
  width: 100%;
  max-width: 420px;
  font-size: 0.82rem;
  color: var(--mut);
}

.bot-switcher select {
  margin-top: 0.25rem;
  min-height: 40px;
  width: 100%;
  padding: 0.4rem 0.65rem;
  font-weight: 600;
  color: var(--ink);
}

.bot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.55rem;
}

.bot-tab {
  padding: 0.55rem 0.85rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--mut);
  text-decoration: none;
  font-weight: 550;
}

.bot-tab:hover {
  color: var(--ink);
  background: transparent;
  text-decoration: none;
}

.bot-tab.active {
  background: transparent;
  color: var(--acc-d);
  border-bottom-color: var(--acc);
  font-weight: 650;
}

.bot-bar-note {
  margin: 0;
}

.bot-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.75fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 4.5rem;
}

.bot-page-head {
  margin-bottom: 0.85rem;
}

.bot-page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.bot-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.bot-main-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bot-side-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bot-info-box {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  background: var(--acc-soft);
  border: 1px solid var(--acc-line);
  border-radius: 8px;
  color: var(--acc-text);
  font-size: 0.88rem;
}

.changed-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok-line);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.unsaved-card {
  border-color: var(--acc-line);
  box-shadow: 0 0 0 1px var(--acc-line);
}

.unsaved-list {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.unsaved-cta {
  width: 100%;
}

.reason-inline {
  display: block;
  margin: 0.5rem 0 0;
}

.bot-settings-footer,
.bot-ad-footer {
  justify-content: flex-end;
}

.bot-ad-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: 4.5rem;
}

.bot-ads-table tr.is-selected {
  background: var(--ok-soft);
}

.adopt-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.85rem;
  font-size: 0.9rem;
}

.closed-ad-panel {
  border-color: var(--danger-border);
}

.closed-ad-banner {
  margin: 0 0 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  color: var(--dng);
  font-weight: 550;
}

.cooling-input {
  max-width: 7.5rem;
}

.market-filters {
  margin-bottom: 0.85rem;
}

.chip-ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.chip-crit {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--dng);
}

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

/* ——— System health (board 17) ——— */

.system-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.system-tiles .tile-value {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.load-bar {
  height: 6px;
  margin: 0.45rem 0 0.35rem;
  background: var(--soft2);
  border-radius: 999px;
  overflow: hidden;
}

.load-bar span {
  display: block;
  height: 100%;
  background: var(--acc-btn);
  border-radius: 999px;
}

.db-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
  background: var(--mut);
}

.db-dot.ok {
  background: var(--ok);
}

.db-dot.bad {
  background: var(--dng);
}

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

.chip-warn {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.system-mid-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 0.85rem;
  align-items: start;
}

.system-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.system-event-title {
  font-weight: 550;
}

.retention-dl {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.retention-dl div {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.retention-dl dt {
  margin: 0;
  color: var(--mut);
}

.retention-dl dd {
  margin: 0;
}

.system-log-view {
  max-height: 220px;
  overflow: auto;
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: #0b1730;
  color: #d7e0f2;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.log-card-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.log-inline-filters {
  margin-bottom: 0.5rem;
}

@media (max-width: 1023px) {
  .system-mid-grid {
    grid-template-columns: 1fr;
  }
}

.bot-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-ranges {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surf);
}

.chart-ranges button {
  min-height: 32px;
  min-width: 44px;
  padding: 0 0.75rem;
  font-size: 0.82rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
}

.chart-ranges button + button {
  border-left: 1px solid var(--line);
}

.chart-ranges button.active {
  background: var(--acc-solid);
  border-color: transparent;
  color: #fff;
}

.chart-empty {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px dashed var(--bd2);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.pair-chart {
  width: 100%;
  max-width: 100%;
  height: auto;
  color: var(--acc, #2563eb);
}

.pair-chart .chart-label {
  fill: var(--mut, #64748b);
  font-size: 11px;
}

.settings-form .panel h2 {
  margin-bottom: 0.85rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
}

.settings-grid label {
  margin: 0;
}

.users-table tr.is-selected td,
.attention-table tr.is-selected td {
  background: var(--acc-soft);
}

/* Alerts */
.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surf);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.status-tab:hover {
  background: var(--soft);
}

.status-tab.active {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-d);
}

.tab-count {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--mut);
  background: var(--soft2);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.status-tab.active .tab-count {
  background: var(--surf);
  color: var(--acc-d);
}

.delivery-hint {
  margin: 0 0 1rem;
}

.delivery-box {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.delivery-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.delivery-box h2 {
  margin: 0;
  font-size: 0.95rem;
}

.delivery-box > .hint {
  margin: 0 0 0.65rem;
}

.delivery-table {
  margin: 0;
  background: var(--surf);
}

.delivery-table th,
.delivery-table td {
  padding: 0.4rem 0.65rem;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
  padding: 0.8rem 1.1rem;
  background: var(--acc-soft);
  border-radius: 12px;
  border: 1px solid var(--acc-line);
  color: var(--acc-d);
}

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

.bulk-bar p {
  margin: 0;
  font-size: 0.95rem;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alerts-card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.alerts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.7rem 1rem;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.alerts-toolbar .select-page {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.alerts-toolbar .select-page input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.alerts-toolbar .hint {
  font-size: 0.82rem;
}

.alerts-card .alerts-table {
  margin: 0;
}

.alerts-table th {
  background: var(--soft);
  color: var(--mut);
  padding: 0.85rem 0.75rem;
  white-space: nowrap;
}

.alerts-table td {
  padding: 0.85rem 0.75rem;
  vertical-align: middle;
}

.alerts-table tbody tr:last-child td {
  border-bottom: 0;
}

.alerts-table .col-check {
  width: 2.5rem;
  padding-left: 1rem;
}

.alerts-table .col-check input {
  width: 16px;
  min-height: 0;
  height: 16px;
  margin: 0;
  padding: 0;
}

.alerts-table .pair-cell {
  font-weight: 650;
  white-space: nowrap;
}

.alerts-table .event-cell {
  min-width: 150px;
}

.alerts-table .event-cell a {
  color: inherit;
  text-decoration: none;
}

.alerts-table .event-cell a:hover {
  text-decoration: underline;
}

.alerts-table .details-cell {
  min-width: 170px;
  max-width: 240px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}

.alerts-table .time-cell {
  white-space: nowrap;
}

.alerts-table .num {
  text-align: right;
}

.alerts-table .state-cell {
  min-width: 110px;
}

.alerts-table .col-open {
  text-align: right;
  padding-right: 1rem;
  white-space: nowrap;
}

.alerts-table .col-open a {
  color: var(--mut);
  text-decoration: none;
}

.alerts-table .col-open a:hover {
  color: var(--acc-d);
  text-decoration: underline;
}

.chip-open {
  background: var(--orange-soft);
  border-color: var(--orange-line);
  color: var(--orange-text);
}

.chip-ack {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.pager .pg-range {
  margin-right: 0.5rem;
  color: var(--mut);
  font-size: 0.88rem;
}

.pager .pg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surf);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.pager a.pg:hover {
  background: var(--soft);
}

.pager .pg.pg-wide {
  padding: 0 0.9rem;
}

.pager .pg.active {
  background: var(--acc-btn);
  border-color: var(--acc-btn);
  color: #fff;
  font-weight: 650;
}

.pager .pg-gap {
  color: var(--mut);
  padding: 0 0.2rem;
}

.delivery-card {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem 1.4rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.delivery-card .delivery-box-head {
  margin-bottom: 0.9rem;
}

.delivery-card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.delivery-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.delivery-col p {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 899px) {
  .delivery-cols {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.crumb {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--mut);
}

.alert-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.detail-dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.detail-dl > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 0.5rem;
}

.detail-dl dt {
  margin: 0;
  color: var(--mut);
  font-size: 0.82rem;
  font-weight: 600;
}

.detail-dl dd {
  margin: 0;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.timeline li {
  padding-left: 0.85rem;
  border-left: 2px solid var(--line);
}

.timeline-label {
  font-weight: 650;
}

.ack-form textarea {
  width: 100%;
  margin: 0.35rem 0 0.75rem;
}

.dismiss-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.link-list {
  margin: 0;
  padding-left: 1.1rem;
}

.link-list li {
  margin-bottom: 0.35rem;
}

/* Responsive breakpoints moved to § Phone / tablet (Chunk 23) at file end. */

/* Partners / deals */
.button-link.primary {
  background: var(--acc-btn);
  border-color: var(--acc-btn);
  color: #fff;
}

.button-link.primary:hover {
  background: var(--acc-btn-d);
  border-color: var(--acc-btn-d);
  color: #fff;
}

.chip-active {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.chip-scheduled {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-d);
}

.chip-ended {
  background: var(--soft2);
  border-color: var(--line);
  color: var(--mut);
}

.deal-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 4.5rem;
}

.deal-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.deal-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.deal-problem-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: 10px;
  color: var(--warning);
  font-weight: 550;
}

.deal-quota-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surf);
  overflow: hidden;
}

.input-unit input {
  border: 0 !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
}

.input-unit .unit {
  padding: 0 0.65rem;
  color: var(--mut);
  background: var(--soft);
  border-left: 1px solid var(--line);
  align-self: stretch;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

input.is-invalid,
.input-unit:has(input.is-invalid) {
  border-color: var(--dng-solid);
}

.input-unit:has(input.is-invalid) {
  box-shadow: 0 0 0 1px var(--danger-border);
}

.deal-side-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.deal-terms-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--mut);
  font-size: 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.deal-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.deal-checks li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.9rem;
}

.deal-checks .check-mark {
  width: 1.1rem;
  font-weight: 700;
  flex: none;
}

.check-ok {
  color: var(--ok, #067647);
}

.check-bad {
  color: var(--dng, #b42318);
}

.deal-edit-notice {
  padding: 0.85rem 1rem;
  background: var(--acc-soft);
  border: 1px solid var(--acc-line);
  border-radius: 10px;
  color: var(--acc-text);
  font-size: 0.9rem;
}

.deal-form-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  background: rgba(243, 245, 249, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.deal-form-footer .primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.deal-locked {
  margin: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.partner-actions details {
  position: relative;
}

.partner-actions .inline-edit {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--soft);
  border-radius: 8px;
  border: 1px solid var(--line);
  min-width: 220px;
}

.range-switch {
  display: flex;
  gap: 0.25rem;
}

.range-switch button {
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.range-switch button.active {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-d);
}

.qo-chart {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  background: var(--soft);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.log-view {
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.end-deal summary {
  cursor: pointer;
  list-style: none;
}

.danger-link {
  color: var(--dng);
  border-color: var(--danger-border);
}

.end-form {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surf);
  min-width: 240px;
}

.deals-table {
  font-size: 0.85rem;
}

/* Partners and deals — table cards, row buttons, dialogs */
.table-card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

.table-card .users-table {
  margin: 0;
}

.table-card .users-table th {
  background: var(--soft);
  color: var(--mut);
  padding: 0.8rem 0.6rem;
  white-space: nowrap;
}

.table-card .users-table td {
  padding: 0.8rem 0.6rem;
}

.table-card .users-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-card .users-table th.num,
.table-card .users-table td.num {
  text-align: right;
  white-space: nowrap;
}

.table-card .name-cell {
  font-weight: 650;
}

.table-card .period-cell {
  white-space: nowrap;
}

/* Open / Edit stay in view when a wide table scrolls sideways. */
.table-card .col-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  text-align: right;
  white-space: nowrap;
  padding-right: 1rem;
  background: var(--surf);
  box-shadow: -10px 0 10px -10px rgba(16, 24, 40, 0.18);
}

.table-card .users-table th.col-actions {
  background: var(--soft);
}

.table-note {
  margin: 0.75rem 0 0;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.btn-sm,
button.btn-sm,
.button-link.btn-sm {
  min-height: 32px;
  padding: 0 0.8rem;
  font-size: 0.85rem;
}

button.text-btn {
  min-height: 0;
  padding: 0.2rem 0.45rem;
  border: 0;
  box-shadow: none;
  background: none;
  color: var(--acc-d);
  font-size: 0.85rem;
  font-weight: 600;
}

button.text-btn:hover {
  background: var(--soft);
  text-decoration: underline;
}

button.text-btn.danger-text {
  color: var(--dng);
}

button.link-btn {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
  color: var(--ink);
  font-weight: 650;
  text-align: left;
}

button.link-btn:hover {
  background: none;
  color: var(--acc-d);
  text-decoration: underline;
}

.app-dialog {
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surf);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.app-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.app-dialog .dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.app-dialog .dialog-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.app-dialog .dialog-head .hint {
  margin: 0;
}

.app-dialog .dialog-x {
  flex: 0 0 auto;
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
}

.app-dialog .dialog-form {
  display: grid;
  gap: 0.1rem;
}

.app-dialog .dialog-form label {
  margin: 0.6rem 0 0;
}

.app-dialog .dialog-form label input {
  margin-top: 0.3rem;
}

.app-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.app-dialog .dialog-facts {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.4rem 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.app-dialog .dialog-facts dt {
  color: var(--mut);
}

.app-dialog .dialog-facts dd {
  margin: 0;
}

.app-dialog .dialog-deals {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.app-dialog .dialog-deals li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.app-dialog .dialog-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.app-dialog .dialog-secondary form {
  margin: 0;
}

@media (max-width: 599px) {
  .table-card {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .table-card .col-actions {
    position: static;
    box-shadow: none;
    background: transparent;
  }

  .app-dialog {
    width: calc(100vw - 1rem);
    padding: 1.1rem 1rem;
  }

  .app-dialog .dialog-facts {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .app-dialog .dialog-secondary {
    flex-direction: column;
    align-items: stretch;
  }
}


/* Reports */
.is-hidden {
  display: none !important;
}

.mode-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 140px;
  margin: 0.75rem 0 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.mode-day {
  flex: 1 1 36px;
  min-width: 28px;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.mode-stack {
  width: 100%;
  height: 120px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft2);
  border: 1px solid var(--line);
}

.mode-stack .seg {
  display: block;
  min-height: 0;
  width: 100%;
}

.seg-at { background: var(--ok); }
.seg-pp { background: var(--acc); }
.seg-cool { background: var(--warn-solid); }
.seg-lim { background: var(--dng); }
.seg-stop { background: var(--mut-3); }
.seg-behind { background: var(--mut-4); }

.mode-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.mode-legend .leg {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.report-tabs {
  margin-bottom: 1rem;
}

.audit-layout {
  align-items: start;
}

.audit-table tr.audit-group td {
  background: var(--soft);
}

.audit-detail-panel {
  position: sticky;
  top: 1rem;
}

/* Board 19 — confirm dialogs */
.confirm-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-width: 420px;
  box-shadow: var(--sh);
  background: var(--surf);
  color: var(--ink);
}
.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.confirm-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.confirm-dialog .confirm-reason {
  display: block;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}
.confirm-dialog .confirm-reason input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}
.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ——— Phone / tablet layout (Chunk 23 · Tech Spec §10) ———
   Phone ≤599 · Tablet 600–1023 · PC ≥1024 */

.nav-toggle,
.nav-close,
.nav-backdrop {
  display: none;
}

.nav-toggle {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surf);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--ink);
  border-radius: 1px;
}

.nav-close {
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.otp-code {
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  text-align: center;
  min-height: 48px;
  font-variant-numeric: tabular-nums;
}

/* Tablet: collapsed sidebar with short labels */
@media (max-width: 1023px) and (min-width: 600px) {
  :root {
    --sidebar-width: 88px;
  }

  .app-shell {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .sidebar {
    padding: 12px 6px;
    overflow-x: hidden;
  }

  .sidebar .brand-name,
  .nav-group,
  .sidebar-footer .hint br,
  .sidebar-footer .hint {
    display: none;
  }

  .sidebar .brand-row {
    justify-content: center;
    padding: 8px 0 12px;
  }

  .sidebar a.nav-link {
    justify-content: center;
    padding: 10px 4px;
    min-height: 44px;
    font-size: 0.68rem;
    text-align: center;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar a.nav-link {
    font-size: 0;
  }

  .sidebar a.nav-link::before {
    content: attr(data-short);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.02em;
  }

  .sidebar a.nav-link .nav-count {
    font-size: 10px;
  }

  .sidebar-footer a,
  .sidebar-footer button {
    font-size: 0.7rem;
    text-align: center;
  }

  .topbar-user {
    display: none;
  }

  .users-layout,
  .alert-detail-grid,
  .deal-form-grid,
  .bot-columns,
  .bot-page-grid,
  .audit-layout {
    grid-template-columns: 1fr;
  }

  .deal-quota-grid,
  .settings-grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar,
  .content,
  .shell-banners {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Phone */
@media (max-width: 599px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(100vw, 320px);
    max-width: 100%;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    padding-bottom: 2rem;
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.45);
  }

  .nav-backdrop[hidden] {
    display: none !important;
  }

  body.nav-lock {
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .topbar-left,
  .topbar-right {
    gap: 0.4rem;
  }

  .topbar-user {
    display: none;
  }

  .shell-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
  }

  .topbar-stop {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .content,
  .shell-banners {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Dashboard phone board 21 */
  .tiles {
    grid-template-columns: 1fr 1fr;
  }

  .dash-actions {
    width: 100%;
  }

  .dash-actions form,
  .dash-actions button {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .pair-card,
  .dash-pair-card {
    width: 100%;
  }

  .users-layout,
  .alert-detail-grid,
  .deal-form-grid,
  .bot-columns,
  .audit-layout,
  .report-layout {
    grid-template-columns: 1fr;
  }

  /* Touch targets + no iOS zoom */
  button,
  .button,
  a.button-link,
  .range-switch button,
  input[type="checkbox"] {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }

  /* Tables → cards (no sideways scroll at 360px) */
  table.phone-stack,
  table.users-table,
  table.deals-table,
  table.alerts-table,
  table.audit-table,
  table.attention-table {
    display: block;
    width: 100%;
    border: 0;
  }

  table.phone-stack thead,
  table.users-table thead,
  table.deals-table thead,
  table.alerts-table thead,
  table.audit-table thead,
  table.attention-table thead {
    display: none;
  }

  table.phone-stack tbody,
  table.users-table tbody,
  table.deals-table tbody,
  table.alerts-table tbody,
  table.audit-table tbody,
  table.attention-table tbody {
    display: block;
  }

  table.phone-stack tr,
  table.users-table tr,
  table.deals-table tr,
  table.alerts-table tr,
  table.audit-table tr,
  table.attention-table tr {
    display: block;
    margin: 0 0 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surf);
    box-shadow: var(--sh);
  }

  table.phone-stack td,
  table.users-table td,
  table.deals-table td,
  table.alerts-table td,
  table.audit-table td,
  table.attention-table td {
    display: none;
    padding: 0.35rem 0;
    border: 0;
    text-align: right;
  }

  table.phone-stack td:first-child,
  table.users-table td:first-child,
  table.deals-table td:first-child,
  table.alerts-table td:first-child,
  table.audit-table td:first-child,
  table.attention-table td:first-child {
    display: block;
    text-align: left;
    font-weight: 650;
    font-size: 1rem;
    margin-bottom: 0.35rem;
  }

  table.phone-stack td:nth-child(2),
  table.phone-stack td:nth-child(3),
  table.phone-stack td:nth-child(4),
  table.phone-stack td:nth-child(5),
  table.users-table td:nth-child(2),
  table.users-table td:nth-child(3),
  table.users-table td:nth-child(4),
  table.users-table td:nth-child(5),
  table.deals-table td:nth-child(2),
  table.deals-table td:nth-child(3),
  table.deals-table td:nth-child(4),
  table.deals-table td:nth-child(5),
  table.alerts-table td:nth-child(2),
  table.alerts-table td:nth-child(3),
  table.alerts-table td:nth-child(4),
  table.alerts-table td:nth-child(5),
  table.audit-table td:nth-child(2),
  table.audit-table td:nth-child(3),
  table.audit-table td:nth-child(4),
  table.audit-table td:nth-child(5),
  table.attention-table td:nth-child(2),
  table.attention-table td:nth-child(3),
  table.attention-table td:nth-child(4),
  table.attention-table td:nth-child(5) {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
  }

  table.phone-stack td::before,
  table.users-table td::before,
  table.deals-table td::before,
  table.alerts-table td::before,
  table.audit-table td::before,
  table.attention-table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--mut);
    text-align: left;
    flex: 0 1 45%;
  }

  table.phone-stack td:first-child::before,
  table.users-table td:first-child::before,
  table.deals-table td:first-child::before,
  table.alerts-table td:first-child::before,
  table.audit-table td:first-child::before,
  table.attention-table td:first-child::before {
    content: none;
  }

  table.phone-stack tr.is-expanded td,
  table.users-table tr.is-expanded td,
  table.deals-table tr.is-expanded td,
  table.alerts-table tr.is-expanded td,
  table.audit-table tr.is-expanded td,
  table.attention-table tr.is-expanded td {
    display: flex;
    justify-content: space-between;
  }

  table.phone-stack tr.is-expanded td:first-child,
  table.users-table tr.is-expanded td:first-child,
  table.deals-table tr.is-expanded td:first-child,
  table.alerts-table tr.is-expanded td:first-child,
  table.audit-table tr.is-expanded td:first-child,
  table.attention-table tr.is-expanded td:first-child {
    display: block;
  }

  /* Alert detail: ack without scrolling to bottom */
  .alert-detail-side {
    order: -1;
  }

  .alert-detail-grid {
    display: flex;
    flex-direction: column;
  }

  /* Confirm dialogs → full-width sheets */
  .confirm-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border: 0;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    position: fixed;
    bottom: 0;
    top: auto;
    max-height: 90vh;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions button {
    width: 100%;
  }

  .confirm-dialog .confirm-actions #confirm-cancel:focus {
    outline: 2px solid var(--acc);
  }

  /* Auth */
  .auth-card {
    margin: 1rem;
    max-width: none;
    width: auto;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 0.75rem 0;
    z-index: 5;
  }
}

/* —— Pair detail (board 03) —— */
.page-bot-overview .pair-detail {
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.page-bot-overview .pair-detail > .bot-bar {
  margin-bottom: 0;
}

.pair-detail-header {
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0;
}

.pair-detail-header .dash-title-row {
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.pair-detail-header h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.pair-banners {
  padding: 0;
  margin: 0;
}

.pair-banners:empty {
  display: none;
}

.pair-banners .pair-banner,
.pair-banners .banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0;
}

.pair-banners .banner-text {
  flex: 1 1 240px;
  min-width: 0;
  line-height: 1.45;
}

.pair-banners .banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
}

.pair-banners .banner-critical .button-link {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.82rem;
}

.pair-tiles {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0;
}

.pair-tile {
  overflow: hidden;
  min-width: 0;
  padding: 0.85rem 0.95rem;
}

.pair-tile .tile-value {
  font-size: clamp(1.05rem, 1.35vw, 1.4rem);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
}

.pair-tile .tile-sub {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

/* Board 03 body — also enforced inline in overview.html */
.b03-body,
.pair-body-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}

.b03-main,
.pair-col-main {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.b03-side,
.pair-col-side {
  flex: 0 0 300px;
  width: 300px;
  max-width: 300px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pair-panel,
.pair-side-card {
  min-width: 0;
  overflow: hidden;
  margin-bottom: 0;
}

.pair-side-card {
  padding: 0.95rem 1rem;
}

.pair-side-card > h2,
.pair-panel > h2,
.pair-chart-head h2,
.pair-actions-head h2 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
  font-weight: 650;
}

.pair-panel-hint {
  margin: 0 0 0.7rem;
}

.pair-side-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: inherit;
}

.pair-panel .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pair-actions-head {
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.pair-control-dl {
  margin-bottom: 0.85rem;
}

.pair-control-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pair-control-form {
  margin: 0;
  width: 100%;
}

.pair-control-btn {
  width: 100%;
  min-height: 42px;
  justify-content: center;
}

.pair-control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pair-foot-note {
  margin: 0;
}

.pair-rank-table,
.pair-actions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.pair-rank-table th,
.pair-actions-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--side-muted);
  font-weight: 650;
  padding: 0.4rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.pair-rank-table td,
.pair-actions-table td {
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-rank-table th:nth-child(1),
.pair-rank-table td:nth-child(1) {
  width: 3.2rem;
}

.pair-rank-table th:nth-child(2),
.pair-rank-table td:nth-child(2) {
  width: 4.5rem;
}

.pair-rank-table th:nth-child(4),
.pair-rank-table td:nth-child(4),
.pair-rank-table th:nth-child(5),
.pair-rank-table td:nth-child(5) {
  width: 6.5rem;
  font-variant-numeric: tabular-nums;
}

.pair-rank-table th:nth-child(6),
.pair-rank-table td:nth-child(6) {
  width: 7rem;
}

.pair-rank-table th:nth-child(7),
.pair-rank-table td:nth-child(7) {
  width: 4.5rem;
}

.pair-rank-table tr.is-ours {
  background: var(--acc-soft);
}

.pair-rank-table tr.is-ours td {
  font-weight: 550;
}

.pair-rank-table tr.is-excluded td {
  color: var(--mut);
}

.pair-rank-table .ad-cell {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
}

.role-chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-managed {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-text);
}

.role-partner {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.role-competitor {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink-2);
}

.role-excluded {
  background: var(--orange-soft);
  border-color: var(--orange-line);
  color: var(--orange-text);
}

.pair-chart-head {
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.pair-chart-panel .pair-chart-head {
  margin-bottom: 0.75rem;
}

.pair-chart-box {
  width: 100%;
  min-width: 0;
  margin-bottom: 0.35rem;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.pair-chart-hint {
  margin: 0 0 0.45rem;
}

.pair-chart-clickable {
  cursor: zoom-in;
  border-radius: 6px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pair-chart-clickable:hover,
.pair-chart-clickable:focus-visible {
  background: rgba(37, 99, 235, 0.04);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
  outline: none;
}

.pair-chart {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.pair-chart-lightbox {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(1100px, 96vw);
  max-height: 92vh;
  background: var(--surf);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.pair-chart-lightbox::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.pair-chart-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.pair-chart-lightbox-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.pair-chart-lightbox-body {
  padding: 1rem 1.1rem 1.25rem;
  overflow: auto;
  max-height: calc(92vh - 4rem);
}

.pair-chart-lightbox-body .pair-chart {
  pointer-events: auto;
  min-height: 320px;
  height: min(58vh, 520px);
}

.pair-chart-legend {
  margin-top: 0.15rem;
}

.b03-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.35rem;
}

.b03-legend .leg,
.pair-chart-legend .leg {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.b03-legend .leg::before,
.pair-chart-legend .leg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.95rem;
  height: 2px;
  background: currentColor;
}

.leg-ours {
  color: var(--acc-solid);
}

.leg-ours::before {
  background: var(--acc-solid);
}

.leg-best {
  color: var(--mut-3);
}

.leg-best::before {
  border-top: 2px dashed var(--mut-4);
  background: transparent !important;
  height: 0;
}

.leg-min {
  color: #e11d48;
}

.leg-min::before {
  border-top: 2px dashed #e11d48;
  background: transparent !important;
  height: 0;
}

.leg-max {
  color: #f97316;
}

.leg-max::before {
  border-top: 2px dashed #f97316;
  background: transparent !important;
  height: 0;
}

.b03-chart-note {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
}

.deal-card {
  min-width: 0;
}

.deal-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.deal-q-label {
  margin-bottom: 0.25rem;
}

.deal-q-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--soft2);
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.deal-q-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--acc-solid), #60a5fa);
  border-radius: inherit;
  max-width: 100%;
}

.deal-q-vals {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--mut);
  margin-bottom: 0.75rem;
}

.deal-dl {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.deal-dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 0.5rem;
  align-items: baseline;
  min-width: 0;
}

.deal-dl dt {
  margin: 0;
  color: var(--mut);
  font-size: 0.78rem;
}

.deal-dl dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.pair-cool-list,
.pair-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.pair-cool-list li,
.pair-alert-list li {
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pair-actions-table th:nth-child(1),
.pair-actions-table td:nth-child(1) {
  width: 5rem;
}

.pair-actions-table th:nth-child(3),
.pair-actions-table td:nth-child(3),
.pair-actions-table th:nth-child(4),
.pair-actions-table td:nth-child(4) {
  width: 5.5rem;
  font-variant-numeric: tabular-nums;
}

.pair-actions-table td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .pair-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .b03-body,
  .pair-body-grid {
    flex-direction: column;
  }

  .b03-side,
  .pair-col-side {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .pair-rank-table,
  .pair-actions-table {
    table-layout: auto;
    min-width: 560px;
  }
}

@media (max-width: 720px) {
  .pair-tile .tile-value {
    font-size: 1.05rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}


/* ── Deal detail: balances chart, deal terms, deal history ── */
.balances-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.balances-head h2 {
  margin: 0;
}

.balances-card .range-switch {
  gap: 0;
  padding: 3px;
  background: var(--soft2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.balances-card .range-switch button {
  border: 0;
  background: transparent;
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.85rem;
  color: var(--mut);
  font-weight: 600;
  box-shadow: none;
}

.balances-card .range-switch button.active {
  background: var(--surf);
  color: var(--ink);
  box-shadow: var(--sh);
}

.balances-sub {
  margin: 0.4rem 0 0.6rem;
}

.qo-wrap {
  min-height: 120px;
}

.qo-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.qo-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.qo-axis {
  fill: var(--mut);
  font-size: 11px;
}

.qo-band {
  fill: rgba(47, 91, 234, 0.13);
}

.qo-line {
  fill: none;
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.qo-line.qo-q,
.qo-dot.qo-q {
  stroke: var(--ink);
  fill: var(--ink);
}

.qo-line.qo-q {
  fill: none;
}

.qo-line.qo-o,
.qo-dot.qo-o {
  stroke: var(--mut-3);
  fill: var(--mut-3);
}

.qo-line.qo-o {
  fill: none;
  stroke-dasharray: 6 4;
}

.qo-breach-line {
  stroke: var(--dng);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

.qo-breach-dot {
  fill: var(--dng);
  stroke: #fff;
  stroke-width: 1.5;
}

.qo-empty {
  margin: 0;
  padding: 2.25rem 0.5rem;
  text-align: center;
  background: var(--soft);
  border-radius: var(--radius-sm);
}

.qo-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--mut);
}

.qo-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.lg-line {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2.25px solid var(--ink);
}

.lg-line.lg-o {
  border-top: 2.25px dashed var(--mut-3);
}

.lg-band {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 2px;
  background: rgba(47, 91, 234, 0.2);
}

.lg-breach {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dng-btn);
}

.held-block {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.held-block h3 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
}

.held-bar {
  display: flex;
  height: 14px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--soft2);
}

.held-seg {
  display: block;
  height: 100%;
  transition: width 0.3s ease;
}

.held-us {
  background: var(--acc-btn);
}

.held-partner {
  background: var(--warn-solid);
}

.held-other {
  background: var(--neutral-seg);
}

.held-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.6rem 0 0;
  padding: 0;
  font-size: 0.85rem;
}

.held-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.held-legend b {
  font-weight: 650;
}

.held-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.held-note {
  margin: 0.5rem 0 0;
}

.terms-dl {
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.terms-dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.terms-dl dt {
  margin: 0;
  color: var(--mut);
  font-size: 0.88rem;
}

.terms-dl dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}

.terms-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.9rem 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.history-list li {
  position: relative;
  padding: 0 0 1.1rem 1.5rem;
}

.history-list li:last-child {
  padding-bottom: 0.2rem;
}

.history-list li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}

.history-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--acc-btn);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.history-text {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-meta {
  color: var(--mut);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}

.history-link {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
}

/* ── Deal form (New / Edit deal) — board 06 ── */
.deal-form-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.deal-form-head p {
  margin: 0 0 1rem;
}

.deal-form-grid {
  padding-bottom: 1.5rem;
}

.deal-form .stack-grid {
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.deal-form .deal-quota-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deal-form label {
  font-weight: 600;
  font-size: 0.85rem;
}

.deal-form .field-hint {
  display: block;
  margin-top: 0.3rem;
  font-weight: 400;
  font-size: 0.8rem;
}

.deal-form .field-error {
  margin: 0.3rem 0 0;
  font-weight: 500;
  font-size: 0.8rem;
}

.deal-form .deal-note,
.deal-side-col .deal-note {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
}

.deal-form input:disabled {
  background: var(--soft);
  color: var(--mut);
}

.deal-form-footer {
  position: static;
  justify-content: flex-end;
  background: transparent;
  border-top: 0;
  backdrop-filter: none;
  padding: 0.25rem 0 0;
}

.deal-terms-card {
  background: var(--soft);
}

.deal-terms-intro {
  margin: 0 0 0.7rem;
  font-weight: 600;
  color: var(--mut);
  font-size: 0.88rem;
}

.terms-rows {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.terms-rows > div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.terms-rows dt {
  margin: 0;
  color: var(--mut);
  font-size: 0.82rem;
  font-weight: 600;
}

.terms-rows dd {
  margin: 0;
  font-weight: 650;
  font-size: 0.85rem;
}

.deal-checks {
  list-style: disc;
  padding-left: 1.1rem;
  gap: 0.5rem;
}

.deal-checks li {
  display: list-item;
  font-size: 0.88rem;
  color: var(--ink);
}

.deal-checks .check-state {
  font-weight: 700;
}

.deal-checks li.check-bad .check-state {
  color: var(--ink);
}

.deal-edit-notice {
  margin: 0;
  background: var(--acc-soft);
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--acc-text);
  font-weight: 600;
  font-size: 0.88rem;
}

@media (max-width: 599px) {
  .deal-form .deal-quota-grid {
    grid-template-columns: 1fr;
  }

  .terms-rows > div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ── Reports (board 09) ── */
.rp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.5rem;
  margin: 0 0 1.1rem;
  border-bottom: 1px solid var(--line);
}

.rp-tab {
  position: relative;
  padding: 0.55rem 0.1rem 0.7rem;
  color: var(--mut);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.rp-tab:hover {
  color: var(--ink);
}

.rp-tab.active {
  color: var(--acc-d);
  border-bottom-color: var(--acc);
}

.rp-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 0 0 1.1rem;
}

.rp-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mut);
}

.rp-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mut);
}

.rp-field select,
.rp-field input[type="date"] {
  min-height: 38px;
  min-width: 150px;
  margin: 0;
  font-weight: 500;
}

.rp-field input[type="date"]:disabled {
  background: var(--soft2);
  color: var(--ink);
  opacity: 1;
  cursor: default;
}

.rp-seg {
  display: inline-flex;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surf);
}

.rp-seg label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  margin: 0;
  padding: 0 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  position: relative;
}

.rp-seg label + label {
  border-left: 1px solid var(--line);
}

.rp-seg label.active {
  background: var(--acc-btn);
  color: #fff;
}

.rp-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.rp-seg label:focus-within {
  outline: 2px solid var(--acc);
  outline-offset: -2px;
}

.rp-apply {
  min-height: 38px;
}

.rp-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 1rem;
}

.rp-tile {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--sh);
}

.rp-tile-label {
  font-size: 0.8rem;
  color: var(--mut);
  font-weight: 600;
}

.rp-tile-value {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
}

.rp-tile-sub {
  font-size: 0.78rem;
  color: var(--mut);
}

.rp-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.rp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.rp-card-head .hint {
  margin: -0.5rem 0 0.85rem;
}

.rp-small {
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
}

.rp-chart {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 0.5rem;
}

.rp-yaxis {
  height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  font-size: 0.75rem;
  color: var(--mut);
  line-height: 0;
}

.rp-yaxis span {
  display: block;
}

.rp-plot {
  position: relative;
  min-width: 0;
}

.rp-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rp-grid i {
  display: block;
  border-top: 1px solid var(--line);
}

.rp-cols {
  position: relative;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
}

.rp-col {
  flex: 1 1 0;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.rp-bar {
  height: 220px;
  display: flex;
  flex-direction: column-reverse;
  width: min(100%, 72px);
  margin: 0 auto;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}

.rp-bar .rp-s {
  flex-basis: 0;
  flex-shrink: 1;
  min-height: 0;
  display: block;
  width: 100%;
}

.rp-bar .seg-at,
.rp-dot.seg-at { background: var(--acc); }
.rp-bar .seg-pp,
.rp-dot.seg-pp { background: var(--acc-3); }
.rp-bar .seg-cool,
.rp-dot.seg-cool { background: var(--warn-solid); }
.rp-bar .seg-lim,
.rp-dot.seg-lim { background: var(--dng-solid); }
.rp-bar .seg-stop,
.rp-dot.seg-stop { background: var(--mut-2); }
.rp-bar .seg-behind,
.rp-dot.seg-behind { background: var(--neutral-seg); }

.rp-xl {
  display: block;
  margin-top: 0.4rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--mut);
  white-space: nowrap;
}

.rp-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.85rem 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--mut);
}

.rp-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.rp-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.rp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rp-table thead th {
  background: var(--soft);
  color: var(--mut);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 0.65rem 0.9rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.rp-table tbody th,
.rp-table tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.rp-table tbody th {
  font-weight: 650;
}

.rp-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rp-table tbody tr:last-child th,
.rp-table tbody tr:last-child td {
  border-bottom: 0;
}

.rp-table tr.rp-total th,
.rp-table tr.rp-total td {
  background: var(--acc-soft);
  font-weight: 700;
}

.rp-empty,
.rp-empty-cell {
  color: var(--mut);
  text-align: center;
  padding: 1.75rem 1rem;
  margin: 0;
}

.rp-foot {
  margin: 0.7rem 0 0;
  text-align: right;
  font-size: 0.78rem;
  color: var(--mut);
}

@media (max-width: 1100px) {
  .rp-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .rp-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rp-field,
  .rp-field select,
  .rp-field input[type="date"] {
    width: 100%;
  }

  .rp-seg {
    width: 100%;
  }

  .rp-seg label {
    flex: 1;
    justify-content: center;
    padding: 0 0.4rem;
  }

  .rp-apply {
    width: 100%;
  }

  .rp-chart {
    grid-template-columns: 36px minmax(0, 1fr);
  }
}

@media (min-width: 1360px) {
  .rp-filters {
    display: grid;
    grid-template-columns: 130px 130px max-content minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem 1rem;
  }

  .rp-field select,
  .rp-field input[type="date"] {
    min-width: 0;
    width: 100%;
  }

  .rp-apply {
    grid-column: 1;
    justify-self: start;
  }
}

.rp-hint {
  grid-column: 2 / -1;
  align-self: center;
  margin: 0;
  font-size: 0.8rem;
  color: var(--mut);
}

.rp-note {
  margin: -0.35rem 0 1rem;
  padding: 0.6rem 0.85rem;
  background: var(--acc-soft);
  border-radius: var(--radius-sm);
  color: var(--acc-text);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Board 16 — Audit log */
.aud-filters-card {
  padding: 1rem 1.15rem;
}

.aud-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.aud-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink);
}

.aud-field select,
.aud-field input {
  min-height: 38px;
  min-width: 158px;
  margin: 0;
  font-weight: 500;
}

.aud-search-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}

.aud-search {
  flex: 1 1 auto;
}

.aud-search input {
  width: 100%;
  background: var(--soft);
}

.aud-apply {
  min-height: 38px;
  padding: 0.4rem 1.1rem;
}

.aud-target-note {
  margin: 0.6rem 0 0;
}

.aud-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 1rem;
  align-items: start;
}

.aud-entries h2,
.aud-side h2 {
  font-size: 1rem;
  margin: 0 0 0.85rem;
}

.aud-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.aud-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.aud-table thead th {
  background: var(--soft);
  color: var(--mut);
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 0.65rem 0.75rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.aud-table tbody td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.aud-table tbody tr:last-child td {
  border-bottom: 0;
}

.aud-table td:first-child {
  white-space: nowrap;
}

.aud-table td:first-child a {
  color: inherit;
  text-decoration: none;
}

.aud-table td:last-child {
  white-space: nowrap;
}

.aud-table tr.aud-row {
  cursor: pointer;
}

.aud-table tr.aud-row:hover td {
  background: var(--soft);
}

.aud-table tr.audit-group td {
  background: transparent;
}

.aud-table tr.aud-row.is-selected td {
  background: var(--acc-soft);
}

.aud-row-hint {
  display: block;
  color: var(--mut);
  font-size: 0.74rem;
  margin-top: 0.15rem;
}

.aud-empty {
  color: var(--mut);
  text-align: center;
  padding: 1.5rem 1rem;
}

.aud-count {
  margin: 0.85rem 0 0.6rem;
  font-size: 0.78rem;
}

.aud-pager {
  display: flex;
  gap: 0.5rem;
}

.aud-pager a.button-link,
.aud-pager button {
  min-height: 34px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.aud-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.aud-side .panel {
  margin-bottom: 0;
}

.aud-dl {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
}

.aud-dl > div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.28rem 0;
}

.aud-dl dt {
  color: var(--ink);
  font-weight: 500;
}

.aud-dl dd {
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.aud-dl dd a {
  color: inherit;
}

.aud-note {
  margin: 0;
  color: var(--mut);
  font-size: 0.75rem;
  font-weight: 600;
}

.aud-note-strong {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .aud-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .aud-field,
  .aud-field select,
  .aud-field input {
    width: 100%;
    min-width: 0;
  }

  .aud-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .aud-table {
    min-width: 0;
  }

  .aud-table-wrap {
    border: 0;
  }
}
/* Board 10 — Pair settings */
.bot-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 1rem;
  margin-bottom: 0.6rem;
}

.bot-bar-row .bot-switcher {
  width: auto;
  max-width: 260px;
  flex: 0 1 260px;
}

.bot-switcher-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

.bot-all-link {
  align-self: center;
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: var(--mut);
  text-decoration: none;
}

.bot-all-link:hover {
  color: var(--ink);
}

.bot-bar-row .bot-tabs {
  margin: 0 0 0 auto;
  border-bottom: 0;
  align-self: center;
  padding-top: 1.1rem;
}

.ps-head {
  margin: 0.25rem 0 1rem;
}

.ps-head h1 {
  font-size: 1.35rem;
}

.ps-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.95fr);
}

.ps-card {
  padding: 1.1rem 1.25rem 1.25rem;
}

.ps-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.25rem;
}

.ps-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.ps-field > label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

.ps-field select,
.ps-field > input,
.ps-field .input-unit input {
  margin: 0;
  min-height: 38px;
  width: 100%;
}

.ps-field input:disabled,
.ps-field select:disabled {
  background: var(--soft);
  color: var(--ink);
  opacity: 1;
}

.ps-field.is-changed select,
.ps-field.is-changed > input,
.ps-field.is-changed .input-unit {
  border-color: var(--acc-btn);
  box-shadow: 0 0 0 1px var(--acc);
}

.ps-field.is-changed .input-unit input {
  border-color: transparent;
  box-shadow: none;
}

.ps-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--mut);
  line-height: 1.35;
}

.ps-hint-text:empty {
  display: none;
}

.ps-hint .changed-pill {
  margin-left: 0;
  font-size: 0.62rem;
}

.ps-hint .changed-pill[hidden],
.ps-hint .ps-was[hidden] {
  display: none;
}

.ps-inr:empty {
  display: none;
}

.ps-info {
  margin-top: 1rem;
  font-size: 0.8rem;
}

.ps-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.ps-footer .button-link,
.ps-footer button {
  min-height: 38px;
}

.unsaved-rows {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
}

.unsaved-rows > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
}

.unsaved-rows dt {
  font-weight: 650;
  color: var(--ink);
}

.unsaved-rows dd {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.unsaved-rows s {
  color: var(--mut);
}

.unsaved-rows b {
  color: var(--acc-d, var(--acc));
}

.ps-side-note {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  color: var(--mut);
  font-weight: 500;
}

.ps-side-strong {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.45;
}

.ps-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
  font-size: 0.8rem;
  font-weight: 650;
}

.ps-links a {
  color: var(--acc-d, var(--acc));
  text-decoration: underline;
}

.ps-rejected {
  background: var(--soft);
  box-shadow: none;
}

.ps-review {
  max-width: 720px;
}

.ps-review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0 1rem;
}

.ps-review-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mut);
  background: var(--soft);
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.ps-review-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.ps-old {
  color: var(--mut);
  text-decoration: line-through;
}

.ps-apply {
  border: 0;
  padding: 0;
  margin: 0 0 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
}

.ps-apply legend {
  width: 100%;
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
}

.ps-apply label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.ps-reason {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 1rem;
}

.ps-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

@media (max-width: 900px) {
  .bot-bar-row .bot-tabs {
    margin-left: 0;
    padding-top: 0;
    width: 100%;
  }

  .ps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ps-fields {
    grid-template-columns: 1fr;
  }

  .bot-bar-row .bot-switcher {
    max-width: none;
    flex: 1 1 100%;
  }
}
.ps-apply input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}
/* Board 11 — Managed ad and competitor set */
.ma-card {
  padding: 1.1rem 1.25rem 1.25rem;
}

.ma-card h2 {
  margin: 0 0 0.85rem;
}

.ma-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.85rem;
}

.ma-card-head h2 {
  margin: 0;
}

.ma-refresh {
  margin: 0;
  font-size: 0.75rem;
  color: var(--mut);
}

.ma-default-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ma-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.ma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.ma-table th {
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mut);
  background: var(--soft);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ma-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.ma-table tbody tr:last-child td {
  border-bottom: 0;
}

.ma-table .num {
  text-align: right;
  white-space: nowrap;
}

.ma-table .mono {
  white-space: nowrap;
}

.ma-radio-col {
  width: 36px;
}

.ma-table input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.ma-own-row.is-selected td {
  background: var(--acc-soft);
}

.ma-own-row.is-muted td {
  color: var(--mut);
}

.ma-status-bad {
  color: var(--dng) !important;
}

.ma-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--soft2);
  color: var(--mut);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ma-chip-managed,
.ma-chip-partner {
  background: var(--success-soft);
  color: var(--ok);
}

.ma-chip-new {
  background: var(--acc-soft);
  color: var(--acc-d);
}

.ma-chip-managed {
  margin-left: 0.4rem;
}

.ma-manage {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--acc-d);
  text-decoration: underline;
}

.ma-note {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--mut);
}

.ma-adopt {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
}

.ma-adopt input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0.1rem 0 0;
  flex: 0 0 auto;
}

.ma-closed {
  border: 1.5px solid var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.ma-closed-banner {
  margin: 0 0 0.9rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--dng-btn);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
}

.ma-actions {
  text-align: right;
  white-space: nowrap;
}

.ma-actions .primary {
  min-height: 32px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
}

.ma-cool {
  width: 128px;
}

.ma-cool input {
  min-height: 32px;
  padding: 0.3rem 0.4rem 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.ma-cool input::placeholder {
  color: var(--mut-2);
}

.ma-link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mut);
  cursor: pointer;
  box-shadow: none;
}

.ma-link:hover {
  color: var(--dng);
  text-decoration: underline;
}

.comp-row.is-new td {
  background: var(--row-new);
}

.ma-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.1fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.9rem;
}

.ma-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

.ma-filters select,
.ma-filters input {
  margin: 0;
  min-height: 36px;
  width: 100%;
}

.ma-search-btn,
.ma-add {
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surf);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--sh);
}

.ma-add {
  min-height: 30px;
  padding: 0.25rem 0.75rem;
  font-size: 0.76rem;
}

.ma-search-btn:hover,
.ma-add:hover:not(:disabled) {
  border-color: var(--acc-btn);
  color: var(--acc-d);
}

.ma-add:disabled {
  cursor: default;
  color: var(--mut);
  background: var(--soft);
  box-shadow: none;
}

.ma-empty td {
  color: var(--mut);
  text-align: center;
  padding: 1rem;
}

.ma-footer {
  margin-top: 0.25rem;
}

@media (max-width: 900px) {
  .ma-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Board 12 — Global settings */
.gs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.gs-card {
  padding: 1.1rem 1.25rem 1.25rem;
  margin: 0;
}

.gs-card h2 {
  margin: 0 0 0.9rem;
}

.gs-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.gs-fields-tight {
  margin-top: 0.85rem;
}

.gs-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.gs-field > label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

.gs-field select,
.gs-field > input,
.gs-field textarea,
.gs-field .input-unit input {
  margin: 0;
  width: 100%;
  min-height: 38px;
}

.gs-field textarea {
  resize: vertical;
  font-family: inherit;
}

.gs-field input:disabled,
.gs-field select:disabled,
.gs-field textarea:disabled {
  background: var(--soft);
  color: var(--ink);
  opacity: 1;
}

.gs-field.is-changed select,
.gs-field.is-changed > input,
.gs-field.is-changed textarea,
.gs-field.is-changed .input-unit {
  border-color: var(--acc-btn);
  box-shadow: 0 0 0 1px var(--acc);
}

.gs-field.is-changed .input-unit input {
  border-color: transparent;
  box-shadow: none;
}

tr.gs-pair-row.is-changed td {
  background: var(--acc-soft);
}

.gs-divider {
  height: 1px;
  background: var(--line);
  margin: 1rem 0;
}

.gs-seg {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surf);
}

.gs-seg-opt {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.gs-seg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gs-seg-opt span {
  display: block;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink);
}

.gs-seg-opt input:checked + span {
  background: var(--acc-btn);
  color: #fff;
}

.gs-seg-opt input:focus-visible + span {
  outline: 2px solid var(--acc-d);
  outline-offset: -2px;
}

.gs-field.is-changed .gs-seg {
  border-color: var(--acc-btn);
  box-shadow: 0 0 0 1px var(--acc);
}

.gs-text {
  margin: 0.85rem 0;
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.5;
}

.gs-radios {
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.gs-radios label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
}

.gs-radios input,
.gs-check {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.gs-dl {
  margin: 1rem 0 0.75rem;
  display: grid;
  gap: 0.55rem;
  font-size: 0.8rem;
}

.gs-dl > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.75rem;
}

.gs-dl dt {
  color: var(--mut);
}

.gs-dl dd {
  margin: 0;
  font-weight: 650;
  color: var(--ink);
}

.gs-warn {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.45;
}

.gs-pairs {
  margin-bottom: 1rem;
}

.gs-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: 1px;
  background: var(--ok);
}

.gs-dot-monitoring,
.gs-dot-setup {
  background: transparent;
  border: 1.5px solid var(--mut);
}

.gs-dot-offline {
  background: var(--dng-btn);
}

.gs-link {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
}

.gs-link:hover {
  color: var(--acc-d);
  text-decoration: underline;
}

.gs-pairs-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.gs-pairs-foot .ps-hint {
  margin: 0;
}

.gs-dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(440px, 92vw);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.gs-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.gs-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
}

.gs-dialog-form h2 {
  margin: 0;
}

.gs-dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
}

.gs-dialog-form input,
.gs-dialog-form select {
  margin: 0;
  min-height: 38px;
}

@media (max-width: 1000px) {
  .gs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .gs-fields {
    grid-template-columns: 1fr;
  }
}

/* Board 13 — Notification setup */
.nt-page [hidden] {
  display: none !important;
}

.nt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.nt-card-head h2 {
  margin: 0;
}

.nt-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 0.18rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--soft2);
  color: var(--mut);
  white-space: nowrap;
}

.nt-badge-ok {
  background: var(--success-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.nt-badge-warn {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.nt-badge-bad {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--dng);
}

.nt-badge-pending {
  background: var(--acc-soft);
  border-color: var(--acc-line);
  color: var(--acc-text);
}

.nt-gap {
  margin-top: 0.85rem;
}

.nt-secret {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nt-secret-val {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  font-size: 0.85rem;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nt-dots {
  letter-spacing: 0.08em;
}

.nt-link-btn {
  background: none;
  border: 0;
  padding: 0.2rem 0.1rem;
  min-height: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
}

.nt-link-btn:hover {
  color: var(--acc-d);
  text-decoration: underline;
  background: none;
}

.nt-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.nt-test-result {
  margin: 0;
}

.nt-section {
  margin-bottom: 1rem;
}

.nt-sub {
  margin: -0.4rem 0 0.85rem;
}

.nt-table th.nt-c,
.nt-table td.nt-c {
  text-align: center;
}

.nt-table td {
  vertical-align: middle;
}

.nt-table .chip {
  font-size: 0.64rem;
}

.nt-foot {
  margin: 0.75rem 0 0;
}

.nt-default {
  color: var(--mut);
  font-size: 0.82rem;
}

.nt-dest-input {
  margin: 0;
  width: 100%;
  min-width: 12rem;
  min-height: 34px;
}

.nt-dest-row.has-error td {
  background: var(--danger-soft);
}

.nt-warn {
  margin: 0 0 1rem;
}

/* Board 14 — Binance connection */
.bn-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.bn-head form {
  margin: 0;
}

.bn-tiles {
  margin-bottom: 1rem;
}

.bn-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: 2px;
  background: var(--mut);
}

.bn-dot-ok {
  background: var(--ok);
}

.bn-dot-warn {
  background: var(--warning);
}

.bn-dot-bad {
  background: var(--dng-btn);
}

.bn-dot-none {
  background: transparent;
  border: 1.5px solid var(--mut);
}

.bn-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--soft2);
  overflow: hidden;
  margin: 0.35rem 0 0.1rem;
}

.bn-bar-fill {
  display: block;
  height: 100%;
  background: var(--acc-btn);
  border-radius: 999px;
}

.bn-bar-fill.is-warn {
  background: var(--warning);
}

.bn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.bn-col {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.bn-col > .gs-card,
.bn-col > .bn-section {
  margin: 0;
}

.bn-section h2,
.bn-col > .gs-card > h2 {
  margin: 0 0 0.9rem;
}

.bn-dl {
  display: grid;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
}

.bn-dl > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.bn-dl dt {
  color: var(--mut);
}

.bn-dl dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.bn-saved {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--mut);
  font-family: inherit;
}

.bn-replace h3 {
  margin: 0 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.bn-replace .gs-field {
  margin-bottom: 0.85rem;
}

.bn-pending {
  margin: 0 0 0.85rem;
}

.bn-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.bn-table td.bn-num,
.bn-table th.bn-num {
  text-align: right;
}

.bn-foot {
  margin: 0.75rem 0 0;
}

.bn-calls {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.bn-calls code {
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.55rem;
  display: inline-block;
}

@media (max-width: 1000px) {
  .bn-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .bn-dl > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Board 15 — Users and roles */
.us-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.us-tiles {
  margin-bottom: 1rem;
}

.us-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.us-col {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.us-col > .gs-card {
  margin: 0;
}

.us-table td {
  white-space: nowrap;
}

.us-row {
  cursor: pointer;
}

.us-row:hover td {
  background: var(--soft);
}

.us-row.is-selected td,
.us-row.is-selected:hover td {
  background: var(--acc-soft);
}

.us-row.is-off td {
  color: var(--mut);
}

.us-name {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.us-name:hover {
  text-decoration: underline;
}

.us-foot {
  margin: 0.75rem 0 0;
}

.us-note {
  margin: 0.75rem 0 0;
  color: var(--ink);
}

.us-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.us-detail-head h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.us-dl {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.us-dl > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.us-dl dt {
  color: var(--mut);
}

.us-dl dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.us-role {
  margin: 0 0 0.85rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.us-btns {
  display: grid;
  gap: 0.6rem;
}

.us-btns form {
  margin: 0;
}

.us-btn {
  width: 100%;
  justify-content: center;
  font-weight: 600;
}

.us-btn.us-btn-danger {
  background: var(--dng);
  border-color: var(--dng);
  color: #fff;
}

.us-btn.us-btn-danger:hover:not(:disabled) {
  background: #912018;
  border-color: #912018;
}

.us-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.us-matrix th,
.us-matrix td {
  padding: 0.65rem 0.6rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.us-matrix th {
  width: 36%;
  font-weight: 700;
}

.us-matrix td {
  font-weight: 600;
}

.us-matrix tr:last-child th,
.us-matrix tr:last-child td {
  border-bottom: 0;
}

.us-form {
  display: grid;
  gap: 0.85rem;
}

.us-form .ps-hint {
  margin: 0;
}

.us-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.us-error {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--dng);
}

.us-warn {
  margin: 0 0 0.85rem;
}

.us-dialog .us-error {
  margin: 0 0 0.5rem;
}

.us-dialog[open] {
  width: min(420px, calc(100vw - 2rem));
}

@media (max-width: 1000px) {
  .us-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .us-dl > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Theme toggle: topbar on signed-in pages, floating on the sign-in page. */
.theme-toggle {
  gap: 0.45rem;
  padding: 0 0.85rem;
  color: var(--ink);
  white-space: nowrap;
}

/* Phones: keep the topbar compact, icon only. */
@media (max-width: 599px) {
  .theme-toggle {
    width: 38px;
    min-width: 38px;
    padding: 0;
  }

  .theme-toggle .theme-toggle-label {
    display: none;
  }
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.theme-toggle-floating {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
}