@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #f5f6fa;
  --bg-2: #ffffff;
  --bg-3: #eef0f6;
  --bg-4: #e4e7ef;
  --bg-glass: rgba(255,255,255,0.7);
  --border: rgba(0,0,0,0.06);
  --border-2: rgba(0,0,0,0.1);
  --border-3: rgba(0,0,0,0.14);
  --text: #1a1a2e;
  --text-2: #5c5f7a;
  --text-3: #8e91a8;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-3: #a5b4fc;
  --accent-glow: rgba(99,102,241,0.12);
  --accent-bg: rgba(99,102,241,0.06);
  --success: #10b981;
  --success-bg: rgba(16,185,129,0.08);
  --success-border: rgba(16,185,129,0.15);
  --warn: #f59e0b;
  --warn-bg: rgba(245,158,11,0.08);
  --warn-border: rgba(245,158,11,0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.06);
  --danger-border: rgba(239,68,68,0.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.06);
  --r: 14px;
  --r-lg: 18px;
  --r-sm: 10px;
  --r-xs: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-glow: 0 4px 14px rgba(99,102,241,0.18);
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light only; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ===== LAYOUT — desktop sidebar + content ===== */
#app { display: flex; min-height: 100dvh; }

/* ===== HEADER (mobile only) ===== */
.header {
  position: sticky; top: 0; z-index: 50;
  padding: 14px 20px;
  display: none; /* hidden on desktop */
  align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
}
.header-title {
  font-size: 18px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 8px;
}
.conn-dot.on { background: var(--success); box-shadow: 0 0 6px var(--success); }
.conn-dot.off { background: var(--danger); }
.fleet-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
  letter-spacing: 0.5px; animation: pulse-badge 2s infinite;
}

/* ===== SIDEBAR (desktop) ===== */
.sidebar {
  width: var(--sidebar-w); min-height: 100dvh;
  background: var(--bg-2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; right: 0; top: 0; bottom: 0;
  z-index: 40; overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-text {
  font-size: 17px; font-weight: 800; letter-spacing: -0.3px;
  color: var(--text);
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-section {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 16px 12px 6px; margin-top: 4px;
}
.sidebar-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  background: none; border: none; cursor: pointer;
  width: 100%; text-align: right; font-family: inherit;
  transition: all 0.15s; margin-bottom: 2px;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-btn:hover { background: var(--bg-3); color: var(--text); }
.sidebar-btn.active {
  background: var(--accent-bg); color: var(--accent);
  font-weight: 600;
}
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-alert-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; margin-right: auto;
}
.sidebar-btn-action {
  color: var(--text-3); font-size: 12.5px;
}
.sidebar-btn-action:hover {
  color: var(--accent); background: var(--accent-bg);
}

/* ===== CONTENT ===== */
#content {
  padding: 28px 32px 40px;
  margin-right: var(--sidebar-w);
  flex: 1; min-width: 0;
  max-width: 1100px;
}

/* ===== BOTTOM NAV (mobile) ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: none; /* hidden on desktop */
  justify-content: space-around;
  padding: 6px 0 calc(env(safe-area-inset-bottom, 4px) + 4px);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 6px 8px;
  min-width: 56px; color: var(--text-3); background: none;
  border: none; cursor: pointer; transition: color 0.2s;
  -webkit-tap-highlight-color: transparent; font-family: inherit;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn span { font-size: 10px; font-weight: 500; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active::after {
  content: ''; position: absolute; top: -6px; left: 50%;
  transform: translateX(-50%); width: 20px; height: 3px;
  background: var(--accent); border-radius: 0 0 3px 3px;
}

/* ===== PAGE TITLE ===== */
.page-title {
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 4px; color: var(--text);
}
.page-subtitle {
  font-size: 13px; color: var(--text-3);
  font-weight: 500; margin-bottom: 24px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.card-interactive {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px; margin-bottom: 8px;
  cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}
.card-interactive:hover {
  border-color: var(--accent-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.card-interactive:active { transform: scale(0.995); }
.card-glow {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(129,140,248,0.03));
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: var(--r-lg);
  padding: 22px;
}

/* ===== STAT GRID ===== */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value {
  font-size: 26px; font-weight: 900;
  line-height: 1; letter-spacing: -0.5px; color: var(--text);
}
.stat-label {
  font-size: 12px; color: var(--text-3);
  margin-top: 4px; font-weight: 500;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: flex; gap: 10px; margin-bottom: 20px;
  overflow-x: auto; padding-bottom: 4px;
  flex-wrap: wrap;
}
.quick-action {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px; padding: 16px 18px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  min-width: 100px; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.quick-action:hover { border-color: var(--accent-3); box-shadow: var(--shadow); }
.quick-action-icon {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.quick-action span {
  font-size: 12px; font-weight: 600;
  color: var(--text-2); white-space: nowrap;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}
.badge-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-active .badge-dot { background: var(--success); }
.badge-warming { background: var(--warn-bg); color: var(--warn); }
.badge-warming .badge-dot { background: var(--warn); }
.badge-idle { background: rgba(142,145,168,0.1); color: var(--text-3); }
.badge-idle .badge-dot { background: var(--text-3); }
.badge-settling { background: var(--info-bg); color: var(--info); }
.badge-settling .badge-dot { background: var(--info); }
.badge-slow { background: var(--warn-bg); color: var(--warn); }
.badge-slow .badge-dot { background: var(--warn); }
.badge-limited { background: var(--danger-bg); color: var(--danger); }
.badge-limited .badge-dot { background: var(--danger); }
.badge-dead { background: rgba(239,68,68,0.06); color: #ef4444; }
.badge-dead .badge-dot { background: #ef4444; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all 0.15s;
  min-height: 42px; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { background: #5558e6; box-shadow: 0 6px 20px rgba(99,102,241,0.3); }
.btn-danger {
  background: var(--danger); color: #fff;
}
.btn-secondary {
  background: var(--bg-3); color: var(--text-2);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-4); color: var(--text); }
.btn-success {
  background: var(--success); color: #fff;
}
.btn-sm {
  padding: 7px 14px; font-size: 12px; min-height: 34px;
  border-radius: var(--r-xs);
}
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-xs); min-height: auto;
}
.btn-block { width: 100%; }

/* ===== CHIPS ===== */
.chip {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s;
  white-space: nowrap; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.chip-active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 6px rgba(99,102,241,0.25);
}
.chip-inactive {
  background: var(--bg-2); color: var(--text-3);
  border: 1px solid var(--border-2);
}
.chip-inactive:hover { color: var(--text-2); border-color: var(--accent-3); }

/* ===== INPUTS ===== */
.input {
  width: 100%; background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 11px 14px;
  color: var(--text); font-size: 14px; font-family: inherit;
  min-height: 42px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input::placeholder { color: var(--text-3); }
textarea.input { min-height: 100px; resize: vertical; }

.search-box {
  width: 100%; background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px 10px 36px;
  color: var(--text); font-size: 13px;
  font-family: inherit; min-height: 42px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box::placeholder { color: var(--text-3); }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); width: 16px; height: 16px;
  color: var(--text-3); pointer-events: none;
}

/* ===== CATEGORY AVATAR ===== */
.cat-avatar {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; top: 20px; left: 16px; right: 16px;
  max-width: 440px; margin: 0 auto;
  padding: 14px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; z-index: 100;
  animation: slideDown 0.3s ease-out;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.toast-success {
  background: rgba(16,185,129,0.1); color: #059669;
  border: 1px solid rgba(16,185,129,0.2);
}
.toast-error {
  background: rgba(239,68,68,0.1); color: #dc2626;
  border: 1px solid rgba(239,68,68,0.2);
}
.toast-warning {
  background: rgba(245,158,11,0.1); color: #d97706;
  border: 1px solid rgba(245,158,11,0.2);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 60; opacity: 0; transition: opacity 0.25s;
}
.modal-overlay.show { opacity: 1; }
.modal-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-2); border-radius: 20px 20px 0 0;
  z-index: 61; max-height: 85vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.12);
}
.modal-sheet.show { transform: translateY(0); }
.modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--bg-4); margin: 10px auto 0;
}
.modal-header {
  position: sticky; top: 0; background: var(--bg-2);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-3);
  color: var(--text-3); border: none; cursor: pointer;
  font-size: 16px; transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-4); }
.modal-body { padding: 16px 20px 36px; }

/* ===== MENU ITEMS ===== */
.menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:hover { background: var(--bg-3); }
.menu-item:active { background: var(--bg-4); }
.menu-item-icon {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.menu-item-icon svg { width: 20px; height: 20px; }
.menu-item-text { font-size: 14px; font-weight: 500; color: var(--text); }
.menu-item-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 0 4px; margin-bottom: 10px;
}

/* ===== TAGS ===== */
.tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}

/* ===== DETAIL ROW ===== */
.detail-row {
  display: flex; justify-content: space-between;
  align-items: center; font-size: 13px;
}
.detail-label { color: var(--text-3); }
.detail-value { color: var(--text); font-weight: 500; }
.detail-box {
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  overflow: hidden; background: var(--bg-2);
}
.detail-box .detail-row { padding: 12px 14px; }
.detail-box .detail-row + .detail-row { border-top: 1px solid var(--border); }

/* ===== EVENT ROW ===== */
.event-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.event-row:last-child { border-bottom: none; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-3);
}
.empty-text { font-size: 14px; color: var(--text-3); }

/* ===== ALERT BADGE ===== */
.alert-badge {
  position: absolute; top: 0; right: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  height: 6px; background: var(--bg-3);
  border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px; transition: width 0.4s ease;
}

/* ===== GLASS PANEL ===== */
.glass-panel {
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(129,140,248,0.03));
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: var(--r-lg); padding: 22px;
}

/* ===== NAME POOL ITEM ===== */
.pool-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.pool-item:last-child { border-bottom: none; }
.pool-name { font-size: 14px; font-weight: 500; color: var(--text); }
.pool-status {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px;
}

/* ===== APPLY PROFILE OVERLAY ===== */
.profile-overlay-bg {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeUp 0.2s ease-out;
}
.profile-overlay-card {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  width: 100%; max-width: 440px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

/* ===== NAMING OVERLAY ===== */
.naming-overlay-bg {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeUp 0.2s ease-out;
}
.naming-overlay-card {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  width: 100%; max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.naming-spinner, .profile-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}
.naming-status, .profile-status {
  font-size: 15px; font-weight: 600;
  color: var(--text); margin-bottom: 16px;
}
.naming-bar-wrap {
  height: 6px; background: var(--bg-3);
  border-radius: 3px; overflow: hidden; margin-bottom: 10px;
}
.naming-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px; transition: width 0.4s ease;
}
.naming-counter {
  font-size: 13px; color: var(--text-3); margin-bottom: 16px;
}
.naming-log {
  max-height: 200px; overflow-y: auto;
  text-align: right; padding: 0 4px;
}
.naming-log-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.naming-log-row.ok { color: var(--success); }
.naming-log-row.err { color: var(--danger); }
.naming-log-row.warn { color: var(--warn); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 2px; }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(99,102,241,0.15); }
  50% { box-shadow: 0 0 16px rgba(99,102,241,0.3); }
}
.fade-in { animation: fadeUp 0.3s ease-out both; }

/* ===== BTN-BACK ===== */
.btn-back {
  color: var(--accent); font-size: 13px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 16px; font-family: inherit; padding: 0;
}
.btn-back:hover { color: var(--text); }

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 768px) {
  #app { flex-direction: column; }
  .sidebar { display: none; }
  .header { display: flex; }
  .bottom-nav { display: flex; }
  #content {
    padding: 0 16px 110px;
    margin-right: 0;
    max-width: 100%;
  }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { flex-wrap: nowrap; }
  .modal-sheet { border-radius: 20px 20px 0 0; }
}

/* ===== DESKTOP WIDE ===== */
@media (min-width: 769px) {
  .modal-sheet {
    bottom: auto; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -50%) scale(0.95);
    border-radius: var(--r-lg);
    max-width: 520px; width: 90%;
    max-height: 80vh;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .modal-sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .modal-handle { display: none; }
}
