:root {
  --bg: #e9eef2;
  --surface: #ffffff;
  --ink: #12212e;
  --muted: #5b6b78;
  --line: #d3dce3;
  --accent: #0a6c74;
  --accent-soft: #cfe6e8;
  --good: #1f7a4d;
  --warn: #b5441c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif; letter-spacing: -0.015em; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* controls */
input {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: 9px 10px;
}
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: 13px; color: var(--muted); }
label input { margin-top: 4px; color: var(--ink); }
.btn {
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 4px; padding: 8px 13px;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #085860; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 14px; }
.login h1 { font-size: 34px; }
.err { color: var(--warn); margin: 0; font-size: 14px; }

/* shell */
#shell { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.top { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { font-size: 30px; }
.stats { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.stats b { color: var(--ink); font-size: 18px; font-weight: 600; margin-right: 5px; }

.add {
  display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto; gap: 12px; align-items: end;
  padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.created {
  display: flex; gap: 16px; align-items: end; justify-content: space-between; flex-wrap: wrap;
  margin-top: 12px; padding: 14px 16px; background: var(--accent-soft); border-radius: 6px;
}
.created > div:first-child { flex: 1; min-width: 260px; }
.created input { margin-top: 6px; background: #fff; }

/* table */
.tablewrap {
  margin-top: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #f6f9fb; }
.num { text-align: right; }
.lead-name { font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); margin: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: #eef2f5; color: var(--muted); }
.chip.live { background: #dcf1e5; color: var(--good); }
.chip.done { background: var(--accent-soft); color: var(--accent); }
.chip.watch { background: #e1edf2; color: #1d5870; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.meter { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.meter .track { flex: 1; height: 6px; background: #e3e9ee; border-radius: 3px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); }
.meter span { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(18, 33, 46, .35); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); z-index: 11;
  background: var(--bg); overflow-y: auto; padding: 22px 22px 60px;
  box-shadow: -20px 0 40px -24px rgba(18, 33, 46, .5);
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: 0; } }
}
.d-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 16px; }
.d-head h2 { font-size: 28px; line-height: 1.1; }
.d-head a { color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-top: 12px; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.linkrow { display: grid; gap: 8px; }
.figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.figures div { font-size: 13px; color: var(--muted); }
.figures b { display: block; color: var(--ink); font-size: 22px; font-weight: 600; font-family: "Bricolage Grotesque", sans-serif; }

.heat { display: flex; height: 38px; border-radius: 3px; overflow: hidden; background: #e3e9ee; }
.heat i { flex: 1; background: var(--accent); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.sess { padding: 12px 0; border-top: 1px solid var(--line); }
.sess:first-of-type { border-top: 0; padding-top: 0; }
.sess-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sbar { position: relative; height: 10px; background: #e3e9ee; border-radius: 2px; overflow: hidden; }
.sbar i { position: absolute; top: 0; bottom: 0; background: var(--accent); }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; margin: 10px 0 0; }
.kv div { font-size: 12px; color: var(--muted); }
.kv b { display: block; font-size: 14px; color: var(--ink); font-weight: 500; }

.events { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.events li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); white-space: nowrap; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 4px; font-size: 14px;
}

@media (max-width: 760px) {
  .add { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: repeat(2, 1fr); }
}
