:root {
  /* base */
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --accent-tint: #fdece3;      /* accent @ ~8% for active seek highlight */
  --bg: #faf7f5;
  --card: #ffffff;
  --text: #1c1917;
  --muted: #6b6560;            /* darkened from #78716c for AA on --bg */
  --line: #e7e5e4;

  /* status text colors (AA on their tints below) */
  --green: #15803d;
  --red: #b91c1c;
  --amber: #854d0e;            /* darkened from #92400e for AA on tint */
  --gray: #57534e;

  /* chip tints */
  --tint-green: #e7f4ec;
  --tint-red: #fbeaea;
  --tint-amber: #fbf1e0;
  --tint-gray: #f0efee;

  /* interaction */
  --focus: #c2410c;
  --done-opacity: .55;

  /* type scale */
  --fs-title: 1.15rem;
  --fs-body: 0.95rem;
  --fs-small: 0.8rem;
}
* { box-sizing: border-box; max-width: 100%; }
html { font-size: 16px; }                 /* no iOS zoom-on-focus */
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Ladle branding ---------- */
.applogo{
  display:inline-flex; align-items:center; justify-content:center;
  width:1.6em; height:1.6em; border-radius:.4em;
  background:linear-gradient(160deg,#e2591f,#9a3412);
  flex-shrink:0;
}
.applogo svg{ width:64%; height:64%; }
.wordmark{ display:inline-flex; align-items:center; gap:.45em;
  font-weight:700; letter-spacing:-.02em; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--accent);
  color: #fff;
  min-height: 52px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  z-index: 10;
}
.topbar h1 { font-size: var(--fs-title); margin: 0; font-weight: 650; }
.topbar .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.topbar a, .topbar button {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar a:active, .topbar button:active { background: rgba(255,255,255,0.3); }
@media (min-width: 600px) { .topbar { position: sticky; top: 0; } }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
a.card { display: block; color: inherit; text-decoration: none; min-height: 64px; }
a.card:active { background: #fff7f2; }
.card--todo { border-left: 3px solid var(--accent); }
.card--done { opacity: var(--done-opacity); border-left: 3px solid transparent; }
.hint { color: var(--accent); font-size: 0.85rem; margin-top: 0.3rem; font-weight: 600; }
.card--done .hint { color: var(--muted); font-weight: 400; }
.meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.35rem; }
.row-title { font-weight: 600; font-size: 0.98rem; }
.preview { color: var(--muted); font-size: 0.88rem; margin-top: 0.3rem;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }

/* ---------- chips (4 semantic colors) ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 20%, transparent);
}
.chip.green { background: var(--tint-green); color: var(--green); }
.chip.red   { background: var(--tint-red);   color: var(--red); }
.chip.amber { background: var(--tint-amber); color: var(--amber); }
.chip.gray  { background: var(--tint-gray);  color: var(--gray); }

/* ---------- queue filter (index) ---------- */
.queue-filter {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 8px 0;
}
@media (min-width: 600px) { .queue-filter { top: 52px; } }
.seg {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.3rem;
}
.seg[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- forms ---------- */
label { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--muted);
        margin: 0.7rem 0 0.25rem; }
input[type=text], input[type=tel], input[type=password], textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;              /* prevents mobile zoom-on-focus */
  background: #fff;
}
textarea { min-height: 3.2rem; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  min-height: 48px;
  padding: 0.6rem 1.1rem;
  font-size: var(--fs-body);
  font-weight: 600;
  cursor: pointer;
}
button.primary:active { background: var(--accent-dark); }
button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 48px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
.danger { background: var(--red) !important; color: #fff !important; font-weight: 700; }
.savebar { color: var(--muted); font-size: var(--fs-small); min-height: 1.2rem; margin-top: 0.4rem; }
.savebar.ok { color: var(--green); }
.savebar.warn { color: var(--red); }
.toggle { display: flex; align-items: center; gap: 0.6rem; margin: 0.8rem 0; min-height: 44px; }
.toggle input { width: 1.4rem; height: 1.4rem; accent-color: var(--green); }

/* ---------- detail: questions, transcript, split, mini-player ---------- */
.question { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.question .qtext { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; }
.segment {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 0 0.4rem 8px;
  font-size: 0.9rem;
  border-top: 1px dashed var(--line);
  border-left: 3px solid var(--line);
  align-items: flex-start;
  transition: background 0.3s;
}
.segment.ch1 { border-left-color: #1e40af; }
.segment.active { background: var(--accent-tint); }
.segment .who { font-size: 0.75rem; color: var(--muted); font-weight: 650; min-width: 4.2em; padding-top: 0.35rem; }
.seg-time {
  flex-shrink: 0;
  min-height: 32px;
  min-width: 44px;
  background: var(--accent-tint);
  color: var(--accent-dark);
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}
.miniplayer {
  position: sticky;
  bottom: 0;
  z-index: 8;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  margin: 0 -1rem -1rem;
}
.miniplayer .meta { margin: 0 0 2px; }
audio { width: 100%; display: block; }
@media (min-width: 900px) {
  body.detail main { max-width: 1080px; }
  .detail-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

/* ---------- login ---------- */
.center-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 340px; }
.error, #error { color: var(--red); font-size: 0.85rem; min-height: 1.2em; }

/* ---------- softphone ---------- */
.bigbtn { width: 100%; min-height: 64px; font-size: 1.2rem; border-radius: 10px; border: none;
          font-weight: 700; margin-top: 0.55rem; cursor: pointer; }
.bigbtn--answer { min-height: 72px; background: var(--green); color: #fff; }
.bigbtn--hangup { background: #44403c; color: #fff; }
.discard-zone { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 16px; }
.dialrow { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.dialrow input { flex: 1; }
.banner {
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-weight: 650;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}
.banner.on { background: var(--tint-green); color: var(--green); }
.banner.off { background: var(--tint-red); color: var(--red); }
.status-line { font-size: 1.05rem; margin: 0.6rem 0 0.9rem; color: var(--muted); min-height: 1.4em; }
.status-line.ok { color: var(--green); font-weight: 650; }

/* ---------- call timer ---------- */
.calltimer {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin: 0.3rem 0 0;
}
.calltimer.warn { color: var(--amber); }
.calltimer.over { color: var(--red); }
.countdown {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 650;
  min-height: 1.4em;
  margin-bottom: 0.4rem;
}
.countdown.warn { color: var(--amber); }
.countdown.over { color: var(--red); }
@keyframes timerflash { 50% { opacity: 0.12; } }
.flashing { animation: timerflash 0.7s step-start infinite; }

@media (max-width: 480px) {
  main { padding: 0.6rem 12px; }
  .card { padding: 0.8rem; }
  .primary, .secondary, .danger, .bigbtn { width: 100%; }
  .miniplayer { margin: 0 -0.6rem -0.6rem; }
}
