/* ContextMesh — app.css — White/Light theme, #990000 brand */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
  --brand:      #990000;
  --brand-h:    #b30000;
  --brand-t:    #ffe6e6;
  --bg:         #ffffff;
  --surface:    #fafafa;
  --surface2:   #f2f2f2;
  --border:     #e5e5e5;
  --border2:    #cccccc;
  --text:       #1a1a1a;
  --muted:      #666666;
  --muted2:     #999999;
  --green:      #16a34a;
  --green-t:    #dcfce7;
  --amber:      #ca8a04;
  --amber-t:    #fef9c3;
  --red:        #dc2626;
  --red-t:      #fee2e2;
  --blue:       #2563eb;
  --blue-t:     #dbeafe;
  --shadow:     0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --radius:     6px;
  --radius-lg:  10px;
  --font:       'Open Sans', sans-serif;
  --teal: #990000;
  --accent: #990000;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-h); }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease;
  white-space: nowrap; text-decoration: none;
}
.btn-primary   { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-h); border-color: var(--brand-h); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline   { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-t); }
.btn-danger    { background: #fff; color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--red-t); }
.btn-ghost     { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; background: #fff; border: 1px solid var(--border2);
  border-radius: var(--radius); font-size: 14px; color: var(--text); transition: border 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(153,0,0,0.1);
}
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body  { padding: 20px; }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 9999px; font-size: 11px; font-weight: 700; text-transform: capitalize;
}
.badge-green  { background: var(--green-t); color: var(--green); }
.badge-amber  { background: var(--amber-t); color: var(--amber); }
.badge-red    { background: var(--red-t); color: var(--red); }
.badge-gray   { background: var(--surface2); color: var(--muted); }
.badge-blue   { background: var(--blue-t); color: var(--blue); }
.badge-brand  { background: var(--brand-t); color: var(--brand); }
.badge-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9999px; font-size: 11px; font-weight: 700;
  background: var(--brand); color: #fff;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px;
  text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--surface2); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; align-items: center; justify-content: center; padding: 16px;
}
.modal.open { display: flex; }
.modal-content {
  background: #fff; border-radius: var(--radius-lg); width: 480px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-header {
  padding: 16px 20px; background: var(--brand); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { color: #fff; font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 22px; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md); animation: slideIn .2s ease; max-width: 320px; }
.toast.success { background: var(--green-t); color: var(--green); border: 1px solid #86efac; }
.toast.error   { background: var(--red-t); color: var(--red); border: 1px solid #fca5a5; }
.toast.default { background: #fff; color: var(--text); border: 1px solid var(--border); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Stat boxes ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card  { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); margin-top: 6px; }
.stat-value.brand, .stat-value.teal, .stat-value.accent { color: var(--brand); }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }

/* ── kv rows ──────────────────────────────────────────────────────────── */
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--surface2); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-row span { color: var(--muted); }
.kv-row strong { color: var(--text); font-weight: 600; }

/* ── Sidebar nav ──────────────────────────────────────────────────────── */
.dash-shell { display: flex; min-height: 100vh; background: var(--surface); }
.dash-sidebar {
  width: 220px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.dash-logo {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-size: 18px; font-weight: 700; color: var(--text); display: block; text-decoration: none;
}
.dash-logo span { color: var(--brand); }
.dash-logo .logo-badge {
  display: inline-block; background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px;
  margin-left: 6px; vertical-align: middle; text-transform: uppercase;
}
.dash-nav { padding: 8px 0; flex: 1; }
.dash-nav-section { padding: 10px 16px 3px; font-size: 10px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none;
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
  transition: all .12s ease; border-left: 3px solid transparent;
}
.nav-item svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.nav-item:hover { background: var(--brand-t); color: var(--brand); }
.nav-item:hover svg { stroke: var(--brand); }
.nav-item.active { background: var(--brand-t); color: var(--brand); font-weight: 700; border-left-color: var(--brand); }
.nav-item.active svg { stroke: var(--brand); }
.nav-item .nav-badge { margin-left: auto; }
.dash-footer { padding: 16px; border-top: 1px solid var(--border); }
.dash-footer a, .dash-footer button {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  font-size: 13px; color: var(--muted); text-decoration: none; background: none; border: none;
  cursor: pointer; width: 100%; font-family: var(--font);
}
.dash-footer a:hover, .dash-footer button:hover { color: var(--brand); }
.dash-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dash-topbar {
  background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.dash-topbar h1 { font-size: 16px; font-weight: 700; color: var(--text); }
.dash-content { padding: 24px; flex: 1; }

/* ── Content sections (hidden by default, shown by adminNav) ──────────── */
[id$="-content"] { display: none; }

/* ── Spinner ──────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ── Global site header ───────────────────────────────────────────────── */
.site-header {
  background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 200;
}
.site-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; height: 64px; gap: 32px;
}
.site-logo { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; }
.site-logo span { color: var(--brand); }
.site-nav { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.site-nav a {
  padding: 6px 12px; font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; border-radius: var(--radius); transition: all .12s;
}
.site-nav a:hover { background: var(--brand-t); color: var(--brand); }
.site-nav a.active { color: var(--brand); font-weight: 700; border-bottom: 2px solid var(--brand); border-radius: 0; }
.site-nav .btn { margin-left: 8px; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer { background: #111; color: #ccc; padding: 40px 0 24px; }
.site-footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-footer a { color: #aaa; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 32px; margin-bottom: 32px; }
.site-footer-col h4 { color: #fff; font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.site-footer-col a { display: block; font-size: 13px; margin-bottom: 6px; }
.site-footer-bottom { border-top: 1px solid #333; padding-top: 20px; font-size: 12px; color: #666; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── Misc utilities ───────────────────────────────────────────────────── */
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.mt-4  { margin-top: 16px; }
.text-muted { color: var(--muted); font-size: 13px; }
.text-brand { color: var(--brand); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }

/* ── FAQ accordion ────────────────────────────────────────────────────── */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.faq-q {
  width: 100%; background: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; font-size: 15px; font-weight: 600; color: var(--text); text-align: left;
  transition: background .12s;
}
.faq-q:hover { background: var(--brand-t); }
.faq-q .faq-icon { font-size: 20px; color: var(--brand); flex-shrink: 0; transition: transform .2s; }
.faq-q.open .faq-icon { transform: rotate(45deg); }
.faq-a { display: none; padding: 0 20px 16px; font-size: 14px; color: var(--muted); line-height: 1.7; background: #fff; }
.faq-a.open { display: block; }

/* ── Login/register ───────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 40px; width: 420px; max-width: 100%; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo a { font-size: 24px; font-weight: 700; color: var(--text); text-decoration: none; }
.auth-logo span { color: var(--brand); }
.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }

/* Responsive */
@media (max-width: 768px) {
  .dash-sidebar { display: none; }
  .site-nav { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}



/* ── Dashboard sections ── */
.dash-section { display: none; }
.dash-section.active { display: block; }

/* ── Sidebar footer (dash-sidebar-footer) ── */
.dash-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-sidebar-footer a, .dash-sidebar-footer button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--muted);
  text-decoration: none; background: none; border: none;
  cursor: pointer; width: 100%; font-family: var(--font);
  border-radius: var(--radius); transition: all .12s;
}
.dash-sidebar-footer a:hover, .dash-sidebar-footer button:hover {
  background: var(--brand-t); color: var(--brand);
}
.dash-sidebar-footer svg { width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;flex-shrink:0 }

/* ── Sidebar user info ── */
.dash-user-info {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.dash-user-name { font-size: 13px; font-weight: 700; color: var(--text); }
.dash-user-role {
  display: inline-flex; align-items: center; margin-top: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--brand); letter-spacing: .05em;
}

/* ── Admin Panel link in sidebar ── */
.admin-panel-link {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 12px; padding: 8px 12px;
  background: var(--brand-t); color: var(--brand);
  font-size: 12px; font-weight: 700; text-decoration: none;
  border-radius: var(--radius); border: 1px solid #fca5a5;
  transition: all .12s;
}
.admin-panel-link:hover { background: var(--brand); color: #fff; }
.admin-panel-link svg { width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2 }

/* ── Role selector cards (register) ── */
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.role-card {
  border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; cursor: pointer; text-align: center; background: #fff; transition: all .15s;
}
.role-card:hover { border-color: var(--brand); background: var(--brand-t); }
.role-card.selected { border-color: var(--brand); background: var(--brand-t); }
.role-card .role-icon { font-size: 28px; margin-bottom: 8px; }
.role-card h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.role-card p { font-size: 12px; color: var(--muted); }

/* ── Legal pages ── */
.legal-wrap { max-width: 760px; margin: 0 auto; padding: 48px 24px; }
.legal-wrap h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.legal-wrap h2 { font-size: 18px; font-weight: 700; margin: 28px 0 8px; color: var(--text); }
.legal-wrap p { font-size: 15px; color: #444; line-height: 1.75; margin-bottom: 12px; }
.legal-wrap ul { padding-left: 24px; margin-bottom: 12px; }
.legal-wrap li { font-size: 15px; color: #444; line-height: 1.75; margin-bottom: 4px; }
.legal-date { font-size: 13px; color: var(--muted); margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

/* ── Topbar stat badge ── */
.topbar-badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  background: var(--brand-t); color: var(--brand);
  border-radius: var(--radius); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ── Currency/Payment settings ── */
.setting-section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.setting-section:last-child { border-bottom: none; }
.setting-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.setting-section .hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.payment-method {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; transition: all .12s;
}
.payment-method:hover { border-color: var(--brand); background: var(--brand-t); }
.payment-method.active { border-color: var(--brand); background: var(--brand-t); }
.payment-method .pm-icon { font-size: 24px; flex-shrink: 0; }
.payment-method h4 { font-size: 13px; font-weight: 700; }
.payment-method p { font-size: 12px; color: var(--muted); }
.currency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 8px; }
.currency-btn {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px;
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .12s;
  font-family: var(--font); text-align: center;
}
.currency-btn:hover { border-color: var(--brand); }
.currency-btn.active { border-color: var(--brand); background: var(--brand-t); color: var(--brand); }
