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

:root {
  --ink: #1B2A22;
  --ink-soft: #28392F;
  --cream: #F2ECD8;
  --gold: #B8923F;
  --gold-dark: #8F6F2E;
  --gold-soft: #F3E7C9;
  --maroon: #7A3B3B;
  --maroon-soft: #F5E7E3;
  --moss: #4F6B4C;
  --moss-soft: #E7EEE3;
  --text: #241F17;
  --text-muted: #71695A;
  --border: #DDD3B8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Sarabun', sans-serif;
  background: var(--cream);
  color: var(--text);
}
h1, h2, h3, h4, .head-font { font-family: 'Kanit', sans-serif; color: var(--ink); }

a { color: var(--gold-dark); text-decoration: none; }
a:hover { opacity: .8; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--ink); color: var(--cream);
  display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px; }
.sidebar .brand-badge {
  width: 36px; height: 36px; border-radius: 8px; background: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.sidebar .brand-name { font-family: 'Kanit', sans-serif; font-weight: 600; line-height: 1.1; }
.sidebar .brand-sub { font-size: 11px; color: #9AA89A; line-height: 1.2; }
.sidebar nav { flex: 1; padding: 8px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px;
  color: #C7CDC2; font-size: 14px; font-weight: 500; border-left: 3px solid transparent;
  margin-bottom: 2px;
}
.sidebar nav a.active { background: var(--ink-soft); color: var(--gold); border-left-color: var(--gold); }
.sidebar nav a:hover { opacity: .85; text-decoration: none; }
.sidebar .footer-note { padding: 12px 16px; font-size: 11px; color: #6C7A67; }

.main { flex: 1; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.topbar h2 { margin: 0; font-size: 20px; }
.checker-strip {
  height: 7px;
  background-image:
    linear-gradient(45deg, var(--border) 25%, transparent 25%),
    linear-gradient(-45deg, var(--border) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--border) 75%),
    linear-gradient(-45deg, transparent 75%, var(--border) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
}
.content { padding: 24px 32px; max-width: 1200px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.panel-p { padding: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 6px;
  font-size: 14px; font-weight: 500; border: none; cursor: pointer; font-family: 'Sarabun', sans-serif;
  text-decoration: none;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-danger { background: var(--maroon); color: #fff; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { flex: 1; justify-content: center; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.field .req { color: var(--maroon); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: 6px; border: 1px solid var(--border);
  font-family: 'Sarabun', sans-serif; font-size: 14px; background: #fff; color: var(--text);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: -10px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.section-title { font-size: 14px; font-weight: 600; color: var(--gold-dark); font-family: 'Kanit', sans-serif; margin: 18px 0 8px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--cream); color: var(--text-muted); }
th, td { text-align: left; padding: 10px 14px; }
tbody tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: #FAF8F0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 500; }
.badge-gold { background: var(--gold-soft); color: var(--gold-dark); }
.badge-moss { background: var(--moss-soft); color: var(--moss); }
.badge-maroon { background: var(--maroon-soft); color: var(--maroon); }
.badge-muted { background: #EFEAD9; color: var(--text-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-icon { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }
.stat-value { font-size: 24px; font-weight: 600; font-family: 'Kanit', sans-serif; color: var(--ink); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--cream);
  padding: 10px 16px; border-radius: 6px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--cream); }
.login-box { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 32px; width: 100%; max-width: 380px; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
