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

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  --bg:        #f5f3ee;
  --surface:   #ffffff;
  --border:    #e2ddd5;
  --text:      #1a1814;
  --muted:     #7a7570;
  --accent:    #2d6a4f;
  --accent-l:  #e8f4ed;
  --accent-d:  #1b4332;
  --danger:    #c0392b;
  --danger-l:  #fdecea;
  --warn:      #d97706;
  --warn-l:    #fef3c7;
  --info:      #1d4ed8;
  --info-l:    #eff6ff;
  --sidebar-w: 240px;
  --radius:    10px;
}

/* ── BASE ──────────────────────────────────────────────────── */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ── AUTH PAGES ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 60%, #40916c 100%);
}
.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
}
.auth-logo .logo-icon svg { width: 28px; height: 28px; fill: white; }
.auth-logo h1 { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 300; }
.auth-logo p  { color: var(--muted); font-size: 13px; }
.auth-link { text-align: center; margin-top: 1rem; font-size: 13px; color: var(--muted); }
.auth-link a { color: var(--accent); text-decoration: none; font-weight: 500; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--accent-d);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .brand {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 300;
  color: white;
  display: block;
}
.sidebar-logo .sub { color: rgba(255,255,255,.5); font-size: 11px; }
.sidebar-user {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-user .role-chip {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
}
.sidebar-user .name { color: white; font-weight: 600; font-size: 13px; }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-section { padding: .25rem 1.25rem .1rem; }
.nav-section span { font-size: 10px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.sidebar-nav a:hover  { color: white; background: rgba(255,255,255,.07); }
.sidebar-nav a.active { color: white; background: rgba(255,255,255,.12); border-left-color: #74c69d; }
.sidebar-nav a svg    { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-footer { padding: .75rem 1.25rem 1.25rem; }
.sidebar-footer form button {
  width: 100%;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  padding: .5rem;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: background .15s;
}
.sidebar-footer form button:hover { background: rgba(255,255,255,.18); color: white; }
.sidebar-footer form button svg   { width: 15px; height: 15px; }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h2         { font-size: 1rem; font-weight: 600; }
.topbar .breadcrumb { font-size: 12px; color: var(--muted); }

.content { padding: 1.75rem; flex: 1; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: .35rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .8rem;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-l);
}
.form-row        { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row.three  { grid-template-columns: 1fr 1fr 1fr; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  font-family: inherit;
  text-decoration: none;
  transition: all .15s;
}
.btn svg         { width: 15px; height: 15px; }
.btn-primary     { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-d); }
.btn-secondary   { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger      { background: var(--danger-l); color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm          { padding: .3rem .7rem; font-size: 12px; }
.btn-full        { width: 100%; justify-content: center; padding: .65rem; }

/* ── CARDS ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ── STATS ──────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.stat-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; font-family: 'Fraunces', serif; }
.stat-card.green  .value { color: var(--accent); }
.stat-card.orange .value { color: var(--warn); }
.stat-card.red    .value { color: var(--danger); }
.stat-card.blue   .value { color: var(--info); }

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg);
  padding: .6rem .85rem;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 99px;
  letter-spacing: .02em;
}
.badge-pending   { background: var(--warn-l);   color: #92400e; }
.badge-approved  { background: var(--accent-l); color: var(--accent-d); }
.badge-rejected  { background: var(--danger-l); color: var(--danger); }
.badge-cancelled { background: #f3f4f6;         color: #6b7280; }
.badge-admin     { background: #ede9fe; color: #5b21b6; }
.badge-staff     { background: var(--info-l);   color: var(--info); }
.badge-borrower  { background: var(--accent-l); color: var(--accent-d); }

/* ── FLASH ──────────────────────────────────────────────────── */
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: var(--accent-l); color: var(--accent-d); border: 1px solid #a7f3d0; }
.flash-error   { background: var(--danger-l); color: var(--danger);   border: 1px solid #fca5a5; }

/* ── CHECK GRID ─────────────────────────────────────────────── */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.check-item {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  cursor: pointer;
  transition: border-color .15s;
}
.check-item:hover        { border-color: var(--accent); }
.check-item input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.check-item .item-label  { font-size: 13px; }
.check-item .item-price  { font-size: 11px; color: var(--muted); }
.qty-input { width: 60px !important; margin-top: .25rem; }

/* ── MISC ───────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.page-header h1 { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 300; }
.empty { text-align: center; padding: 3rem; color: var(--muted); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.detail-row { display: flex; gap: .5rem; font-size: 13px; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .dk { color: var(--muted); width: 130px; flex-shrink: 0; }

/* ── MODAL (pure CSS :target) ───────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay:target { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 480px;
  position: relative;
}
.modal-box h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg);
  text-decoration: none; color: var(--muted); font-size: 16px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main    { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
}
