/* ============================================================
   Vowi — Component Library
   ============================================================ */

/* ============================================================
   PRINT — hide chrome so only content prints
   ============================================================ */
@media print {
  .sidebar, .sidebar-overlay, .app-header, .m-tabbar,
  .m-sheet, .m-overlay, .drawer, .drawer-overlay,
  .table-actions, .header-actions, .notif-wrap, .toolbar,
  #toastContainer { display: none !important; }

  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ============================================================
   MOBILE APP SHELL — dark floating tab bar, gold action button,
   bottom sheets. Built by buildMobileNav() in sidebar.js; only
   shown at phone width (<= 768px). The rest of the phone layout
   lives in "MOBILE APP LAYOUT" at the end of this file.
   ============================================================ */

.m-head, .m-tabbar, .m-fab, .m-sheet, .m-overlay { display: none; }
.m-only { display: none !important; }

.mbn-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid transparent;
  flex-shrink: 0;
}
.mbn-avatar img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 768px) {
  .m-only { display: block !important; }
  .d-only { display: none !important; }

  html.m-locked, html.m-locked body { overflow: hidden; }

  /* ---- Header ---- */
  .m-head {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 1;
    min-width: 0;
  }
  .m-head-logo {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: #1c1410;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
    box-shadow: 0 6px 14px -8px rgba(28,20,16,.7);
  }
  .m-head-text { min-width: 0; }
  .m-head-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }
  .m-head-title {
    font-family: var(--font-serif);
    font-size: 25px;
    font-weight: 700;
    line-height: 1.05;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- Floating tab bar ---- */
  .m-tabbar {
    display: flex;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    max-width: 440px;
    margin: 0 auto;
    z-index: 250;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    background: rgba(40,29,21,.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid #3a2c20;
    border-radius: 999px;
    box-shadow: 0 14px 32px -6px rgba(28,20,16,.55);
  }
  html.m-locked .m-tabbar { z-index: 390; }

  .m-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 48px;
    min-width: 48px;
    padding: 0 13px;
    border: none;
    border-radius: 999px;
    background: none;
    color: #a8957a;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s, transform .15s;
  }
  .m-tab hi-icon { font-size: 19px; }
  .m-tab span { display: none; }
  .m-tab.active { background: var(--primary); color: #1c1410; }
  .m-tab.active span { display: inline; }
  .m-tab:hover { text-decoration: none; }
  .m-tab:active { transform: scale(.94); }

  /* Action button: a lone dark button floating above the bar's right end */
  .m-fab {
    display: flex;
    position: fixed;
    right: 20px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 250;
    width: 58px;
    height: 58px;
    border: 1px solid #5a4430;
    border-radius: 20px;
    padding: 0;
    background: linear-gradient(160deg, #3a2a1e, #1c1410);
    color: #e2c48e;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 14px 28px -8px rgba(28,20,16,.6), inset 0 1px 0 rgba(255,255,255,.08);
    transition: transform .15s;
  }
  html.m-locked .m-fab { z-index: 390; }
  html.m-locked .m-fab:not(.open) { opacity: 0; pointer-events: none; }
  .m-fab span { display: flex; transition: transform .25s ease; }
  .m-fab:active { transform: scale(.94); }
  .m-fab.open span { transform: rotate(45deg); }

  /* Moving between pages: the tab bar and + button stay put while the page
     content fades across, like switching tabs in a native app */
  @view-transition { navigation: auto; }
  .m-tabbar { view-transition-name: m-tabbar; }
  .m-fab    { view-transition-name: m-fab; }

  /* ---- Sheets ---- */
  .m-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 380;
    background: rgba(28,20,16,.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .m-overlay.open { opacity: 1; pointer-events: auto; }

  .m-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 385;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    border-radius: 28px 28px 0 0;
    padding: 10px 18px calc(104px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(0,0,0,.18);
    transform: translateY(105%);
    transition: transform .32s cubic-bezier(.2,.8,.2,1);
  }
  .m-sheet.open { transform: none; }
  /* Leave room for the floating button, which turns into the close button */
  .m-action-sheet { padding-bottom: calc(166px + env(safe-area-inset-bottom)); }

  .m-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 2px auto 16px;
  }
  .m-sheet-title {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.05;
    color: var(--text-primary);
  }
  .m-sheet-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 6px 0 18px;
  }
  .m-sheet-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 18px 2px 8px;
  }

  .m-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .m-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-height: 108px;
    padding: 14px 12px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: transform .15s;
  }
  .m-tile:active { transform: scale(.96); }
  .m-tile-ic {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--primary-bg);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }
  .m-tile.main {
    background: linear-gradient(160deg, #2e2116, #1c1410);
    border-color: #1c1410;
    color: #f3e9d8;
  }
  .m-tile.main .m-tile-ic {
    background: linear-gradient(145deg, #d9bc84, #a07840);
    color: #fff;
  }

  .m-more-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 2px 4px;
  }
  .m-more-user .mbn-avatar { width: 48px; height: 48px; font-size: 1rem; }
  .m-more-user .name  { font-weight: 800; font-size: 16px; }
  .m-more-user .email { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .m-more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .m-more-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 6px 12px;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: transform .15s;
  }
  .m-more-tile:hover { text-decoration: none; }
  .m-more-tile:active { transform: scale(.96); }
  .m-more-ic {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }
  .m-more-tile.active { border-color: var(--primary); }
  .m-more-tile.active .m-more-ic { background: var(--primary); color: #1c1410; }

  .m-signout {
    margin-top: 18px;
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 16px;
    border: 1px solid var(--error-border);
    background: var(--error-bg);
    color: var(--error);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }
  .m-signout hi-icon { font-size: 18px; }
}

/* ============================================================
   WEDDING SWITCHER (sidebar)
   ============================================================ */

.sidebar-wedding.switchable {
  cursor: pointer;
  position: relative;
  padding-right: 32px;
  transition: background var(--transition);
}
.sidebar-wedding.switchable:hover { background: #34271c; }

.sidebar-wedding-switch-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--sidebar-muted);
  font-size: 13px;
  pointer-events: none;
}

.wedding-switch-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #2a2018;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 250;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.wedding-switch-menu.open { display: block; }

.wedding-switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--sidebar-border);
}
.wedding-switch-item:last-child { border-bottom: none; }
.wedding-switch-item:hover { background: var(--primary-dark); }
.wedding-switch-item.active { background: var(--sidebar-active-bg); }

.wedding-switch-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wedding-switch-role {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-muted);
  flex-shrink: 0;
}
.wedding-switch-item.active .wedding-switch-role { color: var(--primary-light); }

/* ============================================================
   NOTIFICATION BELL
   ============================================================ */

.notif-wrap { position: relative; }

.notif-bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.notif-bell:hover { background: var(--bg-muted); color: var(--text-primary); }

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--error);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}
.notif-badge.hidden { display: none; }

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  display: none;
}
.notif-panel.open { display: block; }

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-panel-title { font-weight: 600; font-size: 0.9rem; }

.notif-list { max-height: 380px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: inherit;
}
.notif-item:hover { background: var(--bg-muted); text-decoration: none; }
.notif-item.unread { background: var(--primary-bg); }
.notif-item.unread:hover { background: var(--primary-light); }

.notif-item-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 5px;
}
.notif-item.read .notif-item-dot { background: transparent; }

.notif-item-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.notif-item-body  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.notif-item-time  { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }

.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ============================================================
   GETTING STARTED CHECKLIST
   ============================================================ */

.gs-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }

.gs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.gs-item:last-child { border-bottom: none; }
.gs-item:hover { background: var(--bg-muted); text-decoration: none; }
.gs-item.done { opacity: 0.55; pointer-events: none; }

.gs-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.gs-item.done .gs-check {
  background: #16a34a;
  border-color: #16a34a;
}

.gs-label { font-weight: 600; font-size: 0.875rem; }
.gs-hint  { font-size: 0.775rem; color: var(--text-muted); margin-top: 1px; }

/* ============================================================
   TRIAL DAYS CHIP
   ============================================================ */

.trial-chip-wrap { position: relative; display: flex; align-items: center; }

.trial-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #c9a96e 0%, #a07840 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: default;
  user-select: none;
  white-space: nowrap;
  border: none;
  box-shadow: 0 2px 8px rgba(160,120,64,0.30), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: box-shadow var(--transition), transform var(--transition);
}
.trial-chip:hover { box-shadow: 0 4px 14px rgba(160,120,64,0.40); transform: translateY(-1px); }

.trial-chip-tooltip {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 310;
  display: none;
  pointer-events: none;
}
.trial-chip-wrap:hover .trial-chip-tooltip,
.trial-chip-wrap.open    .trial-chip-tooltip { display: block; pointer-events: auto; }

.trial-chip-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 18px;
  width: 9px;
  height: 9px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.trial-chip-tooltip-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a07840;
  margin-bottom: 6px;
}
.trial-chip-tooltip-days {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 2px;
}
.trial-chip-tooltip-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.trial-chip-tooltip-body {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.trial-chip-tooltip-body a { color: var(--primary); font-weight: 600; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform 0.1s ease;
  white-space: nowrap;
  text-decoration: none !important;
}

.btn:active { transform: scale(0.98); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border);
  border-color: var(--border);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--primary-dark);
  border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-bg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 4px;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239e8e7e' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
}

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control {
  border-radius: 0;
  flex: 1;
}
.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.input-prefix {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-body {
  padding: 20px 24px;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================================================
   STAT CARDS
   ============================================================ */

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-sm); }

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-num);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-sub {
  font-family: var(--font-num);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-icon.gold   { background: var(--primary-bg); }
.stat-icon.green  { background: var(--success-bg); }
.stat-icon.red    { background: var(--error-bg); }
.stat-icon.blue   { background: var(--info-bg); }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-meta {
  font-family: var(--font-num);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-bg); }

tbody td {
  padding: 12px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.table-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.table-empty-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  border-radius: 0 0 var(--radius) var(--radius);
  gap: 12px;
}

.pagination-info {
  font-family: var(--font-num);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-num);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-bg);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid var(--error-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid var(--info-border); }
.badge-gold    { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid var(--primary-light); }
.badge-muted   { background: var(--bg-muted);   color: var(--text-muted);   border: 1px solid var(--border); }

/* ============================================================
   DRAWERS
   ============================================================ */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  backdrop-filter: blur(2px);
}
.drawer-overlay.show { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-card);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-xl);
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
}

.drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 20px;
  transition: background var(--transition), color var(--transition);
}
.drawer-close:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-card);
}

@media (max-width: 520px) {
  .drawer { width: 100vw; }
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 640px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 24px 24px 0;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Confirm delete modal */
.confirm-modal .modal-body {
  text-align: center;
  padding: 24px;
}
.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--error-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
}
.confirm-message {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* ============================================================
   TOASTS
   ============================================================ */

#toastContainer {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  background: var(--bg-card);
  border-left: 4px solid;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--error); }
.toast-warning { border-color: var(--warning); }
.toast-info    { border-color: var(--info); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */

.progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.5s ease;
}

.progress-fill.success { background: linear-gradient(90deg, #4ade80, var(--success)); }
.progress-fill.warning { background: linear-gradient(90deg, #fbbf24, var(--warning)); }
.progress-fill.danger  { background: linear-gradient(90deg, #f87171, var(--error)); }

/* ============================================================
   SEARCH + FILTER BAR
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box input {
  width: 100%;
  padding: 9px 13px 9px 36px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}
.search-box input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

/* ============================================================
   SETTINGS LAYOUT
   ============================================================ */

.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: calc(var(--header-height) + 16px);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-bottom: 1px solid var(--border);
}
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover { background: var(--bg-muted); color: var(--text-primary); }
.settings-nav-item.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 600;
}

/* Mobile settings: drill-down list → detail screen with back button */
.settings-back-btn { display: none; }

@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  /* Nav becomes a vertical list of rows with chevrons */
  .settings-nav {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .settings-nav { border-radius: 20px; }
  .settings-nav-item {
    justify-content: flex-start;
    gap: 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px;
  }
  .settings-nav-item hi-icon { font-size: 1.15rem; color: var(--primary-dark); }
  .settings-nav-item::after {
    content: '›';
    margin-left: auto;
    font-size: 1.3rem;
    color: var(--text-muted);
    line-height: 1;
  }
  /* In list mode nothing is "selected" yet */
  .settings-layout:not(.detail-open) .settings-nav-item.active { background: none; color: var(--text-primary); }

  /* List mode: hide every panel, show the list */
  .settings-layout:not(.detail-open) .settings-panel { display: none !important; }
  /* Detail mode: hide the list, show the back button + active panel */
  .settings-layout.detail-open .settings-nav { display: none; }
  .settings-layout.detail-open .settings-back-btn { display: inline-flex; }

  .settings-back-btn {
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
  }
}

/* ============================================================
   WELCOME MODAL STEPS
   ============================================================ */

.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}

.welcome-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.welcome-step:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  text-decoration: none;
}

.welcome-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.welcome-step-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.welcome-step-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   TASK / MILESTONE ITEMS
   ============================================================ */

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: box-shadow var(--transition);
}
.task-item:hover { box-shadow: var(--shadow-sm); }

.task-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.task-info { flex: 1; min-width: 0; }
.task-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}
.task-title.done {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.milestone-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: box-shadow var(--transition);
}
.milestone-item:hover { box-shadow: var(--shadow-sm); }
.milestone-item.completed { opacity: 0.65; }

.milestone-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  flex-shrink: 0;
  margin-top: 3px;
}
.milestone-item.completed .milestone-dot {
  background: var(--success);
  border-color: var(--success);
}

/* ============================================================
   COPY LINK WIDGET
   ============================================================ */

.copy-link-box {
  display: flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.copy-link-url {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: 'Courier New', monospace;
}

.copy-link-btn {
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}
.copy-link-btn:hover { background: var(--primary-dark); }

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.auth-art {
  flex: 1;
  background: linear-gradient(160deg, #1c1410 0%, #2e1f14 50%, #1c1410 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.auth-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 60% 40%, rgba(201,169,110,0.15) 0%, transparent 60%);
}

.auth-art-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.auth-art-logo {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.auth-art-tagline {
  font-size: 1.125rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 48px;
}

.auth-art-decoration {
  font-size: 5rem;
  opacity: 0.15;
  position: absolute;
  bottom: 40px;
  right: 40px;
}

.auth-form-side {
  width: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  background: var(--bg-card);
}

.auth-form-header {
  margin-bottom: 32px;
}

.auth-form-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-form-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.auth-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary-dark);
  font-weight: 600;
}

@media (max-width: 900px) {
  .auth-art { display: none; }
  .auth-form-side {
    width: 100%;
    padding: 32px 24px;
  }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero {
  padding: 80px 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--bg) 100%);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--text-primary);
  max-width: 720px;
  margin: 0 auto 20px;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.features-section {
  padding: 80px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.features-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.feature-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.landing-footer {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 40px 48px;
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .landing-nav { padding: 0 20px; }
  .hero { padding: 60px 20px; }
  .features-section { padding: 60px 20px; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   VENDOR STATUS PILLS
   ============================================================ */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending   { background: var(--warning-bg);  color: var(--warning); }
.status-confirmed { background: var(--success-bg); color: var(--success); }
.status-cancelled { background: var(--error-bg);   color: var(--error); }
.status-in_progress { background: var(--info-bg);  color: var(--info); }
.status-completed { background: var(--success-bg); color: var(--success); }

/* ============================================================
   SPINNER / LOADER
   ============================================================ */

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================
   INLINE ALERT
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-error   { background: var(--error-bg);   border-color: var(--error-border);   color: var(--error); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }

/* ============================================================
   ACCORDION (budget categories)
   ============================================================ */

.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--bg-card);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.accordion-header:hover { background: var(--primary-bg); }

.accordion-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.accordion-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.accordion-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.accordion-item.open .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  display: none;
  padding: 0 20px 16px;
  border-top: 1px solid var(--border);
}
.accordion-item.open .accordion-body { display: block; }

/* ============================================================
   PLEDGE PUBLIC PAGE
   ============================================================ */

.pledge-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #1c1410 0%, #2e1f14 40%, #f9f7f4 40%);
  padding-top: 48px;
}

.pledge-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 520px;
  margin: 0 auto 40px;
  overflow: hidden;
}

.pledge-card-hero {
  background: linear-gradient(135deg, #1c1410, #3a2a1e);
  padding: 40px 36px;
  text-align: center;
  position: relative;
}

.pledge-couple-names {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.pledge-wedding-info {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
}

.pledge-form-body {
  padding: 32px 36px;
}

.pledge-success {
  text-align: center;
  padding: 48px 36px;
}

.pledge-success-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.pledge-success-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pledge-success-message {
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   PWA "Add to Home Screen" hint (iOS Safari)
   ============================================================ */
.a2hs-hint {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10001;
  animation: a2hs-in 0.3s ease;
}
/* Sit above the mobile bottom nav when it's present. */
@media (max-width: 768px) {
  .a2hs-hint { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
.a2hs-hint.a2hs-hide { opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease; }
.a2hs-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 14px;
  background: #241810;
  color: #f3e9db;
  border: 1px solid rgba(201,169,110,0.35);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}
.a2hs-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.a2hs-text { font-size: 0.85rem; line-height: 1.35; flex: 1; }
.a2hs-text strong { color: #fff; font-weight: 700; }
.a2hs-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(243,233,219,0.6);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.a2hs-close:hover { color: #fff; }
@keyframes a2hs-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   MOBILE APP LAYOUT (<= 768px)
   Turns the desktop pages into a phone app: native header, cards
   instead of tables, bottom sheets instead of side drawers and
   centred modals, thumb-sized controls. Desktop is untouched.
   ============================================================ */
@media (max-width: 768px) {
  html, body { background: var(--bg); }
  body { -webkit-tap-highlight-color: transparent; }

  .sidebar, .sidebar-overlay, .hamburger-btn, .app-header-wedding { display: none !important; }
  .main-content { margin-left: 0 !important; min-width: 0; max-width: 100vw; }
  body.has-m-tabbar .main-content { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  body.has-m-fab .main-content { padding-bottom: calc(168px + env(safe-area-inset-bottom)); }

  /* ---- Header: translucent, big serif title ---- */
  body.has-m-tabbar .app-header {
    height: auto;
    min-height: 0;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    gap: 10px;
    justify-content: flex-start;
    background: rgba(249,247,244,.9);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid rgba(229,221,212,.6);
  }
  body.has-m-tabbar .app-header .header-title,
  body.has-m-tabbar #headerWeddingName { display: none !important; }
  .app-header .header-actions { flex-shrink: 0; gap: 8px; }
  .app-header .header-actions .btn-secondary { display: none; }

  /* The page's own add button becomes a round "+" next to the bell */
  body.has-m-tabbar .app-header .header-actions .btn-primary {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    gap: 0;
    background: #1c1410;
    border-color: #1c1410;
    color: #e8d5b0;
  }
  body.has-m-tabbar .app-header .header-actions .btn-primary::before {
    content: '+';
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    margin-top: -2px;
  }
  .notif-bell {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
  }
  .notif-badge { top: 1px; right: 1px; }
  .notif-panel {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 20px;
  }
  body.has-m-tabbar:not([data-page="dashboard"]) .trial-chip-wrap { display: none; }

  /* ---- Page ---- */
  .page-body { padding: 14px 16px 8px !important; }
  .page-heading { font-size: 1.5rem; }
  .page-subheading { margin-bottom: 16px; }

  .card { border-radius: 20px; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 14px 16px; }
  .card-title { font-size: 1rem; }

  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .grid-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
  /* Paired form fields stack: keep the same rhythm as single fields */
  .grid-2:has(> .form-group) { row-gap: 16px !important; margin-bottom: 16px; }
  .grid-2 > .form-group { margin-bottom: 0; }
  .mb-6 { margin-bottom: 16px; }
  .mt-6 { margin-top: 16px; }

  .stat-card { padding: 14px; border-radius: 18px; min-width: 0; }
  .stat-icon { width: 34px; height: 34px; font-size: 17px; margin-bottom: 10px; border-radius: 11px; }
  .stat-label { font-size: 0.68rem; margin-bottom: 4px; }
  .stat-value { font-size: 1.15rem; overflow-wrap: anywhere; }
  .stat-sub { font-size: 0.72rem; }

  /* ---- Tabs become scrolling pills ---- */
  .tabs, .tab-bar {
    display: flex;
    flex-wrap: nowrap;
    border-bottom: none;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px 16px;
    padding: 2px 16px;
  }
  .tabs::-webkit-scrollbar, .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    margin: 0;
    padding: 9px 15px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    font-size: 13px;
    font-weight: 700;
  }
  .tab-btn.active { background: #1c1410; border-color: #1c1410; color: #e8d5b0; }

  /* ---- Search + filters ---- */
  .toolbar { gap: 8px; }
  .card-body input[type="search"].form-control { max-width: none !important; flex: 1 1 100%; }
  .search-box { flex: 1 1 100%; min-width: 0; }
  .search-box input { padding: 12px 14px 12px 40px; border-radius: 14px; }
  .search-icon { left: 14px; }
  .toolbar > select.form-control,
  .toolbar > .form-control { flex: 1 1 0; min-width: 0; width: auto !important; }

  /* ---- Forms: no iOS zoom, thumb-sized ---- */
  input, select, textarea, .form-control, .search-box input { font-size: 16px !important; }
  .form-control { min-height: 46px; border-radius: 12px; }
  textarea.form-control { min-height: 90px; }
  .btn:not(.btn-sm):not(.btn-icon) { min-height: 46px; border-radius: 14px; }
  .btn-sm { min-height: 36px; }

  /* ---- Tables become a stack of cards ---- */
  .card:has(> .table-wrapper),
  .card:has(> .card-body > .table-wrapper) {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .card:has(> .table-wrapper) > .card-header,
  .card:has(> .table-wrapper) > .card-body {
    padding-left: 0;
    padding-right: 0;
    border-bottom: none;
  }
  .card:has(> .table-wrapper) > .table-meta { padding: 0 2px !important; }

  .table-wrapper { overflow: visible; border: none; }
  table.m-cards,
  table.m-cards tbody,
  table.m-cards tfoot { display: block; width: 100%; }
  table.m-cards thead { display: none; }
  table.m-cards tr {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    margin: 0 0 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
  }
  table.m-cards tr:hover td { background: transparent; }
  table.m-cards td {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 6px 0 !important;
    border: none !important;
    font-size: 14px;
    text-align: right !important;
    white-space: normal;
    width: auto !important;
  }
  table.m-cards td::before {
    content: attr(data-label);
    flex-shrink: 0;
    max-width: 45%;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
  }
  table.m-cards td[data-label=""]::before,
  table.m-cards td.m-title::before,
  table.m-cards td.m-act::before,
  table.m-cards td.m-full::before { content: none; }
  table.m-cards td.m-title {
    display: block;
    padding: 4px 0 10px !important;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border) !important;
    font-size: 15.5px;
    font-weight: 700;
    text-align: left !important;
  }
  table.m-cards td.m-lead {
    grid-column: 1;
    align-self: start;
    padding: 4px 0 0 !important;
  }
  table.m-cards td.m-lead + td.m-title { grid-column: 2; }
  table.m-cards td.m-act {
    justify-content: flex-end;
    padding-top: 8px !important;
    margin-top: 4px;
    border-top: 1px solid var(--border) !important;
  }
  table.m-cards td.m-act:empty { display: none; }
  table.m-cards td.m-full { display: block; text-align: center !important; }
  table.m-cards tr:has(> td.m-full:only-child) {
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  table.m-cards tfoot tr { background: var(--bg-muted); }
  .table-actions .btn-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--bg-muted); }

  /* ---- Drawers become bottom sheets ---- */
  .drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100%;
    height: auto;
    max-height: calc(100% - 24px - env(safe-area-inset-top));
    border-radius: 26px 26px 0 0;
    transform: translateY(105%);
    transition: transform .32s cubic-bezier(.2,.8,.2,1);
  }
  .drawer.open { transform: none; }
  .drawer::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--border);
  }
  .drawer-header { padding: 24px 18px 10px; border-bottom: none; }
  .drawer-title { font-size: 1.6rem; font-weight: 700; }
  .drawer-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-muted); }
  .drawer-body { padding: 6px 18px 18px; min-height: 0; }
  .drawer-footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .drawer-footer .btn { flex: 1; min-height: 52px; border-radius: 16px; font-size: 15px; }
  .drawer-footer .btn-primary,
  .modal-footer .btn-primary {
    flex: 2;
    background: linear-gradient(145deg, #d9bc84, #a07840);
    border-color: transparent;
    box-shadow: 0 8px 18px -8px rgba(160,120,64,.85);
  }

  /* ---- Modals become bottom sheets ---- */
  .modal-overlay.show { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: mSheetUp .3s cubic-bezier(.2,.8,.2,1);
  }
  .modal-header { padding: 24px 18px 0; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 0 18px 18px; flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; min-height: 50px; border-radius: 16px; }

  /* ---- Toasts drop from the top ---- */
  #toastContainer {
    top: calc(10px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
  }
  .toast {
    min-width: 0;
    max-width: none;
    border-radius: 16px;
    transform: translateY(-140%);
  }
  .toast.show { transform: none; }

  /* ---- Bits and pieces ---- */
  .a2hs-hint { bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
  body.has-m-fab .a2hs-hint { bottom: calc(162px + env(safe-area-inset-bottom)) !important; }
  .plan-expired-banner { margin: 10px 16px 0; border-radius: 16px; }
  .pagination { flex-wrap: wrap; justify-content: center; }
  .accordion-item, .accordion { border-radius: 18px; }

  /* ---- Budget hero ---- */
  .b-hero { padding: 20px 18px !important; }
  .b-hero .grid-4 { gap: 14px 12px !important; }
  .b-hero .grid-4 > div > div:last-child { font-size: 1.12rem !important; overflow-wrap: anywhere; }
  .b-legend { flex-direction: column; gap: 6px !important; }
}

/* Budget legend: the amount sits inline with its label, not as a separate flex item */
.b-legend > span { display: inline-flex; align-items: center; gap: 0 !important; }
.b-legend > span > span:first-child { margin-right: 8px; }

@keyframes mSheetUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

/* ---- Phone home screen (dashboard) + pledge rows ---- */
@media (max-width: 768px) {
  .m-home { margin-bottom: 16px; }
  .m-hero {
    display: block;
    padding: 20px 20px 18px;
    border-radius: 24px;
    background: radial-gradient(120% 140% at 0% 0%, #5a4530 0%, #2a1d13 55%, #1a120c 100%);
    color: #f3e9d8;
    text-decoration: none;
    box-shadow: 0 18px 34px -18px rgba(28,20,16,.8);
  }
  .m-hero:hover { text-decoration: none; }
  .m-hero-top {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #b9a585;
  }
  .m-hero-amt {
    margin: 8px 0 16px;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.05;
    color: #fff;
    overflow-wrap: anywhere;
  }
  .m-hero-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    overflow: hidden;
  }
  .m-hero-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #e8d5b0, #c9a96e);
  }
  .m-hero-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 14px;
    margin-top: 12px;
    font-size: 12.5px;
    color: #cdbb9c;
  }
  .m-hero-legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
  }
  .m-hero-legend i.gold { background: #c9a96e; }

  .m-chips {
    display: flex;
    gap: 8px;
    margin: 14px -16px 4px;
    padding: 2px 16px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .m-chips::-webkit-scrollbar { display: none; }
  .m-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
  }
  .m-chip:hover { text-decoration: none; }
  .m-chip hi-icon { font-size: 16px; color: var(--primary-dark); }
  .m-chip.gold { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary-dark); }

  .m-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 18px 2px 10px;
  }
  .m-sec-head span { font-family: var(--font-serif); font-size: 21px; font-weight: 700; }
  .m-sec-head a { font-size: 13px; font-weight: 700; color: var(--primary-dark); }

  .m-feed, .m-plist {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
  }
  .m-plist { margin-top: 4px; }
  .m-plist:empty { display: none !important; }
  .m-fi, .m-prow {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
  }
  .m-fi:last-child, .m-prow:last-child { border-bottom: none; }
  .m-prow.tappable { cursor: pointer; }
  .m-prow.tappable:active { background: var(--bg-muted); }
  .m-pav {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 800;
  }
  .m-pav.done { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
  .m-pmain { flex: 1; min-width: 0; }
  .m-pname { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-psub { margin-top: 2px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-pright { text-align: right; flex-shrink: 0; }
  .m-pamt { font-size: 15px; font-weight: 800; white-space: nowrap; }
  .m-pstat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
  }
  .m-pstat.pending { background: var(--warning-bg); color: var(--warning); }
  .m-pstat.cleared { background: var(--success-bg); color: var(--success); }
  .m-pdel {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    margin-right: -4px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-muted);
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .m-pdel:active { background: var(--error-bg); color: var(--error); }
  .m-plist .empty-state, .m-feed .empty-state { padding: 28px 16px; }
}

/* Page-to-page fade on phones (see @view-transition in the mobile layout) */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .18s; }
/* The bar and + button swap instantly (no cross-fade), so they never blink */
::view-transition-group(m-tabbar),
::view-transition-group(m-fab),
::view-transition-new(m-tabbar),
::view-transition-new(m-fab) { animation: none; }
::view-transition-old(m-tabbar),
::view-transition-old(m-fab) { display: none; }
