/* Shared styling. Function over form - visual design comes later. */
:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1c2024; --muted: #6b7280;
  --line: #e3e6ea; --accent: #1f6feb; --accent-soft: #eaf1fe;
  --good: #087443; --good-bg: #e8f5ee;
  --warn: #7a4a06; --warn-bg: #fff4e5; --warn-line: #f0a13a;
  --bad: #b42318; --bad-bg: #fdeceb;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 20px;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: var(--accent); }
.wrap { max-width: 1220px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; margin-bottom: 14px;
}
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, button, textarea {
  font: inherit; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: inherit;
}
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button:hover { filter: brightness(1.06); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr.clickable:hover { background: var(--accent-soft); cursor: pointer; }
.scroll { overflow-x: auto; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line); background: #fff;
}
.pill.good { background: var(--good-bg); color: var(--good); border-color: #b7dfc8; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: #f3c0bc; }
.pill.mute { background: #f1f3f5; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 600; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.warnbox {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px;
}
.cols { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 150px 110px 1fr; gap: 10px;
         padding: 9px 0; border-bottom: 1px solid var(--line); align-items: start; }
.tl li:last-child { border-bottom: 0; }
.tl .when { color: var(--muted); font-size: 12px; }
.tl .what { font-weight: 600; font-size: 13px; }
.tl .detail { font-size: 13px; }
.strike { color: var(--bad); font-weight: 600; }

/* Callback - the warmest signal the system produces. Impossible to miss. */
.callback { border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; border: 2px solid; }
.callback.hot  { background: #fdeceb; border-color: var(--bad);  color: #7a1610; }
.callback.warm { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.callback.cool { background: #f1f3f5; border-color: var(--line); color: var(--muted); }
.callback .hd { font-weight: 700; font-size: 15px; }
.callback .bd { font-size: 13px; margin-top: 4px; opacity: .9; }

/* Upsell - built from what the dealer themselves asked for. */
.upsell {
  background: #eef6ff; border: 2px solid var(--accent);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 14px;
}
.upsell .hd { font-size: 15px; margin-bottom: 10px; }
.upsell .grp { margin-top: 10px; }
.upsell .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px;
}
.upsell .cat { font-size: 13px; padding: 3px 0; }
.upsell .cat .n {
  display: inline-block; min-width: 24px; font-weight: 700; color: var(--accent);
}
.upsell .note {
  font-size: 12px; color: var(--muted); margin-top: 10px;
  border-top: 1px solid #cfe0f7; padding-top: 8px;
}

/* Premier - a different pitch, on different criteria. Never category access. */
.premier {
  background: #f6f1ff; border: 2px solid #7a5af8;
  border-radius: 8px; padding: 14px 16px; margin-bottom: 14px;
}
.premier .hd { font-size: 15px; font-weight: 700; color: #4c2fb8; margin-bottom: 8px; }
.premier .why { margin: 0 0 10px 18px; padding: 0; font-size: 13px; }
.premier .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px;
}
.premier .sell .pill { margin: 0 4px 4px 0; }
.premier .note {
  font-size: 12px; color: var(--muted); margin-top: 10px;
  border-top: 1px solid #ddd0f7; padding-top: 8px;
}

/* Kanban board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col {
  background: #eef0f3; border: 1px solid var(--line); border-radius: 8px;
  min-width: 250px; max-width: 250px; flex: 0 0 250px; padding: 8px;
}
.col > .hd {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); padding: 2px 4px 8px;
  display: flex; justify-content: space-between;
}
.col.terminal { background: #f4f1f1; }
.pcard {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 8px; cursor: pointer; font-size: 13px;
}
.pcard:hover { border-color: var(--accent); }
.pcard.hot { border-left: 4px solid var(--bad); }
.pcard.warm { border-left: 4px solid var(--warn-line); }
.pcard .co { font-weight: 600; }
.pcard .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.pcard .cb { color: var(--bad); font-weight: 600; font-size: 12px; margin-top: 3px; }

/* ---- call intelligence on the 360 timeline -------------------------- */
/* Generated from the audio, not typed by anyone. Set apart from the
   logged facts around it so nobody mistakes a model's reading of a call
   for something a human recorded. */
.intel { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--line);
         background: #fafbfc; border-radius: 0 6px 6px 0; }
.intelhead { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.intelsum { margin: 4px 0 8px; line-height: 1.45; }
.intelblock { margin-top: 8px; }
.intelfoot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 12px;
             align-items: center; font-size: 12px; }

/* A quote is the dealer's or the agent's actual words. Anything not in
   this style is a summary and may be wrong. */
.q { margin: 3px 0; padding-left: 10px; border-left: 2px solid #dfe3e8;
     font-style: italic; color: #333; line-height: 1.4; }
.q.ans { border-left-color: #b7dfc8; }
.qk { display: inline-block; min-width: 62px; font-style: normal;
      font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
      color: var(--muted); }

.transcript { margin-top: 8px; padding: 10px; background: #fff;
              border: 1px solid var(--line); border-radius: 6px;
              max-height: 340px; overflow: auto; white-space: pre-wrap;
              font-size: 12px; line-height: 1.5; }

.linkbtn { background: none; border: 0; padding: 0; cursor: pointer;
           color: var(--link, #0b63ce); font: inherit; font-size: 12px; }
.linkbtn:hover { text-decoration: underline; }
.warntext { color: var(--warn); }
.warnbox { border-color: var(--warn-line); background: var(--warn-bg); }

/* ---- admin board ---------------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 4px;
        border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent;
       padding: 8px 12px; cursor: pointer; font: inherit; font-size: 14px;
       color: var(--muted); }
.tab:hover { color: inherit; }
.tab.on { color: inherit; font-weight: 600; border-bottom-color: #0b63ce; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase;
          letter-spacing: .04em; color: var(--muted); font-weight: 600;
          padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
/* A deactivated row is still readable - it is history, not clutter. */
.tbl tr.off td { opacity: .55; }

.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
            gap: 14px; }
.formgrid input, .formgrid select { width: 100%; padding: 6px 8px;
            border: 1px solid var(--line); border-radius: 5px; font: inherit;
            font-size: 13px; }
.fl { display: flex; align-items: center; gap: 7px; font-size: 13px;
      align-self: end; padding-bottom: 6px; }
.fl input { width: auto; }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--line);
       border-radius: 6px; background: #fff; cursor: pointer; font: inherit;
       font-size: 13px; text-decoration: none; color: inherit; }
.btn:hover { background: #f6f8fa; }
.btn.primary { background: #0b63ce; border-color: #0b63ce; color: #fff; }
.btn.primary:hover { background: #0a58b8; }

/* One rule per row: the value and the sentence explaining it stay together,
   because a threshold without its meaning is a number nobody can safely
   change. */
.rule { padding: 10px 0; border-bottom: 1px solid #f0f2f4; }
.rule:last-child { border-bottom: 0; }
.ruletop { display: grid; grid-template-columns: 240px minmax(120px, 320px) auto;
           gap: 10px; align-items: center; }
.ruletop input { padding: 6px 8px; border: 1px solid var(--line);
                 border-radius: 5px; font: inherit; font-size: 13px; }
.ruletop .k { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.goodbox { border-color: #b7dfc8; background: var(--good-bg); }
.badbox  { border-color: #f3c0bc; background: var(--bad-bg); }

/* ---- session bar ---------------------------------------------------- */
/* Present on every page so "who am I signed in as" is never a question.
   This is visibility, not access control - the server refuses regardless
   of what is rendered here. */
.sessionbar { display: flex; justify-content: space-between; align-items: center;
              gap: 16px; padding: 8px 18px; background: #fff;
              border-bottom: 1px solid var(--line); font-size: 13px;
              flex-wrap: wrap; }
.sessionleft { display: flex; gap: 16px; align-items: center; }
.sessionleft a { text-decoration: none; color: var(--muted); }
.sessionleft a:first-child { font-weight: 600; color: inherit; }
.sessionleft a:hover { color: inherit; text-decoration: underline; }
.sessionright { display: flex; gap: 12px; align-items: center; }
