:root {
  --bg: #14161a;
  --panel: #1b1e24;
  --line: #2a2f38;
  --text: #dfe3ea;
  --muted: #8a93a3;
  --accent: #d8b46a;
  --good: #6fbf73;
  --warn: #d9a441;
  --bad: #cf6a5a;
}

/* Combat achievements */
.ca-page { max-width: 1100px; padding: 20px; margin: 0 auto; }
.ca-page h1 { margin: 0 0 8px; }
.ca-page a { color: var(--accent); }
.ca-page p { color: var(--muted); }
.ca-account, .ca-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 18px 0; }
.ca-account label, .ca-filters label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.ca-account input, .ca-filters input, .ca-filters select, .ca-page button { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 8px; font: inherit; }
.ca-account input[type=file] { max-width: 260px; }
.ca-filters input[type=number] { width: 72px; }
.ca-filters input[type=search] { min-width: 190px; }
.ca-page button { cursor: pointer; }
.ca-page button:hover { border-color: var(--accent); }
.ca-hint { line-height: 1.5; }
#caMessage { color: var(--accent); min-height: 1em; }
#caSummary { border-top: 1px solid var(--line); padding-top: 12px; }
.ca-row { --ca-hue: 0; margin: 5px 0; padding: 13px 12px; border-left: 4px solid hsl(var(--ca-hue) 72% 66%); border-bottom: 1px solid var(--line); background: hsl(var(--ca-hue) 55% 45% / .09); border-radius: 3px; }
.ca-row.ca-neutral { border-left-color: var(--muted); background: var(--panel); }
.ca-row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; font-weight: 600; }
.ca-row-head a { font-size: 15px; color: hsl(var(--ca-hue) 72% 72%); }
.ca-neutral .ca-row-head a { color: var(--accent); }
.ca-points { margin-left: auto; color: var(--accent); white-space: nowrap; }
.ca-meta { color: var(--muted); margin: 3px 0; font-size: 12px; }
.ca-percent { color: hsl(var(--ca-hue) 72% 72%); }
.ca-neutral .ca-percent { color: var(--muted); }
.ca-scale { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 12px 0; }
.ca-scale[hidden] { display: none; }
.ca-scale-bar { display: inline-block; width: 110px; height: 9px; border-radius: 4px; background: linear-gradient(90deg, hsl(0 72% 66%), hsl(60 72% 66%), hsl(120 72% 66%)); }
.ca-description { color: var(--text); }
.ca-badge { border-radius: 4px; padding: 2px 5px; font-size: 11px; }
.ca-badge.done { color: var(--good); background: #183321; }
.ca-badge.todo { color: var(--muted); background: #282d34; }
.ca-empty { padding: 20px 0; }
#caMore { margin: 16px 0 30px; }
.ca-group-toggle { flex-direction: row !important; align-items: center; padding: 8px 0; cursor: pointer; }
.ca-group-toggle input { margin: 0 5px 0 0; }
.ca-boss-group { margin: 5px 0; border: 1px solid var(--line); border-radius: 4px; }
.ca-boss-group summary { cursor: pointer; padding: 10px 12px; color: var(--accent); font-size: 16px; }
.ca-boss-group summary small { color: var(--muted); font-size: 12px; margin-left: 8px; }
.ca-boss-rows { padding: 0 8px 8px; }
.master-summary { border: 1px solid var(--line); border-radius: 5px; padding: 14px; background: var(--panel); margin: 18px 0; }
.master-summary p { margin: 6px 0; }
.master-page h2 { margin: 26px 0 8px; }
.master-row .ca-row-head { align-items: center; }
.master-row button { margin-left: 5px; }
.master-page input[type=search] { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 8px; font: inherit; max-width: 100%; }

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

/* ── Nav ───────────────────────────────────────────── */
#nav {
  width: 190px;
  flex: 0 0 190px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}
#nav .brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  padding: 0 18px 16px;
  letter-spacing: .5px;
}
#nav .brand span { color: var(--muted); font-weight: 400; margin-left: 4px; }
#nav a {
  display: block;
  padding: 8px 18px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}
#nav a:hover { color: var(--text); background: #21252c; }
#nav a.active { color: var(--accent); border-left-color: var(--accent); background: #21252c; }
.nav-more summary { cursor: pointer; padding: 8px 18px; color: var(--muted); list-style-position: inside; }
.nav-more summary:hover, .nav-more[open] summary { color: var(--accent); background: #21252c; }
.nav-more-links a { padding-left: 30px !important; }
.nav-more-short { display: none; }
.nav-foot { margin-top: auto; padding: 12px 18px 0; }
.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #232830;
  margin-top: 6px;
  color: var(--good);
}
.chip.muted { color: var(--muted); }
.chip.stale { color: var(--bad); }

/* ── Main ──────────────────────────────────────────── */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#controls {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
#controls input[type=text], #controls input[type=number] {
  width: 120px;
  background: #12141a;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 7px;
  border-radius: 4px;
  font-family: inherit;
}
#controls select {
  background: #12141a;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 7px;
  border-radius: 4px;
}
#controls output { color: var(--text); min-width: 42px; font-variant-numeric: tabular-nums; }
.status { margin-left: auto; font-size: 12px; color: var(--muted); }

.toggle {
  background: #12141a;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.toggle:hover { color: var(--text); border-color: #3a4150; }
.toggle.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* Sell-shock watch: compact on desktop, readable cards on mobile. */
#view-dumps { padding: 22px; }
.dump-caveat { max-width: 900px; color: var(--warn); line-height: 1.5; }
.dump-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 18px 0; }
.dump-filters label { display: flex; gap: 7px; align-items: center; color: var(--muted); }
.dump-filters select, .dump-filters input[type=number] {
  background: #12141a; color: var(--text); border: 1px solid var(--line);
  padding: 6px; border-radius: 4px; max-width: 140px;
}
.dump-list { display: grid; gap: 12px; max-width: 1100px; }
.dump-card { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 15px; }
.dump-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dump-top h2 { margin: 0 0 3px; font-size: 17px; }
.dump-top a { color: var(--accent); white-space: nowrap; }
.dump-prices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.dump-prices > div { padding: 9px; background: #15181d; border-radius: 4px; }
.dump-prices small { display: block; color: var(--muted); }
.dump-prices strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.dump-card details { color: var(--muted); }
.dump-card summary { cursor: pointer; color: var(--accent); }
@media (max-width: 700px) { .dump-prices { grid-template-columns: 1fr; gap: 5px; } #view-dumps { padding: 14px; } }

/* ── Sparkline hover readout ───────────────────────── */
.spark-wrap { position: relative; }
.spark-wrap svg { display: block; cursor: crosshair; }
.spark-readout {
  position: absolute;
  top: -4px;
  background: #0e1014;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.spark-readout .d { color: var(--muted); }
.spark-readout .h { color: var(--accent); }
.spark-readout .l { color: #7fa8d8; }
.spark-readout.hidden { display: none; }

/* An info affordance for anything carrying an explanatory title. */
.info {
  border-bottom: 1px dotted var(--muted);
  cursor: help;
}

.view { padding: 16px 20px; flex: 1; min-height: 0; max-width: 1540px; }
.view.hidden { display: none; }
.hidden { display: none !important; }
.note {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-left: 3px solid var(--accent);
  background: #1e2128;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 900px;
}

/* ── Per-domain sub-toolbar (money makers, training) ── */
.subbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.subhint { font-size: 12px; color: var(--muted); }
.subbar select {
  background: #12141a;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.seg button {
  background: #12141a;
  border: none;
  color: var(--muted);
  padding: 5px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--bg); }

/* ── Grid ──────────────────────────────────────────── */
#grid { height: calc(100vh - 190px); }
#mmGrid, #trGrid { height: calc(100vh - 165px); }
.method-name { color: var(--text); font-weight: 600; }
.source-link { color: var(--accent); font-size: 11px; margin-left: 6px; white-space: nowrap; }
.source-link:hover { color: #f7d893; }
#mmGrid .tabulator-row, #trGrid .tabulator-row { cursor: pointer; }
.row-exception { border-left: 3px solid var(--warn) !important; }
.row-provisional { opacity: .88; }
.row-lowconf { opacity: .45; }
.badge.est { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.unknown { color: var(--muted); font-style: italic; }
.badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #2c313a;
  color: var(--muted);
  margin-left: 5px;
}
.badge.prov { color: var(--warn); }

/* ── Drawer ────────────────────────────────────────── */
#drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 18px 20px;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0,0,0,.4);
}
#drawer.hidden { display: none; }
#drawerClose {
  position: absolute; right: 12px; top: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer;
}
#drawer h2 { margin: 0 0 4px; font-size: 17px; color: var(--accent); }
#drawer h3 { margin: 18px 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #22262e; }
.kv span:first-child { color: var(--muted); }
.bar { height: 7px; background: #262b33; border-radius: 3px; overflow: hidden; margin: 3px 0 9px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.factor-label { display: flex; justify-content: space-between; font-size: 12px; }

/* ── Methodology ───────────────────────────────────── */
#methodology { max-width: 760px; }
#methodology h2 { font-size: 15px; color: var(--accent); margin-top: 22px; }
#methodology code {
  background: #12141a; padding: 1px 5px; border-radius: 3px; color: var(--accent);
}
#methodology table { border-collapse: collapse; width: 100%; margin-top: 8px; }
#methodology td, #methodology th {
  border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; font-size: 13px;
}
#methodology th { color: var(--muted); font-weight: 500; }
.placeholder { color: var(--muted); padding: 40px 0; text-align: center; }

/* ── What-next dashboard ───────────────────────────── */
.dash-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.dash-head h1 { margin: 0; font-size: 20px; color: var(--accent); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
}
/* On the dashboard, the training plan is the widest table — give it the full row.
   Scoped to #view-next so it doesn't reshape the alerts page's grid. */
#view-next .dash-grid > .panel:nth-child(2) { grid-column: 1 / -1; }
.panel h2 {
  margin: 0 0 10px; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
table.dash { border-collapse: collapse; width: 100%; font-size: 13px; }
table.dash th, table.dash td {
  padding: 5px 8px; border-bottom: 1px solid #22262e; text-align: left;
}
table.dash th { color: var(--muted); font-weight: 500; }
table.dash td.r, table.dash th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.dash td.mut, .mut { color: var(--muted); }

/* ── Alerts / watchlist ────────────────────────────── */
.tokrow { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tokrow input { background: #12141a; border: 1px solid var(--line); color: var(--text);
  padding: 5px 8px; border-radius: 4px; width: 260px; margin-left: 6px; }
.ruleform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ruleform input, .ruleform select, .ruleform textarea { background: #12141a;
  border: 1px solid var(--line); color: var(--text); padding: 5px 8px;
  border-radius: 4px; font: inherit; font-size: 12px; }
.ruleform textarea { width: 100%; resize: vertical; font-family: inherit; }
.ruleform label { display: flex; flex-direction: column; gap: 3px; }
.ruleform > label { align-items: stretch; }
.linkbtn { background: none; border: none; color: var(--bad); cursor: pointer;
  font: inherit; font-size: 12px; text-decoration: underline; }

/* ── Method details ─────────────────────────────────── */
#view-method { max-width: 1220px; overflow-y: auto; }
.method-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 13px; }
#view-method h1 { font-size: clamp(22px, 3vw, 32px); color: var(--accent); margin: 0 0 4px; }
.method-source { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.method-source a { color: var(--accent); }
.method-description { max-width: 900px; line-height: 1.6; white-space: pre-wrap; }
.method-warning { max-width: none; color: var(--warn); border-left-color: var(--warn); }
.method-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 22px 0; }
.method-section { min-width: 0; overflow-wrap: anywhere; }
.method-section h2 { color: var(--accent); }
.detail-list { padding-left: 20px; margin: 4px 0; }
.detail-list li { margin: 5px 0; }
.detail-pairs { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr; gap: 5px 12px; margin: 5px 0; }
.detail-pairs dt { color: var(--muted); text-transform: capitalize; }
.detail-pairs dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.method-calc { margin-bottom: 30px; }
.method-calc-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.method-calc-head p { margin: 0 0 14px; }
.method-calc-head label { display: grid; gap: 5px; min-width: 150px; }
.method-calc-head input { width: 150px; background: #12141a; border: 1px solid var(--line); color: var(--text); padding: 7px 9px; border-radius: 4px; font: inherit; }
.method-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 9px; }
.method-metrics .metric { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #15181e; }
.method-metrics .metric span { color: var(--muted); font-size: 12px; }
.method-metrics .metric strong { font-size: 20px; color: var(--text); }
.method-breakdown { margin-top: 16px; }
.method-breakdown summary { color: var(--accent); cursor: pointer; }
#methodCalculations.calculating { opacity: .55; }
.method-add-fields { display: grid; gap: 10px; border: 1px solid var(--line); padding: 12px; border-radius: 5px; }

/* The desktop rail becomes a horizontally scrollable command strip on phones. */
@media (max-width: 760px) {
  body { display: block; min-width: 320px; }
  #nav {
    position: sticky; top: 0; z-index: 20;
    width: 100%; max-width: 100vw; height: auto; padding: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center;
    overflow: visible; white-space: nowrap;
    border-right: 0; border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
  }
  #nav .brand { grid-column: 1 / -1; padding: 6px 12px 2px; font-size: 13px; }
  #nav a { min-width: 0; padding: 8px 5px; text-align: center; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; }
  #nav a.active { border-bottom-color: var(--accent); }
  #nav .nav-more { position: relative; }
  #nav .nav-more summary { padding: 8px; font-size: 12px; }
  #nav .nav-more-short { display: inline; }
  #nav .nav-more-full { display: none; }
  #nav .nav-more-links { position: fixed; top: 66px; right: 0; width: min(260px, 85vw); max-height: calc(100vh - 74px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 24px #0009; white-space: normal; }
  #nav .nav-more-links a { padding: 10px 16px !important; border-bottom: 1px solid var(--line); }
  #nav .nav-foot { display: none; }
  main { width: 100%; min-width: 0; overflow: hidden; }
  #controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; }
  #controls label { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
  #controls input[type=text], #controls input[type=number], #controls input[type=range], #controls select { width: 100%; min-width: 0; }
  #controls .status { grid-column: 1 / -1; margin: 0; overflow-wrap: anywhere; }
  #controls .toggle { justify-self: start; }
  .view { width: 100%; max-width: 100%; min-width: 0; padding: 12px; overflow-x: auto; }
  #grid, #mmGrid, #trGrid { width: 100%; height: min(68vh, 650px); }
  .subbar { flex-wrap: wrap; gap: 8px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  #view-next .dash-grid > .panel:nth-child(2) { grid-column: auto; }
  .panel { min-width: 0; overflow-x: auto; }
  .tokrow { flex-wrap: wrap; }
  .tokrow input { max-width: calc(100vw - 50px); margin-left: 0; }
  #drawer { width: min(420px, 100vw); z-index: 30; }
  .method-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .method-calc-head { flex-direction: column; }
  .detail-pairs { grid-template-columns: minmax(0, 1fr); }
}

/* Source-backed method pages and editable calculation */
.md-description { max-width: 900px; line-height: 1.6; margin: 18px 0; }
.md-description p { margin: 8px 0; }
.md-chip { display: inline-block; font-size: 11px; font-weight: 650; border-radius: 999px; padding: 3px 8px; background: #253440; color: #b6e4e3; }
.md-chip.md-derived { background: #322f25; color: #e4ce8c; }
.md-chip.md-custom { background: #282f47; color: #bcc9f7; }
.md-chip.md-missing { background: #35282b; color: #e6b4b7; }
.md-section { min-width: 0; overflow-wrap: anywhere; }
.md-section header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.md-section h2 { margin: 0; color: var(--accent); }
.md-section h3 { font-size: 13px; margin: 17px 0 7px; }
.md-note, .md-sub, .md-ref, .md-missing-text { color: var(--muted); font-size: 12px; }
.md-ref { margin-left: 5px; }
.md-list { margin: 8px 0; padding-left: 20px; }
.md-list li { margin: 5px 0; }
.md-wide { grid-column: 1 / -1; }
.md-pairs { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 7px 12px; }
.md-pairs dt { color: var(--muted); }
.md-pairs dd { margin: 0; }
.md-pairs ul { margin: 0; }
.md-gear { margin: 10px 0 17px; }
.md-gear-title { font-weight: 650; margin-bottom: 6px; }
.md-scroll { width: 100%; overflow-x: auto; }
.md-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.md-table th, .md-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md-table .r { text-align: right; white-space: nowrap; }
.md-table input { background: #12141a; border: 1px solid var(--line); border-radius: 4px; color: var(--text); padding: 5px; width: 95px; }
.md-binding { background: rgba(230, 174, 72, .08); }
.md-inv-wrap { display: inline-block; max-width: 100%; margin: 8px 15px 12px 0; vertical-align: top; }
.md-inv { width: 244px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.md-slot { display: grid; place-items: center; min-height: 48px; padding: 3px; background: #27221e; border: 1px solid #4a4034; border-radius: 4px; font-size: 10px; text-align: center; overflow-wrap: anywhere; }
.md-slot.empty { opacity: .38; }
.md-calc-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.md-inputs { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; }
.md-inputs label, .am-form label { display: grid; gap: 5px; min-width: 100px; }
.md-inputs input, .md-inputs select, .am-form input, .am-form select, .am-form textarea { background: #12141a; border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 7px 9px; font: inherit; }
.md-inputs input { width: 130px; }
.md-steps { font-size: 12px; line-height: 1.6; padding-left: 22px; }
.md-steps li { margin: 4px 0; }
.md-more { margin: 10px 0; }
.md-more summary { cursor: pointer; color: var(--accent); }
.md-warn, .md-warn-text { color: var(--warn); }
.am-form { max-width: 920px; }
.am-form label { margin: 9px 0; }
.am-form textarea { width: 100%; resize: vertical; }
.am-row { display: flex; flex-wrap: wrap; gap: 12px; }
.am-type, #amValue { margin: 13px 0; }
.am-drop-head, .am-drop { display: grid; grid-template-columns: minmax(140px, 2fr) minmax(120px, 1fr) 100px auto; gap: 7px; align-items: center; margin: 5px 0; }
.am-drop input { min-width: 0; width: 100%; }
.am-more { margin-top: 18px; }
.am-actions { display: flex; gap: 12px; align-items: center; margin: 16px 0 7px; }
.am-hint { font-size: 11px; }
@media (max-width: 760px) { .md-pairs { grid-template-columns: 1fr; } .md-calc-head { flex-direction: column; } .am-drop-head { display: none; } .am-drop { grid-template-columns: 1fr 1fr; } .am-drop-name { grid-column: 1 / -1; } }
/* Flip decision and journal: the action remains visible before the diagnostics. */
.trade-action, .journal-import, .flip-card, .journal-summary {
  border: 1px solid var(--border, #343b45);
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
  background: var(--panel, #1d222a);
}
.trade-action h3, .flip-card h3 { margin: 0 0 8px; }
.trade-action p { line-height: 1.5; }
.flip-card details { margin-top: 10px; }
.flip-card form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0; }
.flip-card label { display: grid; gap: 4px; min-width: 110px; flex: 1 1 125px; }
.flip-card input, .flip-card select { width: 100%; box-sizing: border-box; }
.journal-error:not(:empty) { color: #f3a0a0; }
.journal-import input[type=file] { max-width: 100%; margin: 8px 8px 8px 0; }
#view-journal button, #planFlip {
  background: #273039; color: var(--text); border: 1px solid #4a5a66;
  border-radius: 5px; padding: 7px 11px; font: inherit; cursor: pointer;
}
#view-journal button:hover, #planFlip:hover { border-color: var(--accent); color: var(--accent); }
#view-journal button:disabled { opacity: .45; cursor: default; }
.flip-card input, .flip-card select {
  background: #12141a; color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 9px; font: inherit;
}

/* Public-data strategy suggestions: compact on desktop, readable on phone. */
.strategy-intro { margin-bottom: 20px; }
.strategy-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.strategy-controls label { display: grid; gap: 5px; }
.strategy-controls input { width: 170px; }
.strategy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)); gap: 12px; margin: 12px 0 24px; }
.strategy-card { padding: 16px; border: 1px solid var(--border, #3b4350); border-radius: 10px; background: var(--panel, #1b2028); }
.strategy-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.strategy-card h3 { margin: 0; }
.strategy-card p { line-height: 1.5; }
.strategy-scenario { color: var(--positive, #85d7a0); }
