/* Trotline: neutral product styles. The fund's name appears inside; the brand stays plain. */

:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --ink: #1b1d1c;
  --muted: #646a67;
  --faint: #8d938f;
  --line: #e2e3de;
  --line-strong: #cfd1cb;
  --accent: #1f5f5b;
  --accent-ink: #ffffff;
  --accent-soft: #e3efed;
  --good: #23704a;
  --good-soft: #e2f2e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --bad: #a3322b;
  --bad-soft: #f9e4e2;
  --shadow: 0 1px 2px rgba(20, 24, 22, .06);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121413;
    --panel: #1a1d1c;
    --ink: #e8eae7;
    --muted: #a2a8a4;
    --faint: #7c827e;
    --line: #2a2e2c;
    --line-strong: #3a3f3c;
    --accent: #5fb3aa;
    --accent-ink: #0e1413;
    --accent-soft: #1c3331;
    --good: #6cc495;
    --good-soft: #1a3226;
    --warn: #e0b45c;
    --warn-soft: #362b14;
    --bad: #ee8a82;
    --bad-soft: #3a1f1d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 48px 24px; color: var(--muted); }

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

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 8px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 14px; height: 14px; }
.fund { padding: 0 8px; }
.fund-name { font-weight: 600; }
.fund-role { color: var(--faint); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 7px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 6px 9px; }
.nav .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav .count.hot { color: var(--accent); font-weight: 650; }
.side-foot { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--faint); }
.side-foot button { all: unset; cursor: pointer; color: var(--muted); }
.side-foot button:hover { color: var(--ink); }

.main { min-width: 0; padding: 26px 32px 64px; max-width: 1080px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.topbar .sub { color: var(--muted); margin-top: 4px; }
.run-pick { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--faint); }
.run-pick select {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px;
  padding: 6px 30px 6px 10px; font-size: 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}

.demo-bar { background: var(--warn-soft); color: var(--warn); font-size: 13px; padding: 7px 32px; border-bottom: 1px solid var(--line); }

/* ---------- building blocks ---------- */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.section-head .hint { color: var(--faint); font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .note { color: var(--faint); font-size: 12.5px; }
a.tile { color: inherit; display: block; }
a.tile:hover { text-decoration: none; border-color: var(--line-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.badge.ship, .badge.approved, .badge.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.skipped { background: var(--bg); color: var(--faint); }
.badge.pending { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.up { background: var(--good-soft); color: var(--good); border-color: transparent; }

.score {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 6px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.score.s5, .score.s4 { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.meta .dot::before { content: "·"; margin-right: 12px; color: var(--faint); }

.list { display: flex; flex-direction: column; }
.row { display: flex; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); align-items: flex-start; }
.row:first-child { border-top: 0; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; margin: 2px 0 3px; overflow-wrap: anywhere; }
.row .actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.row.done .title { color: var(--muted); }

.btn {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--bg); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 99px;
  padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .75; margin-left: 4px; }
.toggle { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; margin-left: 6px; }

.empty { padding: 28px 18px; color: var(--muted); text-align: center; }
.note-box { padding: 12px 16px; font-size: 13.5px; color: var(--muted); }
.private { border-left: 3px solid var(--bad); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tr:first-child td { border-top: 0; }
table.data .num { font-variant-numeric: tabular-nums; }
table.data tr.pick { cursor: pointer; }
table.data tr.pick:hover td { background: var(--bg); }
table.data tr.current td { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }

/* ---------- approval queue ---------- */

.queue { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.export { position: sticky; top: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.export .big { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.export .btns { display: flex; flex-direction: column; gap: 8px; }
.export details { font-size: 13px; color: var(--muted); }
.export pre {
  margin: 8px 0 0; padding: 10px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line);
  font: 11.5px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; color: var(--ink);
}

/* ---------- drafts ---------- */

.draft { padding: 16px; }
.draft + .draft { margin-top: 12px; }
.draft-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.draft-block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.draft-block .kind { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.draft-block p { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-block .count { font-weight: 500; text-transform: none; letter-spacing: 0; }
.draft-block .count.over { color: var(--bad); }
.missing { color: var(--faint); font-style: italic; }

/* ---------- sign in ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { padding: 0; margin-bottom: 22px; }
.login h1 { font-size: 20px; }
.login p { color: var(--muted); margin-top: 6px; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.login input {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 9px 12px;
}
.login .btn { padding: 9px 12px; }
.login .error { color: var(--bad); font-size: 13.5px; }

/* ---------- toast ---------- */

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 9px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .queue { grid-template-columns: 1fr; }
  .export { position: static; order: -1; }
  .draft-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    min-width: 0;
    position: sticky; top: 0; z-index: 5; height: auto; background: var(--bg);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand, .fund { padding: 0; }
  .fund-role { display: none; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; margin: 0 -4px; }
  .nav a { white-space: nowrap; gap: 6px; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; gap: 12px; }
  .side-foot .who { display: none; }
  .main { padding: 20px 16px 48px; }
  .demo-bar { padding: 7px 16px; }
  .row { flex-wrap: wrap; }
  .row .actions { width: 100%; justify-content: flex-end; }
}

/* spacing hooks (inline style attributes are blocked by the page's security policy) */
[data-gap="mt4"] { margin-top: 4px; }
[data-gap="mt6"] { margin-top: 6px; }
[data-gap="mt8"] { margin-top: 8px; }
[data-gap="mt10"] { margin-top: 10px; }
[data-gap="mt12"] { margin-top: 12px; }
[data-gap="mb12"] { margin-bottom: 12px; }
.chips > .toggle:first-child { margin-left: 0; }

/* ---------- fund branding (set by applyBrand from the fund's accent) ---------- */

.brand-mark { background: #1f5f5b; }  /* Trotline's own mark keeps its colour; the fund's colour is the accent */
:root[data-brand] {
  --accent: var(--brand);
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--brand) 12%, #ffffff);
}
@media (prefers-color-scheme: dark) {
  :root[data-brand]:not([data-theme="light"]) {
    --accent: var(--brand-dark);
    --accent-ink: #0e1413;
    --accent-soft: color-mix(in srgb, var(--brand-dark) 18%, #1a1d1c);
  }
  .fund-logo { background: #ffffff; padding: 4px 6px; border-radius: 6px; }
}
.fund-logo { display: block; max-width: 150px; max-height: 36px; object-fit: contain; object-position: left; margin-bottom: 8px; }
.fund-pick {
  width: 100%; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 7px;
  padding: 4px 8px; font-weight: 600; font-size: 14px;
}
@media (max-width: 720px) {
  .fund-logo { margin-bottom: 0; max-height: 26px; max-width: 110px; }
  .fund { display: flex; align-items: center; gap: 8px; }
  .fund-pick { width: auto; max-width: 160px; }
}
