/* MARCHAA Web App — Design System */
/* Light theme: bg #f4f6f9 · card #ffffff · accent #ff5722 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f6f9;
  --card:      #ffffff;
  --card2:     #f8f9fa;
  --border:    #e2e8f0;
  --orange:    #ff5722;
  --orange-h:  #e64a19;
  --orange-bg: #fff3ef;
  --text:      #1a202c;
  --muted:     #64748b;
  --dim:       #94a3b8;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 4px 24px rgba(0,0,0,.08);
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-disp: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Dark Theme Override ──────────────────────── */
[data-theme="dark"] {
  --bg:        #0f1117;
  --card:      #1a1d27;
  --card2:     #22263a;
  --border:    #2d3148;
  --text:      #e8eaf0;
  --muted:     #94a3b8;
  --dim:       #4b5563;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --orange-bg: #2a1a12;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .form-input { background: var(--card2); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-secondary { background: var(--card2); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-google { background: var(--card2); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-logout { background: rgba(220,38,38,.15); }
[data-theme="dark"] .auth-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .sidebar { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .topbar { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .stat-card { background: var(--card); }
[data-theme="dark"] .action-card { background: var(--card2); }
[data-theme="dark"] .info-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .profile-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .consent-box { background: rgba(37,99,235,.1); border-color: #1e3a5f; }
[data-theme="dark"] .address-item { background: var(--card2); border-color: var(--border); }
[data-theme="dark"] .tab-btn { background: var(--card2); color: var(--muted); }
[data-theme="dark"] .tab-btn.active { background: var(--card); color: var(--text); }
[data-theme="dark"] select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); }

body { background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 1.6; min-height: 100vh; overflow-x: hidden; }
img { max-width: 100%; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ──────────────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-disp); font-weight: 800; color: var(--text); line-height: 1.3; }

/* ── Alerts ──────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ── Buttons ─────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--orange); color: #fff;
  padding: 13px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; border: none; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--orange-h); text-decoration: none; }
.btn-primary:active { transform: scale(.98); }
.btn-primary.btn-full { width: 100%; justify-content: center; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--text);
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: 1.5px solid var(--border); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--orange); background: var(--orange-bg); text-decoration: none; }

.btn-danger-sm {
  background: #fef2f2; color: #dc2626;
  padding: 6px 10px; border-radius: 8px;
  font-size: 13px; border: 1px solid #fecaca; cursor: pointer;
}
.btn-danger-sm:hover { background: #fee2e2; }

.btn-link { background: none; border: none; color: var(--orange); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn-logout { width: 100%; background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.btn-logout:hover { background: #fee2e2; }

/* ── Google Button ───────────────────────────── */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 20px; font-size: 14px; font-weight: 600;
  width: 100%; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.btn-google:hover { border-color: #4285F4; box-shadow: 0 2px 8px rgba(66,133,244,.15); text-decoration: none; }
.google-icon { flex-shrink: 0; }

/* ── Forms ───────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.form-label-link { font-size: 11px; font-weight: 600; color: var(--orange); }

.form-input {
  background: #fff; border: 1.5px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; font-family: var(--font-sans);
  width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,87,34,.1); }
.form-input::placeholder { color: var(--dim); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-input { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.input-password-wrap { position: relative; }
.input-password-wrap .form-input { padding-right: 44px; }
.toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; opacity: .6; }
.toggle-pw:hover { opacity: 1; }

.checkbox-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 12px; color: var(--muted); line-height: 1.5; }
.checkbox-label input { margin-top: 2px; accent-color: var(--orange); width: 14px; height: 14px; flex-shrink: 0; }

/* ── Avatar Grid ─────────────────────────────── */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-option { position: relative; cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.avatar-emoji {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; font-size: 24px;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, transform .1s, box-shadow .15s;
}
.avatar-option input:checked + .avatar-emoji { border-color: var(--orange); transform: scale(1.1); }
.avatar-emoji:hover { border-color: var(--orange); }

/* ── Consent Box ─────────────────────────────── */
.consent-box {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.consent-header { display: flex; gap: 12px; align-items: flex-start; }
.consent-icon { font-size: 24px; flex-shrink: 0; }
.consent-header strong { display: block; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.consent-header p { font-size: 12px; color: var(--muted); margin: 0; }

/* ── Auth Layout ─────────────────────────────── */
.auth-body { display: flex; flex-direction: column; min-height: 100vh; background: linear-gradient(135deg,#fff8f6 0%,#f4f6f9 100%); }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 48px 16px 80px; }

/* Logo above auth cards */
.auth-logo-top { text-align: center; margin-bottom: 28px; }
.auth-logo-top a { display: inline-block; text-decoration: none; }
.auth-logo-text { font-family: var(--font-disp); font-size: 28px; font-weight: 900; color: var(--orange); letter-spacing: .04em; }
.auth-footer { text-align: center; padding: 20px 24px; border-top: 1px solid var(--border); font-size: 11px; color: var(--dim); background: #fff; }
.auth-footer a { color: var(--muted); }

.brand { display: flex; align-items: center; gap: 8px; width: fit-content; text-decoration: none; }
.brand-tagline { font-size: 9px; font-weight: 800; color: var(--orange); letter-spacing: .15em; text-transform: uppercase; }
.brand-name { font-family: var(--font-disp); font-size: 22px; font-weight: 900; color: var(--text); letter-spacing: .02em; }
.brand-beta { font-size: 9px; font-weight: 600; color: var(--dim); letter-spacing: .1em; font-family: var(--font-mono); }

.auth-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 24px; padding: 36px 32px;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.auth-card-wide { max-width: 560px; }
@media (max-width: 480px) { .auth-card { padding: 24px 18px; border-radius: 16px; } }

.auth-card-icon { font-size: 40px; text-align: center; }
.auth-title { font-size: 24px; text-align: center; color: var(--text); }
.auth-subtitle { font-size: 13px; color: var(--muted); text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-link { font-size: 13px; color: var(--muted); text-align: center; }
.auth-extra { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--muted); }
.otp-input { text-align: center; font-size: 24px; font-family: var(--font-mono); letter-spacing: .4em; }
.inline-form { display: inline; }

/* ── App Shell Layout ────────────────────────── */
.app-body { display: flex; background: var(--bg); min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
  transition: transform .25s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,.04);
}
.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.brand-name-sm { font-family: var(--font-disp); font-size: 18px; font-weight: 900; color: var(--orange); }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-item:hover, .nav-item.active { background: var(--orange-bg); color: var(--orange); text-decoration: none; }
.nav-item.active { color: var(--orange); font-weight: 700; }
.nav-item-admin { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 29; }

/* App shell */
.app-shell { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar */
.topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow);
}
.menu-toggle { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; display: none; padding: 6px; line-height: 1; }
.topbar-brand { display: none; font-family: var(--font-disp); font-weight: 900; font-size: 18px; color: var(--orange); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-avatar { font-size: 22px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Page content */
.page-content { flex: 1; padding: 28px 28px 60px; max-width: 900px; width: 100%; }

/* ── Page elements ───────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.page-subtitle { color: var(--muted); margin-top: 4px; font-size: 13px; }
.section-header { margin: 28px 0 14px; }
.section-header h2 { font-size: 16px; }
.section-title { font-size: 15px; margin-bottom: 20px; }
.mt-6 { margin-top: 24px; } .mb-3 { margin-bottom: 12px; }
.text-sm { font-size: 13px; } .font-semibold { font-weight: 600; } .text-gray-300 { color: var(--muted); } .text-gray-400 { color: var(--dim); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; text-align: center; box-shadow: var(--shadow); }
.stat-icon { font-size: 24px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-disp); font-size: 24px; font-weight: 900; color: var(--orange); }
.stat-label { font-size: 11px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

/* Actions */
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.action-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 14px;
  text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.action-card:hover { border-color: var(--orange); box-shadow: var(--shadow); text-decoration: none; }
.action-icon { font-size: 26px; flex-shrink: 0; }
.action-text strong { display: block; font-size: 13px; color: var(--text); font-weight: 700; }
.action-text span { font-size: 11px; color: var(--muted); }
.action-arrow { margin-left: auto; color: var(--dim); font-size: 16px; }

/* Info Card */
.info-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.info-value { font-size: 13px; color: var(--text); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-green  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(255,87,34,.2); }

/* Profile Card */
.profile-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.profile-avatar-section { text-align: center; margin-bottom: 24px; }
.profile-avatar-large { font-size: 64px; margin-bottom: 8px; }
.profile-avatar-name { font-family: var(--font-disp); font-weight: 800; font-size: 20px; color: var(--text); }
.profile-avatar-email { font-size: 12px; color: var(--muted); margin-top: 2px; }

.profile-form { display: flex; flex-direction: column; gap: 16px; }

/* Tabs */
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; flex-wrap: wrap; }
.tab-btn { flex: 1; min-width: 100px; padding: 9px 14px; border-radius: 8px; font-size: 12px; font-weight: 700; border: none; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.tab-btn.active { background: var(--orange); color: #fff; }
.tab-btn:hover:not(.active) { background: #fff; color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Address List */
.address-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.address-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
.address-default { border-color: rgba(255,87,34,.4); background: var(--orange-bg); }
.address-info strong { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.address-info p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty-state { color: var(--dim); font-size: 13px; padding: 20px 0; }

/* Toggles (notification settings) */
.toggle-list { display: flex; flex-direction: column; gap: 0; }
.toggle-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.toggle-item:last-child { border-bottom: none; }
.toggle-item strong { display: block; font-size: 14px; color: var(--text); }
.toggle-item p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch-slider::before { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: transform .2s; }
.switch input:checked + .switch-slider { background: var(--orange); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* Security section */
.security-info { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.security-info h4 { font-size: 14px; margin-bottom: 6px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .app-shell { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar-brand { display: block; }
  .hidden-sm { display: none; }
  .page-content { padding: 20px 16px 60px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
  .tab-bar { gap: 2px; }
  .tab-btn { font-size: 11px; padding: 8px 10px; min-width: 80px; }
  .profile-card { padding: 20px 16px; }
  .auth-card { padding: 20px 14px; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Milestone 3 Utilities ──────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }

/* Tabs */
.tabs-bar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.tab-link { padding: 8px 16px; border-radius: 8px 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px; transition: all .15s; }
.tab-link:hover { color: var(--text); background: var(--bg); }
.tab-link.active { color: var(--orange); background: var(--card); border-color: var(--border); }
.badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; padding: 0 5px; margin-left: 4px; }

/* Badges extended */
.badge-red  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-gray { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* Tables */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

/* Listings grid */
.listings-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 20px; }
.listing-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

/* Button sizes */
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-danger { background: #dc2626; color: #fff; border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn-danger:hover { background: #b91c1c; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* req asterisk */
.req { color: #dc2626; }
