/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* Variables */
:root {
  --primary: #0056b3;
  --primary-light: #0a84ff;
  --accent: #ff8c00;
  --accent-light: #ff9f0a;
  --bg: #f5f5f7;
  --surface: rgba(255,255,255,0.72);
  --border: rgba(0,0,0,0.08);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --radius-card: 16px;
  --radius-btn: 10px;
  --blur: blur(20px);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
:root.dark {
  --primary: #0a84ff;
  --accent: #ff9f0a;
  --bg: #1c1c1e;
  --surface: rgba(44,44,46,0.72);
  --border: rgba(255,255,255,0.08);
  --text: #f5f5f7;
  --text-muted: #98989d;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

/* Base */
html { font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
h1,h2,h3,h4,h5 { font-family: 'Plus Jakarta Sans', sans-serif; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
@media(max-width:768px) {
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-brand { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--primary); }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}
.nav-name { font-size: 0.9rem; color: var(--text-muted); }

/* Card */
.card {
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header { padding: 20px 24px 0; }
.card-body { padding: 20px 24px; }
.card-footer { padding: 0 24px 20px; border-top: 1px solid var(--border); padding-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-btn);
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; border: none; transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-success { background: #34c759; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Badges */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
}
.badge-warning  { background: rgba(255,140,0,0.15);  color: #b35900; }
.badge-info     { background: rgba(10,132,255,0.15); color: #0056b3; }
.badge-primary  { background: rgba(0,86,179,0.15);   color: #0056b3; }
.badge-accent   { background: rgba(255,140,0,0.15);  color: #b35900; }
.badge-success  { background: rgba(52,199,89,0.15);  color: #1a7a35; }
.badge-danger   { background: rgba(255,59,48,0.15);  color: #c0392b; }
.badge-secondary{ background: rgba(110,110,115,0.15);color: var(--text-muted); }
:root.dark .badge-warning  { color: var(--accent); }
:root.dark .badge-info     { color: var(--primary); }
:root.dark .badge-primary  { color: var(--primary); }
:root.dark .badge-success  { color: #30d158; }
:root.dark .badge-danger   { color: #ff453a; }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { padding: 12px 16px; text-align: left; font-family: 'Plus Jakarta Sans',sans-serif; font-size: 0.82rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0,0,0,0.02); }
:root.dark tbody tr:hover { background: rgba(255,255,255,0.03); }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content:''; position:absolute; left:8px; top:0; bottom:0; width:2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--bg);
}
.timeline-dot.done { background: #34c759; }
.timeline-content { }
.timeline-status { font-weight: 600; font-size: 0.9rem; }
.timeline-time { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.timeline-note { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg); border-radius: var(--radius-card);
  width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease-out;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: 'Plus Jakarta Sans',sans-serif; font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 14px 20px; border-radius: 12px; font-size: 0.9rem; font-weight: 500;
  color: #fff; min-width: 240px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #34c759; }
.toast-error   { background: #ff3b30; }
.toast-info    { background: var(--primary); }

/* Service selector */
.service-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media(max-width:768px) { .service-grid { grid-template-columns: repeat(2,1fr); } }
.service-card {
  padding: 20px 16px; border-radius: var(--radius-card);
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: center; transition: border-color 0.2s, background 0.2s;
}
.service-card:hover { border-color: var(--primary); }
.service-card.active { border-color: var(--primary); background: rgba(0,86,179,0.08); }
.service-card .icon { font-size: 2rem; margin-bottom: 8px; }
.service-card .label { font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 600; font-size: 0.88rem; }

/* Sidebar (admin) */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); backdrop-filter: var(--blur);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--primary); padding: 0 20px 24px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 500; color: var(--text);
  transition: background 0.15s;
}
.sidebar-link:hover { background: rgba(0,0,0,0.05); }
.sidebar-link.active { background: rgba(0,86,179,0.1); color: var(--primary); font-weight: 600; }
:root.dark .sidebar-link:hover { background: rgba(255,255,255,0.05); }
.admin-main { flex: 1; padding: 32px; overflow-x: hidden; }
@media(max-width:768px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .admin-main { padding: 16px; }
}

/* Stats card */
.stats-card { padding: 24px; }
.stats-icon { font-size: 2rem; margin-bottom: 12px; }
.stats-value { font-family: 'Plus Jakarta Sans',sans-serif; font-size: 2rem; font-weight: 700; }
.stats-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Misc */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; }
.page-header p { color: var(--text-muted); margin-top: 4px; }
.section-title { font-family: 'Plus Jakarta Sans',sans-serif; font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { font-family: 'Plus Jakarta Sans',sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 8px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--text-muted); }

/* Alert */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 16px; }
.alert-error { background: rgba(255,59,48,0.1); color: #c0392b; border: 1px solid rgba(255,59,48,0.2); }
:root.dark .alert-error { color: #ff453a; }

/* Footer */
.footer { padding: 24px 0; border-top: 1px solid var(--border); margin-top: 48px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Pending row highlight */
tr.pending-row { background: rgba(255,140,0,0.06); }

/* Step indicator */
.steps { display: flex; gap: 0; margin-bottom: 32px; }
.step { flex: 1; text-align: center; padding: 12px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); border-bottom: 3px solid var(--border); }
.step.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Contact cards */
.contact-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.contact-icon { font-size: 1.5rem; }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; }

/* ——— Chart containers ——— */
.chart-container { position: relative; width: 100%; min-height: 280px; }
.chart-container canvas { max-height: 360px; }

/* ——— Report summary KPI grid ——— */
.report-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .report-summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .report-summary-grid { grid-template-columns: 1fr; } }

/* ——— Stats value fix ——— */
.stats-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 2rem; font-weight: 700; word-break: break-word; line-height: 1.2; }
.stats-value--currency { font-size: 1.25rem; }

/* ——— mb-4 utility ——— */
.mb-4 { margin-bottom: 16px !important; }
