/* Warm Editorial-Luxury Light UI Design System */

:root {
  --bg-canvas: radial-gradient(circle at top right, #fff5ea 0%, #f8f5f0 48%, #f3ede4 100%);
  --surface: #ffffff;
  --surface-inset: #faf7f2;
  --border-primary: #e6ddd2;
  --border-divider: #efe8df;

  --text-primary: #221b17;
  --text-muted: #6e6259;

  --accent: #b86b35;
  --accent-hover: #9e5827;
  --accent-tint: #fdf3eb;
  --accent-border: #edd3be;
  --accent-gradient: linear-gradient(135deg, #c97a3d, #a75924);

  --gold: #c58b3a;
  --gold-bg: #fef7e7;

  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --crimson: #dc2626;
  --crimson-bg: #fef2f2;
  --sky: #0284c7;
  --sky-bg: #e0f2fe;
  --whatsapp: #16a34a;
  --whatsapp-bg: #dcfce7;

  --shadow-sm: 0 2px 8px rgba(34, 27, 23, 0.05);
  --shadow-md: 0 8px 24px rgba(34, 27, 23, 0.08);
  --shadow-lg: 0 18px 44px rgba(34, 27, 23, 0.16);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.serif-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.muted-text {
  color: var(--text-muted);
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(184, 107, 53, 0.24);
}
.btn-primary:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-primary);
}
.btn-secondary:hover {
  background: var(--surface-inset);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-primary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-inset);
}

.btn-whatsapp {
  background: var(--whatsapp-bg);
  color: var(--whatsapp);
  border-color: #bbf7d0;
}
.btn-whatsapp:hover {
  background: #bbf7d0;
}

.btn-danger {
  background: var(--crimson-bg);
  color: var(--crimson);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-full {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-primary);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}
.icon-btn:hover {
  background: var(--surface-inset);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}

/* Badges & Pastel Icon Tiles */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-crimson { background: var(--crimson-bg); color: var(--crimson); }
.badge-sky { background: var(--sky-bg); color: var(--sky); }
.badge-gold { background: var(--gold-bg); color: var(--gold); }
.badge-taupe { background: var(--surface-inset); color: var(--text-muted); border: 1px solid var(--border-primary); }

.icon-tile {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-tile svg { width: 17px; height: 17px; }
.tile-terracotta { background: var(--accent-tint); color: var(--accent); }
.tile-amber { background: var(--amber-bg); color: var(--amber); }
.tile-indigo { background: #eef2ff; color: #4f46e5; }
.tile-emerald { background: var(--emerald-bg); color: var(--emerald); }
.tile-rose { background: #fff1f2; color: #e11d48; }
.tile-sky { background: var(--sky-bg); color: var(--sky); }
.tile-violet { background: #f5f3ff; color: #7c3aed; }
.tile-taupe { background: var(--surface-inset); color: var(--text-muted); }

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.login-hint {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-inset);
  border: 1px solid var(--border-divider);
  padding: 8px 12px;
  border-radius: 8px;
}

/* App Shell & Sticky Sidebar */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
}

.sidebar-header {
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--border-divider);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.1;
}
.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-summary-pill {
  margin: 14px 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gold-bg);
  border: 1px solid #f5e2b8;
}
.summary-pill-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #8a5d1c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-pill-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}
.summary-pill-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.nav-item:hover {
  background: var(--surface-inset);
}
.nav-item.active {
  background: var(--accent-tint);
  border-color: var(--accent-border);
  font-weight: 600;
  color: var(--accent-hover);
}
.nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-count {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-inset);
  color: var(--text-muted);
  border: 1px solid var(--border-divider);
}
.nav-item.active .nav-count {
  background: #ffffff;
  color: var(--accent);
  border-color: var(--accent-border);
}

/* Main Column & Sticky Frosted Topbar */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-primary);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  line-height: 1.2;
}
.topbar-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--crimson);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.view-container {
  padding: 22px 26px 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Hero Banner & KPI Grid */
.hero-banner {
  background: linear-gradient(135deg, #fff6eb 0%, #fde8d5 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.hero-banner h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 4px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.kpi-value {
  font-size: 23px;
  font-weight: 700;
  margin: 6px 0 2px;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Panels & Cards */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
  margin: 0;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  color: var(--text-primary);
}
.card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 2px 0 0;
}
.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-divider);
}

/* Progress Bars */
.progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--border-divider);
  overflow: hidden;
}
.progress-track.lg {
  height: 9px;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  transition: width 0.25s ease;
}
.progress-fill.emerald {
  background: var(--emerald);
}

/* Toolbar, Filters & Segmented Tabs */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.segmented-tabs {
  display: inline-flex;
  background: var(--surface-inset);
  border: 1px solid var(--border-primary);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
.seg-tab {
  padding: 6px 13px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.seg-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Inputs & Forms */
input, select, textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 107, 53, 0.12);
}
input.input-error {
  border-color: var(--crimson);
}

.inline-error {
  color: var(--crimson);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 4px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Ledger Row Cards & Collapsible Payments */
.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ledger-card {
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  box-shadow: var(--shadow-sm);
}
.ledger-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ledger-right {
  text-align: right;
  flex-shrink: 0;
}
.ledger-amount {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.payments-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 1px solid var(--border-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.payments-drawer {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.payment-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

/* Attachment Thumbnails */
.att-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-inset);
  border: 1px solid var(--border-primary);
  font-size: 12px;
  cursor: pointer;
}
.att-chip:hover {
  border-color: var(--accent);
}

/* Maintenance Task Row */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.task-check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--border-primary);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}
.task-check.done {
  background: var(--emerald);
  border-color: var(--emerald);
}

/* Tables (Inventory & Audit) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  background: var(--surface-inset);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-divider);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}

/* Empty State & Pagination */
.empty-state {
  text-align: center;
  padding: 42px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

/* Modal & Mobile Bottom Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(34, 27, 23, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.modal-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 19px;
  margin: 0;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-divider);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-inset);
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(34, 27, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox-card {
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.lightbox-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.lightbox-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lightbox-content {
  padding: 16px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface-inset);
  min-height: 300px;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 8px;
}
.lightbox-content iframe {
  width: 100%;
  height: 74vh;
  border: none;
  border-radius: 8px;
}

/* Global Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(248, 245, 240, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--accent-tint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Floating Dark Espresso Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: #221b17;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}
.toast.error {
  background: #991b1b;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
}

/* Printable Rent Receipt */
.receipt-box {
  background: #ffffff;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 20px;
}
@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .modal-footer, .modal-header button {
    display: none !important;
  }
  .modal-backdrop {
    position: static;
    background: #ffffff;
    padding: 0;
  }
  .modal-sheet {
    box-shadow: none;
    border: none;
    max-height: none;
  }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .sidebar {
    display: none;
  }
  .topbar {
    padding: 12px 16px;
  }
  .view-container {
    padding: 16px 14px calc(84px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-primary);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-bottom-nav::-webkit-scrollbar { display: none; }
  .mobile-nav-item {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
  }
  .mobile-nav-item.active {
    background: var(--accent-tint);
    border-color: var(--accent-border);
    color: var(--accent-hover);
  }
  input, select, textarea {
    font-size: 16px; /* Prevents iOS Safari auto-zoom */
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .toast-container {
    bottom: calc(76px + env(safe-area-inset-bottom));
    right: 14px;
    left: 14px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-sheet {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
  }
  .modal-footer {
    flex-direction: column;
  }
  .modal-footer .btn {
    width: 100%;
  }
}
