/* ============================================================
   Simpan Pinjam — KBAT
   Design: steel blue-grey primary, warm amber accent.
   ============================================================ */

:root {
  --primary:      #2c4a6e;   /* steel blue-grey dark */
  --primary-mid:  #3a5f8a;   /* sidebar hover */
  --primary-light:#e8f0f9;   /* light bg tint */
  --accent:       #c07a2f;   /* warm amber accent */
  --accent-soft:  #fdf3e3;   /* accent background */
  --ink:          #1a2433;
  --ink-soft:     #2d3f55;
  --muted:        #5a7a99;
  --faint:        #8aaec8;
  --line:         #d4e2f0;
  --bg:           #f4f7fb;
  --surface:      #ffffff;
  --red:          #dc2626;
  --red-soft:     #fee2e2;
  --green:        #166534;
  --green-soft:   #dcfce7;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', Consolas, monospace;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(44,74,110,0.08), 0 1px 8px rgba(44,74,110,0.05);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

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

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--primary);
  color: #c8ddf0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}
.sidebar .brand {
  font-family: var(--font-display);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
  padding: 0 8px;
}
.sidebar .brand-sub {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 28px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #c8ddf0;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.12s;
}
.sidebar nav a:hover { background: var(--primary-mid); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar .spacer { flex: 1; }
.sidebar .user-box {
  padding: 12px 8px;
  border-top: 1px solid var(--primary-mid);
  font-size: 12.5px;
  color: var(--faint);
}
.sidebar .user-box .name { color: #fff; font-weight: 600; display: block; margin-bottom: 2px; }
.sidebar .logout-link { color: var(--faint); font-size: 12.5px; }
.sidebar .logout-link:hover { color: #fff; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--primary);
}
.topbar .topbar-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.content { padding: 28px 32px; max-width: 1280px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--primary); }

/* ── Stat tiles ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  border-left: 3px solid var(--primary);
}
.stat-tile .label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-tile .value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--primary);
}
.stat-tile .value.gold { color: var(--accent); }
.stat-tile .value.red  { color: var(--red); }

/* ── Tables ──────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  background: #f8fafd;
}
td { padding: 10px 14px; border-bottom: 1px solid #eef3fa; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f4f8fd; }
td.num { text-align: right; font-family: var(--font-mono); font-size: 13px; }
td.center { text-align: center; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
}
.badge-hadir      { background: var(--green-soft); color: var(--green); }
.badge-absen      { background: var(--red-soft);   color: #991b1b; }
.badge-dapat      { background: var(--green-soft); color: var(--green); }
.badge-tidakdapat { background: var(--accent-soft); color: #92400e; }
.badge-keringanan { background: var(--accent-soft); color: #92400e; }
.badge-info       { background: var(--primary-light); color: var(--primary); }
.badge-muted      { background: #eef3fa; color: #5a7a99; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: filter 0.1s;
}
.btn:hover { filter: brightness(0.92); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-gold    { background: var(--accent);  color: #fff; }
.btn-ghost   { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-danger  { background: var(--red);     color: #fff; }
.btn-sm      { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.field-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Flash messages ──────────────────────────────────────── */
.flash { padding: 11px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 18px; }
.flash-error   { background: var(--red-soft);   color: #991b1b; }
.flash-success { background: var(--green-soft);  color: var(--green); }

/* ── Misc ────────────────────────────────────────────────── */
.muted       { color: var(--muted); }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state .big { font-size: 32px; margin-bottom: 8px; }
.toolbar     { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.divider     { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* ── Login ───────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #1a3350 100%);
}
.login-card {
  width: 360px;
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-card .brand     { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.login-card .brand-sub { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 26px; }

/* ── Member hero ─────────────────────────────────────────── */
.member-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.member-hero .name    { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.member-hero .sub     { font-size: 13px; color: #c8ddf0; margin-top: 4px; }
.member-hero .balance { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: #fde68a; margin-top: 14px; }
.member-hero .balance-label { font-size: 12px; color: #c8ddf0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
  .field-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    flex-wrap: nowrap; padding: 12px 14px; gap: 14px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .sidebar .brand, .sidebar .brand-sub { display: none; }
  .sidebar nav { flex-direction: row; gap: 4px; flex-shrink: 0; }
  .sidebar nav a { white-space: nowrap; padding: 7px 11px; font-size: 13px; }
  .sidebar .spacer { display: none; }
  .sidebar .user-box {
    border-top: none; border-left: 1px solid var(--primary-mid);
    padding: 6px 0 6px 14px; white-space: nowrap; flex-shrink: 0;
  }
  .sidebar .user-box .name { display: none; }
  .topbar { padding: 14px 16px; }
  .content { padding: 16px; }
}
