:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ==================== Layout Shell ==================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 84px;
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #111827, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-sub {
  margin: 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.desktop-nav {
  display: none;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.main-content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 32px;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 9px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
}

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* ==================== Hero Summary ==================== */
.summary-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #1d4ed8 140%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.summary-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.reserve-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.reserve-badge.warn {
  background: rgba(248, 113, 113, 0.22);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
}

.summary-amount {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
}

.summary-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-track {
  position: relative;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: visible;
}

.progress-track-hero {
  background: rgba(255, 255, 255, 0.16);
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #10b981);
  transition: width 0.35s ease, background 0.25s ease;
  max-width: 100%;
}

.progress-fill.status-caution {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.progress-fill.status-danger {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.progress-threshold {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.progress-threshold::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  border: 1.5px solid #fff;
}

.summary-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ==================== Reminders Strip ==================== */
.reminders-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.reminder-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: #92400e;
  border: 1px solid #fde68a;
}

.reminder-pill.urgent {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: #fecaca;
}

.reminder-pill.info {
  background: var(--primary-soft);
  color: #1e40af;
  border-color: #bfdbfe;
}

/* ==================== Section Header ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-compact, .select-input {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
}

/* ==================== Cards Grid ==================== */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.credit-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.credit-card:hover {
  box-shadow: var(--shadow-md);
}

.card-banner {
  padding: 16px 18px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.theme-blue { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.theme-crimson { background: linear-gradient(135deg, #be123c, #f43f5e); }
.theme-emerald { background: linear-gradient(135deg, #047857, #10b981); }
.theme-purple { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.theme-gold { background: linear-gradient(135deg, #b45309, #f59e0b); }
.theme-obsidian { background: linear-gradient(135deg, #0f172a, #334155); }

.card-bank-name {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-last4 {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.card-limit-sub {
  font-size: 12px;
  opacity: 0.88;
  margin-top: 3px;
}

.card-edit-btn {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.card-edit-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.card-body {
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-key-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.metric-box.safe-highlight {
  background: var(--success-soft);
  border-color: #a7f3d0;
}

.metric-box.caution-highlight {
  background: var(--warning-soft);
  border-color: #fde68a;
}

.metric-box.danger-highlight {
  background: var(--danger-soft);
  border-color: #fecaca;
}

.metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
}

.metric-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  margin-top: 2px;
}

.metric-box.safe-highlight .metric-value { color: #047857; }
.metric-box.caution-highlight .metric-value { color: #b45309; }
.metric-box.danger-highlight .metric-value { color: #b91c1c; }

.metric-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Card progress */
.card-progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.card-progress-meta strong {
  color: var(--text);
}

.threshold-note {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Billing cycle info row */
.card-cycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.cycle-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cycle-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
}

.cycle-badge.due-soon {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 18px 16px;
}

.card-action-spend {
  background: #0f172a;
  color: #fff;
}

.card-action-spend:hover {
  background: #1e293b;
}

.card-action-repay {
  background: var(--success-soft);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.card-action-repay:hover {
  background: #d1fae5;
}

/* ==================== Empty State ==================== */
.empty-state {
  background: var(--surface);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-state p {
  margin: 0 auto 20px;
  max-width: 420px;
  font-size: 14px;
  color: var(--text-secondary);
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==================== Records Tab ==================== */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.records-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.record-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.record-icon.spend {
  background: var(--danger-soft);
  color: var(--danger);
}

.record-icon.repay {
  background: var(--success-soft);
  color: var(--success);
}

.record-info {
  min-width: 0;
}

.record-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.record-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.record-amount {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.record-del-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 15px;
}

.record-del-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ==================== Settings Tab ==================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.settings-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.settings-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-with-unit {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 10px;
  background: var(--surface-subtle);
}

.input-with-unit input {
  width: 72px;
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 15px;
  font-weight: 700;
  outline: none;
}

.settings-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-btn {
  cursor: pointer;
}

.tips-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==================== Bottom Nav ==================== */
.header-actions {
  display: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.35fr;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
}

.bottom-nav-btn.active {
  color: var(--primary);
}

.bottom-nav-cta {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
  cursor: pointer;
  white-space: nowrap;
}

.bottom-nav-cta:active {
  transform: scale(0.96);
}

/* ==================== Modals ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.icon-close {
  border: none;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 16px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.seg-btn.active[data-type="repay"] {
  color: var(--success);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 440px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.amount-input-box {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 6px 14px;
  background: var(--surface-subtle);
}

.amount-input-box:focus-within {
  border-color: var(--primary);
  background: #fff;
}

.currency-prefix {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 6px;
}

.amount-input-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  outline: none;
  font-variant-numeric: tabular-nums;
}

.quick-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Live Preview Box */
.live-preview-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.preview-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preview-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
}

.preview-grid strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.preview-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--danger-soft);
  color: var(--danger);
}

.theme-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.theme-dot.active {
  border-color: var(--text);
  transform: scale(1.1);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.modal-footer-split {
  justify-content: space-between;
  align-items: center;
}

.modal-footer-right {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* ==================== Auth Screen ==================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1d4ed8 140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}

.auth-brand .brand-icon {
  margin: 0 auto 12px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.auth-brand h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
}

.auth-brand p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.auth-hint {
  margin: 2px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.change-pw-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field .form-input {
  padding-right: 42px;
}

.pw-toggle-btn {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.pw-toggle-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-subtle);
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 80;
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

/* ==================== Desktop Responsive ==================== */
@media (min-width: 768px) {
  .app-shell {
    padding-bottom: 0;
  }

  .desktop-nav, .header-actions {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .main-content {
    padding: 26px 24px 48px;
  }

  .summary-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 26px 28px;
  }

  .summary-main {
    flex: 1.3;
    max-width: 540px;
  }

  .summary-stats {
    flex: 1;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    padding-top: 0;
    padding-left: 26px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .modal-sheet {
    border-radius: 20px;
  }

  .toast {
    bottom: 28px;
  }
}

@media (min-width: 1060px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
