/* AnswerFlow — warm client-facing design system.
   Shared by the client app (client-app.html), the invite signup, and login.
   Mobile-first, light + dark aware. Self-contained: no external fonts. */

:root {
  --bg: #f4f8ff;
  --bg-blush: #eaf3ff;
  --surface: #ffffff;
  --surface-2: #f7fbff;
  --ink: #081421;
  --ink-soft: #273546;
  --muted: #657487;
  --muted-2: #8a97a8;
  --accent: #159447;
  --accent-strong: #0f7437;
  --accent-soft: #a8e4bd;
  --accent-tint: #e9f8ef;
  --blue: #087cc1;
  --blue-tint: #e8f4ff;
  --gold: #a77b05;
  --gold-tint: #fff5d8;
  --good-bg: #e0f5e8;
  --good-ink: #0f7437;
  --danger: #c43d3d;
  --danger-tint: #fde8e8;
  --line: #dce6f1;
  --line-strong: #cbd8e6;
  --shadow: 0 10px 26px rgba(15, 34, 55, 0.07);
  --shadow-lg: 0 22px 55px rgba(15, 34, 55, 0.13);
  --radius-card: 22px;
  --radius-field: 16px;
  --radius-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141c;
    --bg-blush: #132231;
    --surface: #151f2a;
    --surface-2: #101923;
    --ink: #f4f8ff;
    --ink-soft: #dbe6f2;
    --muted: #a7b6c8;
    --muted-2: #7f8fa3;
    --accent: #38c56f;
    --accent-strong: #72dc96;
    --accent-soft: #1f6d42;
    --accent-tint: #153223;
    --blue: #5bbcf2;
    --blue-tint: #132d42;
    --gold: #f5c542;
    --gold-tint: #332a13;
    --good-bg: #173522;
    --good-ink: #8fe6a9;
    --danger: #ff8d8d;
    --danger-tint: #3b2024;
    --line: #263546;
    --line-strong: #34495f;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="light"] {
  --bg: #f4f8ff; --bg-blush: #eaf3ff; --surface: #ffffff; --surface-2: #f7fbff;
  --ink: #081421; --ink-soft: #273546; --muted: #657487; --muted-2: #8a97a8;
  --accent: #159447; --accent-strong: #0f7437; --accent-soft: #a8e4bd; --accent-tint: #e9f8ef;
  --blue: #087cc1; --blue-tint: #e8f4ff; --gold: #a77b05; --gold-tint: #fff5d8;
  --good-bg: #e0f5e8; --good-ink: #0f7437; --danger: #c43d3d; --danger-tint: #fde8e8;
  --line: #dce6f1; --line-strong: #cbd8e6;
  --shadow: 0 10px 26px rgba(15, 34, 55, 0.07); --shadow-lg: 0 22px 55px rgba(15, 34, 55, 0.13);
}

:root[data-theme="dark"] {
  --bg: #0d141c; --bg-blush: #132231; --surface: #151f2a; --surface-2: #101923;
  --ink: #f4f8ff; --ink-soft: #dbe6f2; --muted: #a7b6c8; --muted-2: #7f8fa3;
  --accent: #38c56f; --accent-strong: #72dc96; --accent-soft: #1f6d42; --accent-tint: #153223;
  --blue: #5bbcf2; --blue-tint: #132d42; --gold: #f5c542; --gold-tint: #332a13;
  --good-bg: #173522; --good-ink: #8fe6a9; --danger: #ff8d8d; --danger-tint: #3b2024;
  --line: #263546; --line-strong: #34495f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4); --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 {
  color: var(--ink);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.12;
  margin: 0;
}

p { margin: 0; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }

/* ---------- Brand ---------- */
.af-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink);
}
.af-brand .af-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow);
}
.af-brand .af-word b { color: var(--accent); font-weight: 800; }

/* ---------- Pills / badges ---------- */
.af-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.af-pill.is-ai { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.af-pill.is-urgent { background: var(--danger-tint); color: var(--danger); border-color: transparent; }
.af-pill.is-accent { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; }
.af-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.af-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 15px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease;
  line-height: 1;
}
.af-btn:active { transform: translateY(1px); }
.af-btn:disabled { opacity: .55; cursor: not-allowed; }

.af-btn.primary {
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.af-btn.primary:hover { box-shadow: var(--shadow-lg); text-decoration: none; }

.af-btn.ghost {
  background: var(--accent-tint);
  color: var(--accent-strong);
}
.af-btn.ghost:hover { background: var(--line); text-decoration: none; }

.af-btn.soft {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.af-btn.soft:hover { background: var(--surface-2); text-decoration: none; }

.af-btn.danger { background: var(--danger-tint); color: var(--danger); }
.af-btn.block { width: 100%; }
.af-btn.sm { padding: 10px 16px; font-size: 14px; }

/* ---------- Cards & fields ---------- */
.af-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.af-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.af-field > .control {
  position: relative;
  display: flex;
  align-items: center;
}
.af-field .control > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted-2); pointer-events: none; }
.af-field input,
.af-field textarea,
.af-field select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  padding: 14px 16px;
}
.af-field .control.has-icon input { padding-left: 44px; }
.af-field textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.af-field input::placeholder,
.af-field textarea::placeholder { color: var(--muted-2); font-weight: 500; }
.af-field input:focus,
.af-field textarea:focus,
.af-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.af-check {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface-2);
  font-size: 15px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer;
}
.af-check input { width: 20px; height: 20px; accent-color: var(--accent); }

.af-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
.af-status { font-size: 13px; color: var(--muted); }
.af-status.error { color: var(--danger); font-weight: 600; }
.af-status.ok { color: var(--good-ink); font-weight: 600; }

/* ---------- Auth / onboarding layout ---------- */
.af-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  gap: 20px;
}
.af-auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.af-auth-head { display: flex; flex-direction: column; gap: 6px; }
.af-auth-head h1 { font-size: 26px; }
.af-auth-head p { color: var(--muted); }
.af-form { display: flex; flex-direction: column; gap: 14px; }
.af-hairline { height: 1px; background: var(--line); border: 0; margin: 2px 0; }
.af-or {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted-2); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
}
.af-or::before, .af-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.af-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 700; font-size: 14px;
}

/* ---------- Business-type choice grid ---------- */
.af-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.af-choice {
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease;
  min-height: 132px;
}
.af-choice:active { transform: translateY(1px); }
.af-choice:hover { border-color: var(--accent-soft); }
.af-choice[aria-pressed="true"], .af-choice.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.af-choice .chip {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--accent-tint); color: var(--accent-strong);
  display: grid; place-items: center;
}
.af-choice .chip svg { width: 22px; height: 22px; }
.af-choice strong { font-size: 15px; color: var(--ink); font-weight: 800; line-height: 1.2; }
.af-choice span { font-size: 13px; color: var(--muted); }

@media (max-width: 360px) {
  .af-choice-grid { grid-template-columns: 1fr; }
}

/* ================= Client app shell ================= */
.app-body {
  background-attachment: fixed;
}
.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 28px 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-top .who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.app-top .who .af-mark { flex: none; }
.app-top .who .names { min-width: 0; }
.app-top .who .biz { font-weight: 800; font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top .who .line { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.app-top .who .line .live { width: 7px; height: 7px; border-radius: 50%; background: var(--good-ink); box-shadow: 0 0 0 3px var(--good-bg); }
.icon-btn {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: translateY(1px); }

/* Scrollable view area */
.app-main {
  flex: 1;
  padding: 28px 28px 126px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.app-view { display: flex; flex-direction: column; gap: 18px; }

.view-title { font-size: 22px; }
.view-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Home hero / daily board */
.hero-board {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.86)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: 30px;
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}
.hero-board::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--blue), var(--accent), var(--gold));
}
.hero-copy { max-width: 640px; display: flex; flex-direction: column; gap: 12px; }
.hero-copy h1 { font-size: 42px; line-height: 1.05; }
.hero-copy p { color: var(--muted); font-size: 17px; max-width: 620px; }
.hero-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.action-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.action-card {
  appearance: none;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.9)),
    var(--surface);
  color: var(--ink);
  border-radius: 28px;
  box-shadow: var(--shadow);
  min-height: 174px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease;
}
.action-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.action-card:active { transform: translateY(1px); }
.action-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
}
.action-icon svg { width: 22px; height: 22px; }
.action-num {
  min-width: 52px;
  height: 42px;
  padding: 0 13px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--surface-2);
}
.action-title { font-size: 15px; font-weight: 680; color: var(--ink); letter-spacing: 0; }
.action-copy { font-size: 13px; color: var(--muted); line-height: 1.28; font-weight: 480; }
.action-card.is-blue .action-icon { color: var(--blue); background: var(--blue-tint); }
.action-card.is-blue .action-num { color: var(--blue); background: var(--blue-tint); }
.action-card.is-green .action-icon { color: var(--accent-strong); background: var(--accent-tint); }
.action-card.is-green .action-num { color: var(--accent-strong); background: var(--accent-tint); }
.action-card.is-orange .action-icon { color: var(--gold); background: var(--gold-tint); }
.action-card.is-orange .action-num { color: var(--gold); background: var(--gold-tint); }
.action-card.is-red .action-icon { color: var(--danger); background: var(--danger-tint); }
.action-card.is-red .action-num { color: var(--danger); background: var(--danger-tint); }
.action-card.is-slate .action-icon { color: var(--ink-soft); background: var(--surface-2); }
.action-card.is-slate .action-num { color: var(--ink-soft); background: var(--surface-2); }
.action-card.is-settings .action-icon { color: var(--blue); background: var(--blue-tint); }
.action-card.is-settings .action-num { color: var(--blue); background: var(--blue-tint); font-size: 21px; }
.action-card.is-access .action-icon { color: var(--accent-strong); background: var(--accent-tint); }
.action-card.is-access .action-num { color: var(--accent-strong); background: var(--accent-tint); font-size: 21px; }

/* Stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
}
.stat-tile .num { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; }
.stat-tile .lbl { font-size: 12px; color: var(--muted); font-weight: 700; line-height: 1.2; }
.stat-tile.is-urgent .num { color: var(--danger); }
.stat-tile.is-accent .num { color: var(--accent); }

/* Section heading */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec-head h2 { font-size: 16px; }
.sec-head .link { font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer; }

/* Generic list */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 34, 55, 0.04);
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease;
}
.list-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.list-item:active { transform: translateY(1px); }
.list-item .avatar {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-tint); color: var(--accent-strong);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.list-item.unread .avatar { background: var(--accent); color: #fff; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .body .row1 { display: flex; align-items: center; gap: 8px; }
.list-item .body .name { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .body .snippet { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.list-item .meta .when { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.tag {
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.tag.urgent { background: var(--danger-tint); color: var(--danger); }
.tag.new { background: var(--accent-tint); color: var(--accent-strong); }
.tag.done { background: var(--good-bg); color: var(--good-ink); }
.tag.callback { background: #e9eef6; color: #3b5b86; }
@media (prefers-color-scheme: dark) { .tag.callback { background: #22303f; color: #9dc0e6; } }

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pills button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.filter-pills button.active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

/* Empty / loading states */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty .ico { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-tint); color: var(--accent-strong); display: grid; place-items: center; }
.empty .ico svg { width: 26px; height: 26px; }
.empty strong { color: var(--ink); font-size: 16px; }
.skeleton { height: 66px; border-radius: 18px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Detail sheet (calls / bookings) */
.sheet-back { position: fixed; inset: 0; background: rgba(20,16,10,.35); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.sheet-back.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  max-width: 620px;
  margin: 0 auto;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.22,.61,.36,1);
  padding: 8px 18px calc(28px + env(safe-area-inset-bottom));
}
.sheet.open { transform: translateY(0); }
.sheet .grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 14px; }
.sheet .sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet .sheet-head h3 { font-size: 20px; }
.sheet .sheet-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.sheet-block { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sheet-block > .lbl { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); }
.readbox { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--ink-soft); white-space: pre-wrap; }
.audio-row audio { width: 100%; }
.btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* Settings groups */
.group { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.group > h2 { font-size: 16px; }
.group .group-sub { color: var(--muted); font-size: 13px; margin-top: -6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }

.access-panel {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--accent-tint) 54%, var(--surface)));
}
.mini-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.access-panel strong { display: block; font-size: 22px; color: var(--ink); }
.access-panel p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.permission-list {
  list-style: none;
  display: flex;
  align-content: start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.permission-list li {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}
.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--danger-tint) 28%, var(--surface)));
}
.audit-card { grid-column: 1 / -1; }
.audit-list { display: grid; gap: 10px; }
.audit-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.audit-row:first-child { border-top: 0; padding-top: 0; }
.audit-dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-tint);
}
.audit-row strong { display: block; color: var(--ink); font-size: 14px; }
.audit-row p { color: var(--ink-soft); font-size: 13px; }
.audit-row small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 12px; }
.empty.mini { padding: 14px; min-height: 0; }

@media (max-width: 620px) {
  .access-panel { grid-template-columns: 1fr; }
}

/* Calendar connection */
.calendar-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.af-pill.is-connected { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.af-pill.is-off { background: var(--surface-2); color: var(--muted); }

/* Bottom navigation */
.app-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px; border-radius: 14px;
  color: var(--muted-2); font-size: 11px; font-weight: 700;
  position: relative;
}
.nav-btn svg { width: 23px; height: 23px; }
.nav-btn .badge {
  position: absolute; top: 2px; right: calc(50% - 22px);
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}
.nav-btn.active { color: var(--accent); }

@media (min-width: 900px) {
  .app-view[data-view="settings"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .app-view[data-view="settings"] > div:first-child,
  .app-view[data-view="settings"] > #logoutBtn,
  .app-view[data-view="settings"] > #appVersion {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .action-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-board { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy h1 { font-size: 34px; }
}

@media (max-width: 620px) {
  .app-top { padding-left: 18px; padding-right: 18px; }
  .app-main { padding: 18px 16px 116px; }
  .hero-board { padding: 24px 20px; border-radius: 24px; }
  .hero-copy h1 { font-size: 30px; }
  .hero-copy p { font-size: 15px; }
  .action-board { gap: 10px; }
  .action-card { min-height: 154px; padding: 15px; border-radius: 24px; }
  .action-num { min-width: 48px; height: 38px; font-size: 22px; border-radius: 15px; }
  .action-card.is-settings .action-num,
  .action-card.is-access .action-num { font-size: 19px; }
}

@media (max-width: 380px) {
  .action-board { grid-template-columns: 1fr; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 60;
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }

/* Install hint */
.install-hint {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 16px;
}
.install-hint .txt { flex: 1; font-size: 13px; color: var(--accent-strong); font-weight: 600; }
.install-hint .txt b { display: block; color: var(--ink); font-size: 14px; }
