:root {
  --bg: #f5f1ea; --card: #ffffff; --ink: #1d1813; --muted: #6d645a; --line: #e7e0d5;
  --soft: #f3eee6; --accent: #b4441f; --accent-2: #d9772b; --accent-ink: #fff;
  --ok: #2f7d4f; --err: #b3261e; --radius: 18px;
  --shadow: 0 1px 2px rgba(40,25,10,.04), 0 8px 24px rgba(40,25,10,.06);
  --font: "Noto Sans Ethiopic", system-ui, -apple-system, "Segoe UI", Roboto, "Nyala", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); min-height: 100vh; }
a { color: var(--accent); }
code { background: var(--soft); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.band {
  background: radial-gradient(120% 140% at 0% 0%, #d9772b 0%, #b4441f 45%, #6e2410 100%);
  color: #fff; padding: 36px 16px 88px; position: relative; overflow: hidden;
}
.band::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  border-radius: 50%; border: 40px solid rgba(255,255,255,.07);
}
.band .inner { max-width: 760px; margin: 0 auto; position: relative; z-index: 1; }
.band.wide .inner { max-width: 1100px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 18px; backdrop-filter: blur(4px);
}
.band h1 { font-size: 34px; line-height: 1.2; margin: 22px 0 8px; }
.band .lead { color: rgba(255,255,255,.88); max-width: 560px; margin: 0; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 64px; }
.wrap.wide { max-width: 1100px; }
.wrap.narrow { max-width: 440px; }
.band + .wrap { margin-top: -64px; position: relative; z-index: 2; }
.plain-top { padding-top: 40px; }

.hero { padding: 16px 0 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--accent); font-weight: 700; margin: 0; }
.band .eyebrow { color: rgba(255,255,255,.8); }
h1 { font-size: 30px; line-height: 1.25; margin: 6px 0 8px; }
h2 { font-size: 18px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 19px; margin: 0; }
.lead { color: var(--muted); margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; margin-top: 18px; box-shadow: var(--shadow);
}
.step {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.step-sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

/* ---------- Script ---------- */
.script {
  font-size: 19px; line-height: 2.1; background: #fcf9f4; border: 1px solid #f0e7da;
  border-left: 5px solid var(--accent); padding: 20px 22px; border-radius: 12px;
  max-height: 460px; overflow-y: auto; scrollbar-width: thin;
}
.script-tools { display: flex; justify-content: flex-end; gap: 6px; margin: -6px 0 10px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.tips li {
  background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--muted);
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.45;
}
.tips li b { font-size: 18px; line-height: 1; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 16px; }
input[type=text], input[type=tel], input[type=password], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 13px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; font: inherit; font-size: 16px; font-weight: 400; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(180,68,31,.12); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

button, .btn {
  font: inherit; font-weight: 600; font-size: 15px; border-radius: 12px; padding: 11px 16px; min-height: 44px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.3;
  transition: transform .08s, border-color .15s, background .15s;
}
button:hover, .btn:hover { border-color: #cfc5b7; }
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { border-color: var(--accent); background: #a33c1a; }
.block { width: 100%; padding: 16px; font-size: 17px; margin-top: 10px; border-radius: 14px; }
.small { padding: 6px 12px; font-size: 13px; min-height: 36px; }
.danger { color: var(--err); }
.danger:hover { border-color: #f3c1bc; background: #fdf3f2; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; background: var(--soft); padding: 5px; border-radius: 14px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; min-height: 42px; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- Recorder ---------- */
.stage {
  background: linear-gradient(180deg, #fbf8f3, #f6f0e7); border: 1px solid #efe6d8; border-radius: 16px;
  padding: 28px 18px 22px; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.rec {
  width: 104px; height: 104px; border-radius: 50%; padding: 0; font-size: 38px; border: 0;
  background: var(--accent); color: #fff; box-shadow: 0 10px 28px rgba(180,68,31,.35);
}
.rec:hover { background: #a33c1a; }
.rec.on { background: var(--err); animation: pulse 1.5s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(179,38,30,.45); }
  70% { box-shadow: 0 0 0 22px rgba(179,38,30,0); }
  100% { box-shadow: 0 0 0 0 rgba(179,38,30,0); }
}
.rec-label { font-weight: 600; margin-top: 14px; }
.timer { font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 700; letter-spacing: .02em; margin-top: 2px; }
.meter { width: 100%; max-width: 320px; height: 8px; background: #ebe2d4; border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3b9a63, #d9a92b, #c9452a); transition: width .08s; }
.stage audio { margin-top: 18px; }
audio { width: 100%; margin-top: 12px; height: 44px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  border: 2px dashed #dccfbd; border-radius: 16px; padding: 30px 16px; background: #fcf9f4; font-weight: 600;
  margin: 0; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #fdf4ee; }
.dropzone .icon { font-size: 34px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .fname { color: var(--accent); word-break: break-all; }

/* ---------- Messages ---------- */
.hint { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin: 8px 0 0; }
.notice { background: #fff6e5; border: 1px solid #f0d9a8; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.err-box { background: #fdecea; border-color: #f3c1bc; color: var(--err); }
.msg { min-height: 1.2em; font-size: 14px; margin: 14px 0 0; }
.msg.err { color: var(--err); background: #fdecea; padding: 10px 14px; border-radius: 10px; }
.progress { height: 8px; background: #eee7dc; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .2s; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.done { text-align: center; padding: 48px 24px; }
.done .big {
  width: 76px; height: 76px; border-radius: 50%; background: #e4f3e9; color: var(--ok);
  display: grid; place-items: center; font-size: 38px; margin: 0 auto 14px; font-weight: 700;
}
.done h2 { justify-content: center; font-size: 22px; }
pre.config { overflow: auto; background: var(--ink); color: var(--bg); padding: 14px; border-radius: 10px; font-size: 13px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.actions form { margin: 0; }

/* ---------- Admin ---------- */
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.topbar h1 { margin: 16px 0 0; }
.topbar .actions { margin: 0; }
.band .btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.band .btn:hover { background: rgba(255,255,255,.24); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .1s;
}
.stat:hover { border-color: #d5c9b9; }
.stat.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180,68,31,.12), var(--shadow); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; display: block; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.stat.pending .dot { background: #d9a92b; } .stat.shortlisted .dot { background: #2f9a5a; } .stat.rejected .dot { background: #c9452a; }
.search { display: flex; gap: 8px; margin-top: 16px; }
.search input { margin: 0; flex: 1; }
.flash { margin-top: 16px; background: #e4f3e9; color: var(--ok); border: 1px solid #bfe0cb; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.sub { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; }
.sub .left { min-width: 0; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.who .name { min-width: 0; }
.who h3 { overflow-wrap: anywhere; }
.phone { margin: 0; font-size: 15px; font-weight: 600; }
.phone a { color: var(--accent); text-decoration: none; }
.meta { color: var(--muted); font-size: 13px; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.meta span { background: var(--soft); padding: 2px 10px; border-radius: 99px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 99px; margin-left: auto; white-space: nowrap; }
.badge.pending { background: #fff1d6; color: #8a5a00; }
.badge.shortlisted { background: #dff3e6; color: #1e6b3c; }
.badge.rejected { background: #fbe3e1; color: #9b2219; }
.review { border-left: 1px solid var(--line); padding-left: 28px; }
.review label { margin-bottom: 12px; }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sub { grid-template-columns: 1fr; gap: 18px; }
  .review { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .band { padding: 22px 16px 76px; }
  .band h1 { font-size: 26px; margin-top: 16px; }
  .band .lead { font-size: 15px; }
  .card { padding: 18px; border-radius: 16px; margin-top: 14px; }
  .script { font-size: 17.5px; line-height: 2; padding: 14px 16px; max-height: 60vh; }
  .tips { grid-template-columns: 1fr; gap: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .tabs button { font-size: 14px; }
  .timer { font-size: 30px; }
  .topbar .actions { width: 100%; }
  .topbar .actions .btn { flex: 1; padding: 10px 8px; font-size: 14px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 24px; }
  .review .row { gap: 0 12px; }
  .actions .btn, .actions button { flex: 1; }
  /* keep the submit button reachable on phones */
  #sendWrap { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); padding: 18px 0 12px; margin: 0 -2px -6px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
