/* ==========================================================================
   Doculo app shell: everything behind the login.
   Loaded after main.css. Public pages keep their own look (body.site-body).
   ========================================================================== */

:root {
  --app-bg: #f5f7fa;
  --app-surface: #ffffff;
  --app-border: #e4e8ee;
  --app-border-strong: #d3dae3;
  --app-ink: #0f1c2e;
  --app-ink-2: #334155;
  --app-muted: #64748b;
  --app-subtle: #f1f4f8;
  --app-brand: #0e7490;
  --app-brand-ink: #155e75;
  --app-brand-soft: #e6f4f7;
  --app-success: #15803d;
  --app-success-soft: #e8f6ee;
  --app-warning: #b45309;
  --app-warning-soft: #fdf3e3;
  --app-danger: #b91c1c;
  --app-danger-soft: #fdecec;
  --app-info: #1d4ed8;
  --app-info-soft: #e9effd;
  --app-radius: 14px;
  --app-radius-sm: 10px;
  --app-shadow: 0 1px 2px rgba(15, 28, 46, 0.04), 0 1px 3px rgba(15, 28, 46, 0.04);
  --app-shadow-lg: 0 12px 32px rgba(15, 28, 46, 0.10);
  --app-sidebar-w: 268px;
  --app-topbar-h: 60px;
  --app-tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.app-body {
  background: var(--app-bg);
  color: var(--app-ink);
  font-size: 0.95rem;
  display: block;
}

.app-body h1, .app-body h2, .app-body h3, .app-body h4 {
  color: var(--app-ink);
  letter-spacing: -0.01em;
}

/* ---------- Shell ---------- */
.app-shell {
  min-height: 100vh;
}

@media (min-width: 992px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--app-sidebar-w) minmax(0, 1fr);
  }
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
  --bs-offcanvas-width: 288px;
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--app-border);
    background: var(--app-surface);
  }
}

.app-sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: calc(1rem + var(--safe-top)) 0.85rem calc(1rem + var(--safe-bottom));
  background: var(--app-surface);
  overflow-y: auto;
}

.app-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.4rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--app-brand-ink);
  text-decoration: none;
}

.app-brand img { border-radius: 8px; }
.app-brand-compact { font-size: 1.05rem; }

.app-household-pill,
.app-household-switch {
  margin: 0 0.2rem;
}

.app-household-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  color: var(--app-ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--app-subtle);
}

.app-household-pill:hover { border-color: var(--app-border-strong); color: var(--app-ink); }

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.app-nav-label {
  margin: 0.9rem 0.75rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--app-muted);
}

.app-household-switch .app-nav-label { margin: 0 0 0.3rem 0.1rem; display: block; }

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: transparent;
  border-radius: var(--app-radius-sm);
  color: var(--app-ink-2);
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  line-height: 1.3;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-nav-link i { font-size: 1.05rem; color: var(--app-muted); width: 1.2rem; text-align: center; }
.app-nav-link:hover { background: var(--app-subtle); color: var(--app-ink); }
.app-nav-link.active { background: var(--app-brand-soft); color: var(--app-brand-ink); font-weight: 650; }
.app-nav-link.active i { color: var(--app-brand); }

.app-nav-badge {
  margin-left: auto;
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--app-brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.app-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--app-border);
}

.app-install-card,
.app-plan-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--app-radius-sm);
  text-decoration: none;
  text-align: left;
}

.app-install-card {
  border: 1px dashed var(--app-border-strong);
  background: var(--app-surface);
  color: var(--app-ink-2);
}

.app-install-card i { font-size: 1.25rem; color: var(--app-brand); }
.app-install-card span { display: flex; flex-direction: column; line-height: 1.25; }
.app-install-card small { color: var(--app-muted); font-size: 0.75rem; }

.app-plan-card {
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  background: linear-gradient(135deg, #0f2942, #0e7490);
  color: #fff;
}

.app-plan-card:hover { color: #fff; opacity: 0.96; }
.app-plan-label { width: 100%; font-size: 0.72rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.05em; }
.app-plan-card strong { font-size: 0.95rem; }
.app-plan-cta { margin-left: auto; font-size: 0.8rem; font-weight: 600; color: #fde68a; }

.app-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--app-radius-sm);
  color: var(--app-ink);
  text-decoration: none;
}

.app-user:hover, .app-user.active { background: var(--app-subtle); }
.app-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-user-text strong { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-text small { color: var(--app-muted); font-size: 0.75rem; }

.app-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--app-brand-soft);
  color: var(--app-brand-ink);
  font-weight: 700;
}

.app-logout { color: var(--app-muted); font-size: 0.88rem; }

/* ---------- Topbar ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: calc(var(--app-topbar-h) + var(--safe-top));
  padding: var(--safe-top) 1rem 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--app-border);
}

@media (min-width: 992px) {
  .app-topbar { padding: 0 2rem; background: rgba(245, 247, 250, 0.85); border-bottom-color: transparent; }
}

.app-topbar-title { font-weight: 600; color: var(--app-muted); }
.app-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.app-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--app-ink-2);
  font-size: 1.25rem;
}

.app-icon-btn:hover { background: var(--app-subtle); }

.app-dot {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--app-danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
}

.app-bell-menu {
  width: min(360px, calc(100vw - 24px));
  padding: 0;
  border-radius: var(--app-radius);
  border-color: var(--app-border);
  box-shadow: var(--app-shadow-lg);
  overflow: hidden;
}

.app-bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--app-border);
}

.app-bell-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  color: var(--app-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--app-border);
}

.app-bell-item:hover { background: var(--app-subtle); }
.app-bell-item i { color: var(--app-muted); font-size: 1.05rem; margin-top: 0.1rem; }
.app-bell-item span { display: flex; flex-direction: column; min-width: 0; }
.app-bell-item strong { font-size: 0.88rem; font-weight: 600; }
.app-bell-item small { color: var(--app-muted); font-size: 0.8rem; }
.app-bell-item em { color: var(--app-muted); font-size: 0.72rem; font-style: normal; margin-top: 0.15rem; }
.app-bell-item.unread { background: #f4fafb; }
.app-bell-item.unread strong::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--app-brand); margin-right: 0.4rem; vertical-align: middle; }
.app-bell-empty { padding: 1.2rem 1rem; margin: 0; color: var(--app-muted); text-align: center; }
.app-bell-all { display: block; padding: 0.7rem 1rem; text-align: center; font-weight: 600; text-decoration: none; color: var(--app-brand-ink); }

/* ---------- Content ---------- */
.app-flash { padding: 1rem 1rem 0; }
.app-flash:empty { display: none; }
.app-flash .alert { border-radius: var(--app-radius-sm); margin-bottom: 0.75rem; }

.app-content {
  flex: 1;
  padding: 1.25rem 1rem calc(var(--app-tabbar-h) + var(--safe-bottom) + 1.5rem);
}

@media (min-width: 992px) {
  .app-flash { padding: 1rem 2rem 0; }
  .app-content { padding: 1.5rem 2rem 3rem; }
}

/* Existing page markup (section + container) fits into the shell without its marketing spacing. */
.app-content .section-block,
.app-content .dashboard-shell { padding: 0; background: none; }
.app-content > section > .container,
.app-content > .container { max-width: 1240px; padding-left: 0; padding-right: 0; margin-left: 0; }
.app-content .section-title { font-size: 1.6rem; margin-bottom: 1.25rem; }

.app-body .feature-card,
.app-body .app-form-card,
.app-body .price-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  background: var(--app-surface);
}

.app-body .stat-card { box-shadow: var(--app-shadow); border-color: var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); }
.app-body .dashboard-item-card { box-shadow: var(--app-shadow); border-color: var(--app-border); }
.app-body .dashboard-item-card:hover { transform: none; box-shadow: var(--app-shadow-lg); }
.app-body .btn { border-radius: var(--app-radius-sm); font-weight: 500; }
.app-body .btn-light { background: var(--app-surface); border: 1px solid var(--app-border-strong); color: var(--app-ink-2); }
.app-body .btn-light:hover { background: var(--app-subtle); color: var(--app-ink); }
.app-body .btn-brand { background: var(--app-brand); }
.app-body .btn-brand:hover { background: var(--app-brand-ink); opacity: 1; }
.app-body .form-control, .app-body .form-select { border-color: var(--app-border-strong); border-radius: var(--app-radius-sm); }
.app-body .form-control:focus, .app-body .form-select:focus { border-color: var(--app-brand); box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15); }
.app-body .form-check-input:checked { background-color: var(--app-brand); border-color: var(--app-brand); }
.app-body .kicker { color: var(--app-brand); }

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.65rem; margin: 0; }
.page-header p { margin: 0.3rem 0 0; color: var(--app-muted); max-width: 70ch; }
.page-eyebrow { font-size: 0.8rem; font-weight: 600; color: var(--app-muted); margin-bottom: 0.25rem !important; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

@media (max-width: 575.98px) {
  .page-header h1 { font-size: 1.4rem; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > a { flex: 1 1 auto; }
}

/* ---------- Panels ---------- */
.panel {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--app-border); }
.panel-head h2, .panel-head h3 { font-size: 1rem; margin: 0; font-family: inherit; font-weight: 650; }
.panel-head p { margin: 0.15rem 0 0; color: var(--app-muted); font-size: 0.85rem; }
.panel-body { padding: 1.25rem; }
.panel-foot { padding: 0.8rem 1.25rem; border-top: 1px solid var(--app-border); background: #fafbfc; border-radius: 0 0 var(--app-radius) var(--app-radius); }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 991.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  color: inherit;
  text-decoration: none;
}

a.kpi:hover { border-color: var(--app-border-strong); }
.kpi-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--app-muted); }
.kpi-label i { color: var(--app-brand); }
.kpi-value { font-family: "Sora", sans-serif; font-size: 1.55rem; font-weight: 600; color: var(--app-ink); line-height: 1.2; }
.kpi-sub { font-size: 0.78rem; color: var(--app-muted); }
.kpi.kpi-alert .kpi-value { color: var(--app-warning); }
.kpi.kpi-alert .kpi-label i { color: var(--app-warning); }

@media (max-width: 575.98px) {
  .kpi { padding: 0.85rem; }
  .kpi-value { font-size: 1.25rem; }
}

/* ---------- Status pills ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--app-subtle);
  color: var(--app-ink-2);
}

.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--app-success-soft); color: var(--app-success); }
.status-renewing { background: var(--app-info-soft); color: var(--app-info); }
.status-ending { background: var(--app-warning-soft); color: var(--app-warning); }
.status-urgent { background: var(--app-danger-soft); color: var(--app-danger); }
.status-expired, .status-inactive { background: var(--app-subtle); color: var(--app-muted); }

.type-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--app-ink-2);
}

.type-tag i { color: var(--app-muted); }

/* ---------- Segmented tabs ---------- */
.segmented {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  background: #e9edf2;
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar { display: none; }

.segmented a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9px;
  color: var(--app-ink-2);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}

.segmented a:hover { color: var(--app-ink); }
.segmented a.active { background: var(--app-surface); color: var(--app-ink); box-shadow: var(--app-shadow); }
.segmented .count { font-size: 0.75rem; color: var(--app-muted); font-weight: 600; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-bar .search { position: relative; flex: 1 1 260px; }
.filter-bar .search i { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--app-muted); }
.filter-bar .search input { padding-left: 2.2rem; }
.filter-bar .form-select { width: auto; flex: 0 1 auto; }

@media (max-width: 575.98px) {
  .filter-bar .form-select { flex: 1 1 40%; min-width: 0; }
}

/* Phones: less chrome before the content. */
@media (max-width: 575.98px) {
  .page-header { margin-bottom: 1rem; }
  .page-header p:not(.page-eyebrow) { display: none; }
  .app-flash .demo-readonly-banner { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0.7rem 0.85rem; font-size: 0.85rem; }
  .app-flash .demo-readonly-banner span { display: none; }
  .kpi-grid.kpi-strip { display: flex; overflow-x: auto; gap: 0.5rem; margin-left: -1rem; margin-right: -1rem; padding: 0 1rem 0.25rem; scrollbar-width: none; }
  .kpi-grid.kpi-strip::-webkit-scrollbar { display: none; }
  .kpi-grid.kpi-strip .kpi { flex: 0 0 auto; min-width: 140px; padding: 0.65rem 0.8rem; }
  .kpi-grid.kpi-strip .kpi-value { font-size: 1.1rem; }
  .kpi-grid.kpi-strip .kpi-sub { display: none; }
  .row-list > li { padding: 0.75rem 1rem; }
  .panel-head { padding: 0.85rem 1rem; }
}

/* ---------- Record table (cards on phones) ---------- */
.record-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.record-table th {
  padding: 0.7rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--app-border);
  white-space: nowrap;
}

.record-table th:first-child { border-top-left-radius: var(--app-radius); }
.record-table th:last-child { border-top-right-radius: var(--app-radius); }
.record-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--app-border); vertical-align: middle; }
.record-table tbody tr:last-child td { border-bottom: 0; }
.record-table tbody tr { transition: background-color 0.12s ease; }
.record-table tbody tr:hover { background: #fafcfd; }
.record-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-title { display: block; font-weight: 600; color: var(--app-ink); text-decoration: none; }
.record-title:hover { color: var(--app-brand-ink); }
.record-sub { display: block; font-size: 0.8rem; color: var(--app-muted); }
.record-partner { display: block; font-size: 0.85rem; color: var(--app-ink-2); }
.record-partner i { color: var(--app-muted); }
.record-date { white-space: nowrap; }
.record-date small { display: block; color: var(--app-muted); font-size: 0.76rem; }
.record-actions { text-align: right; white-space: nowrap; }
.record-row-link { position: absolute; inset: 0; }

@media (max-width: 767.98px) {
  .record-table thead { display: none; }
  .record-table, .record-table tbody, .record-table tr, .record-table td { display: block; width: 100%; }
  .record-table tr {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--app-border);
  }
  .record-table tbody tr:last-child { border-bottom: 0; }
  .record-table td { padding: 0; border: 0; }
  .record-table td[data-cell="title"] { grid-column: 1 / -1; padding-right: 2.5rem; }
  .record-table td[data-cell="type"] { display: none; }
  .record-table td[data-cell="actions"] { position: absolute; top: 0.6rem; right: 0.5rem; width: auto; }
  .record-table td[data-cell="cost"] { text-align: right; font-weight: 600; }
  .record-table td[data-cell="deadline"] { text-align: right; white-space: normal; font-size: 0.85rem; min-width: 0; }
  .record-table td[data-cell="renewal"] { display: none; }
}

/* ---------- Lists inside panels ---------- */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

.row-list > li:last-child { border-bottom: 0; }
.row-list .row-main { flex: 1; min-width: 0; }
.row-list .row-main strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-list .row-main small { display: block; color: var(--app-muted); }
.row-list .row-aside { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.date-badge {
  flex: 0 0 auto;
  width: 48px;
  padding: 0.3rem 0;
  border-radius: 10px;
  text-align: center;
  background: var(--app-subtle);
  line-height: 1.1;
}

.date-badge b { display: block; font-size: 1.05rem; font-family: "Sora", sans-serif; }
.date-badge span { font-size: 0.68rem; text-transform: uppercase; font-weight: 700; color: var(--app-muted); }
.date-badge.is-urgent { background: var(--app-danger-soft); color: var(--app-danger); }
.date-badge.is-soon { background: var(--app-warning-soft); color: var(--app-warning); }

.icon-badge {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--app-brand-soft);
  color: var(--app-brand);
  font-size: 1.05rem;
}

/* ---------- Empty state ---------- */
.empty-state { padding: 2.5rem 1.25rem; text-align: center; color: var(--app-muted); }
.empty-state i { font-size: 2rem; color: var(--app-brand); display: block; margin-bottom: 0.5rem; }
.empty-state h3 { font-size: 1.05rem; color: var(--app-ink); font-family: inherit; font-weight: 650; }
.empty-state p { max-width: 46ch; margin: 0.25rem auto 1rem; }

/* ---------- Onboarding steps ---------- */
.setup-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.4rem;
  margin-bottom: 1.25rem;
  border-radius: var(--app-radius);
  background: linear-gradient(135deg, #0f2942 0%, #0e7490 100%);
  color: #e6f6f9;
}

.setup-card h2 { color: #fff; font-size: 1.3rem; }
.setup-card p { color: #cfeef4; }
.setup-steps { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.setup-steps a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.setup-steps a:hover { background: rgba(255, 255, 255, 0.16); }
.setup-steps .done a { opacity: 0.7; text-decoration: line-through; }
.setup-steps i { font-size: 1.1rem; color: #fde68a; }

@media (max-width: 767.98px) { .setup-card { grid-template-columns: 1fr; } }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--app-topbar-h) + 1rem); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 0.5rem 0.75rem; border-radius: var(--app-radius-sm); color: var(--app-ink-2); text-decoration: none; font-weight: 500; }
.settings-nav a:hover { background: var(--app-subtle); }
.settings-section { scroll-margin-top: calc(var(--app-topbar-h) + 1rem); }

@media (max-width: 991.98px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 0.35rem; }
  .settings-nav a { white-space: nowrap; background: var(--app-surface); border: 1px solid var(--app-border); }
}

.plan-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.plan-name { font-family: "Sora", sans-serif; font-size: 1.35rem; font-weight: 600; }
.usage-bar { height: 8px; border-radius: 999px; background: var(--app-subtle); overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--app-brand); border-radius: inherit; }
.usage-bar.is-full span { background: var(--app-danger); }

.pref-table { width: 100%; }
.pref-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--app-muted); font-weight: 700; padding: 0 0 0.5rem; text-align: center; }
.pref-table th:first-child { text-align: left; }
.pref-table td { padding: 0.7rem 0; border-top: 1px solid var(--app-border); text-align: center; }
.pref-table td:first-child { text-align: left; }
.pref-table td small { display: block; color: var(--app-muted); }
.pref-table .form-check-input { float: none; margin: 0; width: 2.2em; height: 1.2em; }

/* ---------- Pricing (in app) ---------- */
.billing-toggle { display: inline-flex; padding: 0.25rem; background: #e9edf2; border-radius: 12px; margin-bottom: 1.25rem; }
.billing-toggle button { border: 0; background: transparent; padding: 0.45rem 1rem; border-radius: 9px; font-weight: 600; color: var(--app-ink-2); }
.billing-toggle button.active { background: var(--app-surface); color: var(--app-ink); box-shadow: var(--app-shadow); }
.billing-toggle .save { color: var(--app-success); font-size: 0.75rem; margin-left: 0.25rem; }

.plan-card { display: flex; flex-direction: column; height: 100%; padding: 1.4rem; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.plan-card.featured { border: 2px solid var(--app-brand); box-shadow: var(--app-shadow-lg); }
.plan-card h3 { font-size: 1.1rem; font-family: inherit; font-weight: 700; margin-bottom: 0.25rem; }
.plan-card .plan-price { font-family: "Sora", sans-serif; font-size: 2rem; font-weight: 600; margin: 0.5rem 0 0; }
.plan-card .plan-price small { font-size: 0.9rem; color: var(--app-muted); font-family: "Plus Jakarta Sans", sans-serif; font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; margin: 1rem 0 1.25rem; display: grid; gap: 0.5rem; }
.plan-card li { display: flex; gap: 0.5rem; color: var(--app-ink-2); }
.plan-card li i { color: var(--app-success); }
.plan-card .plan-cta { margin-top: auto; }
.plan-ribbon { align-self: flex-start; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--app-brand-ink); background: var(--app-brand-soft); padding: 0.2rem 0.55rem; border-radius: 999px; margin-bottom: 0.6rem; }

/* ---------- Inbox ---------- */
.inbox-item { position: relative; }
.inbox-item.unread { background: #f6fbfc; }
.inbox-item.unread .row-main strong::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 0.4rem; border-radius: 50%; background: var(--app-brand); vertical-align: middle; }
.inbox-item a.stretched-link { color: inherit; text-decoration: none; }

/* ---------- Bottom tab bar (phones, installed app) ---------- */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  height: calc(var(--app-tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid var(--app-border);
}

.app-tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--app-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
}

.app-tabbar a i { font-size: 1.3rem; }
.app-tabbar a.active { color: var(--app-brand); }

.app-tabbar .app-tab-add {
  justify-self: center;
  width: 50px;
  height: 50px;
  margin-top: -18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--app-brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(14, 116, 144, 0.35);
}

.app-tabbar .app-tab-add i { font-size: 1.45rem; }

.app-tab-badge {
  position: absolute;
  top: -4px;
  left: calc(50% + 4px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--app-danger);
  color: #fff;
  font-size: 0.62rem;
  line-height: 16px;
}

.app-ios-hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.75rem;
  border-radius: var(--app-radius-sm);
  background: var(--app-brand-soft);
  color: var(--app-brand-ink);
  font-size: 0.88rem;
}

.app-ios-hint.d-none { display: none !important; }
.app-ios-hint .btn-close { margin-left: auto; }

/* Installed app: no hover-only affordances, native-feeling touch. */
@media (display-mode: standalone) {
  body.app-body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  [data-pwa-install] { display: none !important; }
}

@media print {
  .app-sidebar, .app-topbar, .app-tabbar, .app-flash { display: none !important; }
  .app-content { padding: 0; }
}

/* ---------- Starter list (common contracts & subscriptions) ---------- */
.starter-row { flex-direction: column; align-items: stretch !important; gap: 0.6rem !important; }
.starter-top { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.starter-choice { display: flex; gap: 0.35rem; margin-left: auto; }
.starter-details { display: none; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; padding: 0.75rem; border-radius: var(--app-radius-sm); background: var(--app-subtle); }
.starter-row:has(input[value="have"]:checked) .starter-details { display: grid; }
.starter-row:has(input[value="have"]:checked) { background: #f6fbf8; }
.starter-row:has(input[value="no"]:checked) .row-main { opacity: 0.45; text-decoration: line-through; }
.starter-savebar {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-lg);
}

@media (max-width: 991.98px) {
  .starter-savebar { bottom: calc(var(--app-tabbar-h) + var(--safe-bottom) + 0.5rem); }
}

@media (max-width: 767.98px) {
  .starter-details { grid-template-columns: 1fr; }
  .starter-choice { margin-left: 0; width: 100%; }
  .starter-choice .btn { flex: 1; }
}

/* ---------- Spaces (Private / Business / ...) ---------- */
.space-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--space-color, #94a3b8); }
.space-teal { --space-color: #0e7490; --space-soft: #e6f4f7; }
.space-blue { --space-color: #2563eb; --space-soft: #e8efff; }
.space-violet { --space-color: #7c3aed; --space-soft: #f1ebff; }
.space-amber { --space-color: #d97706; --space-soft: #fdf3e3; }
.space-rose { --space-color: #e11d48; --space-soft: #fdebf0; }
.space-green { --space-color: #16a34a; --space-soft: #e8f6ee; }
.space-slate { --space-color: #475569; --space-soft: #eef1f5; }
.space-none { --space-color: transparent; border: 1.5px dashed #94a3b8; }
.space-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--app-subtle); font-size: 0.75rem; font-weight: 600; color: var(--app-ink-2); white-space: nowrap; }
.space-switch { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 46vw; padding: 0.35rem 0.75rem; border: 1px solid var(--app-border-strong); border-radius: 999px; background: var(--app-surface); color: var(--app-ink); font-weight: 600; font-size: 0.85rem; }
.space-switch span:not(.space-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-switch:hover { background: var(--app-subtle); }
.dropdown-item.active .space-dot { box-shadow: 0 0 0 2px #fff; }
.space-filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55rem 0.9rem; margin-bottom: 0.75rem; border-radius: var(--app-radius-sm); background: var(--app-surface); border: 1px solid var(--app-border); font-size: 0.88rem; }
.move-bar {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + var(--safe-bottom));
  z-index: 1040;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(680px, calc(100% - 2rem));
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  transform: translateX(-50%);
  background: var(--app-ink);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 28, 46, 0.3);
}
.move-bar.show { display: flex; }
.move-bar .btn-link { color: #cbd5e1; text-decoration: none; }
.move-bar .btn-link:hover { color: #fff; }
.move-bar .text-muted { color: #cbd5e1 !important; }
.move-bar-count { display: flex; align-items: center; gap: 0.45rem; font-weight: 600; white-space: nowrap; }
.move-bar-badge { min-width: 1.6rem; height: 1.6rem; padding: 0 0.45rem; border-radius: 999px; background: #fff; color: var(--app-ink); display: inline-grid; place-items: center; font-size: 0.8rem; }
.move-bar-action { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.move-bar-action .form-select { width: auto; min-width: 9rem; max-width: 14rem; }
@media (min-width: 992px) {
  .move-bar { left: calc(50% + var(--app-sidebar-w) / 2); }
}
@media (max-width: 991.98px) {
  .move-bar { bottom: calc(var(--app-tabbar-h) + var(--safe-bottom) + 0.75rem); }
}
@media (max-width: 575.98px) {
  .move-bar { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0.75rem; }
  .move-bar-action label { display: none; }
  .move-bar-action .form-select { flex: 1 1 auto; min-width: 0; max-width: none; }
}
.record-table .check-cell { width: 2.5rem; }
@media (max-width: 767.98px) {
  .record-table td.check-cell { position: absolute; top: 0.85rem; left: 0.6rem; width: auto; }
  .record-table tr:has(td.check-cell) td[data-cell="title"] { padding-left: 1.6rem; }
}

/* ---------- Shared lists ---------- */
.list-page { max-width: 760px; }
.list-cards { display: grid; gap: 0.75rem; }
.list-card {
  display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.1rem;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius);
  box-shadow: var(--app-shadow); color: inherit; text-decoration: none;
}
.list-card:hover { border-color: var(--app-border-strong); color: inherit; }
.list-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-card-main small { color: var(--app-muted); }
.list-card-count { min-width: 2rem; height: 2rem; padding: 0 0.5rem; border-radius: 999px; display: grid; place-items: center; background: var(--app-brand); color: #fff; font-weight: 700; font-size: 0.85rem; }

.list-add {
  position: sticky; top: calc(var(--app-topbar-h) + var(--safe-top) + 0.5rem); z-index: 10;
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  background: var(--app-surface); border: 1px solid var(--app-border-strong); border-radius: var(--app-radius); box-shadow: var(--app-shadow-lg);
}
.list-add > i { color: var(--app-muted); font-size: 1.1rem; }
.list-add input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 1rem; padding: 0.5rem 0; background: transparent; }

.list-entries { list-style: none; margin: 0; padding: 0; }
.list-entry { display: flex; align-items: center; border-bottom: 1px solid var(--app-border); transition: opacity 0.15s ease; }
.list-entry:last-child { border-bottom: 0; }
.list-entry.is-pending { opacity: 0.45; }
.list-entry-main { flex: 1; min-width: 0; }
.list-entry-toggle {
  display: flex; align-items: center; gap: 0.85rem; width: 100%; padding: 0.85rem 1rem; min-height: 3.25rem;
  border: 0; background: transparent; text-align: left; color: var(--app-ink); font-size: 1rem;
}
.list-entry-toggle:hover { background: #fafcfd; }
.list-check {
  flex: 0 0 auto; width: 1.45rem; height: 1.45rem; border-radius: 50%; border: 2px solid var(--app-border-strong);
  display: grid; place-items: center; color: #fff; font-size: 0.85rem;
}
.list-entry-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-entry-who { color: var(--app-muted); font-size: 0.75rem; }
.list-entry-delete { border: 0; background: transparent; color: var(--app-muted); padding: 0.75rem 1rem; opacity: 0.5; }
.list-entry-delete:hover { opacity: 1; color: var(--app-danger); }
.list-entry.is-done .list-check { background: var(--app-success); border-color: var(--app-success); }
.list-entry.is-done .list-entry-text { color: var(--app-muted); text-decoration: line-through; }

.list-done { border-top: 1px solid var(--app-border); }
.list-done > summary { padding: 0.75rem 1rem; color: var(--app-muted); font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.list-done-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--app-border); background: #fafbfc; border-radius: 0 0 var(--app-radius) var(--app-radius); }

@media (hover: none) { .list-entry-delete { opacity: 0.7; } }

.list-page-wide { max-width: 1100px; }
.list-card-count.is-urgent { background: var(--app-danger); }
.section-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--app-muted); margin: 0 0 0.6rem; font-family: inherit; }
.lists-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.lists-crumbs a { color: inherit; text-decoration: none; }
.lists-crumbs a:hover { color: var(--app-brand-ink); }
.lists-crumbs .bi-chevron-right { font-size: 0.7rem; opacity: 0.6; }

/* Folders: colour per folder, like notebook tabs */
.folder-slate { --folder: #475569; --folder-soft: #f1f5f9; }
.folder-blue { --folder: #1d4ed8; --folder-soft: #e9effd; }
.folder-green { --folder: #15803d; --folder-soft: #e8f6ee; }
.folder-orange { --folder: #c2410c; --folder-soft: #fff1e6; }
.folder-red { --folder: #b91c1c; --folder-soft: #fdecec; }
.folder-purple { --folder: #7e22ce; --folder-soft: #f3e8ff; }
.folder-pink { --folder: #be185d; --folder-soft: #fce7f3; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.75rem; }
.folder-card {
  position: relative; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 1rem 0.9rem 1.15rem;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius);
  box-shadow: var(--app-shadow); color: inherit; text-decoration: none; overflow: hidden;
}
.folder-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--folder); }
.folder-card:hover { border-color: var(--app-border-strong); color: inherit; }
.folder-card > i { color: var(--folder); font-size: 1.35rem; }
.folder-card strong { overflow-wrap: anywhere; }
.folder-card small { color: var(--app-muted); }
.folder-dot { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 10px; background: var(--folder-soft); color: var(--folder); font-size: 1.1rem; vertical-align: 0.15rem; }
.color-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.color-picker[hidden] { display: none; }
.folder-swatch { width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--folder); cursor: pointer; position: relative; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.folder-swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.folder-swatch:has(input:checked) { outline: 2px solid var(--folder); outline-offset: 2px; }
.segmented-sm { margin-bottom: 0; align-self: flex-start; }
.seg-option { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-radius: 9px; font-weight: 600; font-size: 0.85rem; color: var(--app-ink-2); cursor: pointer; margin: 0; }
.seg-option input { position: absolute; opacity: 0; pointer-events: none; }
.seg-option.active { background: var(--app-surface); color: var(--app-ink); box-shadow: var(--app-shadow); }

/* To-do lists: black = to start, orange = started, red = urgent, green = done */
.st-todo, .s-todo { --st: #0f172a; --st-soft: #f1f4f8; }
.st-started, .s-started { --st: #ea580c; --st-soft: #fff1e6; }
.st-urgent, .s-urgent { --st: #dc2626; --st-soft: #fdecec; }
.st-done, .s-done { --st: #16a34a; --st-soft: #e8f6ee; }
.todo-status {
  flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--st); background: transparent;
  display: inline-grid; place-items: center; color: #fff; font-size: 0.9rem; padding: 0; line-height: 1;
}
.todo-status.s-started { background: linear-gradient(90deg, var(--st) 50%, transparent 50%); }
.todo-status.s-started i { display: none; }
.todo-status.s-urgent, .todo-status.s-done { background: var(--st); }
.todo-status.is-small { width: 0.85rem; height: 0.85rem; border-width: 2px; vertical-align: -1px; }
.todo-status-wrap { padding: 0.85rem 0 0.85rem 1rem; }
.todo-status-menu .dropdown-item { display: flex; align-items: center; gap: 0.55rem; }
.todo-status-menu .dropdown-item.active { background: var(--app-subtle); color: var(--app-ink); font-weight: 600; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-row { border-bottom: 1px solid var(--app-border); border-left: 4px solid var(--st); transition: opacity 0.15s ease; }
.todo-row:last-child { border-bottom: 0; }
.todo-row.is-pending { opacity: 0.45; }
.todo-row.st-todo { border-left-color: transparent; }
.todo-line { display: flex; align-items: center; }
.todo-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem 0.85rem; border: 0; background: transparent;
  text-align: left; color: var(--app-ink); text-decoration: none;
}
.todo-main:hover { background: #fafcfd; color: var(--app-ink); }
.todo-text { font-size: 1rem; overflow-wrap: anywhere; }
.st-done .todo-text { color: var(--app-muted); text-decoration: line-through; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.todo-label { font-size: 0.72rem; font-weight: 700; color: var(--st); text-transform: uppercase; letter-spacing: 0.03em; }
.st-todo .todo-label { color: var(--app-muted); }
.todo-chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.76rem; color: var(--app-ink-2); background: var(--app-subtle); padding: 0.05rem 0.45rem; border-radius: 999px; }
.todo-chip.is-late { background: var(--app-danger-soft); color: var(--app-danger); font-weight: 600; }
.todo-chip.is-soon { background: var(--app-warning-soft); color: var(--app-warning); font-weight: 600; }
.todo-edit { padding: 0.25rem 1rem 1rem 3.4rem; }
.todo-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--app-border); background: #fafbfc; border-radius: var(--app-radius) var(--app-radius) 0 0; }
.todo-summary, .todo-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.todo-count { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--app-border); background: var(--app-surface); border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.8rem; color: var(--app-ink-2); }
.todo-count b { color: var(--st); }
.todo-count:disabled { opacity: 0.45; }
.todo-count.active, .todo-filter .btn.active { border-color: var(--app-ink); box-shadow: inset 0 0 0 1px var(--app-ink); }
.todo-row[hidden] { display: none; }
@media (max-width: 575.98px) {
  .todo-edit { padding-left: 1rem; }
  .todo-toolbar { flex-direction: column; }
}

/* Contact lists & address book */
.contact-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--app-border); }
.contact-table td[data-cell="reach"] { max-width: 260px; }
.contact-table td[data-cell="reach"] a { color: var(--app-ink-2); text-decoration: none; }
.contact-table td[data-cell="reach"] a:hover { color: var(--app-brand-ink); }
.contact-table .select-col { width: 2.5rem; }
.kind-tag { font-weight: 600; }
.picker-list { list-style: none; margin: 0; padding: 0.5rem 0; max-height: 340px; overflow-y: auto; }
.picker-list label { display: flex; align-items: center; gap: 0.75rem; padding: 0.45rem 1rem; cursor: pointer; margin: 0; }
.picker-list label:hover { background: #fafcfd; }
.picker-list strong { display: block; font-weight: 600; }
.picker-list small { display: block; color: var(--app-muted); }
.picker-list li[hidden] { display: none; }
.picker-search-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--app-muted); }
@media (min-width: 992px) { .picker-new { border-left: 1px solid var(--app-border); } }
@media (max-width: 991.98px) { .picker-new { border-top: 1px solid var(--app-border); } }
.selection-bar .move-bar-action { flex-wrap: wrap; justify-content: flex-end; }
.selection-bar .form-control { width: 12rem; }
.selection-bar [hidden] { display: none !important; }
@media (max-width: 767.98px) {
  .contact-table tr { grid-template-columns: 1fr; }
  .contact-table td[data-cell="owner"] { font-size: 0.82rem; color: var(--app-muted); }
  .contact-table td[data-cell="owner"]::before { content: "\F4DA  "; font-family: "bootstrap-icons"; }
  .contact-table td[data-cell="address"], .contact-table td[data-cell="reach"] { font-size: 0.88rem; max-width: none; }
  .contact-table td[data-cell="address"]:has(> .text-muted:only-child),
  .contact-table td[data-cell="reach"]:has(> .text-muted:only-child) { display: none; }
  .contact-table td[data-cell="select"] { position: absolute; top: 0.95rem; left: 0.75rem; width: auto; }
  .contact-table tr:has(td[data-cell="select"]) td { padding-left: 1.75rem; }
  .contact-table tr:has(td[data-cell="select"]) td[data-cell="select"] { padding-left: 0; }
  .selection-bar .form-control, .selection-bar .form-select { width: 100%; max-width: none; }
}

/* ---------- Emergency folder ---------- */
.emergency-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem; }
.emergency-number {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.85rem; border-radius: var(--app-radius-sm);
  background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-ink); text-decoration: none;
}
.emergency-number:hover { border-color: var(--app-border-strong); color: var(--app-ink); }
.emergency-number i { font-size: 1.2rem; color: var(--app-danger); }
.emergency-number span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.emergency-number strong { font-size: 1.05rem; }
.emergency-number small { color: var(--app-muted); font-size: 0.75rem; }
.emergency-number.is-primary { background: var(--app-danger); border-color: var(--app-danger); color: #fff; }
.emergency-number.is-primary i, .emergency-number.is-primary small { color: #fff; }
.icon-badge.is-priority { background: var(--app-warning-soft); color: var(--app-warning); }
.medical-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; padding: 1rem 1.25rem; }
.medical-card { border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); padding: 0.85rem; }
.medical-card dt { font-weight: 600; margin-top: 0.35rem; }
.medical-card dd { margin: 0; }
.blood-type { display: inline-grid; place-items: center; min-width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--app-danger-soft); color: var(--app-danger); font-weight: 700; }
#notesAccordion .accordion-button { font-weight: 600; }
#notesAccordion .accordion-button:not(.collapsed) { background: var(--app-brand-soft); color: var(--app-brand-ink); box-shadow: none; }
.panel-head .btn { white-space: nowrap; }
@media (max-width: 575.98px) {
  .emergency-numbers { display: flex; overflow-x: auto; gap: 0.5rem; margin: 0 -1rem; padding: 0 1rem 0.25rem; scrollbar-width: none; }
  .emergency-numbers::-webkit-scrollbar { display: none; }
  .emergency-number { flex: 0 0 auto; width: 9.5rem; padding: 0.55rem 0.7rem; gap: 0.5rem; }
  .emergency-number strong { font-size: 0.95rem; }
  .emergency-number small { font-size: 0.68rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .medical-cards { padding: 0.75rem; }
}

/* ---------- Documents ---------- */
.drop-zone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 1.5rem 1rem;
  border: 2px dashed var(--app-border-strong); border-radius: var(--app-radius); background: #fafbfc; text-align: center; cursor: pointer;
}
.drop-zone:hover, .drop-zone.is-over { border-color: var(--app-brand); background: var(--app-brand-soft); }
.drop-zone > i { font-size: 1.8rem; color: var(--app-brand); }
.drop-zone small { color: var(--app-muted); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone-files { font-size: 0.85rem; font-weight: 600; color: var(--app-ink-2); overflow-wrap: anywhere; }
.upload-form [hidden] { display: none !important; }
.doc-icon { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--app-subtle); color: var(--app-ink-2); font-size: 1.1rem; }
.doc-icon .bi-file-earmark-pdf { color: #dc2626; }
.doc-icon .bi-file-earmark-image { color: #7e22ce; }
.doc-icon .bi-file-earmark-word { color: #1d4ed8; }
.doc-icon .bi-file-earmark-spreadsheet { color: #15803d; }
.doc-link { display: block; font-size: 0.85rem; color: var(--app-ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.doc-link:hover { color: var(--app-brand-ink); }
.min-w-0 { min-width: 0; }
@media (max-width: 767.98px) {
  .doc-table tr { grid-template-columns: 1fr auto; }
  .doc-table td[data-cell="where"] { grid-column: 1; padding-left: 3.1rem; }
  .doc-table td[data-cell="where"]:has(.text-muted:only-child) { display: none; }
  .doc-table td[data-cell="expiry"] { grid-column: 1; padding-left: 3.1rem; }
  .doc-table td[data-cell="expiry"]:has(> .text-muted) { display: none; }
  .doc-table td[data-cell="size"] { display: none; }
}

/* ---------- Contact import ---------- */
.import-steps { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0.5rem 0 0; counter-reset: step; font-size: 0.85rem; color: var(--app-muted); }
.import-steps li { counter-increment: step; display: flex; align-items: center; gap: 0.4rem; }
.import-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--app-subtle); font-weight: 700; font-size: 0.75rem; }
.import-steps li.active { color: var(--app-ink); font-weight: 600; }
.import-steps li.active::before { background: var(--app-brand); color: #fff; }
.import-steps li.done::before { content: "✓"; background: var(--app-success-soft); color: var(--app-success); }
.import-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1.1rem; margin-bottom: 1rem; }
.import-summary > div:first-child { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.import-filter { display: inline-flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.2rem; border-radius: 11px; background: var(--app-subtle); }
.import-filter .seg-option { border: 0; background: transparent; }
.import-filter .seg-option.active { background: var(--app-surface); }
.import-rows { display: grid; gap: 0.6rem; padding-bottom: 5.5rem; }
.import-row { background: var(--app-surface); border: 1px solid var(--app-border); border-left: 4px solid var(--app-success); border-radius: var(--app-radius-sm); padding: 0.7rem 0.9rem; }
.import-row[hidden] { display: none; }
.import-row.is-match { border-left-color: var(--app-warning); }
.import-row.has-error { border-left-color: var(--app-danger); background: #fffafa; }
.import-row.is-off { opacity: 0.55; }
.import-row.is-off .import-match, .import-row.is-off .import-fields { display: none; }
.import-row header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.import-row header label { min-width: 0; cursor: pointer; }
.import-row header input { margin-top: 0; flex: 0 0 auto; }
.import-name { overflow-wrap: anywhere; }
.import-meta { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; }
.import-note { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--app-warning); }
.import-match { margin-top: 0.6rem; padding: 0.65rem 0.8rem; border-radius: 9px; background: var(--app-warning-soft); font-size: 0.875rem; overflow-wrap: anywhere; }
.import-changes { width: auto; max-width: 100%; margin-bottom: 0.5rem; font-size: 0.85rem; }
.import-changes th { font-weight: 600; padding: 0.15rem 0.75rem 0.15rem 0; white-space: nowrap; width: 1%; }
.import-changes td { padding: 0.15rem 0.35rem; vertical-align: top; }
.import-changes td:nth-child(3) { color: var(--app-muted); }
.import-changes .old { color: var(--app-muted); text-decoration: line-through; }
.import-changes .new { font-weight: 600; color: var(--app-ink); }
.import-choice { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; }
.import-choice label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.import-choice input { margin: 0; }
.import-fields { margin-top: 0.5rem; }
.import-fields summary { font-size: 0.8rem; color: var(--app-muted); cursor: pointer; }
.import-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.45rem 0.6rem; margin-top: 0.45rem; }
.import-field { display: flex; flex-direction: column; min-width: 0; }
.import-field.wide { grid-column: span 2; }
.import-field label { font-size: 0.72rem; color: var(--app-muted); margin-bottom: 0.1rem; }
.import-field.has-error .form-control, .import-field.has-error .form-select { border-color: var(--app-danger); }
.import-bar {
  position: sticky; bottom: 0.75rem; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.7rem 0.9rem; border-radius: var(--app-radius); background: var(--app-surface); border: 1px solid var(--app-border); box-shadow: var(--app-shadow-lg);
}
@media (max-width: 991.98px) {
  .import-bar { bottom: calc(var(--app-tabbar-h) + var(--safe-bottom) + 0.5rem); }
}
@media (max-width: 767.98px) {
  .import-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-bar .btn { flex: 1 1 auto; }
  .import-bar > div { width: 100%; }
}
