@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --sand: #F5F0E8;
  --sand-dark: #EDE6D6;
  --sand-border: #D8CEB8;
  --ocean: #0A4D68;
  --ocean-mid: #1A7FA0;
  --ocean-light: #E8F4F8;
  --coral: #E8624A;
  --coral-light: #FDF0EE;
  --gold: #C9963A;
  --gold-light: #FDF6E8;
  --palm: #2D7A4F;
  --palm-light: #EAF5EE;
  --text-primary: #1A1814;
  --text-secondary: #6B6355;
  --text-muted: #A09880;
  --white: #FFFFFF;
  --danger: #CC3B2A;
  --danger-light: #FCECEA;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(10,30,20,0.08);
  --shadow-md: 0 4px 16px rgba(10,30,20,0.10);
  --shadow-lg: 0 8px 32px rgba(10,30,20,0.13);
  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--sand);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--ocean);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--sand-border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-body {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

/* ── Sidebar ── */
.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.02em;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1.25rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 1.25rem;
  font-size: 13.5px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.nav-item.active {
  color: var(--white);
  background: rgba(255,255,255,0.1);
  border-left-color: #5DC8E8;
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--coral);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--white);
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: var(--white); }
.user-role { font-size: 10px; color: rgba(255,255,255,0.45); }
.logout-btn {
  margin-left: auto;
  background: none; border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer; font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--white); background: rgba(255,255,255,0.1); }

/* ── Topbar ── */
.page-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12px; color: var(--text-muted); }
.notif-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sand-border);
  background: var(--sand);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px;
  position: relative;
  transition: var(--transition);
}
.notif-btn:hover { background: var(--sand-dark); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px;
  background: var(--coral); border-radius: 50%;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--sand-border);
  padding: 1.5rem;
}
.card-sm { padding: 1rem 1.25rem; }
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Metric Cards ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 1.75rem;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.metric-card.ocean::before { background: var(--ocean-mid); }
.metric-card.coral::before { background: var(--coral); }
.metric-card.gold::before { background: var(--gold); }
.metric-card.palm::before { background: var(--palm); }

.metric-icon { font-size: 20px; margin-bottom: 10px; }
.metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.metric-value { font-size: 26px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1; }
.metric-delta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.metric-delta.up { color: var(--palm); }
.metric-delta.down { color: var(--coral); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ocean);
  color: var(--white);
  border-color: var(--ocean);
}
.btn-primary:hover { background: var(--ocean-mid); border-color: var(--ocean-mid); }
.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border-color: var(--sand-border);
}
.btn-secondary:hover { background: var(--sand); }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--sand-border);
  background: var(--sand);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sand-border);
  color: var(--text-primary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--sand); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
}
.badge-green { background: var(--palm-light); color: var(--palm); }
.badge-coral { background: var(--coral-light); color: var(--coral); }
.badge-gold { background: var(--gold-light); color: var(--gold); }
.badge-blue { background: var(--ocean-light); color: var(--ocean); }
.badge-gray { background: var(--sand-dark); color: var(--text-secondary); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--white);
  border: 1px solid var(--sand-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--ocean-mid); box-shadow: 0 0 0 3px rgba(26,127,160,0.12); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

/* ── Alert/Toast ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-warn { background: var(--gold-light); color: #7A5A1A; border: 1px solid #E8C878; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #F0B0A8; }
.alert-success { background: var(--palm-light); color: var(--palm); border: 1px solid #A8D8B8; }
.alert-info { background: var(--ocean-light); color: var(--ocean); border: 1px solid #A8D0E0; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text-primary);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
  max-width: 320px;
}
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,20,15,0.5);
  z-index: 500;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 90%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.97); } to { opacity:1; transform:scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--sand); color: var(--text-primary); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Section header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.section-title { font-size: 15px; font-weight: 600; }
.section-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 36px; margin-bottom: 1rem; }
.empty-text { font-size: 14px; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-sub { font-size: 12px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; margin-bottom: 1.5rem; background: var(--sand-dark); padding: 4px; border-radius: var(--radius-md); width: fit-content; }
.tab-btn {
  padding: 6px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  background: none; border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active { background: var(--white); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-body { padding: 1rem; }
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  background: var(--ocean);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 70%, rgba(93,200,232,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(201,150,58,0.1) 0%, transparent 50%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%; max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { font-size: 36px; margin-bottom: 10px; }
.login-logo-title { font-size: 20px; font-weight: 600; color: var(--ocean); letter-spacing: -0.02em; }
.login-logo-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Progress bar ── */
.progress-bar { height: 6px; background: var(--sand-dark); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }

/* ── Stat row ── */
.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--sand-border); }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-value { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ── Page fade-in ── */
.page { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.hidden { display: none !important; }

/* ── Speed: skeleton loading ── */
.skeleton{background:linear-gradient(90deg,var(--sand) 25%,var(--sand-dark) 50%,var(--sand) 75%);background-size:200% 100%;animation:shimmer 1.5s infinite;border-radius:var(--radius-sm);height:14px;margin-bottom:8px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
.skeleton-card{background:var(--white);border:1px solid var(--sand-border);border-radius:var(--radius-lg);padding:16px;margin-bottom:12px}

/* ── Speed: instant page transitions ── */
.page{animation:fadeIn .15s ease-out}
@keyframes fadeIn{from{opacity:.4}to{opacity:1}}

/* ── Speed: reduce repaints ── */
.metric-card,.card,.res-card,.req-card{will-change:auto;contain:layout style}
