/* ============================================================
   Mizan — Shared Stylesheet
   All pages import this: <link rel="stylesheet" href="css/style.css">
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  /* ── Design Tokens ──────────────────────────────────────────── */
  :root {
    /* Colors */
    --color-bg:            #fafaff;
    --color-surface:       #ffffff;
    --color-border:        rgba(124, 58, 237, 0.15);
    --color-border-input:  rgba(124, 58, 237, 0.25);
  
    --color-primary:       #7c3aed;
    --color-primary-hover: #6d28d9;
    --color-primary-active:#5b21b6;
    --color-primary-soft:  rgba(124, 58, 237, 0.12);
  
    --color-text-heading:  #1a0f2e;
    --color-text-body:     #1a0f2e;
    --color-text-muted:    #6b5a8e;
  
    --color-success-bg:    #f0fdf4;
    --color-success-text:  #15803d;
    --color-success-border:#bbf7d0;
    --color-error-bg:      #fef2f2;
    --color-error-text:    #b91c1c;
    --color-error-border:  #fecaca;
  
    --color-green:         #16a34a;
    --color-red:           #dc2626;
    --color-amber:         #d97706;
  
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body:    'Inter', sans-serif;
  
    /* Radii */
    --radius-card:  16px;
    --radius-input: 10px;
    --radius-btn:   10px;
    --radius-sm:    8px;
  
    /* Shadows */
    --shadow-card: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.1);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  }
  
  /* ── Base ───────────────────────────────────────────────────── */
  html, body {
    min-height: 100%;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-text-body);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
  }
  
  a {
    color: var(--color-primary);
    text-decoration: none;
  }
  a:hover { text-decoration: underline; }
  
  /* ── Auth Layout (Sign Up / Sign In) ────────────────────────── */
  .auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  
  .auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    width: 448px;
    max-width: 100%;
    padding: 33px;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  
  .auth-card__header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .auth-card__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 30px;
    line-height: 36px;
    color: var(--color-text-heading);
  }
  
  .auth-card__subtitle {
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-muted);
  }
  
  .auth-card__footer {
    text-align: center;
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-muted);
  }
  
  .auth-card__footer a {
    color: var(--color-primary);
    font-weight: 500;
  }
  
  /* ── App Layout (Dashboard / Add Expense / Profile) ─────────── */
  .app-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
  }
  
  .app-header {
    width: 100%;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    height: 81px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  
  .app-header__inner {
    width: 100%;
    max-width: 1143px;
    margin: 0 auto;
    padding: 0 59.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .app-header__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 26px;
    line-height: 32px;
    color: var(--color-text-heading);
  }
  
  .app-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 81px;
  }
  
  .app-content__inner {
    max-width: 1143px;
    margin: 0 auto;
    padding: 32px 59.5px;
  }
  
  .app-content__narrow {
    max-width: 448px;
    margin: 0 auto;
  }
  
  /* ── Bottom Nav ─────────────────────────────────────────────── */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 81px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    z-index: 100;
  }
  
  .bottom-nav__inner {
    width: 100%;
    max-width: 1143px;
    margin: 0 auto;
    padding: 0 59.5px;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
  
  .bottom-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 12px;
    line-height: 16px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
  }
  
  .bottom-nav__link:hover,
  .bottom-nav__link.active {
    color: var(--color-primary);
    text-decoration: none;
  }
  
  .bottom-nav__link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  
  .bottom-nav__add {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 12px;
    line-height: 16px;
  }
  
  .bottom-nav__add-icon {
    width: 44px;
    height: 44px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -16px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
  }
  
  .bottom-nav__add-icon svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  
  /* ── Form Elements ──────────────────────────────────────────── */
  .form {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .field {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .field label,
  .field__label {
    font-size: 14px;
    font-weight: 500;
    line-height: 14px;
    color: var(--color-text-heading);
  }
  
  .field input,
  .field select,
  .field textarea,
  .input {
    height: 36px;
    padding: 4px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius-input);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-text-body);
    background: var(--color-surface);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
  }
  
  .field input::placeholder,
  .input::placeholder {
    color: var(--color-text-muted);
  }
  
  .field input:focus,
  .field select:focus,
  .field textarea:focus,
  .input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
  }
  
  .field__hint {
    font-size: 12px;
    line-height: 16px;
    color: var(--color-text-muted);
  }
  
  /* ── Buttons ────────────────────────────────────────────────── */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    text-decoration: none;
  }
  
  .btn:disabled { opacity: 0.6; cursor: not-allowed; }
  
  .btn-primary {
    background: var(--color-primary);
    color: #fff;
    width: 100%;
  }
  .btn-primary:hover:not(:disabled)  { background: var(--color-primary-hover); }
  .btn-primary:active:not(:disabled) { background: var(--color-primary-active); }
  
  .btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    width: 100%;
  }
  .btn-secondary:hover:not(:disabled) { background: var(--color-primary-soft); }
  
  .btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    width: 100%;
  }
  .btn-ghost:hover:not(:disabled) { background: rgba(0,0,0,0.04); }
  
  .btn-danger {
    background: transparent;
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
  }
  .btn-danger:hover:not(:disabled) { background: var(--color-error-bg); }
  
  .btn-sm {
    height: 28px;
    padding: 0 12px;
    font-size: 13px;
  }
  
  /* Spinner inside button */
  .btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
    flex-shrink: 0;
  }
  .btn.loading .spinner   { display: block; }
  .btn.loading .btn-label { display: none; }
  
  @keyframes spin { to { transform: rotate(360deg); } }
  
  /* ── Banners ────────────────────────────────────────────────── */
  .banner {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    line-height: 18px;
    display: none;
  }
  .banner.error   { background: var(--color-error-bg);   color: var(--color-error-text);   border: 1px solid var(--color-error-border); }
  .banner.success { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid var(--color-success-border); }
  .banner.visible { display: block; }
  
  /* ── Cards / Panels ─────────────────────────────────────────── */
  .card  { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
  .panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
  
  /* ── Stat Cards ─────────────────────────────────────────────── */
  .stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
  }
  
  .stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 25px;
  }
  
  .stat-card__label {
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
  }
  
  .stat-card__value {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 36px;
    color: var(--color-text-heading);
  }
  
  .stat-card__value.positive { color: var(--color-green); }
  .stat-card__value.negative { color: var(--color-red); }
  
  /* ── Section Headings ───────────────────────────────────────── */
  .section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 20px;
    line-height: 28px;
    color: var(--color-text-heading);
    margin-bottom: 16px;
  }
  
  /* ── Balance Rows ───────────────────────────────────────────── */
  .balance-list,
  .expense-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--color-surface);
  }
  
  .balance-row,
  .expense-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
  }
  .balance-row:last-child,
  .expense-row:last-child { border-bottom: none; }
  
  .balance-row__person {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
  }
  
  .balance-row__name  { font-size: 16px; font-weight: 500; color: var(--color-text-heading); line-height: 24px; }
  .balance-row__direction { font-size: 14px; color: var(--color-text-muted); line-height: 20px; }
  
  .balance-row__right {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .balance-row__amount {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 28px;
    color: var(--color-text-heading);
  }
  .balance-row__amount.positive { color: var(--color-green); }
  .balance-row__amount.negative { color: var(--color-red); }
  
  .badge {
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 99px;
    padding: 2px 10px;
  }
  .badge.awaiting { color: var(--color-amber); border-color: rgba(217,119,6,0.3); background: #fffbeb; }
  
  /* ── Expense Rows ───────────────────────────────────────────── */
  .expense-row { align-items: flex-start; }
  
  .expense-row__left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }
  
  .expense-row__icon { font-size: 24px; line-height: 32px; flex-shrink: 0; }
  .expense-row__desc { font-size: 16px; font-weight: 500; color: var(--color-text-heading); line-height: 24px; }
  
  .expense-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
  }
  
  .expense-row__paid-by {
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 99px;
    padding: 2px 10px;
  }
  
  .expense-row__date { font-size: 13px; color: var(--color-text-muted); }
  
  .expense-row__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
  }
  
  .expense-row__total { font-family: var(--font-display); font-size: 18px; line-height: 24px; color: var(--color-text-heading); }
  .expense-row__split { font-size: 13px; color: var(--color-text-muted); }
  
  /* ── Category Grid ──────────────────────────────────────────── */
  .category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 90px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-text-muted);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  
  .category-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
  
  .category-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 500;
  }
  
  .category-btn__emoji { font-size: 24px; line-height: 32px; }
  
  /* ── Chips (Paid By / Exclude) ──────────────────────────────── */
  .chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .chip {
    height: 40px;
    padding: 0 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 99px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-text-body);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  
  .chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
  .chip.selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 500; }
  .chip.excluded { background: var(--color-error-bg); border-color: var(--color-error-border); color: var(--color-error-text); }
  
  /* ── Amount Input (Add Expense) ─────────────────────────────── */
  .amount-field {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 25px 33px;
  }
  
  .amount-field__label { font-size: 14px; font-weight: 500; color: var(--color-text-muted); margin-bottom: 12px; }
  
  .amount-field__row { display: flex; align-items: baseline; gap: 8px; }
  
  .amount-field__currency {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--color-text-muted);
    flex-shrink: 0;
  }
  
  .amount-field__input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 500;
    color: var(--color-text-heading);
    background: transparent;
    width: 100%;
  }
  
  .amount-field__input::placeholder { color: var(--color-border-input); }
  
  /* ── Invite Code Box ────────────────────────────────────────── */
  .invite-code-box {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 26px;
    text-align: center;
  }
  
  .invite-code-box__code {
    font-family: var(--font-display);
    font-size: 32px;
    letter-spacing: 0.1em;
    color: var(--color-text-heading);
    margin-bottom: 8px;
  }
  
  .invite-code-box__expiry { font-size: 13px; color: var(--color-text-muted); }
  
  /* ── Progress Bar ───────────────────────────────────────────── */
  .progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 99px;
    overflow: hidden;
  }
  
  .progress-bar__fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 99px;
    transition: width 0.3s ease;
  }
  
  .step-label { font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }
  
  /* ── Profile ────────────────────────────────────────────────── */
  .profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    flex-shrink: 0;
  }
  
  .info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
  }
  .info-row:last-child { border-bottom: none; }
  .info-row__label { color: var(--color-text-muted); }
  .info-row__value { color: var(--color-text-heading); font-weight: 500; }
  
  /* ── Split Summary ──────────────────────────────────────────── */
  .split-summary {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 17px;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 20px;
  }
  
  .split-summary__amount { font-weight: 600; color: var(--color-primary); font-size: 15px; }
  
  /* ── Utilities ──────────────────────────────────────────────── */
  .text-muted   { color: var(--color-text-muted); }
  .text-heading { color: var(--color-text-heading); }
  .text-primary { color: var(--color-primary); }
  .text-sm      { font-size: 12px; }
  .text-center  { text-align: center; }
  .mt-8   { margin-top: 8px; }
  .mt-16  { margin-top: 16px; }
  .mt-24  { margin-top: 24px; }
  .mt-32  { margin-top: 32px; }
  .w-full { width: 100%; }
  
  /* ── Responsive ─────────────────────────────────────────────── */
  @media (max-width: 768px) {
    .app-header__inner,
    .app-content__inner,
    .bottom-nav__inner {
      padding-left: 16px;
      padding-right: 16px;
    }
  
    .stats-row { grid-template-columns: 1fr; gap: 12px; }
    .auth-card { padding: 24px; }
  }