/* Loop Texts
   One type scale: 12 / 13 / 14 (body) / 16 / 20 / 28 / 44
   One spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48
   Colours: dark teal, teal, light teal, plus neutrals. (Swap for Loop's brand colours when we have them.) */
:root {
  --dark: #0b3b38;
  --dark-2: #0f4c48;
  --teal: #0d9488;
  --teal-hover: #0b7f75;
  --teal-light: #e6f5f3;
  --teal-line: #cfe7e3;
  --ink: #102a28;
  --ink-2: #3b5452;
  --muted: #6b7f7d;
  --line: #e3ebea;
  --bg: #f5f8f8;
  --white: #ffffff;
  --amber: #b26b00;
  --amber-light: #fff6e5;
  --red: #b42318;
  --red-light: #fdeeec;
  --green: #127a3f;
  --green-light: #e9f7ef;
  --radius: 16px;
  --radius-sm: 10px;
  --pad-x: clamp(20px, 3vw, 48px);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; transition: color .3s; }
a:hover { color: var(--teal-hover); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; color: var(--ink-2); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header (dark band, white links) ---------- */
.top { background: var(--dark); position: sticky; top: 0; z-index: 10; }
.top-inner { padding: 0 var(--pad-x); height: 64px; display: flex; align-items: center; gap: 32px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--white); white-space: nowrap; }
.logo:hover { color: var(--white); }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--teal); display: grid; place-items: center; }
.logo-mark svg { width: 18px; height: 18px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: rgba(255, 255, 255, .72); font-weight: 550; padding: 8px 14px; border-radius: 99px; white-space: nowrap; transition: background .3s, color .3s; }
.nav a:hover { color: var(--white); background: rgba(255, 255, 255, .08); }
.nav a.active { color: var(--white); background: rgba(255, 255, 255, .14); }
.nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--teal); color: var(--white); font-size: 12px; text-align: center; }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-right .nav-link { color: rgba(255, 255, 255, .72); font-weight: 550; padding: 8px 14px; border-radius: 99px; }
.top-right .nav-link:hover, .top-right .nav-link.active { color: var(--white); background: rgba(255, 255, 255, .12); }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: var(--white); padding: 4px 12px 4px 4px; border-radius: 99px; font: inherit; font-weight: 550; cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: var(--white); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user-menu { position: absolute; right: 0; top: 46px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(11, 59, 56, .12); min-width: 240px; padding: 8px; animation: drop .25s ease; }
.user-menu .who { padding: 8px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu .who b { display: block; }
.user-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); }
.user-menu a:hover { background: var(--bg); color: var(--ink); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- page ---------- */
.page { padding: 32px var(--pad-x) 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 260px; }
.page-head p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reveal { animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 24px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 32px; }
.card-head .grow { flex: 1; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cols { display: grid; gap: 24px; align-items: stretch; }
.cols > .card + .card { margin-top: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.cols-side { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.stack > * + * { margin-top: 24px; }
.gap { height: 24px; }
@media (max-width: 1100px) { .cols-3, .cols-main, .cols-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .cols-2 { grid-template-columns: 1fr; } .top-inner { gap: 12px; } }

/* ---------- home: next text band ---------- */
.band { background: var(--dark); color: var(--white); border-radius: var(--radius); padding: 32px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; }
.band .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9fd8d1; }
.band .figure { font-size: 44px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; }
.band .figure .unit { font-size: 20px; font-weight: 550; color: #cdebe7; letter-spacing: 0; }
.band .line { margin-top: 10px; color: #cdebe7; }
.band .line b { color: var(--white); font-weight: 650; }
.band .actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) { .band { grid-template-columns: 1fr; } .band .actions { justify-content: flex-start; } }

/* stats strip: one card, four cells */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.strip > div { padding: 20px 24px; }
.strip > div + div { border-left: 1px solid var(--line); }
.strip .k { font-size: 13px; color: var(--muted); font-weight: 550; }
.strip .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.strip .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 900px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip > div:nth-child(3) { border-left: 0; } .strip > div:nth-child(n+3) { border-top: 1px solid var(--line); } }

.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 550; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { display: block; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.t:hover { color: var(--teal); }
.list .s { color: var(--muted); font-size: 13px; }
.list .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.quote { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- buttons (one shape, one minimum width) ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 150px; height: 42px; padding: 0 20px;
  border: 1px solid var(--teal); border-radius: var(--radius-sm); background: var(--teal); color: var(--white);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .3s, border-color .3s, color .3s;
}
button:hover, .btn:hover { background: var(--teal-hover); border-color: var(--teal-hover); color: var(--white); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.outline, .btn.outline { background: transparent; color: var(--teal); }
button.outline:hover, .btn.outline:hover { background: var(--teal-light); color: var(--teal-hover); }
button.on-dark { background: var(--white); border-color: var(--white); color: var(--dark); }
button.on-dark:hover { background: #e6f5f3; border-color: #e6f5f3; color: var(--dark); }
button.on-dark-outline { background: transparent; border-color: rgba(255, 255, 255, .45); color: var(--white); }
button.on-dark-outline:hover { background: rgba(255, 255, 255, .1); border-color: var(--white); }
button.danger { background: var(--red); border-color: var(--red); }
button.danger:hover { background: #8f1c13; border-color: #8f1c13; }
button.sm, .btn.sm { min-width: 96px; height: 34px; padding: 0 14px; font-size: 13px; }
.arrow-link { font-weight: 600; font-size: 13px; white-space: nowrap; }
.arrow-link::after { content: " →"; transition: margin .3s; }
.arrow-link:hover::after { margin-left: 3px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin: 16px 0 6px; color: var(--ink-2); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--teal-line); border-radius: var(--radius-sm); font: inherit; color: inherit; background: var(--white); outline: none;
}
textarea { min-height: 160px; resize: vertical; font-size: 16px; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 10px 0; color: var(--ink); font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); margin: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* ---------- segmented tabs ---------- */
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.seg button { min-width: 0; height: 34px; padding: 0 14px; background: transparent; border: 0; color: var(--muted); font-weight: 550; border-radius: 9px; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 59, 56, .08); }
.seg .c { margin-left: 6px; color: var(--muted); font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -24px -24px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; background: #fafcfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background .3s; }
tbody tr:hover { background: #fafcfc; }
tr.clickable { cursor: pointer; }

/* ---------- chips & notes ---------- */
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--teal-light); color: var(--teal-hover); white-space: nowrap; }
.chip.good { background: var(--green-light); color: var(--green); }
.chip.warn { background: var(--amber-light); color: var(--amber); }
.chip.bad { background: var(--red-light); color: var(--red); }
.chip.gray { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.note { border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0 0; font-size: 14px; }
.note.warn { background: var(--amber-light); color: #6b4100; }
.note.bad { background: var(--red-light); color: #7a1a12; }
.note.good { background: var(--green-light); color: #0b4f29; }
.note.info { background: var(--teal-light); color: #0b4f4a; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* ---------- who gets the next text ---------- */
.funnel { font-variant-numeric: tabular-nums; }
.fz-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.fz-k { font-size: 13px; color: var(--muted); font-weight: 550; }
.fz-big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.fz-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fz-chip { background: var(--teal-light); color: var(--teal-hover); border-radius: 99px; padding: 2px 10px; font-size: 12px; }
.fz-chip.off { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.fz-group { padding: 8px 0; }
.fz-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; padding: 8px 0; }
.fz-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-top: 7px; }
.fz-dot.gray { background: #a9b9b7; } .fz-dot.warn { background: #f0a020; } .fz-dot.bad { background: #e5484d; }
.fz-label { color: var(--ink-2); }
.fz-note { font-size: 12px; color: var(--muted); }
.fz-n { color: var(--ink-2); font-weight: 600; }
.fz-sub, .fz-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: var(--radius-sm); margin: 4px 0; }
.fz-sub { background: var(--bg); font-weight: 600; color: var(--ink-2); }
.fz-total { background: var(--teal-light); color: var(--dark); font-weight: 700; font-size: 16px; }
.fz-total b { font-size: 20px; }
.fz-check { margin-top: 8px; text-align: right; font-size: 12px; color: var(--muted); }

/* ---------- composer ---------- */
.counter { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { background: var(--bg); border-radius: 99px; padding: 4px 12px; font-size: 13px; color: var(--ink-2); }
.pill b { font-variant-numeric: tabular-nums; }
.pill.over { background: var(--red-light); color: var(--red); }
.badchar { display: inline-block; border: 1px solid #f3b3ad; background: var(--white); color: var(--red); border-radius: 6px; padding: 0 6px; margin: 2px; font-family: ui-monospace, Consolas, monospace; }
.phone { background: var(--bg); border-radius: 28px; padding: 24px 20px; min-height: 220px; }
.phone .from { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.bubble { background: #e9ecec; border-radius: 18px 18px 18px 6px; padding: 10px 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; max-width: 88%; color: #111; }
.bigcost { font-size: 44px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; }
.confirm { background: var(--bg); border-radius: var(--radius-sm); padding: 20px; margin-top: 24px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.confirm label { margin-top: 0; }
.confirm input { width: 200px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.kv > div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* delivery bar */
.bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.bar .d { background: #16a34a; } .bar .u { background: #f0a020; } .bar .f { background: #e5484d; } .bar .p { background: #9fdcd4; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--dark); }
.login { background: var(--white); border-radius: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .18); padding: 36px; width: 100%; max-width: 400px; }
.login .logo { color: var(--ink); margin-bottom: 24px; }
.login h1 { font-size: 20px; }
.login p { margin-top: 4px; }
.login button { width: 100%; margin-top: 24px; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--dark); color: var(--white); padding: 12px 18px; border-radius: 12px; box-shadow: 0 12px 32px rgba(11, 59, 56, .2); z-index: 20; max-width: 440px; animation: rise .3s ease; }
.toast.bad { background: var(--red); }
.pager { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px 0; }
