/* Claude Trader — app stylesheet. Dark theme by default, light via [data-theme="light"].
   System font stack only; numbers use tabular figures. No build step. */

/* ============================================================================ tokens */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d13;
  --bg-elev: #0e121a;
  --surface: #121722;
  --surface-2: #171d29;
  --surface-3: #1f2634;
  --border: #212937;
  --border-2: #2c3546;
  --text: #e7ebf3;
  --text-2: #a9b3c4;
  --text-3: #808b9e;
  --brand: #6f7cff;
  --accent: #7c88ff;
  --accent-2: #636ff5;
  --accent-text: #9aa4ff;
  --accent-soft: rgba(124, 136, 255, 0.14);
  --green: #2fbf71;
  --green-text: #43d48a;
  --green-soft: rgba(47, 191, 113, 0.14);
  --red: #f0565a;
  --red-text: #ff7477;
  --red-soft: rgba(240, 86, 90, 0.14);
  --amber: #e5a50a;
  --amber-text: #f4bd52;
  --amber-soft: rgba(229, 165, 10, 0.15);
  --blue: #4c9bff;
  --blue-text: #74b2ff;
  --blue-soft: rgba(76, 155, 255, 0.14);
  --violet: #a678ff;
  --violet-text: #bd9bff;
  --violet-soft: rgba(166, 120, 255, 0.15);
  --gray-soft: rgba(148, 160, 182, 0.13);
  --overlay: rgba(4, 6, 10, 0.62);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 28px 70px rgba(0, 0, 0, 0.6);
  --chart-grid: rgba(140, 152, 175, 0.08);
  --chart-crosshair: rgba(160, 170, 192, 0.45);
  --chart-area-top: rgba(124, 136, 255, 0.28);
  --chart-area-bottom: rgba(124, 136, 255, 0);
  --skeleton-a: rgba(255, 255, 255, 0.04);
  --skeleton-b: rgba(255, 255, 255, 0.09);
  --code-bg: #0c1018;
  --user-bubble: #1d2540;
  --user-bubble-border: #2a3460;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-3: #e8eaf0;
  --border: #e2e5eb;
  --border-2: #d3d8e1;
  --text: #11151d;
  --text-2: #4a5365;
  --text-3: #687184;
  --brand: #5b63ee;
  --accent: #4f57e6;
  --accent-2: #3d45d3;
  --accent-text: #3a42cf;
  --accent-soft: rgba(79, 87, 230, 0.1);
  --green: #12a150;
  --green-text: #0a7a3a;
  --green-soft: rgba(18, 161, 80, 0.11);
  --red: #e5383b;
  --red-text: #c22429;
  --red-soft: rgba(229, 56, 59, 0.1);
  --amber: #d48806;
  --amber-text: #8f5600;
  --amber-soft: rgba(212, 136, 6, 0.13);
  --blue: #2f6fec;
  --blue-text: #1b55c8;
  --blue-soft: rgba(47, 111, 236, 0.1);
  --violet: #7c4dff;
  --violet-text: #5c2fe0;
  --violet-soft: rgba(124, 77, 255, 0.1);
  --gray-soft: rgba(100, 112, 135, 0.1);
  --overlay: rgba(20, 24, 33, 0.38);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 10px 28px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-3: 0 28px 70px rgba(16, 24, 40, 0.22);
  --chart-grid: rgba(60, 70, 90, 0.07);
  --chart-crosshair: rgba(70, 80, 100, 0.4);
  --chart-area-top: rgba(79, 87, 230, 0.2);
  --chart-area-bottom: rgba(79, 87, 230, 0);
  --skeleton-a: rgba(15, 23, 42, 0.05);
  --skeleton-b: rgba(15, 23, 42, 0.1);
  --code-bg: #f6f7f9;
  --user-bubble: #eceefe;
  --user-bubble-border: #d9ddfb;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Cascadia Mono", "Liberation Mono", monospace;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --hdr-h: 52px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================================ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
#app {
  height: 100%;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button {
  font: inherit;
  color: inherit;
}
input,
select,
textarea {
  font: inherit;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
p {
  margin: 0 0 8px;
}
p:last-child {
  margin-bottom: 0;
}
code,
kbd,
pre,
.mono {
  font-family: var(--mono);
}
code {
  font-size: 0.92em;
}
kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 15px;
  color: var(--text-2);
  background: var(--surface);
}
::selection {
  background: var(--accent-soft);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.num,
table {
  font-variant-numeric: tabular-nums;
}
.pos {
  color: var(--green-text);
}
.neg {
  color: var(--red-text);
}
.muted {
  color: var(--text-3);
}
.small {
  font-size: 12px;
}
.spacer {
  flex: 1 1 auto;
}
.warn-text {
  color: var(--amber-text);
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}
.rot90 {
  transform: rotate(90deg);
}
.icon {
  flex: none;
  transition: transform 0.15s var(--ease);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}
.noscript {
  padding: 24px;
  text-align: center;
}

/* ============================================================================ boot */
.boot {
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.boot-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c86ff, #5a4fe0);
  animation: pulse-soft 1.4s ease-in-out infinite;
}
@keyframes pulse-soft {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================================================ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.btn:hover {
  background: var(--surface-3);
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.is-loading {
  opacity: 0.85;
  cursor: progress;
}
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 7px;
}
.btn-xs {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  gap: 5px;
  border-radius: 6px;
}
.btn-lg {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}
.btn-icon {
  padding: 0;
  width: 32px;
}
.btn-sm.btn-icon {
  width: 28px;
}
.btn-xs.btn-icon {
  width: 24px;
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-1);
}
.btn-primary:hover {
  background: var(--accent-2);
}
.btn-success {
  background: var(--green);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-success:hover {
  background: color-mix(in srgb, var(--green) 86%, #000);
}
.btn-danger {
  background: var(--red);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--red) 86%, #000);
}
.btn-danger-soft {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red-text);
}
.btn-danger-soft:hover {
  background: color-mix(in srgb, var(--red) 22%, transparent);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn-subtle {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}
.btn-subtle:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}
.link-btn:hover {
  text-decoration: underline;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.emoji-ico {
  font-size: 14px;
  line-height: 1;
}

/* ============================================================================ badges, dots, spinner, skeleton */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
  background: var(--gray-soft);
  color: var(--text-2);
}
.badge-gray {
  background: var(--gray-soft);
  color: var(--text-2);
}
.badge-green {
  background: var(--green-soft);
  color: var(--green-text);
}
.badge-red {
  background: var(--red-soft);
  color: var(--red-text);
}
.badge-amber {
  background: var(--amber-soft);
  color: var(--amber-text);
}
.badge-blue {
  background: var(--blue-soft);
  color: var(--blue-text);
}
.badge-violet {
  background: var(--violet-soft);
  color: var(--violet-text);
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.badge-link {
  text-decoration: none;
  cursor: pointer;
}
.badge-link:hover {
  text-decoration: none;
  filter: brightness(1.15);
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber-text);
  font-size: 11.5px;
  font-weight: 700;
  vertical-align: 1px;
}
.pulse-dot {
  position: relative;
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent);
  }
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
.idle-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.6;
}
.spinner {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.skeleton {
  display: inline-block;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 40%, var(--skeleton-a) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--text-3);
  vertical-align: 1px;
}
.status-dot[data-status="new"],
.status-dot[data-status="accepted"],
.status-dot[data-status="pending_new"],
.status-dot[data-status="held"] {
  background: var(--blue);
}
.status-dot[data-status="partially_filled"] {
  background: var(--amber);
}
.status-dot[data-status="filled"] {
  background: var(--green);
}
.status-dot[data-status="rejected"] {
  background: var(--red);
}

/* ============================================================================ header */
.hdr > * {
  flex-shrink: 0;
}
.hdr {
  flex: none;
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  margin-right: 4px;
}
.brand:hover {
  text-decoration: none;
}
.brand-name {
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.badge-paper {
  height: 18px;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 0 6px;
  border-radius: 5px;
}
.logo-mark {
  flex: none;
  display: block;
}
.mkt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
  color: var(--text-2);
}
.mkt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.mkt-open .mkt-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.mkt-closed .mkt-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.mkt-state {
  font-weight: 600;
  color: var(--text);
}
.mkt-sub {
  font-variant-numeric: tabular-nums;
}
.mkt-time {
  padding-left: 7px;
  border-left: 1px solid var(--border-2);
  color: var(--text-3);
}
.hdr-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
}
.hdr-equity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.hdr-equity:hover {
  background: var(--surface-2);
}
.hdr-equity-val {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.hdr-equity-pl {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.hdr-spacer {
  flex: 1;
}
.agent-ind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  background: var(--green-soft);
  color: var(--green-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.agent-ind-n {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sse-dot {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.sse-dot:hover {
  background: var(--surface-2);
}
.sse-dot span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}
.sse-ok span {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.sse-warn span {
  background: var(--amber);
  animation: blink 1.2s infinite;
}
.sse-bad span {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
.kill-btn {
  height: 30px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.kill-btn.btn-danger {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 40%, transparent), 0 4px 14px color-mix(in srgb, var(--red) 25%, transparent);
}

/* bell */
.bell-wrap {
  position: relative;
}
.bell {
  position: relative;
}
.bell-count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-elev);
}
.bell-pop {
  position: absolute;
  right: -6px;
  top: calc(100% + 8px);
  width: 380px;
  max-width: calc(100vw - 16px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  z-index: 60;
  animation: pop-in 0.14s var(--ease);
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.bell-pop-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.bell-list {
  max-height: 420px;
  overflow-y: auto;
}
.bell-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.bell-item:hover {
  background: var(--surface-2);
}
.bell-item.is-unread {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.bell-item.is-unread .bell-item-title::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}
.bell-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bell-item-title {
  font-weight: 600;
  font-size: 12.5px;
}
.bell-item-body {
  color: var(--text-2);
  font-size: 12px;
  white-space: pre-line;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.bell-item-time {
  color: var(--text-3);
  font-size: 11.5px;
}
.bell-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-3);
}
.bell-pop-f {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  background: var(--surface-2);
  color: var(--accent-text);
  font-weight: 500;
  cursor: pointer;
}
.bell-pop-f:hover {
  background: var(--surface-3);
}
.lvl {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--gray-soft);
  color: var(--text-2);
}
.lvl-success {
  background: var(--green-soft);
  color: var(--green-text);
}
.lvl-warning {
  background: var(--amber-soft);
  color: var(--amber-text);
}
.lvl-error {
  background: var(--red-soft);
  color: var(--red-text);
}
.lvl-info {
  background: var(--blue-soft);
  color: var(--blue-text);
}

/* mobile header */
.hdr-mobile {
  height: auto;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 12px 8px;
  padding-top: max(8px, env(safe-area-inset-top));
}
.hdr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hdr-row-2 {
  gap: 6px;
}
.hdr-mobile .mkt {
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
}
.hdr-mobile .hdr-equity {
  padding: 0;
}
.hdr-mobile .kill-btn {
  width: 30px;
  padding: 0;
}
.hdr-mobile .agent-ind-label {
  display: none;
}

/* ============================================================================ global banners */
.gbanners {
  flex: none;
  display: flex;
  flex-direction: column;
}
.gbanner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.gbanner-text {
  flex: 1;
  min-width: 0;
}
.gbanner-red {
  background: var(--red-soft);
  color: var(--red-text);
}
.gbanner-amber {
  background: var(--amber-soft);
  color: var(--amber-text);
}
.gbanner-gray {
  background: var(--surface-2);
  color: var(--text-2);
}
.gbanner-red .gbanner-text,
.gbanner-amber .gbanner-text {
  color: var(--text);
}
.gbanner-btn {
  flex: none;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.gbanner-btn:hover {
  background: color-mix(in srgb, currentColor 12%, transparent);
}

/* ============================================================================ layout */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  container: main / inline-size;
}
.tabs {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 0 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  height: 40px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}
.tab:hover {
  color: var(--text);
  text-decoration: none;
}
.tab::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}
.tab.is-active {
  color: var(--text);
}
.tab.is-active::after {
  background: var(--accent);
}
.tab .icon {
  opacity: 0.8;
}
.tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-count-attn {
  background: var(--amber-soft);
  color: var(--amber-text);
}
@container main (max-width: 820px) {
  .tabs {
    padding: 0 6px;
    gap: 0;
  }
  .tab {
    padding: 0 6px;
    gap: 4px;
    font-size: 12.5px;
  }
  .tab::after {
    left: 4px;
    right: 4px;
  }
  .tab .icon {
    display: none;
  }
  .tab-count {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10.5px;
  }
  .tab-count:not(.tab-count-attn) {
    display: none;
  }
}
.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.page-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  container: page / inline-size;
}
.page-h {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.page-sub {
  color: var(--text-3);
  margin-top: 3px;
  font-size: 12.5px;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.subtab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.subtab:hover {
  color: var(--text);
}
.subtab.is-active {
  color: var(--text);
}
.subtab.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.subtab-n {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.subtab-n-attn {
  background: var(--amber-soft);
  color: var(--amber-text);
}

/* chat dock */
.chat-dock {
  flex: none;
  min-width: 340px;
  max-width: 70vw;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
}
.chat-resizer {
  flex: none;
  position: relative;
  width: 8px;
  margin: 0 -4px;
  cursor: col-resize;
  z-index: 6;
  touch-action: none;
}
.chat-resizer span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}
.chat-resizer:hover span,
.chat-resizer:focus-visible span,
body.is-resizing .chat-resizer span {
  background: var(--accent);
}
.chat-resizer:focus-visible {
  outline: none;
}
body.is-resizing {
  cursor: col-resize;
  user-select: none;
}
body.is-resizing iframe,
body.is-resizing .chat-body {
  pointer-events: none;
}
.chat-fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  z-index: 20;
}
.chat-fab:hover {
  background: var(--accent-2);
}
.app:has(.chat-fab) .toasts {
  bottom: 72px;
}

/* mobile tab bar & sheet */
.mtabbar {
  flex: none;
  display: flex;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 25;
}
.mtab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 6px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.mtab:hover {
  text-decoration: none;
  color: var(--text-2);
}
.mtab.is-active {
  color: var(--accent-text);
}
.mtab:focus-visible {
  outline-offset: -4px;
  border-radius: 10px;
}
.mtab-icon {
  position: relative;
  display: inline-flex;
}
.mtab-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.mtab-pulse {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--bg-elev);
}
.overlay.overlay-sheet {
  align-items: flex-end;
  padding: 0;
}
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--border-2);
  border-bottom: 0;
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-3);
  animation: sheet-in 0.2s var(--ease);
}
@keyframes sheet-in {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.sheet-grip {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-2);
  margin: 4px auto 8px;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.sheet-item:hover {
  background: var(--surface-2);
}
.sheet-item > span:not(.tab-count) {
  flex: 1;
}
.sheet-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ============================================================================ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-h {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 12px 16px 0;
  min-height: 44px;
}
.card-h-text {
  flex: 1 1 220px;
  min-width: 0;
}
.card-title {
  font-size: 13.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-sub {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.card-b {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card-b-flush {
  padding: 8px 0 0;
  gap: 0;
}
.card-b-flush > .table-wrap {
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-pad {
  padding: 12px 16px 16px;
}
.card-f {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-wrap: wrap;
}
.sub-h {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 4px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================ empty / banner */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 34px 20px;
  color: var(--text-2);
}
.empty-compact {
  padding: 18px 16px;
}
.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-3);
  margin-bottom: 4px;
}
.empty-compact .empty-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.empty-title {
  font-weight: 600;
  color: var(--text);
}
.empty-hint {
  max-width: 440px;
  color: var(--text-3);
  font-size: 12.5px;
}
.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: 12.5px;
}
.banner-icon {
  margin-top: 1px;
}
.banner-body {
  flex: 1;
  min-width: 0;
}
.banner-title {
  font-weight: 600;
  margin-bottom: 1px;
}
.banner-text {
  color: var(--text-2);
  white-space: pre-line;
  word-break: break-word;
}
.banner-info {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 30%, transparent);
  color: var(--blue-text);
}
.banner-success {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
  color: var(--green-text);
}
.banner-warning {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
  color: var(--amber-text);
}
.banner-error {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red-text);
}
.banner-title {
  color: var(--text);
}
.banner-close {
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
}

/* ============================================================================ forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field-inline {
  flex-direction: row;
  align-items: center;
}
.field-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  min-height: 16px;
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-3);
}
.field-error {
  font-size: 11.5px;
  color: var(--red-text);
}
.input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  min-width: 0;
}
.input::placeholder {
  color: var(--text-3);
  opacity: 0.8;
}
.input:hover {
  border-color: color-mix(in srgb, var(--text-3) 50%, var(--border-2));
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.input.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
textarea.input {
  height: auto;
  padding: 8px 10px;
  line-height: 1.5;
  resize: vertical;
}
select.input {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.input-lg {
  height: 42px;
  font-size: 14.5px;
}
.input-num {
  font-variant-numeric: tabular-nums;
}
.input-sym {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.input-inline {
  display: inline-block;
  width: 170px;
  height: 26px;
  padding: 0 7px;
  font-size: 12px;
}
.input-search {
  width: 240px;
  height: 28px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .input {
  padding-right: 34px;
}
.input-suffix {
  position: absolute;
  right: 10px;
  color: var(--text-3);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px 14px;
}
.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.form-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.form-section-h {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  font-size: 12.5px;
}
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-row-wrap {
  flex-wrap: wrap;
  gap: 10px 18px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.help {
  position: relative;
  display: inline-flex;
  color: var(--text-3);
  cursor: help;
  vertical-align: middle;
}
.help:hover,
.help:focus {
  color: var(--accent-text);
  outline: none;
}
.help-pop {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  z-index: 80;
  pointer-events: none;
}

/* segmented */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg-btn {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.seg-btn:hover:not(:disabled) {
  color: var(--text);
}
.seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border-2);
}
[data-theme="light"] .seg-btn.is-active {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), 0 0 0 1px var(--border);
}
.seg-btn.is-active.seg-green {
  background: var(--green);
  color: #fff;
  box-shadow: none;
}
.seg-btn.is-active.seg-red {
  background: var(--red);
  color: #fff;
  box-shadow: none;
}
.seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.seg-sm .seg-btn {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
}

/* switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  transition: background 0.15s, border-color 0.15s;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s var(--ease);
}
.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: transparent;
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(14px);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.switch-label {
  font-size: 13px;
}

/* chips input */
.chips-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chips-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: text;
}
.chips-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-removable {
  padding-right: 3px;
}
.chip-removable button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
}
.chip-removable button:hover {
  background: var(--red-soft);
  color: var(--red-text);
}
.chips-text {
  flex: 1;
  min-width: 80px;
  height: 24px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  text-transform: uppercase;
  font-weight: 600;
}
.chips-text::placeholder {
  text-transform: none;
  font-weight: 400;
  color: var(--text-3);
}
.chips-sugg {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip-sugg {
  height: 22px;
  padding: 0 7px;
  background: transparent;
  border-style: dashed;
  color: var(--text-3);
  cursor: pointer;
  font-weight: 500;
}
.chip-sugg:hover {
  color: var(--accent-text);
  border-color: var(--accent);
}

/* progress */
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.progress-labels .num {
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.progress-green {
  background: var(--green);
}
.progress-amber {
  background: var(--amber);
}
.progress-red {
  background: var(--red);
}
.progress-accent {
  background: var(--accent);
}

/* collapsible */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface-2) 40%, transparent);
}
.collapsible-h {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-weight: 550;
  font-size: 12.5px;
  color: var(--text-2);
}
.collapsible-h:hover {
  color: var(--text);
}
.collapsible.is-open .collapsible-chev {
  transform: rotate(90deg);
}
.collapsible-title {
  flex: 1;
}
.collapsible-b {
  padding: 0 10px 10px;
}

/* menu */
.menu-wrap {
  position: relative;
  display: inline-flex;
}
.menu {
  position: absolute;
  top: calc(100% + 6px);
  min-width: 190px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  z-index: 70;
  animation: pop-in 0.12s var(--ease);
}
.menu-right {
  right: 0;
}
.menu-left {
  left: 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover {
  background: var(--surface-2);
}
.menu-item.is-danger {
  color: var(--red-text);
}
.menu-item.is-danger:hover {
  background: var(--red-soft);
}
.menu-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

/* ============================================================================ overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  animation: fade-in 0.14s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.modal {
  width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  animation: modal-in 0.18s var(--ease);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}
.modal-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 6px;
}
.modal-title {
  flex: 1;
  font-size: 15.5px;
  font-weight: 650;
}
.modal-danger .modal-title {
  color: var(--red-text);
}
.modal-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  flex: none;
}
.modal-x:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-b {
  padding: 8px 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.confirm-body {
  color: var(--text-2);
}
.confirm-body b {
  color: var(--text);
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  background: var(--surface-2);
}
.check-row:hover {
  border-color: var(--border-2);
}
.check-row input {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex: none;
}
.check-label {
  display: block;
  font-weight: 600;
}
.check-hint {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}
.overlay.overlay-drawer {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
}
.drawer {
  height: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-left: 1px solid var(--border-2);
  box-shadow: var(--shadow-3);
  animation: drawer-in 0.2s var(--ease);
}
@keyframes drawer-in {
  from {
    transform: translateX(28px);
    opacity: 0;
  }
}
.drawer-h {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-h-text {
  flex: 1;
  min-width: 0;
}
.drawer-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.drawer-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12.5px;
}
.drawer-actions {
  display: flex;
  gap: 6px;
}
.drawer-b > * {
  flex-shrink: 0;
}
.drawer-b {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  container: page / inline-size;
}

/* toasts */
.toasts {
  position: fixed;
  right: calc(var(--chat-w, 0px) + 16px);
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 360px;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 10px 11px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--blue);
  box-shadow: var(--shadow-2);
  animation: toast-in 0.2s var(--ease);
}
@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}
.toast-success {
  border-left-color: var(--green);
}
.toast-warning {
  border-left-color: var(--amber);
}
.toast-error {
  border-left-color: var(--red);
}
.toast-main {
  flex: 1;
  min-width: 0;
}
.toast-title {
  font-weight: 600;
}
.toast-body {
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 2px;
  white-space: pre-line;
  word-break: break-word;
  max-height: 140px;
  overflow: hidden;
}
.toast-link {
  margin-top: 4px;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
}
.toast-x {
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}
.toast-x:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ============================================================================ tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.tbl th {
  position: sticky;
  top: 0;
  padding: 8px 9px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.tbl th:first-child,
.tbl td:first-child {
  padding-left: 16px;
}
.tbl th:last-child,
.tbl td:last-child {
  padding-right: 16px;
}
.tbl tbody tr:last-child td {
  border-bottom: 0;
}
.tbl tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.tbl tfoot td {
  border-top: 1px solid var(--border-2);
  border-bottom: 0;
  font-weight: 600;
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.tbl .r {
  text-align: right;
}
.tbl small {
  font-size: 11px;
  opacity: 0.85;
}
.tbl-compact td {
  padding-top: 7px;
  padding-bottom: 7px;
}
.row-link {
  cursor: pointer;
}
.tbl tr.is-leg td {
  border-bottom-style: dashed;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface-2) 30%, transparent);
}
.tbl tr.is-dim td {
  opacity: 0.6;
}
.leg-mark {
  padding-left: 6px;
  color: var(--text-3);
  font-size: 12px;
}
.tbl-actions {
  white-space: nowrap;
  width: 1%;
}
.tbl-actions .icon-btn,
.tbl-actions .menu-wrap {
  vertical-align: middle;
}
.sym-link {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0.01em;
}
.sym-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
}
.side {
  font-weight: 600;
  font-size: 12px;
}
.side-buy {
  color: var(--green-text);
}
.side-sell {
  color: var(--red-text);
}
.w-bar {
  min-width: 140px;
  width: 26%;
}

/* ============================================================================ KPIs & overview */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpis > .kpi:nth-child(7) {
  grid-column: span 2;
}
@container page (min-width: 1240px) {
  .kpis {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .kpis > .kpi:nth-child(7) {
    grid-column: auto;
  }
}
@container page (max-width: 620px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  text-align: left;
}
.kpi-link {
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.kpi-link:hover {
  border-color: var(--border-2);
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 24px;
  display: flex;
  align-items: center;
}
.kpi-of {
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-bar {
  height: 3px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.kpi-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.kpi-bar span.is-amber {
  background: var(--amber);
}
.kpi-bar span.is-red {
  background: var(--red);
}
.ov-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 14px;
  align-items: start;
}
.ov-main,
.ov-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.eq-wrap {
  position: relative;
  height: 270px;
  margin: 0 -6px -6px;
}
.eq-chart,
.candle-chart {
  position: absolute;
  inset: 0;
}
.chart-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--text-3);
}
.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-3);
}
.onboard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface) 70%);
  box-shadow: var(--shadow-1);
}
.onboard-ico {
  font-size: 26px;
  line-height: 1;
}
.onboard-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.onboard-text b {
  font-size: 14px;
}
.onboard-text span {
  color: var(--text-2);
}
.attn-card .card-b {
  gap: 10px;
}
.attn-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nostop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  background: var(--red-soft);
}
.nostop-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nostop .btn {
  align-self: flex-start;
}
.all-good {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--green-soft);
  color: var(--green-text);
}
.all-good div {
  display: flex;
  flex-direction: column;
}
.all-good span {
  color: var(--text-2);
  font-size: 12px;
}
.gauge {
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gauge.is-hit {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: var(--red-soft);
}
.gauge-note {
  font-size: 12px;
  color: var(--text-3);
}
.agent-runs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-run {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  border-radius: var(--r);
  background: var(--green-soft);
  cursor: pointer;
  text-align: left;
}
.agent-run-label {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-idle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
}
.upcoming {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.upcoming li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.upcoming li:last-child {
  border-bottom: 0;
}
.upcoming-name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upcoming-time {
  color: var(--text-3);
  font-size: 12px;
}
.fills {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
}
.fill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fill:last-child {
  border-bottom: 0;
}
.fill-time {
  color: var(--text-3);
  width: 92px;
  font-size: 12px;
}

/* ============================================================================ proposals */
.pcard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
  border-radius: var(--r);
  border: 1px solid var(--border-2);
  background: var(--surface);
  min-width: 0;
}
.pcard.is-pending {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--border));
  box-shadow: inset 3px 0 0 var(--amber);
}
.pcard-h {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.pcard-kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber-text);
}
.pcard-kind-risk {
  color: var(--violet-text);
}
.pcard-kind-close,
.pcard-kind-cancel {
  color: var(--blue-text);
}
.pcard-sym {
  border: 0;
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}
.pcard-sym:hover {
  color: var(--accent-text);
}
.pcard-src {
  color: var(--text-3);
}
.pcard-exp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.pcard-exp.is-urgent {
  color: var(--red-text);
}
.pcard-summary {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}
.pcard-reason {
  color: var(--text-2);
  font-size: 12.5px;
  white-space: pre-line;
}
.pcard-reason.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.pcard-risk {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pcard-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.pcard-metric {
  display: flex;
  gap: 5px;
  font-size: 12px;
  color: var(--text-3);
}
.pcard-metric b {
  color: var(--text);
  font-weight: 600;
}
.pcard-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
.pcard-issues li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.pcard-issues li .icon {
  margin-top: 2px;
}
.pcard-issues.is-error {
  color: var(--red-text);
}
.pcard-issues.is-warning {
  color: var(--amber-text);
}
.pcard-ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--green-text);
}
.pcard-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--red-text);
}
.pcard-f {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.diff {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.diff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(60px, auto);
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.diff-row:last-child {
  border-bottom: 0;
}
.diff-key {
  color: var(--text-2);
}
.diff-before {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent);
  text-align: right;
}
.diff-arrow {
  color: var(--text-3);
}
.diff-after {
  font-weight: 650;
  color: var(--accent-text);
}
.diff-dir {
  font-size: 10px;
  opacity: 0.8;
}

/* ============================================================================ chat */
.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-elev);
}
.chat-h {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid var(--border);
}
.chat-conv-wrap {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
}
.chat-conv {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.chat-conv:hover {
  background: var(--surface-2);
}
.chat-conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.chat-cost {
  color: var(--text-3);
  font-size: 12px;
  flex: none;
}
.conv-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  z-index: 40;
  padding: 6px;
  animation: pop-in 0.12s var(--ease);
}
.conv-new {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  color: var(--accent-text);
  font-weight: 600;
  margin-bottom: 6px;
}
.conv-new:hover {
  background: var(--accent-soft);
}
.conv-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.conv-item {
  display: flex;
  align-items: center;
  border-radius: 8px;
}
.conv-item:hover,
.conv-item.is-active {
  background: var(--surface-2);
}
.conv-item.is-active .conv-title {
  color: var(--accent-text);
}
.conv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
.conv-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.conv-meta {
  font-size: 11.5px;
  color: var(--text-3);
}
.conv-actions {
  display: none;
  gap: 2px;
  padding-right: 6px;
}
.conv-item:hover .conv-actions,
.conv-item:focus-within .conv-actions {
  display: flex;
}
.conv-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
}
.conv-actions button:hover {
  background: var(--surface-3);
  color: var(--text);
}
.conv-actions button.is-danger:hover {
  background: var(--red-soft);
  color: var(--red-text);
}
.conv-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-3);
}
.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.chat-inner {
  padding: 14px 14px 10px;
}
.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--text-3);
}
.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  min-width: 0;
  max-width: 100%;
}
.msg-user {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: 88%;
}
.msg-bubble {
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--user-bubble);
  border: 1px solid var(--user-bubble-border);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.msg-user.is-temp .msg-bubble {
  opacity: 0.7;
}
.msg-skill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  margin-right: 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}
.msg-time {
  font-size: 11px;
  color: var(--text-3);
  padding-right: 4px;
}
.msg-assistant {
  position: relative;
  line-height: 1.6;
}
.msg-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-height: 18px;
}
.msg-footer {
  display: inline-flex;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
}
.msg-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.msg-assistant:hover .msg-copy,
.msg-copy:focus-visible {
  opacity: 1;
}
.msg-copy:hover {
  background: var(--surface-2);
  color: var(--text);
}
.msg-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red-text);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-error > div {
  color: var(--text);
}
.msg-error .icon {
  margin-top: 2px;
}
.msg-system {
  align-self: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
.msg-proposal {
  max-width: 100%;
}
.is-streaming .caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  border-radius: 1px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}
.is-streaming .md > :last-child {
  display: inline;
}
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
}
.dots {
  display: inline-flex;
  gap: 3px;
}
.dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dots 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes dots {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
.tool-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tool-chip:hover,
.tool-chip.is-open {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border-2));
  color: var(--text);
}
.tool-chip.is-open {
  background: var(--accent-soft);
}
.tool-chip.is-trade {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--border-2));
}
.tool-chip.is-error {
  border-color: color-mix(in srgb, var(--red) 55%, transparent);
  background: var(--red-soft);
  color: var(--red-text);
}
.tool-chip.is-pending {
  color: var(--text);
}
.tool-ico {
  font-family: var(--font);
  font-size: 11px;
}
.tool-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-detail {
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  animation: pop-in 0.12s var(--ease);
}
.tool-detail.is-error {
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
}
.tool-detail-h {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-detail-h code {
  color: var(--text-3);
  font-size: 11px;
}
.tool-detail-l {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 4px;
}
.tool-detail.is-error .tool-detail-l:last-of-type {
  color: var(--red-text);
}
.tool-pre {
  margin: 0;
  padding: 8px 10px;
  max-height: 260px;
  overflow: auto;
  border-radius: 6px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.tool-wait {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 26px 8px 10px;
}
.chat-empty h3 {
  font-size: 17px;
  margin-top: 4px;
}
.chat-empty p {
  color: var(--text-2);
  max-width: 400px;
  font-size: 12.5px;
}
.chat-suggest {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}
.chat-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.chat-suggest-item:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--surface-2);
}
.chat-suggest-item span:last-child {
  display: flex;
  flex-direction: column;
}
.chat-suggest-item small {
  color: var(--text-3);
  font-size: 11.5px;
}
.chat-suggest-ico {
  font-size: 18px;
}
.composer {
  flex: none;
  padding: 6px 10px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.skill-chips {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 0 7px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.skill-chips::-webkit-scrollbar {
  display: none;
}
.skill-chip {
  flex: none;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.skill-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--text);
  background: var(--accent-soft);
}
.composer-box {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.composer-box.is-running {
  border-color: color-mix(in srgb, var(--green) 40%, var(--border-2));
}
.composer-input {
  width: 100%;
  min-height: 44px;
  max-height: 220px;
  padding: 11px 12px 4px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  line-height: 1.5;
}
.composer-input::placeholder {
  color: var(--text-3);
}
.composer-hint-inline {
  padding: 0 12px;
  font-size: 11.5px;
  color: var(--text-3);
}
.composer-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 6px 6px;
}
.composer-foot {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}
.slash-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  z-index: 30;
  animation: pop-in 0.12s var(--ease);
}
.slash-h {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.slash-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  text-align: left;
}
.slash-item.is-active,
.slash-item:hover {
  background: var(--accent-soft);
}
.slash-title {
  font-weight: 600;
}
.slash-cmd {
  font-size: 11px;
  color: var(--text-3);
  align-self: center;
}
.slash-desc {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slash-empty {
  padding: 10px;
  color: var(--text-3);
  text-align: center;
}
.chat-mobile .chat-inner {
  padding: 12px 12px 8px;
}
.page-chat {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.page-chat > .chat {
  flex: 1;
}
.transcript .timeline {
  gap: 10px;
}
.transcript-sum {
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

/* ============================================================================ markdown */
.md {
  font-size: 13.5px;
  line-height: 1.62;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p,
.md ul,
.md ol,
.md blockquote,
.md pre,
.md .md-table,
.md .katex-display {
  margin: 0 0 10px;
}
.md h1,
.md h2,
.md h3,
.md h4,
.md h5 {
  margin: 16px 0 8px;
  line-height: 1.3;
  font-weight: 650;
}
.md h1 {
  font-size: 19px;
}
.md h2 {
  font-size: 16.5px;
}
.md h3 {
  font-size: 14.5px;
}
.md h4,
.md h5 {
  font-size: 13.5px;
}
.md ul,
.md ol {
  padding-left: 22px;
}
.md li {
  margin: 3px 0;
}
.md li > p {
  margin: 0;
}
.md strong {
  font-weight: 650;
}
.md a {
  color: var(--accent-text);
}
.md code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  font-size: 0.88em;
}
.md pre {
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
.md pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}
.md blockquote {
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  color: var(--text-2);
}
.md hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}
.md img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.md-table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.md table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.md th,
.md td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.md table {
  overflow-wrap: normal;
  word-break: normal;
}
.md th {
  white-space: normal;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-2);
}
.md tr:last-child td {
  border-bottom: 0;
}
.md th[align="right"],
.md td[align="right"] {
  text-align: right;
}
.md th[align="center"],
.md td[align="center"] {
  text-align: center;
}
.md .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px;
}
.md .katex {
  font-size: 1.06em;
}
.md-file {
  font-size: 14px;
  max-width: 860px;
}

/* KaTeX blocks outside markdown */
.tex-display {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}
.formula-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.formula {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.formula .katex-display {
  margin: 4px 0;
}
.formulas {
  margin-top: 2px;
}

/* ============================================================================ kv */
.kv {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.kv-row:last-child {
  border-bottom: 0;
}
.kv-row dt {
  color: var(--text-3);
}
.kv-row dd {
  margin: 0;
  text-align: right;
}
.kv-tight .kv-row {
  padding: 5px 0;
}
.kv-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--text-2);
}

/* ============================================================================ positions & order form */
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.order-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.order-form .card-b {
  gap: 14px;
}
.quote-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quote-mini-price {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.quote-mini-chg {
  font-size: 13px;
  font-weight: 600;
}
.est {
  display: flex;
  flex-direction: column;
}
.est-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.est-row:last-child {
  border-bottom: 0;
}
.est-row span:first-child {
  color: var(--text-3);
  flex: 1;
}
.est-limits {
  line-height: 1.5;
}
.order-result {
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: 12.5px;
}
.order-result.is-risk {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.order-result.is-error {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
}
.order-result-h {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  color: var(--red-text);
}
.order-result.is-error .order-result-h {
  color: var(--amber-text);
}
.order-result ul {
  margin: 6px 0 0;
  padding-left: 20px;
}
.order-result li {
  margin: 2px 0;
}
.order-result-w {
  margin-top: 8px;
  color: var(--amber-text);
}
.order-result-w b {
  color: var(--text);
}
.order-result-f {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.order-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.order-confirm-sum {
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

/* narrow (card) layouts for positions & orders */
.pcards {
  display: flex;
  flex-direction: column;
}
.poscard,
.ordcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.poscard:last-child,
.ordcard:last-child {
  border-bottom: 0;
}
.poscard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 12.5px;
}
.poscard-sym {
  font-size: 14px;
}
.poscard-foot {
  color: var(--text-3);
  row-gap: 4px;
}
.poscard-kv b {
  color: var(--text);
  font-weight: 600;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
}
.ordcard-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.ordcard-line > .poscard-row {
  flex: 1;
  min-width: 0;
}
.ordcard-line > .icon-btn {
  flex: none;
  margin-top: -3px;
}
.ordcard-leg {
  padding-left: 4px;
  color: var(--text-2);
}
.ordcard.is-dim {
  opacity: 0.65;
}
.nocaps {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}
.alloc-grid .sub-h:not(:first-child),
.kgrid .sub-h:not(:first-child) {
  margin-top: 14px;
}

/* ============================================================================ symbol drawer */
.sym-price {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.sym-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sym-legend {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-3);
}
.lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.lg::before {
  content: "";
  width: 12px;
  height: 0;
  border-top: 2px dashed var(--text-3);
}
.lg-blue::before {
  border-color: var(--blue);
}
.lg-red::before {
  border-color: var(--red);
}
.lg-green::before {
  border-color: var(--green);
}
.lg-grey::before {
  border-color: var(--text-3);
}
.lg-amber::before {
  border-color: var(--amber);
}
.lg-accent::before {
  border-top-style: solid;
  border-top-width: 6px;
  border-color: var(--accent);
  border-radius: 2px;
}
.sym-chart-wrap {
  position: relative;
  height: 380px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.sym-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.sym-panel {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.sym-panel h4 {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.sym-orders {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.sym-order {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.sym-kelly {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  scroll-margin-top: 12px;
}
.sym-kelly-h {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-weight: 650;
}
.sym-kelly-h .muted {
  font-weight: 400;
}
.sym-kelly > .kelly {
  padding: 0 14px 14px;
}

/* ============================================================================ Kelly */
.kelly {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kelly-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kelly-geo {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 10px 8px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}
.kelly-geo b {
  color: var(--text);
}
.kelly-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 4px;
  color: var(--text-3);
}
.is-stale {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s;
}
.kres {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kres-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.kres-head.tone-green {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
}
.kres-head.tone-amber {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
}
.kres-head.tone-red {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.kres-headline {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
}
.kres-headline span {
  color: var(--text-2);
}
.kres-bind {
  font-size: 12px;
  color: var(--text-2);
}
.kmetrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.cell2 {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.cell2 > span:last-child {
  font-size: 11.5px;
}
.eq-chg {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 600;
}
.kmetric {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  min-width: 0;
}
.kmetric-l {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 550;
}
.kmetric-v {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.kmetric-s {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.kgrid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}
.caps {
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
}
.caps-h,
.caps-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: center;
}
.caps-h {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 4px;
}
.caps-row {
  position: relative;
  padding: 6px 0 9px;
  border-top: 1px solid var(--border);
}
.caps-row.is-binding .caps-label {
  font-weight: 650;
}
.caps-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
}
.caps-bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: color-mix(in srgb, var(--text-3) 60%, transparent);
}
.caps-row.is-binding .caps-bar span {
  background: var(--accent);
}
.caps-bar i {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 9px;
  background: var(--text);
  border-radius: 1px;
}
.kdd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
}
.kcmp {
  line-height: 1.5;
}
.kexpl {
  color: var(--text-2);
  line-height: 1.6;
  font-size: 13px;
}
.warn-list {
  margin: 0;
  padding: 8px 12px 8px 28px;
  border-radius: var(--r);
  background: var(--amber-soft);
  color: var(--amber-text);
  font-size: 12.5px;
}
.warn-list li {
  margin: 2px 0;
}
.kactions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================================ capital */
.cap-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.alloc-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.alloc-res,
.prisk {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 6px;
}
.mini-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.mini-kpi {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
}
.mini-kpi span {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-kpi b {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.mini-kpi small {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wbar {
  position: relative;
  height: 14px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.wbar-cur {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--text-3) 35%, transparent);
  border-radius: 4px;
}
.wbar-tgt {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  background: var(--accent);
  border-radius: 3px;
}
.wbar-tgt.is-short {
  background: var(--violet);
}
.alloc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.heat {
  display: grid;
  gap: 2px;
  font-size: 11px;
  overflow-x: auto;
}
.heat-h {
  padding: 3px 4px;
  font-weight: 650;
  color: var(--text-2);
  text-align: center;
  white-space: nowrap;
}
.heat-rh {
  text-align: right;
  padding-right: 6px;
}
.heat-c {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
}
.heat-c.is-diag {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface-3) 4px, var(--surface-3) 8px);
}
.rc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rc-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
}
.rc-sym {
  font-weight: 650;
}
.rc-val {
  text-align: right;
}
.rc-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  flex: 1;
}
.rc-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--red));
  border-radius: 4px;
}
.rc-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rc-inline .num {
  width: 40px;
  text-align: right;
}
.pairs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pairs li {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.pairs li:last-child {
  border-bottom: 0;
}
.caps-applied {
  font-size: 12.5px;
  color: var(--text-2);
}
.views {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.views-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.view-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.view-item .input-wrap .input {
  padding-right: 58px;
}

/* ============================================================================ tasks */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.task.is-off {
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
}
.task.is-off .task-name {
  color: var(--text-2);
}
.task.is-running {
  border-color: color-mix(in srgb, var(--green) 40%, var(--border));
}
.task-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 14px;
}
.task-main > .switch {
  margin-top: 2px;
}
.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.task-name {
  font-weight: 650;
  font-size: 13.5px;
}
.task-sched {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--text-2);
  font-size: 12.5px;
}
.task-sched span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.task-last {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  min-width: 0;
}
.task-last > .badge,
.task-last > .num {
  flex: none;
  white-space: nowrap;
}
.task-sum {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.task-prompt {
  color: var(--text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-actions {
  display: flex;
  gap: 2px;
  flex: none;
}
.runs {
  border-top: 1px solid var(--border);
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.run-row {
  display: grid;
  grid-template-columns: auto 132px 84px 60px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
}
.run-row:hover {
  background: var(--surface-2);
}
.run-when {
  color: var(--text-2);
}
.run-row > .num {
  white-space: nowrap;
}
.run-sum {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cron-check {
  min-height: 22px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cron-check:empty {
  display: none;
}
.cron-check.is-invalid {
  display: none;
}
.cron-desc {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-text);
}
.cron-desc b {
  color: var(--text);
}
.cron-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
}
.cron-run {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
}

/* ============================================================================ risk */
.risk-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.autonomy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.auto-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.auto-opt:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-2));
}
.auto-opt.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.auto-opt.is-auto.is-active {
  border-color: var(--amber);
  background: var(--amber-soft);
  box-shadow: 0 0 0 1px var(--amber);
}
.auto-radio {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
}
.auto-opt.is-active .auto-radio {
  border: 5px solid var(--accent);
}
.auto-opt.is-auto.is-active .auto-radio {
  border-color: var(--amber);
}
.auto-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.auto-body b {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auto-body span {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}
.killcard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.killcard.is-off {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: var(--red-soft);
}
.killcard-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.killcard-text span {
  font-size: 12px;
  color: var(--text-2);
}
.usage-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.usage-note {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-3);
}
.risk-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 70px;
}
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0 22px;
}
.spec {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.spec-wide {
  grid-column: 1 / -1;
}
.spec-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 12.5px;
}
.spec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
}
.spec-meta code {
  font-size: 10.5px;
  opacity: 0.85;
}
.spec.is-dirty .spec-label > span:first-child {
  color: var(--accent-text);
}
.dirty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.spec-num {
  display: flex;
  align-items: center;
  gap: 6px;
}
.spec-num .input {
  max-width: 140px;
}
.stepper {
  display: inline-flex;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  overflow: hidden;
}
.stepper button {
  width: 30px;
  height: 32px;
  border: 0;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 15px;
  color: var(--text-2);
}
.stepper button + button {
  border-left: 1px solid var(--border-2);
}
.stepper button:hover {
  background: var(--surface-3);
  color: var(--text);
}
.spec-range {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.spec-help {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
}
.savebar {
  position: sticky;
  bottom: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-2));
  box-shadow: var(--shadow-2);
  animation: toast-in 0.18s var(--ease);
}

/* ============================================================================ files */
.page-files {
  height: 100%;
  min-height: 560px;
}
.files {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.files-tree {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 210px);
  overflow: hidden;
}
.files-tree-h {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
}
.tree {
  overflow-y: auto;
  padding: 6px;
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 30px;
  padding-right: 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.tree-item:hover {
  background: var(--surface-2);
}
.tree-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.tree-dir {
  font-weight: 600;
}
.tree-ico {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex: none;
}
.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tree-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-size {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  flex: none;
}
.files-view {
  min-width: 0;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.viewer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.viewer-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
}
.crumb {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-3);
  white-space: nowrap;
  cursor: default;
}
button.crumb {
  cursor: pointer;
}
button.crumb:hover {
  color: var(--accent-text);
}
.crumb.is-last {
  color: var(--text);
  font-weight: 600;
}
.crumb-sep {
  color: var(--text-3);
  opacity: 0.6;
}
.viewer-b {
  padding: 16px 20px 24px;
  overflow: auto;
  min-width: 0;
}
.code {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.code-sm {
  font-size: 11.5px;
  padding: 8px 10px;
  max-height: 300px;
  overflow: auto;
}
.j-key {
  color: var(--blue-text);
}
.j-str {
  color: var(--green-text);
}
.j-num {
  color: var(--amber-text);
}
.j-lit {
  color: var(--violet-text);
}
.csv-meta {
  margin-bottom: 8px;
}
.csv-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.tbl-csv th:first-child,
.tbl-csv td:first-child {
  padding-left: 10px;
}
.csv-n {
  width: 1%;
  text-align: right;
}
.img-view {
  display: flex;
  justify-content: center;
}
.img-view img {
  max-width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #fff;
}
.trunc-note {
  margin-top: 10px;
}

/* ============================================================================ journal */
.notif-list {
  overflow: hidden;
}
.notif {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif:last-child {
  border-bottom: 0;
}
.notif.is-unread {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.notif.is-limit {
  background: var(--amber-soft);
  box-shadow: inset 3px 0 0 var(--amber);
}
.notif-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.notif-title {
  font-weight: 600;
}
.notif-body {
  color: var(--text-2);
  font-size: 12.5px;
  white-space: pre-line;
  word-break: break-word;
}
.notif-meta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}
.audit {
  padding: 4px 0;
}
.audit-day-h {
  position: sticky;
  top: 0;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.audit-row {
  display: grid;
  grid-template-columns: 46px 12px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.audit-time {
  color: var(--text-3);
  font-size: 12px;
  padding-top: 1px;
}
.audit-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--text-3);
}
.audit-dot.tone-green {
  background: var(--green);
}
.audit-dot.tone-red {
  background: var(--red);
}
.audit-dot.tone-amber {
  background: var(--amber);
}
.audit-dot.tone-blue {
  background: var(--blue);
}
.audit-dot.tone-violet {
  background: var(--violet);
}
.audit-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.audit-sum {
  color: var(--text-2);
  font-size: 12.5px;
  min-width: 0;
  word-break: break-word;
}
.audit-details {
  border: 0;
  background: none;
}
.audit-details .collapsible-h {
  padding: 0;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  width: auto;
}
.audit-details .collapsible-b {
  padding: 6px 0 2px;
}

/* ============================================================================ settings */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.settings-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.usage-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 130px;
  padding: 6px 0 0;
  border-bottom: 1px solid var(--border);
}
.uc-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  min-width: 2px;
}
.uc-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
}
.uc-bar.is-zero {
  background: var(--surface-3);
}
.uc-col:hover .uc-bar {
  filter: brightness(1.2);
}
.uc-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}
.uc-today {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12.5px;
}
.sec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sec-list li {
  display: flex;
  gap: 12px;
}
.sec-ico {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.sec-list div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sec-list span {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
}

/* ============================================================================ login */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg);
}
.login-theme {
  position: fixed;
  top: 14px;
  right: 14px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 28px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-3);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.login-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-sub {
  color: var(--text-3);
  font-size: 12.5px;
}
.login-input-row {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-3);
  display: flex;
  pointer-events: none;
}
.login-input-row .input {
  padding-left: 36px;
}
.login-error {
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--red-soft);
  color: var(--red-text);
  font-size: 12.5px;
}
.login-submit {
  height: 40px;
  margin-top: 6px;
  font-size: 14px;
}
.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}

/* ============================================================================ responsive */
@container page (max-width: 1080px) {
  .ov-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  }
}
@container page (max-width: 620px) {
  .kmetrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container page (max-width: 900px) {
  .ov-grid,
  .risk-top,
  .settings-grid,
  .order-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .alloc-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container page (max-width: 700px) {
  .kgrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container page (max-width: 640px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sym-panels,
  .autonomy {
    grid-template-columns: minmax(0, 1fr);
  }
  .files {
    grid-template-columns: minmax(0, 1fr);
  }
  .spec-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container page (max-width: 520px) {
  .hide-sm {
    display: none;
  }
}
@container page (max-width: 440px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .kmetrics,
  .mini-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container page (max-width: 300px) {
  .form-grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 1500px) {
  .mkt-time {
    display: none;
  }
}
@media (max-width: 1380px) {
  .mkt-long {
    display: none;
  }
}
@media (max-width: 1240px) {
  .agent-ind-label {
    display: none;
  }
}
@media (max-width: 1180px) {
  .brand-name {
    display: none;
  }
  .hdr-equity-pl {
    font-size: 12px;
  }
}
@media (max-width: 1060px) {
  .kill-btn > span {
    display: none;
  }
  .kill-btn {
    width: 34px;
    padding: 0;
  }
}
@media (max-width: 899px) {
  body {
    font-size: 13.5px;
  }
  .gbanner {
    padding: 6px 12px;
  }
  .gbanner-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
  }
  .gbanner-text.is-expanded {
    display: block;
  }
  .page-h {
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  .page-h > div:first-child {
    min-width: 0;
  }
  .page-actions {
    flex-wrap: nowrap;
    flex: none;
  }
  .page-actions .btn {
    width: 34px;
    height: 34px;
    padding: 0;
  }
  .page-actions .btn > span:not(.spinner) {
    display: none;
  }
  .page-files {
    height: auto;
  }
  .files-view {
    min-height: 0;
  }
  .page-inner {
    padding: 12px 12px 28px;
    gap: 12px;
  }
  .page-title {
    font-size: 18px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi {
    padding: 10px 12px;
  }
  .kpi-value {
    font-size: 17px;
  }
  .eq-wrap {
    height: 210px;
  }
  .sym-chart-wrap {
    height: 300px;
  }
  .files-tree {
    max-height: none;
  }
  .drawer {
    width: 100vw !important;
    border-left: 0;
  }
  .drawer-h {
    padding: 12px 12px 10px 16px;
    flex-wrap: wrap;
  }
  .drawer-b {
    padding: 14px 14px 24px;
  }
  .drawer-actions {
    order: 3;
    width: 100%;
  }
  .toasts {
    left: 12px;
    right: 12px;
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
    width: auto;
  }
  .modal {
    max-height: calc(100dvh - 24px);
  }
  .overlay {
    padding: 12px;
  }
  .task-main {
    flex-wrap: wrap;
  }
  .task-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: -4px;
  }
  .run-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .run-row .run-sum,
  .run-row > .num.muted {
    display: none;
  }
  .input-search {
    width: 100%;
  }
  .card-h {
    padding: 10px 12px 0;
    flex-wrap: wrap;
  }
  .card-b {
    padding: 10px 12px 12px;
  }
  .card-b-flush {
    padding: 6px 0 0;
  }
  .tbl th:first-child,
  .tbl td:first-child {
    padding-left: 12px;
  }
  .tbl th:last-child,
  .tbl td:last-child {
    padding-right: 12px;
  }
  .onboard {
    flex-wrap: wrap;
  }
  .onboard .btn {
    width: 100%;
  }
  .chat-jump {
    bottom: 140px;
  }
  .composer {
    padding: 6px 8px 8px;
  }
  .savebar {
    bottom: 8px;
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  .login-card {
    padding: 22px 18px 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* voice input: pulsing mic while dictating */
.composer-actions .mic-on { animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); } 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } }
@media (prefers-reduced-motion: reduce) { .composer-actions .mic-on { animation: none; } }

/* knowledge base: area tabs + upload zone */
.files-areas { margin-top: 10px; }
.kb-drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 14px;
  border: 1px dashed var(--border, rgba(127,127,127,.35)); border-radius: 12px; }
.kb-drop.is-drag { border-color: var(--accent, #7c83ff); background: rgba(124, 131, 255, .08); }

/* closed positions summary strip */
.closed-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 4px 2px 14px; }
.closed-summary > div { display: flex; flex-direction: column; gap: 2px; }
.closed-summary b { font-size: 15px; }

/* risk profile picker */
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.profile-opt { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border, rgba(127,127,127,.3)); background: transparent; color: inherit; cursor: pointer; }
.profile-opt:hover:not(:disabled) { border-color: var(--accent, #7c83ff); }
.profile-opt.is-active { border-color: var(--accent, #7c83ff); background: rgba(124, 131, 255, .10); box-shadow: 0 0 0 1px var(--accent, #7c83ff) inset; }
.profile-opt.is-aggr.is-active { border-color: #f59e0b; background: rgba(245, 158, 11, .10); box-shadow: 0 0 0 1px #f59e0b inset; }
.profile-opt.is-extreme.is-active { border-color: #ef4444; background: rgba(239, 68, 68, .10); box-shadow: 0 0 0 1px #ef4444 inset; }
.profile-text { font-size: 13px; opacity: .85; }
.profile-nums { font-size: 11.5px; opacity: .7; }
.profile-note { margin-top: 8px; }

/* expandable task cards */
.task-body.is-clickable { cursor: pointer; }
.task-chev { opacity: .55; transition: transform .15s; flex: none; }
.task-chev.rot90 { transform: rotate(90deg); }
.task-expanded { margin-top: 10px; display: flex; flex-direction: column; gap: 12px; cursor: auto; }
.task-ex-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; opacity: .6; margin-bottom: 4px; }
.task-ex-prompt { white-space: pre-wrap; font-size: 13px; line-height: 1.5; opacity: .9; }
.task-ex-md { font-size: 13.5px; }
.task-ex-actions { display: flex; gap: 8px; flex-wrap: wrap; }
