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

:root {
  --terra:    #C1440E;
  --terra-dk: #8F2E06;
  --terra-lt: #F0CDB8;
  --ivory:    #FAF7F2;
  --ivory-dk: #EDE8DF;
  --slate:    #2C2D30;
  --slate-md: #4A4B50;
  --slate-lt: #8A8B91;
  --sage:     #6B8F71;
  --gold:     #D4A853;
  --white:    #FFFFFF;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(44,45,48,0.08);
  --shadow-md: 0 6px 24px rgba(44,45,48,0.12);
  --transition: 0.2s ease;
  --font: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--ivory); color: var(--slate); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ─── LAYOUT ─── */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--slate);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.3px;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 14px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.sidebar-link.active { background: var(--terra); color: var(--white); }
.sidebar-link-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto;
  background: var(--terra);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}
.sidebar-link.active .sidebar-badge { background: rgba(255,255,255,0.25); }

.sidebar-footer {
  padding: 14px 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: pointer;
}
.sidebar-user:hover { background: rgba(255,255,255,0.07); }
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--terra);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.35); }

/* ─── MAIN CONTENT ─── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--ivory-dk);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--slate); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-notif {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  position: relative;
  transition: background var(--transition);
}
.topbar-notif:hover { background: var(--ivory-dk); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--terra);
  border-radius: 50%;
  border: 2px solid var(--white);
}

/* ─── PAGE CONTENT ─── */
.page-content { padding: 28px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left h1 { font-size: 22px; font-weight: 600; color: var(--slate); line-height: 1.2; }
.page-header-left p { font-size: 13px; color: var(--slate-lt); margin-top: 4px; }

/* ─── STAT CARDS ─── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  border: 1px solid var(--ivory-dk);
}
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-card-label { font-size: 12px; font-weight: 600; color: var(--slate-lt); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.stat-card-icon.terra  { background: #FAEADA; }
.stat-card-icon.sage   { background: #DFF0E1; }
.stat-card-icon.gold   { background: #FDF3DC; }
.stat-card-icon.blue   { background: #E3EEF9; }
.stat-card-num { font-size: 26px; font-weight: 600; color: var(--slate); line-height: 1; margin-bottom: 6px; }
.stat-card-sub { font-size: 12px; color: var(--slate-lt); }
.stat-trend-up   { color: #2D6A35; font-size: 11px; font-weight: 600; }
.stat-trend-down { color: #8B1C1C; font-size: 11px; font-weight: 600; }

/* ─── DATA TABLE ─── */
.table-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--ivory-dk);
  overflow: hidden;
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ivory-dk);
}
.table-card-title { font-size: 15px; font-weight: 600; color: var(--slate); }
.table-card-actions { display: flex; gap: 8px; align-items: center; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--ivory);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--slate-lt);
  padding: 11px 22px;
  text-align: left;
  border-bottom: 1px solid var(--ivory-dk);
}
.data-table td {
  padding: 13px 22px;
  font-size: 13px;
  color: var(--slate-md);
  border-bottom: 1px solid var(--ivory-dk);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--ivory); }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #EAF5EC; color: #2D6A35; }
.badge-warning { background: #FEF9E7; color: #926D05; }
.badge-danger  { background: #FEF2F2; color: #8B1C1C; }
.badge-info    { background: #EBF4FD; color: #1A5A9A; }
.badge-neutral { background: var(--ivory-dk); color: var(--slate-md); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--terra); color: var(--white); border-color: var(--terra); }
.btn-primary:hover { background: var(--terra-dk); border-color: var(--terra-dk); }
.btn-outline { background: transparent; color: var(--slate-md); border-color: var(--ivory-dk); }
.btn-outline:hover { background: var(--ivory); border-color: var(--slate-lt); }
.btn-danger  { background: #FEF2F2; color: #8B1C1C; border-color: #FECACA; }
.btn-danger:hover  { background: #FEE2E2; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ─── FORM ─── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--slate-md); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.8px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--ivory-dk);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--slate);
  background: var(--ivory);
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--terra); background: var(--white); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--slate-lt); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── CARDS ─── */
.card {
  background: var(--white);
  border: 1px solid var(--ivory-dk);
  border-radius: var(--radius-md);
  padding: 22px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--slate); margin-bottom: 16px; }

/* ─── PAGINATION ─── */
.pagination { display: flex; align-items: center; gap: 4px; padding: 16px 22px; }
.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--slate-md);
  transition: all var(--transition);
}
.page-btn:hover { background: var(--ivory-dk); }
.page-btn.active { background: var(--terra); color: var(--white); border-color: var(--terra); }

/* ─── ALERTS ─── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.alert-success { background: #EAF5EC; color: #2D6A35; border: 1px solid #A8D8AE; }
.alert-error   { background: #FEF2F2; color: #8B1C1C; border: 1px solid #FECACA; }
.alert-info    { background: #EBF4FD; color: #1A5A9A; border: 1px solid #BFDDFA; }

/* ─── SEARCH INPUT ─── */
.search-wrap { position: relative; }
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--slate-lt); font-size: 14px; pointer-events: none; }
.search-wrap .form-input { padding-left: 34px; width: 220px; }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slate);
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
}
.login-logo-wrap { text-align: center; margin-bottom: 28px; }
.login-logo { width: 60px; height: 60px; background: var(--terra-lt); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; font-size: 26px; }
.login-org-name { font-size: 18px; font-weight: 600; color: var(--slate); }
.login-org-sub  { font-size: 12px; color: var(--slate-lt); margin-top: 2px; }
.login-title { font-size: 20px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--slate-lt); margin-bottom: 28px; }

/* ─── DASHBOARD GRID ─── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--ivory-dk);
}
.recent-item:last-child { border-bottom: none; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recent-dot.terra  { background: var(--terra); }
.recent-dot.sage   { background: var(--sage); }
.recent-dot.gold   { background: var(--gold); }
.recent-info { flex: 1; }
.recent-name  { font-size: 13px; font-weight: 500; color: var(--slate); }
.recent-meta  { font-size: 12px; color: var(--slate-lt); margin-top: 1px; }
.recent-amount { font-size: 13px; font-weight: 600; color: var(--terra); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}
