/* =========================================================
   VoiceQR — design tokens
   Concept: the physical object is a printed label, so the UI
   borrows from postal/parcel-tag language — dashed perforations,
   a stamp-red accent used sparingly, a teal "recording" indicator.
   ========================================================= */

:root {
  --ink: #1B1F2A;
  --paper: #FBF9F4;
  --paper-dim: #F1EEE5;
  --line: #DAD5C8;
  --muted: #6B6558;
  --stamp: #C1442D;      /* accent: alerts, primary actions */
  --record: #2F6F62;     /* accent: recording state, success */
  --record-dim: #E4EEEB;
  --stamp-dim: #F6E4DF;
  --radius: 3px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .5em;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; color: var(--ink); }
.muted { color: var(--muted); }

a { color: var(--stamp); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout shells ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.topbar .brand .dot { color: var(--stamp); }

.main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 90px;
}

/* bottom tab bar — mobile-first PWA nav */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  font-size: .72rem;
  color: var(--muted);
  text-decoration: none;
}
.tabbar a.active { color: var(--stamp); font-weight: 600; }
.tabbar .icon { display: block; font-size: 1.25rem; margin-bottom: 2px; }

/* ---------- cards (perforated-label motif, not rounded-shadow SaaS default) ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
}
.label-card {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.label-card .slug {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
}
.status-pill {
  display: inline-block;
  font-size: .72rem;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 600;
}
.status-pill.active { background: var(--record-dim); color: var(--record); }
.status-pill.locked { background: var(--stamp-dim); color: var(--stamp); }
.status-pill.unassigned { background: var(--paper-dim); color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--record);
  outline-offset: 1px;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn.primary { background: var(--stamp); border-color: var(--stamp); }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.danger { background: #fff; border-color: var(--stamp); color: var(--stamp); }
.btn.record-btn { background: var(--record); border-color: var(--record); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { display: block; width: 100%; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.toggle-row:first-child { border-top: none; }

/* ---------- flash / alerts ---------- */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .88rem;
}
.flash.success { background: var(--record-dim); color: var(--record); border: 1px solid var(--record); }
.flash.error { background: var(--stamp-dim); color: var(--stamp); border: 1px solid var(--stamp); }

/* ---------- misc ---------- */
.divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat-box .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.stat-box .lbl { font-size: .72rem; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: none; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-box .brand { text-align: center; margin-bottom: 26px; font-family: var(--font-display); font-size: 1.5rem; }

.record-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 3px solid var(--record);
  display: flex; align-items: center; justify-content: center;
  margin: 30px auto;
  background: var(--record-dim);
  cursor: pointer;
}
.record-circle.recording { background: var(--stamp-dim); border-color: var(--stamp); animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(193,68,45,.35); }
  70% { box-shadow: 0 0 0 16px rgba(193,68,45,0); }
  100% { box-shadow: 0 0 0 0 rgba(193,68,45,0); }
}

@media (prefers-reduced-motion: reduce) {
  .record-circle.recording { animation: none; }
}
