:root {
  color-scheme: light;
  --bg: #eef5f8;
  --panel: #ffffff;
  --panel-2: #f3f8fb;
  --line: #c8d7e3;
  --text: #14263a;
  --muted: #526b80;
  --accent: #087f78;
  --accent-strong: #087f78;
  --positive: #087c46;
  --negative: #b92f3d;
  --warning: #895d00;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 15% 0%, #d9eef4 0, var(--bg) 38rem); color: var(--text); }
button, input, select, textarea { font: inherit; }
.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 26px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.75rem, 4vw, 2.65rem); letter-spacing: -0.04em; }
h2 { margin-bottom: 6px; font-size: 1.15rem; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.subtitle, .panel-heading p, footer, .help { color: var(--muted); }
.subtitle { max-width: 740px; margin-bottom: 0; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--accent); }
.button.primary { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; font-weight: 700; }
.button:disabled { opacity: .55; cursor: wait; }
.notice { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.notice.error { border-color: var(--negative); color: var(--negative); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 142px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, var(--panel), var(--panel-2)); box-shadow: 0 8px 24px rgba(34,74,101,.07); }
.metric span { color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.metric strong { display: block; margin: 14px 0 6px; font-size: 2rem; letter-spacing: -.04em; }
.metric small { color: var(--muted); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 10px 30px rgba(34,74,101,.07); overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-heading p { margin-bottom: 0; line-height: 1.45; }
.filter { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; }
select, input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); padding: 10px 11px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 990px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .73rem; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: .9rem; }
tbody tr:hover { background: rgba(8,127,120,.055); }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: .76rem; white-space: nowrap; }
.badge.positive { background: rgba(80,216,144,.12); color: var(--positive); }
.badge.negative { background: rgba(255,107,120,.12); color: var(--negative); }
.badge.warning { background: rgba(247,198,95,.12); color: var(--warning); }
.bias { font-weight: 700; }
.bias.bullish { color: var(--positive); }
.bias.bearish { color: var(--negative); }
.bias.sideways { color: var(--warning); }
.numeric { font-variant-numeric: tabular-nums; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.row-button { min-height: 34px; padding: 0 10px; }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; font-size: .76rem; line-height: 1.45; }
dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(2,8,16,.76); backdrop-filter: blur(5px); }
dialog form { padding: 20px; overflow-y: auto; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 1.35rem; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 1.5rem; cursor: pointer; }
fieldset { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 7px; font-weight: 700; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .84rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.trade-fields { margin-top: 12px; }
.trade-fields[aria-disabled="true"] { opacity: .45; }
.check { display: flex; align-items: center; gap: 9px; color: var(--text); }
.check input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.row-actions, .report-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.report-dialog { padding: 20px; }
.report-content { min-height: 280px; max-height: 62vh; margin: 14px 0 0; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; font: 400 .82rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth-card { width: min(460px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 14px 40px rgba(34,74,101,.10); }
.auth-form { display: grid; gap: 14px; margin-top: 22px; }
.auth-form .button { margin-top: 4px; }
.back-link { display: inline-block; margin-top: 20px; color: var(--muted); }
.token-box { display: block; margin: 12px 0; padding: 12px; border-radius: 9px; background: var(--panel-2); overflow-wrap: anywhere; user-select: all; }
.notice.success { border-color: var(--positive); }
.narrow-shell { max-width: 980px; }
.settings-panel { margin-bottom: 18px; }
.padded-form, .schedule-list, .cron-panel > label { padding: 0 20px 20px; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 20px 20px; }
.status-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.status-grid span, .status-grid strong { display: block; }
.status-grid span { margin-bottom: 5px; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.cron-panel > label { display: block; }
.cron-panel input { margin-top: 6px; }
.guide-shell { max-width: 1120px; }
.guide-section { margin-bottom: 16px; padding: 22px; overflow: visible; }
.guide-heading { margin-bottom: 14px; }
.guide-heading .eyebrow { margin-bottom: 5px; }
.guide-section > p { line-height: 1.6; }
.probability-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.definition-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.definition-card h3 { margin: 12px 0 7px; }
.definition-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.guide-badge { display: inline-flex; min-width: 34px; min-height: 30px; align-items: center; justify-content: center; border-radius: 999px; font-weight: 700; }
.guide-badge.bullish { background: rgba(8,124,70,.12); color: var(--positive); }
.guide-badge.bearish { background: rgba(185,47,61,.11); color: var(--negative); }
.guide-badge.sideways { background: rgba(137,93,0,.12); color: var(--warning); }
.example-line { padding: 14px 16px; border-left: 4px solid var(--accent); background: var(--panel-2); line-height: 1.55; }
.quality-list { display: grid; gap: 9px; padding-left: 23px; line-height: 1.5; }
.guide-table-wrap { overflow-x: auto; }
.guide-table { min-width: 720px; }
.guide-table th:first-child { width: 20%; }
.guide-table th:last-child { width: 22%; }
.guide-two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.action-definitions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.action-definitions div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.action-definitions dt { font-weight: 700; }
.action-definitions dd { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.formula { padding: 14px; border-radius: 10px; background: var(--panel-2); color: var(--text); font: 700 1.1rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.guide-automation { max-width: 1120px; margin: 0 auto 26px; line-height: 1.55; }

@media (max-width: 900px) {
  .topbar, .panel-heading { align-items: stretch; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1440px); padding-top: 20px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .primary { grid-column: 1 / -1; }
  .status-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 118px; padding: 14px; }
  .metric strong { margin-top: 10px; font-size: 1.55rem; }
  .metric small { font-size: .72rem; }
  .panel-heading { padding: 15px; }
  footer { flex-direction: column; }
  .form-grid, .form-grid.four { grid-template-columns: 1fr; }
  dialog form { padding: 16px; }
  .guide-section { padding: 17px; }
  .probability-grid, .guide-two-column, .action-definitions { grid-template-columns: 1fr; }
}
