/* Slipway app styles. Tokens come from the Slipway site ("Design C, bold and friendly"),
   calmed down for daily use: smaller headings, denser cards, yellow only for the main action. */
:root {
  --ground: #E9F2F7; --card: #FFFFFF; --ink: #0B2A30; --muted: #23474E; --soft: #5A7479;
  --brand: #0E4A55; --brand-ink: #FFFFFF; --brand-soft: #D6E8EC; --accent: #FFE45C; --accent-ink: #0B2A30;
  --line: #CFE0E7; --tint: #F3F8FA; --pale: #C7DCE4;
  --ok: #1D6B45; --ok-bg: #DDF3E6; --warn: #8A5300; --warn-bg: #FFF1CC; --bad: #A3271B; --bad-bg: #FBE3DF; --info-bg: #E2EEFF; --info: #1F4C8F;
  --r-lg: 28px; --r-md: 22px; --r-sm: 14px; --pill: 999px;
  --head: 'Unbounded', system-ui, sans-serif; --body: 'Figtree', system-ui, sans-serif;
  --focus: 0 0 0 3px var(--ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--body); }
a { color: var(--brand); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); } .soft { color: var(--soft); } .small { font-size: 14px; } .tiny { font-size: 13px; }
.stack > * + * { margin-top: 12px; } .stack-lg > * + * { margin-top: 20px; } .stack-sm > * + * { margin-top: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.top { background: var(--brand); color: var(--brand-ink); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.logo { font-family: var(--head); font-size: 19px; font-weight: 700; color: #fff; text-decoration: none; }
.top a { color: #fff; }
.top .biz { font-weight: 700; font-size: 15px; color: var(--brand-soft); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewas { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.banner { padding: 10px 16px; font-weight: 700; font-size: 15px; text-align: center; }
.banner.bad { background: var(--bad-bg); color: var(--bad); } .banner.warn { background: var(--warn-bg); color: var(--warn); }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 104px; }
.app main { max-width: 640px; }
.with-side { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; max-width: 1240px; margin: 0 auto; }
.with-side main { max-width: none; margin: 0; padding-left: 0; min-width: 0; }
.side { padding: 18px 0 18px 16px; }
.side nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 4px; }
.side a { text-decoration: none; color: var(--ink); font-weight: 700; padding: 10px 14px; border-radius: var(--r-sm); display: flex; justify-content: space-between; align-items: center; }
.side a[aria-current="page"] { background: var(--card); }
@media (max-width: 860px) {
  .with-side { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .with-side main { padding-left: 16px; }
  .side { padding: 10px 16px 0; overflow-x: auto; }
  .side nav { flex-direction: row; position: static; }
  .side a { white-space: nowrap; padding: 8px 12px; }
}

/* bottom tabs (owner) */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabs a { text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 48px; border-radius: var(--r-sm); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--ground); }
.tabs svg { width: 22px; height: 22px; }

/* cards */
.card { background: var(--card); border-radius: var(--r-md); padding: 18px; }
.card.tight { padding: 14px 16px; }
.card.brand { background: var(--brand); color: var(--brand-ink); } .card.brand .muted { color: var(--brand-soft); }
.card.tint { background: var(--tint); }
.card h2 + *, .card h3 + * { margin-top: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list > li { padding: 12px 0; }
.list a.item { display: block; text-decoration: none; color: inherit; }
.item-title { font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--card); border-radius: var(--r-sm); padding: 12px 10px; text-align: center; }
.stat b { display: block; font-family: var(--head); font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 700; }
@media (max-width: 380px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* chips & tags */
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: var(--pill); background: var(--tint); color: var(--muted); white-space: nowrap; }
.tag.new_job, .tag.ok, .tag.confirmed, .tag.booked, .tag.won, .tag.active, .tag.paid { background: var(--ok-bg); color: var(--ok); }
.tag.emergency, .tag.bad, .tag.past_due, .tag.failed, .tag.lost, .tag.transfer_no_answer, .tag.abusive { background: var(--bad-bg); color: var(--bad); }
.tag.pending, .tag.warn, .tag.request, .tag.new, .tag.dropped, .tag.open, .tag.onboarding { background: var(--warn-bg); color: var(--warn); }
.tag.existing_customer, .tag.contacted, .tag.message, .tag.info, .tag.live { background: var(--info-bg); color: var(--info); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: middle; }
.dot.warn { background: #D99A00; } .dot.bad { background: var(--bad); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: var(--pill); border: 0; font: 800 15px var(--body); text-decoration: none; cursor: pointer; background: var(--ink); color: #fff; }
.btn:hover { color: #fff; background: #06262C; }
.btn.primary { background: var(--accent); color: var(--accent-ink); } .btn.primary:hover { background: #FFDA1F; color: var(--accent-ink); }
.btn.ghost { background: var(--tint); color: var(--ink); } .btn.ghost:hover { background: var(--pale); color: var(--ink); }
.tint .btn.ghost, .card.brand .btn.ghost { background: #fff; border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); } .btn.danger:hover { background: #F6C9C2; color: var(--bad); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline { display: inline; }
label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.hint { font-weight: 500; color: var(--muted); font-size: 13px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm); font: 16px var(--body); color: var(--ink); background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
textarea.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 420px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field + .field { margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; min-height: 36px; }
.check input { width: 20px; height: 20px; }
fieldset { border: 0; margin: 0; padding: 0; }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; }
.flash { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; }

/* office hours rows: day + open on one line, times below on narrow screens */
.hours-row { display: grid; grid-template-columns: 52px 1fr; gap: 6px 10px; align-items: center; }
.hours-row .day { font-weight: 700; }
.hours-row .times { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
@media (min-width: 560px) { .hours-row { grid-template-columns: 52px 90px 1fr; } .hours-row .times { grid-column: auto; } }
[hidden] { display: none !important; }

/* calendar */
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav .btn { min-width: 44px; }
.seg { display: inline-flex; background: var(--tint); border-radius: var(--pill); padding: 3px; }
.seg a { text-decoration: none; color: var(--ink); font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: var(--pill); min-height: 38px; display: inline-flex; align-items: center; }
.seg a[aria-current="true"] { background: var(--ink); color: #fff; }
.win-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cap { display: inline-flex; gap: 3px; vertical-align: middle; }
.cap i { width: 10px; height: 10px; border-radius: 3px; background: var(--pale); display: inline-block; }
.cap i.on { background: var(--brand); }
.booking { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; }
.week-day { display: flex; justify-content: space-between; gap: 8px; align-items: center; text-decoration: none; color: inherit; padding: 12px 0; }
.week-day.today b { color: var(--brand); }
.pills { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: var(--pill); background: var(--tint); color: var(--muted); }
.pill.some { background: var(--brand-soft); color: var(--brand); } .pill.full { background: var(--brand); color: #fff; } .pill.off { background: transparent; color: var(--soft); }

/* transcript */
.tx p { margin: 0; padding: 8px 12px; border-radius: var(--r-sm); max-width: 88%; }
.tx p + p { margin-top: 6px; }
.tx .agent { background: var(--tint); }
.tx .caller { background: var(--brand-soft); margin-left: auto; }
.tx .blocked { background: var(--bad-bg); color: var(--bad); font-size: 13px; }
.tx b { display: block; font-size: 12px; color: var(--muted); }
audio { width: 100%; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-weight: 700; font-size: 14px; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* tables (admin) */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* wizard */
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.steps a, .steps span { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: var(--pill); background: var(--card); color: var(--muted); text-decoration: none; }
.steps .done { background: var(--ok-bg); color: var(--ok); } .steps .cur { background: var(--ink); color: #fff; }
.codes { font: 700 18px ui-monospace, Menlo, monospace; letter-spacing: .02em; }
pre.diff { white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; background: var(--card); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; margin: 0; }
pre.diff .add { background: var(--ok-bg); display: block; } pre.diff .del { background: var(--bad-bg); display: block; }

/* login & demo */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; }
.hero { background: var(--brand); color: #fff; border-radius: var(--r-lg); padding: 28px 22px; }
.hero h1 { font-size: clamp(26px, 6vw, 40px); line-height: 1.05; }
.hero p { color: var(--brand-soft); font-size: 17px; margin-top: 12px; }
.talk { width: 132px; height: 132px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font: 800 18px var(--body); cursor: pointer; }
.talk.live { background: var(--bad-bg); color: var(--bad); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,228,92,.6); } 50% { box-shadow: 0 0 0 16px rgba(255,228,92,0); } }
@media (prefers-reduced-motion: reduce) { .talk.live { animation: none; } }
