:root {
  --navy: #0b2c4b;
    --navy-80: rgba(11,44,75,0.8);
    --navy-60: rgba(11,44,75,0.55);
    --navy-10: rgba(11,44,75,0.08);
    --teal: #37b0a2;
    --teal-dark: #2d9a8e;
    --teal-10: rgba(55,176,162,0.12);
    --teal-5: rgba(55,176,162,0.06);
    --sky: #f0faf8;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --border: #e8ecf0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(11,44,75,0.04);
    --shadow: 0 1px 3px rgba(11,44,75,0.05), 0 6px 20px rgba(11,44,75,0.04);
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --success: #059669;
    --success-bg: #ecfdf5;
  }

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

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--navy);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    -webkit-font-smoothing: antialiased;
  }

  .header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .header-brand img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }
  .header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -0.02em;
  }

  .page-title {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 20px 8px;
  }
  .page-title h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.2;
    color: var(--navy);
  }
  .page-title h1 em { font-style: normal; color: var(--teal); }
  .page-title p {
    font-size: 14px;
    color: var(--navy-60);
    margin-top: 6px;
    line-height: 1.5;
    font-weight: 400;
  }

  .container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 0 20px 32px;
    flex: 1;
  }

  .view { display: none; animation: fadeIn 0.25s ease; }
  .view.active { display: block; }

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

  /* Summary cards */
  .summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
  }
  .summary-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
  }
  .summary-card.full {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--navy) 0%, #143d5e 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow);
    padding: 20px;
  }
  .summary-card.full .label { color: rgba(255,255,255,0.65); }
  .summary-card.full .value { color: white; font-size: 28px; }
  .summary-card.full .value.danger { color: #fca5a5; }
  .summary-card.full .value.teal { color: #6ee7b7; }
  .summary-card.full .sub { color: rgba(255,255,255,0.6); }
  .summary-card .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--navy-60);
    margin-bottom: 6px;
  }
  .summary-card .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
  }
  .summary-card .value.teal { color: var(--teal); }
  .summary-card .value.danger { color: var(--danger); }
  .summary-card .sub { font-size: 12px; color: var(--navy-60); margin-top: 4px; }

  /* Section */
  .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 12px;
  }
  .section-head h2 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--navy-60);
  }
  .section-head a {
    font-size: 13px;
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
  }

  /* Credit card visual */
  .cc-card {
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(11,44,75,0.15);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    aspect-ratio: 1.75 / 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .cc-card:hover { box-shadow: 0 12px 32px rgba(11,44,75,0.2); }
  .cc-card:active { transform: scale(0.985); }
  .cc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
  }
  .cc-card::after {
    content: '';
    position: absolute;
    top: -40%; right: -25%;
    width: 55%; height: 130%;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
  }
  .cc-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
  }
  .cc-bank { font-size: 12px; font-weight: 600; opacity: 0.88; letter-spacing: 0.03em; text-transform: uppercase; }
  .cc-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(4px);
  }
  .cc-status.overdue { background: var(--danger); }
  .cc-status.due-soon { background: rgba(180,83,9,0.9); }
  .cc-status.paid { background: rgba(255,255,255,0.22); }
  .cc-number { font-size: 16px; letter-spacing: 3px; font-weight: 500; opacity: 0.92; position: relative; }
  .cc-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
  }
  .cc-label { font-size: 11px; opacity: 0.8; font-weight: 500; }
  .cc-due-amount { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
  .cc-due-date { font-size: 11px; opacity: 0.75; margin-top: 3px; font-weight: 500; }
  .cc-progress {
    margin-top: 14px;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
  }
  .cc-progress-bar {
    height: 100%;
    background: rgba(255,255,255,0.9);
    border-radius: 2px;
    transition: width 0.4s ease;
  }

  /* List items */
  .list-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .list-card:hover {
    border-color: rgba(55,176,162,0.35);
    box-shadow: var(--shadow);
  }
  .list-avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.02em;
  }
  .list-info { flex: 1; min-width: 0; }
  .list-info .title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
  .list-info .meta { font-size: 12px; color: var(--navy-60); margin-top: 3px; }
  .list-amount { text-align: right; }
  .list-amount .amt { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
  .list-amount .days {
    font-size: 11px;
    color: var(--navy-60);
    margin-top: 3px;
    font-weight: 500;
  }
  .list-amount .days.urgent { color: var(--danger); font-weight: 600; }

  /* Timeline */
  .timeline { position: relative; padding-left: 24px; }
  .timeline::before {
    content: '';
    position: absolute;
    left: 6px; top: 10px; bottom: 10px;
    width: 1px;
    background: var(--border);
  }
  .timeline-item {
    position: relative;
    padding: 0 0 18px 14px;
  }
  .timeline-item::before {
    content: '';
    position: absolute;
    left: -22px; top: 7px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--teal);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--teal-10);
  }
  .timeline-item.overdue::before { background: var(--danger); box-shadow: 0 0 0 1px var(--danger-bg); }
  .timeline-date { font-size: 11px; font-weight: 600; color: var(--navy-60); letter-spacing: 0.03em; }
  .timeline-body {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
  }
  .timeline-body .name { font-size: 14px; font-weight: 600; }
  .timeline-body .amt { font-size: 14px; font-weight: 700; color: var(--teal-dark); }

  /* Forms */
  .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 14px;
  }
  .card h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.02em; }

  .form-group { margin-bottom: 16px; }
  .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy-60);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--navy);
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
    font-family: inherit;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-10);
    background: white;
  }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-hint { font-size: 11px; color: var(--navy-60); margin-top: 5px; line-height: 1.4; }

  .color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .color-swatch {
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
  }
  .color-swatch.selected { border-color: var(--navy); transform: scale(1.1); }

  .btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: -0.01em;
  }
  .btn:active { transform: scale(0.98); }
  .btn-primary {
    background: var(--navy);
    color: white;
    box-shadow: var(--shadow-sm);
  }
  .btn-primary:hover { background: #143d5e; box-shadow: var(--shadow); }
  .btn-outline {
    background: white;
    color: var(--navy);
    border: 1px solid var(--border);
    margin-top: 10px;
  }
  .btn-outline:hover { border-color: var(--teal); background: var(--teal-5); }
  .btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
    margin-top: 10px;
  }
  .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .btn-row .btn { margin-top: 0; }

  /* Reminders page */
  .reminders-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #143d5e 100%);
    border-radius: var(--radius);
    padding: 20px;
    color: white;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
  }
  .reminders-hero::after {
    content: '';
    position: absolute;
    top: -40%; right: -15%;
    width: 50%; height: 140%;
    background: rgba(55,176,162,0.12);
    border-radius: 50%;
    pointer-events: none;
  }
  .reminders-hero h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
  }
  .reminders-hero p {
    font-size: 13px;
    opacity: 0.85;
    line-height: 1.5;
    position: relative;
  }
  .reminders-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.12);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    position: relative;
  }
  .reminders-status .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #6ee7b7;
  }
  .reminders-status.off .dot { background: #fca5a5; }

  .section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--navy-60);
    margin: 20px 0 10px;
  }

  .channel-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 14px;
    align-items: flex-start;
  }
  .channel-card.disabled { opacity: 0.72; }
  .channel-icon {
    width: 42px; height: 42px;
    border-radius: 11px;
    background: var(--teal-10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--teal-dark);
  }
  .channel-icon.muted { background: var(--navy-10); color: var(--navy-60); }
  .channel-icon svg { width: 20px; height: 20px; }
  .channel-body { flex: 1; min-width: 0; }
  .channel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
  }
  .channel-head h3 { font-size: 14px; font-weight: 600; }
  .badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
  }
  .badge-live { background: var(--success-bg); color: var(--success); }
  .badge-soon { background: var(--navy-10); color: var(--navy-60); }
  .channel-body p {
    font-size: 12px;
    color: var(--navy-60);
    line-height: 1.5;
    margin-bottom: 12px;
  }
  .channel-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--teal);
    background: transparent;
    color: var(--teal-dark);
    font-family: inherit;
    transition: background 0.2s;
  }
  .channel-action:hover { background: var(--teal-5); }
  .channel-action.primary {
    background: var(--navy);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
  }
  .channel-action.primary:hover { background: #143d5e; }

  .schedule-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
  }
  .schedule-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
  }
  .schedule-card > p {
    font-size: 12px;
    color: var(--navy-60);
    margin-bottom: 14px;
    line-height: 1.4;
  }
  .schedule-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }
  .schedule-row:first-of-type { border-top: none; padding-top: 0; }
  .schedule-row span { font-size: 14px; font-weight: 500; }

  .info-list {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  .info-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .info-item:last-child { border-bottom: none; }
  .info-num {
    width: 24px; height: 24px;
    border-radius: 6px;
    background: var(--teal-10);
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .info-text { font-size: 13px; color: var(--navy-60); line-height: 1.5; }
  .info-text strong { color: var(--navy); font-weight: 600; }
  .toggle {
    position: relative;
    width: 44px; height: 26px;
    flex-shrink: 0;
  }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.2s;
  }
  .toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  }
  .toggle input:checked + .toggle-slider { background: var(--teal); }
  .toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

  .chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .chip {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: white;
    cursor: pointer;
    transition: all 0.15s;
  }
  .chip.selected {
    background: var(--teal-10);
    border-color: var(--teal);
    color: var(--teal-dark);
  }

  /* Payment log */
  .payment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .payment-item:last-child { border-bottom: none; }
  .payment-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--navy-60);
    width: 52px;
    flex-shrink: 0;
    padding-top: 2px;
  }
  .payment-detail { flex: 1; }
  .payment-detail .src { font-size: 13px; font-weight: 500; }
  .payment-detail .note { font-size: 11px; color: var(--navy-60); }
  .payment-amt { font-size: 14px; font-weight: 700; color: var(--success); }

  /* Empty state */
  .empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--navy-60);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }
  .empty h3 { font-size: 17px; color: var(--navy); margin-bottom: 8px; font-weight: 700; letter-spacing: -0.02em; }
  .empty p { font-size: 14px; line-height: 1.55; margin-bottom: 20px; max-width: 280px; margin-left: auto; margin-right: auto; }

  /* Modal */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,44,75,0.45);
    z-index: 100;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-handle {
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
  }
  .modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }
  .modal-head h2 { font-size: 17px; font-weight: 600; }
  .modal-close {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--navy-60);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
  }
  .modal-close:hover { background: var(--sky); }
  .modal-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

  /* Bottom nav */
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255,255,255,0.92);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav-inner {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding: 4px 12px;
  }
  .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    cursor: pointer;
    color: var(--navy-60);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: none;
    background: none;
    font-family: inherit;
    transition: color 0.2s;
    position: relative;
    max-width: 100px;
  }
  .nav-item.active { color: var(--teal-dark); }
  .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--teal);
  }
  .nav-icon-wrap {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-icon-wrap svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .nav-label { line-height: 1; }

  .fab {
    position: fixed;
    bottom: calc(76px + env(safe-area-inset-bottom));
    right: 20px;
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--navy);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 40;
    transition: transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .fab:hover { box-shadow: 0 8px 24px rgba(11,44,75,0.2); }
  .fab svg { width: 22px; height: 22px; stroke: white; fill: none; stroke-width: 2.5; stroke-linecap: round; }
  .fab:active { transform: scale(0.94); }

  .empty-icon-svg {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
    color: var(--navy-60);
    opacity: 0.35;
  }
  .empty-icon-svg svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }

  .alert-banner {
    background: white;
    border: 1px solid #fde68a;
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    color: var(--warning);
    margin-bottom: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
  }
  .alert-banner.danger {
    border-color: #fecaca;
    border-left-color: var(--danger);
    color: var(--danger);
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--navy-60);
    cursor: pointer;
    margin-bottom: 16px;
    font-weight: 600;
    border: none;
    background: none;
    font-family: inherit;
    transition: color 0.2s;
  }
  .back-link:hover { color: var(--teal-dark); }
  .back-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

  .footer {
    text-align: center;
    padding: 16px 20px 12px;
    font-size: 11px;
    color: var(--navy-60);
    opacity: 0.8;
  }
  .footer a { color: var(--teal-dark); text-decoration: none; font-weight: 600; }

  .notes-title { font-size: 13px; display: block; margin-bottom: 6px; }
  .notes-body { font-size: 13px; color: var(--navy-60); line-height: 1.5; }
  .empty-payments { font-size: 13px; color: var(--navy-60); text-align: center; padding: 12px; }
  .pay-link { margin-top: 10px; }

  @media (min-width: 520px) {
    .modal-overlay { align-items: center; padding: 16px; }
    .modal { border-radius: 16px; }
  }

  /* Auth gate — visible by default so page never blanks before JS loads */
  .auth-gate {
    display: block;
    min-height: 100vh;
    background: var(--bg);
  }
  .auth-gate.hidden { display: none; }

  .app-shell { display: none; }
  .app-shell.active { display: block; }

  .auth-card {
    text-align: center;
    padding: 36px 24px;
    max-width: 420px;
    margin: 0 auto;
  }
  .auth-icon { font-size: 36px; margin-bottom: 12px; }
  .auth-card h2 { font-size: 20px; margin-bottom: 6px; color: var(--navy); }
  .auth-subtitle {
    font-size: 13px;
    color: var(--navy-60);
    margin-bottom: 28px;
    line-height: 1.5;
  }
  .auth-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--navy);
    background: #fafbfc;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    letter-spacing: 2px;
    font-family: inherit;
  }
  .auth-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-10);
  }
  .auth-card .btn-primary { margin-top: 16px; width: 100%; }

  .auth-help {
    margin-top: 28px;
    padding: 16px;
    background: var(--sky);
    border: 1px solid rgba(55, 176, 162, 0.15);
    border-radius: var(--radius-sm);
    text-align: center;
  }
  .auth-help-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--navy-60);
    letter-spacing: 0.01em;
    margin-bottom: 10px;
  }
  .auth-help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--teal-dark);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
    box-shadow: var(--shadow-sm);
  }
  .auth-help-link svg {
    flex-shrink: 0;
    opacity: 0.85;
  }
  .auth-help-link:hover {
    border-color: var(--teal);
    color: var(--teal);
    box-shadow: 0 2px 8px var(--teal-10);
  }
  .auth-help-link:active { transform: scale(0.98); }

  .error-box {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
  }

  .header-logout {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--navy-60);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s;
  }
  .header-logout:hover { color: var(--navy); border-color: var(--teal); }

  .user-greeting {
    background: var(--teal-10);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--navy);
  }
