/* =========================================================
   Consentron Mobile — Design System
   ========================================================= */
:root {
  /* Brand */
  --c-primary: #00519E;
  --c-primary-700: #003E79;
  --c-primary-50: #E7F1FB;
  --c-accent: #00A7A2;
  --c-accent-50: #E0F7F6;
  --c-success: #118A57;
  --c-success-50: #E8F5EE;
  --c-warning: #B36A00;
  --c-warning-50: #FFF3E0;
  --c-danger: #B3261E;
  --c-danger-50: #FCE8E8;
  --c-purple: #6D43B5;
  --c-purple-50: #F1ECFA;

  /* Surfaces */
  --bg-page: #F2F4F8;
  --bg-surface: #FFFFFF;
  --bg-elev: #FFFFFF;
  --bg-muted: #EEF1F5;
  --bg-tag: #E8ECF1;
  --bg-status: #000000;

  --border-soft: #E2E6EC;
  --border-strong: #C7CDD6;
  --text-main: #0F172A;
  --text-sub: #5B6573;
  --text-faint: #9AA3B0;

  --shadow-1: 0 1px 2px rgba(15,23,42,.05);
  --shadow-2: 0 4px 12px rgba(15,23,42,.08);
  --shadow-3: 0 10px 30px rgba(15,23,42,.15);

  /* Radii */
  --r-pill: 999px;
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
  --r-xs: 8px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Inter", system-ui, sans-serif;
  --font-script: "Caveat", cursive;

  /* iOS-style heights */
  --status-h: 44px;
  --appbar-h: 52px;
  --tabbar-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --t-fast: 150ms cubic-bezier(.4,0,.2,1);
  --t-base: 250ms cubic-bezier(.4,0,.2,1);
  --t-spring: 320ms cubic-bezier(.34,1.56,.64,1);
}

[data-theme="dark"] {
  --bg-page: #0B0F15;
  --bg-surface: #161B23;
  --bg-elev: #1B2230;
  --bg-muted: #1B2230;
  --bg-tag: #232B3A;
  --border-soft: #232B3A;
  --border-strong: #2F394C;
  --text-main: #E8EDF5;
  --text-sub: #95A0B0;
  --text-faint: #6B7585;
  --c-primary-50: rgba(0,81,158,.22);
  --c-accent-50: rgba(0,167,162,.22);
  --c-success-50: rgba(17,138,87,.22);
  --c-warning-50: rgba(179,106,0,.22);
  --c-danger-50: rgba(179,38,30,.22);
  --c-purple-50: rgba(109,67,181,.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  height: 100dvh; width: 100vw; overflow: hidden;
  font-family: var(--font);
  background: var(--bg-page); color: var(--text-main);
  font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: contain;
  touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; -webkit-appearance: none; appearance: none; }
input, select, textarea { font: inherit; color: inherit; -webkit-appearance: none; appearance: none; }
.hidden { display: none !important; }
.muted { color: var(--text-sub); }

/* =========================================================
   STATUS BAR (mock iOS)
   ========================================================= */
.status-bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--status-h);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 4px 24px 6px;
  z-index: 100; background: var(--bg-page);
  font-weight: 700; font-size: 15px; color: var(--text-main);
  letter-spacing: -.01em;
}
.status-time { font-variant-numeric: tabular-nums; }
.status-icons { display: flex; align-items: center; gap: 6px; }
.status-icons i, .status-icons svg { width: 16px; height: 16px; color: var(--text-main); }
.battery {
  display: inline-block; width: 24px; height: 12px;
  border: 1px solid var(--text-main); border-radius: 3px;
  position: relative; margin-left: 2px;
}
.battery::after {
  content: ''; position: absolute; right: -3px; top: 3px;
  width: 2px; height: 6px; background: var(--text-main); border-radius: 0 1px 1px 0;
}
.battery > span {
  display: block; width: 80%; height: 100%; background: var(--text-main); border-radius: 1.5px;
}

/* =========================================================
   APP SHELL
   ========================================================= */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-top: var(--status-h);
}

/* APP BAR */
.app-bar {
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 4px;
  background: color-mix(in oklab, var(--bg-page) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 50;
  position: relative;
}
.ab-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  color: var(--c-primary); flex-shrink: 0;
  transition: background var(--t-fast);
}
.ab-btn:active { background: var(--bg-muted); }
.ab-btn i, .ab-btn svg { width: 22px; height: 22px; stroke-width: 2.5; }
.ab-title {
  flex: 1; font-size: 17px; font-weight: 700; text-align: center;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ab-actions { display: flex; gap: 4px; min-width: 44px; justify-content: flex-end; }

/* Large title variant (auto-applied on home screens) */
.app-bar.large { background: var(--bg-page); border: none; }
.app-bar.large .ab-title { text-align: left; font-size: 28px; padding-left: 12px; font-weight: 800; }

/* SCREEN MOUNT */
.screen-mount {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
  background: var(--bg-page);
  scroll-behavior: smooth;
  position: relative;
}
.screen { animation: screenIn .22s cubic-bezier(.16,1,.3,1); padding-bottom: 24px; }
@keyframes screenIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
.screen-mount::-webkit-scrollbar { display: none; }

/* TAB BAR */
.tab-bar {
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in oklab, var(--bg-surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--border-soft);
  display: grid; grid-template-columns: repeat(5, 1fr);
  align-items: center; padding-top: 4px;
  position: relative; z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-faint);
  height: var(--tabbar-h);
  font-size: 10px; font-weight: 600;
  position: relative;
  transition: color var(--t-fast);
}
.tab i, .tab svg { width: 24px; height: 24px; stroke-width: 2; }
.tab.active { color: var(--c-primary); }
.tab.active i, .tab.active svg { stroke-width: 2.4; }
.tab-badge {
  position: absolute; top: 4px; right: 22%;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--c-danger); color: #fff;
  border-radius: var(--r-pill);
  font-size: 10px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.tab-badge.show { display: flex; }

.tab-center { padding-bottom: 10px; }
.tab-center-circle {
  display: grid; place-items: center;
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff; box-shadow: 0 6px 20px rgba(0,81,158,.4);
  transition: transform var(--t-fast);
}
.tab-center-circle i, .tab-center-circle svg { width: 26px; height: 26px; stroke-width: 2.6; }
.tab-center:active .tab-center-circle { transform: scale(.92); }

/* =========================================================
   FAB
   ========================================================= */
.fab {
  position: fixed; right: 20px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,81,158,.4);
  display: grid; place-items: center; z-index: 35;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  display: none; /* Off by default; turned on per-screen */
}
.fab.show { display: grid; }
.fab i, .fab svg { width: 26px; height: 26px; stroke-width: 2.6; }
.fab:active { transform: scale(.92); }

/* =========================================================
   COMMON: cards, list, chips, buttons
   ========================================================= */
.section { padding: 12px 16px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 16px 8px;
}
.section-title h2 { font-size: 13px; font-weight: 700; color: var(--text-sub); letter-spacing: .03em; text-transform: uppercase; }
.section-title a { font-size: 14px; color: var(--c-primary); font-weight: 600; }

.card {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 12px; }

/* List rows (iOS-style grouped) */
.list-group {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 0 16px;
}
.list-group + .list-group { margin-top: 12px; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; min-height: 56px;
  position: relative;
  transition: background var(--t-fast);
}
.list-row + .list-row { border-top: 1px solid var(--border-soft); }
.list-row:active { background: var(--bg-muted); }
.list-row .lr-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-muted); color: var(--text-sub);
  display: grid; place-items: center; flex-shrink: 0;
}
.list-row .lr-icon i, .list-row .lr-icon svg { width: 18px; height: 18px; }
.list-row .lr-body { flex: 1; min-width: 0; }
.list-row .lr-title {
  font-size: 16px; font-weight: 500; color: var(--text-main);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .lr-sub {
  font-size: 13px; color: var(--text-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .lr-trail { color: var(--text-faint); font-size: 14px; flex-shrink: 0; }
.list-row .lr-trail i, .list-row .lr-trail svg { width: 18px; height: 18px; color: var(--text-faint); }
.list-row.row-link::after {
  content: ''; flex-shrink: 0;
  width: 14px; height: 14px; margin-left: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA3B0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}

/* Chips / badges */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--bg-tag); color: var(--text-sub);
}
.chip i, .chip svg { width: 11px; height: 11px; }
.chip.primary { background: var(--c-primary-50); color: var(--c-primary); }
.chip.success { background: var(--c-success-50); color: var(--c-success); }
.chip.warning { background: var(--c-warning-50); color: var(--c-warning); }
.chip.danger  { background: var(--c-danger-50);  color: var(--c-danger); }
.chip.accent  { background: var(--c-accent-50);  color: var(--c-accent); }
.chip.purple  { background: var(--c-purple-50);  color: var(--c-purple); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-surface);
  color: var(--c-primary);
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-size: 15px; font-weight: 600;
  transition: background var(--t-fast), transform var(--t-fast);
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--c-primary); color: #fff;
}
.btn-primary:active { background: var(--c-primary-700); }
.btn-tonal { background: var(--c-primary-50); color: var(--c-primary); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-main); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 22px; font-size: 16px; min-height: 52px; border-radius: var(--r-md); }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .5; }
.btn i, .btn svg { width: 18px; height: 18px; stroke-width: 2.2; }

/* Icon button (round) */
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  color: var(--c-primary);
  transition: background var(--t-fast);
}
.icon-btn:active { background: var(--bg-muted); }
.icon-btn i, .icon-btn svg { width: 20px; height: 20px; }

/* =========================================================
   HOME screen
   ========================================================= */
.home-hero {
  padding: 4px 16px 16px;
}
.home-hello {
  font-size: 14px; color: var(--text-sub);
  display: flex; align-items: center; gap: 6px;
}
.home-name {
  font-size: 28px; font-weight: 800; letter-spacing: -.02em;
  margin-top: 2px;
}
.home-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  padding: 0 16px;
}
.stat-card {
  background: var(--bg-surface); border-radius: var(--r-lg);
  padding: 14px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-1);
}
.stat-card .stat-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--c-primary-50); color: var(--c-primary);
  margin-bottom: 8px;
}
.stat-card .stat-icon i, .stat-card .stat-icon svg { width: 16px; height: 16px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-sub); }
.stat-card .stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat-card .stat-delta { font-size: 11px; color: var(--c-success); margin-top: 2px; }
.stat-card.danger .stat-icon { background: var(--c-danger-50); color: var(--c-danger); }
.stat-card.warning .stat-icon { background: var(--c-warning-50); color: var(--c-warning); }
.stat-card.success .stat-icon { background: var(--c-success-50); color: var(--c-success); }
.stat-card.accent .stat-icon { background: var(--c-accent-50); color: var(--c-accent); }

/* Quick actions */
.qa-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 0 16px;
}
.qa-tile {
  background: var(--bg-surface); border-radius: var(--r-md);
  padding: 14px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-main);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast), background var(--t-fast);
}
.qa-tile:active { transform: scale(.95); }
.qa-tile .qa-icon {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center;
}
.qa-tile .qa-icon i, .qa-tile .qa-icon svg { width: 20px; height: 20px; }
.qa-tile.t-accent  .qa-icon { background: var(--c-accent-50);  color: var(--c-accent); }
.qa-tile.t-warning .qa-icon { background: var(--c-warning-50); color: var(--c-warning); }
.qa-tile.t-purple  .qa-icon { background: var(--c-purple-50);  color: var(--c-purple); }
.qa-tile.t-success .qa-icon { background: var(--c-success-50); color: var(--c-success); }

/* Alert banner */
.banner {
  background: linear-gradient(135deg, var(--c-warning-50), #fff8ef);
  border-radius: var(--r-lg);
  margin: 0 16px;
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.banner .banner-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(179,106,0,.18); color: var(--c-warning);
  display: grid; place-items: center; flex-shrink: 0;
}
.banner .banner-body { flex: 1; min-width: 0; }
.banner strong { font-size: 13px; color: #7a4500; display: block; }
.banner p { font-size: 12px; color: #9a6b2f; margin-top: 2px; }

/* =========================================================
   SEARCH bar (iOS-style)
   ========================================================= */
.search-bar {
  margin: 8px 16px 12px;
  background: var(--bg-muted);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
}
.search-bar i, .search-bar svg { width: 18px; height: 18px; color: var(--text-faint); }
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 16px; color: var(--text-main);
}
.search-bar input::placeholder { color: var(--text-faint); }

/* Segmented control */
.segmented {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-muted); border-radius: var(--r-sm);
  margin: 0 16px 12px;
}
.segmented button {
  flex: 1; padding: 8px 10px;
  font-size: 13px; font-weight: 600;
  color: var(--text-sub);
  border-radius: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* =========================================================
   DOC card (in list)
   ========================================================= */
.doc-card {
  background: var(--bg-surface); border-radius: var(--r-md);
  padding: 14px; margin: 0 16px 10px;
  display: flex; align-items: flex-start; gap: 12px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast);
}
.doc-card:active { transform: scale(.99); }
.doc-card .doc-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.doc-card .doc-icon i, .doc-card .doc-icon svg { width: 20px; height: 20px; }
.doc-card.signed .doc-icon { background: var(--c-success-50); color: var(--c-success); }
.doc-card.pending .doc-icon { background: var(--c-warning-50); color: var(--c-warning); }
.doc-card.expired .doc-icon { background: var(--c-danger-50); color: var(--c-danger); }
.doc-card.draft .doc-icon { background: var(--bg-muted); color: var(--text-sub); }
.doc-card .doc-body { flex: 1; min-width: 0; }
.doc-card .doc-title {
  font-size: 15px; font-weight: 600; color: var(--text-main);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin-bottom: 4px;
}
.doc-card .doc-meta {
  font-size: 12px; color: var(--text-sub);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.doc-card .doc-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }

/* =========================================================
   AVATAR
   ========================================================= */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.avatar.alt-1 { background: linear-gradient(135deg, #FF6B6B, #FF8E8E); }
.avatar.alt-2 { background: linear-gradient(135deg, #4ECDC4, #44A08D); }
.avatar.alt-3 { background: linear-gradient(135deg, #FFD93D, #FF8E3C); }
.avatar.alt-4 { background: linear-gradient(135deg, #6C5CE7, #A29BFE); }
.avatar.alt-5 { background: linear-gradient(135deg, #00B894, #00CEC9); }
.avatar.alt-6 { background: linear-gradient(135deg, #E84393, #FD79A8); }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty {
  text-align: center; padding: 60px 30px;
}
.empty .empty-icon {
  width: 80px; height: 80px; border-radius: 24px;
  background: var(--c-primary-50); color: var(--c-primary);
  margin: 0 auto 14px;
  display: grid; place-items: center;
}
.empty .empty-icon i, .empty .empty-icon svg { width: 38px; height: 38px; stroke-width: 1.8; }
.empty h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty p { font-size: 14px; color: var(--text-sub); max-width: 280px; margin: 0 auto 18px; }

/* =========================================================
   BOTTOM SHEET
   ========================================================= */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.2);
  z-index: 201; max-height: 90dvh; display: flex; flex-direction: column;
  animation: sheetIn .32s cubic-bezier(.16,1,.3,1);
  padding-bottom: var(--safe-bottom);
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet.closing { animation: sheetOut .22s cubic-bezier(.4,0,1,1) forwards; }
@keyframes sheetOut {
  to { transform: translateY(100%); }
}
.sheet-handle {
  width: 40px; height: 5px; border-radius: 3px;
  background: var(--border-strong);
  margin: 10px auto 8px;
  flex-shrink: 0;
}
.sheet-body { flex: 1; overflow-y: auto; padding: 0 16px 24px; }
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 14px;
}
.sheet-header h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.sheet-close { color: var(--c-primary); font-weight: 600; font-size: 16px; padding: 4px 8px; }

/* =========================================================
   DIALOG (centered)
   ========================================================= */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: grid; place-items: center; z-index: 250;
  padding: 24px;
  animation: fadeIn .15s;
}
.dialog {
  background: var(--bg-surface); border-radius: var(--r-lg);
  width: 100%; max-width: 320px; max-height: 80dvh; overflow-y: auto;
  animation: dialogIn .25s cubic-bezier(.16,1,.3,1);
}
@keyframes dialogIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dialog-body { padding: 22px 20px; }

/* =========================================================
   ACTION SHEET (iOS-style bottom action picker)
   ========================================================= */
.action-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 220; padding: 0 8px;
  display: flex; align-items: flex-end;
  animation: fadeIn .15s;
}
.action-sheet {
  width: 100%; padding-bottom: calc(var(--safe-bottom) + 8px);
  animation: sheetIn .28s cubic-bezier(.16,1,.3,1);
}
.action-sheet-body {
  background: color-mix(in oklab, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(20px);
  border-radius: 14px; overflow: hidden; margin-bottom: 8px;
}
.action-sheet-body .as-title {
  padding: 14px 16px; font-size: 13px; color: var(--text-sub); text-align: center;
  border-bottom: 1px solid var(--border-soft);
}
.action-sheet-body button {
  width: 100%; padding: 16px;
  font-size: 17px; font-weight: 500; color: var(--c-primary);
  text-align: center;
}
.action-sheet-body button + button { border-top: 1px solid var(--border-soft); }
.action-sheet-body button:active { background: rgba(0,0,0,.05); }
.action-sheet-body button.danger { color: var(--c-danger); }
.action-sheet-cancel {
  width: 100%; padding: 16px;
  background: var(--bg-surface);
  border-radius: 14px;
  font-size: 17px; font-weight: 700; color: var(--c-primary);
}
.action-sheet-cancel:active { background: var(--bg-muted); }

/* =========================================================
   TOASTS
   ========================================================= */
.toast-stack {
  position: fixed; top: calc(var(--status-h) + var(--appbar-h) + 8px);
  left: 8px; right: 8px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(15,23,42,.92); color: #fff;
  border-radius: var(--r-md); padding: 12px 14px;
  display: flex; gap: 10px; align-items: center;
  animation: toastIn .25s cubic-bezier(.16,1,.3,1);
  box-shadow: var(--shadow-3);
  font-size: 14px; font-weight: 500;
  pointer-events: auto;
}
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast i, .toast svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--c-success); }
.toast.warning i, .toast.warning svg { color: var(--c-warning); }
.toast.danger i, .toast.danger svg { color: var(--c-danger); }
.toast.info i, .toast.info svg { color: var(--c-accent); }

/* =========================================================
   FORMS
   ========================================================= */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-sub); padding-left: 4px; }
.field input, .field select, .field textarea {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px 14px;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--text-main);
  width: 100%;
  transition: border-color var(--t-fast);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--c-primary);
}
.field textarea { min-height: 100px; resize: vertical; font-family: inherit; }

/* Toggle */
.toggle {
  position: relative;
  width: 51px; height: 31px;
  display: inline-block; flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  transition: background .25s;
}
.toggle-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.toggle input:checked + .toggle-track { background: var(--c-success); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* Inline toggle row */
.row-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; min-height: 56px;
  background: var(--bg-surface);
}
.row-toggle + .row-toggle { border-top: 1px solid var(--border-soft); }
.row-toggle .meta strong { font-size: 15px; font-weight: 500; display: block; }
.row-toggle .meta p { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* =========================================================
   ACTIVITY feed
   ========================================================= */
.activity { padding: 0 16px; }
.activity-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.activity-item:last-child { border-bottom: none; }
.activity-item .ai-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--c-primary-50); color: var(--c-primary);
}
.activity-item.signed .ai-dot { background: var(--c-success-50); color: var(--c-success); }
.activity-item.expired .ai-dot { background: var(--c-danger-50); color: var(--c-danger); }
.activity-item.viewed .ai-dot { background: var(--c-warning-50); color: var(--c-warning); }
.activity-item .ai-dot i, .activity-item .ai-dot svg { width: 14px; height: 14px; }
.activity-item .ai-body { flex: 1; min-width: 0; }
.activity-item .ai-text { font-size: 14px; line-height: 1.4; }
.activity-item .ai-time { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* =========================================================
   COMPOSE / MULTI-STEP FLOW
   ========================================================= */
.flow-progress {
  display: flex; gap: 4px; padding: 0 16px 12px;
}
.flow-step {
  flex: 1; height: 3px; border-radius: 2px;
  background: var(--bg-muted);
}
.flow-step.active { background: var(--c-primary); }
.flow-step.done { background: var(--c-success); }

.template-card {
  background: var(--bg-surface); border-radius: var(--r-md);
  padding: 14px; display: flex; gap: 12px; align-items: center;
  margin: 0 16px 10px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast);
}
.template-card:active { transform: scale(.98); }
.template-card.selected { box-shadow: 0 0 0 2px var(--c-primary), var(--shadow-2); }
.template-card .t-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.template-card.accent .t-icon  { background: var(--c-accent-50);  color: var(--c-accent); }
.template-card.purple .t-icon  { background: var(--c-purple-50);  color: var(--c-purple); }
.template-card.warning .t-icon { background: var(--c-warning-50); color: var(--c-warning); }
.template-card.danger .t-icon  { background: var(--c-danger-50);  color: var(--c-danger); }
.template-card .t-icon i, .template-card .t-icon svg { width: 22px; height: 22px; }
.template-card .t-body { flex: 1; min-width: 0; }
.template-card .t-title { font-size: 15px; font-weight: 600; }
.template-card .t-sub { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.template-card .t-arrow { color: var(--text-faint); }
.template-card .t-arrow i, .template-card .t-arrow svg { width: 18px; height: 18px; }

/* =========================================================
   CONTACT card / row
   ========================================================= */
.alpha-header {
  padding: 8px 16px;
  font-size: 13px; font-weight: 700; color: var(--text-sub);
  background: var(--bg-page);
  position: sticky; top: 0; z-index: 10;
}
.contact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  transition: background var(--t-fast);
}
.contact-row + .contact-row { border-top: 1px solid var(--border-soft); }
.contact-row:active { background: var(--bg-muted); }
.contact-row .c-body { flex: 1; min-width: 0; }
.contact-row .c-name {
  font-size: 16px; font-weight: 500; color: var(--text-main);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.contact-row .c-sub {
  font-size: 13px; color: var(--text-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* =========================================================
   PROFILE (More tab header)
   ========================================================= */
.profile-hero {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  padding: 24px 20px 28px;
  color: #fff;
  display: flex; gap: 16px; align-items: center;
  position: relative; overflow: hidden;
}
.profile-hero::before, .profile-hero::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.profile-hero::before { width: 200px; height: 200px; top: -100px; right: -50px; }
.profile-hero::after { width: 140px; height: 140px; bottom: -70px; left: -40px; }
.profile-hero .avatar {
  background: rgba(255,255,255,.18); color: #fff;
  border: 3px solid rgba(255,255,255,.3);
  position: relative; z-index: 1;
}
.profile-hero .ph-info { position: relative; z-index: 1; flex: 1; }
.profile-hero h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.profile-hero p { font-size: 14px; opacity: .9; margin-top: 2px; }
.profile-hero .ph-plan {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; margin-top: 6px;
}
.profile-hero .ph-plan i, .profile-hero .ph-plan svg { width: 12px; height: 12px; }

/* =========================================================
   DOCUMENT DETAIL
   ========================================================= */
.doc-detail-head {
  background: var(--bg-surface);
  padding: 18px 16px;
}
.doc-detail-head .dd-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center; margin-bottom: 12px;
}
.doc-detail-head .dd-icon.signed { background: var(--c-success-50); color: var(--c-success); }
.doc-detail-head .dd-icon.pending { background: var(--c-warning-50); color: var(--c-warning); }
.doc-detail-head .dd-icon.expired { background: var(--c-danger-50); color: var(--c-danger); }
.doc-detail-head .dd-icon i, .doc-detail-head .dd-icon svg { width: 28px; height: 28px; }
.doc-detail-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 4px; }
.doc-detail-head .dd-meta { font-size: 13px; color: var(--text-sub); }

.doc-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
}
.doc-action {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
  font-size: 11px; font-weight: 600; color: var(--c-primary);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.doc-action:active { background: var(--bg-muted); }
.doc-action i, .doc-action svg { width: 22px; height: 22px; }
.doc-action.danger { color: var(--c-danger); }

/* Doc body preview */
.doc-preview {
  background: var(--bg-surface); margin: 12px 16px; padding: 18px;
  border-radius: var(--r-lg);
}
.doc-preview h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; letter-spacing: -.01em; }
.doc-preview p { font-size: 14px; color: var(--text-main); line-height: 1.6; margin-bottom: 10px; }

/* Signature row */
.sig-line {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.sig-line .sig-name {
  font-family: var(--font-script); font-size: 28px;
  color: var(--c-primary); margin-bottom: 4px;
}
.sig-line .sig-meta { font-size: 11px; color: var(--text-sub); }

/* =========================================================
   SIGNING flow (guest)
   ========================================================= */
.sign-host {
  position: fixed; inset: 0; background: var(--bg-page);
  display: flex; flex-direction: column;
  z-index: 500;
  padding-top: var(--status-h);
}
.sign-tabs {
  display: flex; gap: 6px;
  padding: 4px;
  background: var(--bg-muted);
  border-radius: var(--r-md);
  margin: 14px 16px;
}
.sign-tabs button {
  flex: 1; padding: 12px;
  font-size: 13px; font-weight: 600;
  color: var(--text-sub);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sign-tabs button.active {
  background: var(--bg-surface); color: var(--c-primary);
  box-shadow: var(--shadow-1);
}
.sign-tabs i, .sign-tabs svg { width: 16px; height: 16px; }

.sign-canvas-wrap { margin: 0 16px; }
.sign-canvas {
  width: 100%; height: 200px; background: #fff;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  touch-action: none;
}
.sign-typed {
  width: 100%; padding: 30px 18px;
  background: #fff; border: 2px solid var(--border-soft);
  border-radius: var(--r-md);
  font-family: var(--font-script); font-size: 36px;
  color: var(--c-primary); text-align: center;
  outline: none;
}
.sign-click-card {
  background: var(--c-primary-50); border: 2px solid var(--c-primary);
  border-radius: var(--r-md); padding: 24px 18px;
  display: flex; gap: 14px; align-items: flex-start;
}
.sign-click-card .sc-check {
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--c-primary);
  display: grid; place-items: center; flex-shrink: 0;
  background: #fff;
}
.sign-click-card.checked .sc-check {
  background: var(--c-primary); color: #fff;
}
.sign-click-card.checked .sc-check::after { content: '✓'; font-weight: 700; }

/* =========================================================
   NOTIFICATIONS list
   ========================================================= */
.notif {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
}
.notif.unread { background: var(--c-primary-50); }
.notif .nf-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--c-primary-50); color: var(--c-primary);
}
.notif .nf-icon.success { background: var(--c-success-50); color: var(--c-success); }
.notif .nf-icon.warning { background: var(--c-warning-50); color: var(--c-warning); }
.notif .nf-icon.danger  { background: var(--c-danger-50);  color: var(--c-danger); }
.notif .nf-icon i, .notif .nf-icon svg { width: 18px; height: 18px; }
.notif .nf-body { flex: 1; min-width: 0; }
.notif .nf-title { font-size: 14px; font-weight: 600; }
.notif .nf-text { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.notif .nf-time { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* =========================================================
   LOADING
   ========================================================= */
.loading {
  display: grid; place-items: center; padding: 80px 0;
}
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pull-to-refresh */
.ptr {
  text-align: center; padding: 16px;
  font-size: 13px; color: var(--text-sub);
}

/* =========================================================
   PROGRESS bar
   ========================================================= */
.progress { height: 6px; background: var(--bg-muted); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--c-primary); border-radius: 3px; transition: width .3s ease; }
.progress > div.success { background: var(--c-success); }
.progress > div.warning { background: var(--c-warning); }
.progress > div.danger  { background: var(--c-danger); }

/* =========================================================
   AUTH screens (login / signup)
   ========================================================= */
.auth-screen {
  padding: 20px 24px 40px;
  display: flex; flex-direction: column; min-height: 100%;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 40px;
}
.auth-brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.auth-brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.auth-title { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-sub { font-size: 15px; color: var(--text-sub); margin-bottom: 28px; }

.divider {
  text-align: center; position: relative; margin: 20px 0;
  font-size: 12px; color: var(--text-faint);
}
.divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--border-soft);
}
.divider span { background: var(--bg-page); padding: 0 12px; position: relative; }

.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-surface); border: 1.5px solid var(--border-soft);
  border-radius: var(--r-md); padding: 14px;
  font-size: 15px; font-weight: 600; color: var(--text-main);
  margin-bottom: 10px;
  width: 100%;
}

/* =========================================================
   AUDIT trail (inside doc detail)
   ========================================================= */
.timeline {
  padding: 0 16px;
}
.timeline-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 15px; top: 30px; bottom: -10px;
  width: 2px; background: var(--border-soft);
}
.timeline-item .tl-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center; flex-shrink: 0;
  position: relative; z-index: 1;
  border: 3px solid var(--bg-page);
}
.timeline-item .tl-dot i, .timeline-item .tl-dot svg { width: 14px; height: 14px; }
.timeline-item.success .tl-dot { background: var(--c-success-50); color: var(--c-success); }
.timeline-item.warning .tl-dot { background: var(--c-warning-50); color: var(--c-warning); }
.timeline-item .tl-body strong { font-size: 14px; }
.timeline-item .tl-body p { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* =========================================================
   PLAN cards (in Plans screen)
   ========================================================= */
.plan-card-m {
  background: var(--bg-surface); border-radius: var(--r-lg);
  padding: 18px; margin: 0 16px 12px;
  border: 2px solid var(--border-soft);
  position: relative;
}
.plan-card-m.featured { border-color: var(--c-primary); }
.plan-card-m.current { background: var(--c-primary-50); border-color: var(--c-primary); }
.plan-card-m .pcm-badge {
  position: absolute; top: -10px; right: 16px;
  background: var(--c-accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill);
}
.plan-card-m .pcm-name { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-sub); }
.plan-card-m .pcm-price { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.plan-card-m .pcm-price small { font-size: 14px; font-weight: 500; color: var(--text-sub); }
.plan-card-m .pcm-tag { font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }
.plan-card-m ul { list-style: none; display: grid; gap: 8px; padding: 0; margin: 0; }
.plan-card-m ul li { font-size: 13px; color: var(--text-main); display: flex; gap: 8px; align-items: flex-start; }
.plan-card-m ul li::before { content: '✓'; color: var(--c-success); font-weight: 700; flex-shrink: 0; }
.plan-card-m .pcm-btn { margin-top: 14px; width: 100%; }
