/* Mimir / Fonn Group identity: Manrope, teal for the primary action and the
   selected state, plum for chrome. Text in ink, never in teal. */
:root {
  --teal: #159AB2;
  --teal-text: #0C485C;
  --teal-fill: #DEF1F4;
  --plum: #474056;
  --plum-light: #6A5F81;
  --page: #F7F0F0;
  --surface: #FFFFFF;
  --ink: #071627;
  --muted: #5F5E5A;
  --border: rgba(10, 12, 8, 0.12);
  --border-strong: rgba(10, 12, 8, 0.24);
  --strong: #1E7F4F;  --strong-fill: #E3F6EA;
  --possible: #8A6A12; --possible-fill: #FBF1D6;
  --weak: #5F5E5A;    --weak-fill: #EFEDE7;
  --none: #8B8A85;    --none-fill: #F4F3EF;
  --danger: #A63A2B;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --teal: #3DB5CB;
    --teal-text: #9ADCE8;
    --teal-fill: #11343D;
    --plum: #2A2533;
    --plum-light: #9A8FB3;
    --page: #121316;
    --surface: #1B1C20;
    --ink: #ECEAE6;
    --muted: #A8A6A0;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.22);
    --strong: #6FD99C;  --strong-fill: #173527;
    --possible: #E6C266; --possible-fill: #3A3017;
    --weak: #B9B7B0;    --weak-fill: #2A2A2C;
    --none: #85837E;    --none-fill: #222225;
    --danger: #F08C7C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}
[hidden] { display: none !important; }
a { color: var(--teal-text); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }

button { cursor: pointer; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); padding: 6px 12px; }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; padding: 10px 16px; }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select { border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--teal); margin: 0 6px 0 0; }

/* ---------------------------------------------------------------- sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.signin-card h1 { margin: 0; font-size: 24px; font-weight: 800; }
.signin-card { overflow: hidden; }
.signin-band { background: var(--plum); margin: -28px -28px 4px; padding: 20px 28px; }
.signin-band .logo { height: 40px; width: auto; display: block; }
.signin-card label { display: grid; gap: 4px; font-weight: 500; }
.signin-card > div { display: grid; gap: 12px; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--plum); color: #F7F0F0;
  position: sticky; top: 0; z-index: 5;
}
.topbar .muted { color: #CFCAD9; }
.topbar button { color: #F7F0F0; border-color: rgba(255,255,255,.3); }
.brand { font-weight: 800; letter-spacing: .01em; display: flex; align-items: center; gap: 12px; }
.brand .logo { height: 32px; width: auto; display: block; }
.brand span { padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); line-height: 1.2; }
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: 0; color: #CFCAD9; padding: 8px 14px; border-radius: 8px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.tab-logo { height: 20px; width: auto; display: block; opacity: .75; }
/* saga's g descends: size it so the x-heights match the other two */
.tab-logo-saga { height: 22px; margin-bottom: -3px; }
.tab[aria-selected=true] .tab-logo { opacity: 1; }
.tab[aria-selected=true] { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 -3px 0 var(--teal); }
.tab .tagline { font-weight: 400; font-size: 12px; opacity: .8; }
.tab .count { font-size: 12px; background: rgba(255,255,255,.16); border-radius: 10px; padding: 0 7px; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ----------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 280px; gap: 24px; padding: 20px; max-width: 1480px; margin: 0 auto; }
.filters-body { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); display: grid; gap: 16px; max-height: calc(100vh - var(--topbar-h, 64px) - 24px); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
.filters-toggle { display: none; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 13px; border: 0; padding: 0; margin: 0; }
.field legend { padding: 0; margin-bottom: 4px; }
.field label { font-weight: 400; font-size: 14px; display: flex; align-items: center; }
.field label.stack { display: grid; gap: 4px; }
.deal { font-weight: 600; color: var(--ink); }
.deal.small-deal { color: var(--muted); text-decoration: line-through; }
.fit-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.fit-dot.strong { background: var(--strong); } .fit-dot.possible { background: var(--possible); }
.fit-dot.weak { background: var(--weak); } .fit-dot.none { background: var(--none); }

.summary { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ------------------------------------------------------------------- card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: grid; gap: 8px; }
.card.dismissed { opacity: .55; }
.card-head { display: flex; gap: 12px; align-items: flex-start; }
.fit { flex: none; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .04em; }
.fit.strong { color: var(--strong); background: var(--strong-fill); }
.fit.possible { color: var(--possible); background: var(--possible-fill); }
.fit.weak { color: var(--weak); background: var(--weak-fill); }
.fit.none { color: var(--none); background: var(--none-fill); }
.fit.pending { color: var(--muted); background: var(--weak-fill); }
.card h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.score { margin-left: auto; flex: none; font-weight: 800; font-size: 18px; color: var(--muted); }
.buyer { color: var(--muted); font-size: 14px; }
.verdict { font-weight: 600; }
.summary-text { margin: 0; }
.angle { margin: 0; font-size: 14px; color: var(--teal-text); background: var(--teal-fill); border-radius: 8px; padding: 6px 10px; }
.others { display: flex; gap: 6px; flex-wrap: wrap; }
.other { font-size: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.meta .soon { color: var(--danger); font-weight: 600; }
.original { font-size: 13px; color: var(--muted); font-style: italic; }
.card-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.mark { font-size: 13px; padding: 3px 10px; }
.mark[aria-pressed=true] { background: var(--teal-fill); border-color: var(--teal); color: var(--teal-text); font-weight: 600; }
.marked-by { font-size: 12px; color: var(--muted); margin-left: auto; }

.banner { background: var(--possible-fill); color: var(--possible); border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.ok { color: var(--strong); }

/* ------------------------------------------------------------ portal badge */
.portal-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.portal { font-weight: 700; border-radius: 6px; padding: 1px 8px; background: var(--plum); color: #F7F0F0; text-decoration: none; }
.portal.also { background: transparent; color: var(--plum-light); border: 1px solid var(--plum-light); font-weight: 600; }
@media (prefers-color-scheme: dark) { .portal { background: var(--plum-light); color: #121316; } }
.portal-row .label { color: var(--muted); }

/* ------------------------------------------------------- requirements, gaps */
.analysis { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 10px; }
.analysis summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.analysis h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.analysis ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 14px; }
.analysis .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gaps li::marker { color: var(--danger); }
.gaps h3 { color: var(--danger); }
.strengths li::marker { color: var(--strong); }
.strengths h3 { color: var(--strong); }
.req-cat { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.req-must { font-size: 11px; font-weight: 700; color: var(--danger); margin-left: 4px; }
.basis { font-size: 12px; color: var(--muted); font-style: italic; }
@media (max-width: 640px) { .analysis .cols { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ users */
dialog.wide { width: min(760px, calc(100vw - 32px)); }
.dialog-body { display: grid; gap: 12px; }
.invite-form { display: grid; grid-template-columns: 1.4fr 1fr auto auto; gap: 8px; align-items: center; }
.inline { display: flex; align-items: center; font-size: 14px; white-space: nowrap; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.users td { padding: 8px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.users td:last-child { text-align: right; white-space: nowrap; }
.user-name { font-weight: 600; }
@media (max-width: 640px) { .invite-form { grid-template-columns: 1fr; } table.users th:nth-child(2), table.users td:nth-child(2) { display: none; } }

/* ------------------------------------------------------------- results bar */
.results-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.results-bar .summary { margin: 0; flex: 1; }
.views { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.view { border: 0; border-radius: 0; background: var(--surface); padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.view + .view { border-left: 1px solid var(--border-strong); }
.view[aria-selected=true] { background: var(--teal-fill); color: var(--teal-text); }

/* ------------------------------------------------------------------ flags */
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.flag { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; }
.flag.watched { background: var(--teal-fill); color: var(--teal-text); }
.flag.competitor { background: var(--possible-fill); color: var(--possible); }

/* --------------------------------------------------------------- pipeline */
.pipeline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.pipeline-row select, .pipeline-row input, .status-row select { width: auto; padding: 3px 8px; font-size: 13px; }
.pipeline-row input { width: 120px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; display: grid; gap: 8px; align-content: start; min-height: 240px; }
.column.over { outline: 2px dashed var(--teal); }
.column h3 { margin: 0; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.column .total { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini { background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 13px; display: grid; gap: 3px; cursor: grab; }
.mini a { color: var(--ink); font-weight: 600; text-decoration: none; }
.mini a:hover { text-decoration: underline; }
.mini .sub { color: var(--muted); font-size: 12px; }
.mini.dragging { opacity: .5; }

/* ----------------------------------------------------------------- market */
.market { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.panel h3 { margin: 0 0 8px; font-size: 15px; }
.leader { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 16px; font-size: 14px; }
.leader .head { font-size: 12px; color: var(--muted); font-weight: 600; }
.leader .num { text-align: right; font-variant-numeric: tabular-nums; }
table.awards { width: 100%; border-collapse: collapse; font-size: 13px; }
table.awards th { text-align: left; font-size: 12px; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.awards td { padding: 7px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.awards td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.winner-competitor { font-weight: 700; color: var(--possible); }
.winner-ours { font-weight: 700; color: var(--strong); }
.supplier { border: 0; background: none; padding: 0; text-align: left; font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.supplier:disabled { cursor: default; text-decoration: none; color: var(--muted); }
.supplier[aria-pressed=true] { background: var(--teal-fill); border-radius: 4px; padding: 0 4px; }
.panel h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clear-winner { font-weight: 600; }
.cal-row { display: flex; gap: 6px; }
.key-row { display: grid; gap: 2px; margin-bottom: 8px; font-weight: 400; }
.key-row .muted { font-size: 12px; }
.cal-row input { font-size: 12px; }
@media (max-width: 860px) { table.awards th:nth-child(1), table.awards td:nth-child(1) { display: none; } }

/* --------------------------------------------------------------- comments */
.comments-toggle { justify-self: start; padding-left: 0; border: 0; color: var(--teal-text); font-weight: 600; }
.comments.open { display: grid; gap: 8px; }
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comment { border-left: 2px solid var(--border-strong); padding: 2px 0 2px 10px; }
.comment-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.comment-text { white-space: pre-wrap; font-size: 14px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.link-button { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; }

/* ------------------------------------------------------------------ tasks */
.tasks { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); align-self: start; max-height: calc(100vh - var(--topbar-h, 64px) - 24px); overflow: auto; }
.tasks h2 { margin: 0; font-size: 16px; }
.task-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.task { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--teal); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: grid; gap: 2px; }
.task.bidding { border-left-color: var(--strong); }
.task.overdue { border-left-color: var(--danger); }
.task a { color: var(--ink); font-weight: 600; text-decoration: none; }
.task a:hover { text-decoration: underline; }
.task .due { color: var(--muted); }
.task.overdue .due { color: var(--danger); font-weight: 600; }
.task .note { color: var(--ink); white-space: pre-wrap; }
.card.flash { outline: 2px solid var(--teal); }

.status-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.status-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 4px; }
.print-link { margin-left: auto; font-size: 13px; }
.mark.dismiss[aria-pressed=true] { background: var(--weak-fill); border-color: var(--border-strong); color: var(--muted); }
.followup-info { font-size: 13px; background: var(--teal-fill); color: var(--teal-text); border-radius: 8px; padding: 6px 10px; white-space: pre-wrap; }
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-right: 6px; vertical-align: middle; }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
dialog form { display: grid; gap: 12px; }
textarea { font: inherit; color: inherit; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%; resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dialog-actions #notify-test { margin-right: auto; }
.inline-check span { font-weight: 400; font-size: 14px; display: flex; align-items: center; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .tasks { grid-column: 2; grid-row: 1; position: static; max-height: none; }
}

@media (max-width: 860px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tab .tagline { display: none; }
  .top-right { margin-left: 0; }
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 12px; }
  .tasks { grid-column: auto; grid-row: auto; }
  .filters-toggle { display: inline-block; }
  .filters-body { position: static; display: none; padding-top: 12px; max-height: none; overflow: visible; }
  .filters.open .filters-body { display: grid; }
}
