:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2430;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  --red: #da291c;
  --red-dark: #b32117;
  --gold: #ffc72c;

  --success: #16803c;
  --success-bg: #e8f7ee;
  --warning: #b45309;
  --warning-bg: #fff5e6;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --info: #2f6fed;
  --info-bg: #eef3fe;
  --neutral-bg: #f1f2f6;

  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- App shell ---------- */

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #1c1712;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 30;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
}
.app-header .brand img { width: 28px; height: auto; }

.app-header .menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 8px;
  margin-right: 8px;
}

.app-header .user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header .user-menu .who { font-size: 12.5px; color: #d8d0c4; text-align: right; line-height: 1.3; }
.app-header .user-menu .who strong { display: block; color: #fff; font-size: 13px; }
.app-header .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px;
}
.app-header .signout {
  font-size: 12.5px; font-weight: 600; color: #f2ede5;
  border: 1px solid #443c31; background: #2a231b;
  padding: 7px 12px; border-radius: 7px; text-decoration: none;
}
.app-header .signout:hover { background: #362d22; }

.app-shell {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: var(--header-h); bottom: 0; left: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  overflow-y: auto;
  z-index: 20;
}

.app-sidebar .nav-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-faint); padding: 14px 12px 6px;
}

.app-sidebar a.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px;
}
.app-sidebar a.nav-link .ico { width: 18px; text-align: center; flex-shrink: 0; }
.app-sidebar a.nav-link:hover { background: var(--neutral-bg); }
.app-sidebar a.nav-link.active { background: #fdeceb; color: var(--red-dark); font-weight: 700; }
.app-sidebar a.nav-link .badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  font-weight: 700; border-radius: 20px; padding: 1px 7px;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px 64px;
  max-width: 1180px;
}

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; }
.page-head .subtitle { color: var(--text-muted); font-size: 13.5px; margin: 0; }

/* ---------- Cards / grid ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; }

.grid { display: grid; gap: 18px; }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-2 { grid-template-columns: 2fr 1fr; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin: 4px 0 2px; }
.stat-card .hint { font-size: 12px; color: var(--text-faint); }

/* ---------- Buttons / forms ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--red); color: var(--red-dark); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #0f6a30; border-color: #0f6a30; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a81f1f; border-color: #a81f1f; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; background: #fff;
}
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.checkbox-inline { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; }
.checkbox-inline input { width: auto; }

/* ---------- Tables / pills ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: capitalize; }
.pill-pending { color: var(--warning); background: var(--warning-bg); }
.pill-approved { color: var(--success); background: var(--success-bg); }
.pill-denied { color: var(--danger); background: var(--danger-bg); }
.pill-cancelled { color: var(--text-muted); background: var(--neutral-bg); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 20px; }
.flash-ok { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

.empty { color: var(--text-muted); font-size: 13px; padding: 26px; text-align: center; }
.inline, form.inline { display: inline; }

/* ---------- Calendar ---------- */

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); text-align: center; padding-bottom: 6px; }
.cal-cell {
  min-height: 86px; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; font-size: 11.5px; background: #fff;
}
.cal-cell.is-other-month { background: #fafafb; color: var(--text-faint); }
.cal-cell.is-today { border-color: var(--red); border-width: 2px; }
.cal-cell .cal-date { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.cal-cell .cal-holiday { color: var(--success); font-weight: 700; font-size: 10.5px; margin-bottom: 3px; }
.cal-chip {
  display: block; font-size: 10.5px; font-weight: 600; padding: 2px 6px;
  border-radius: 5px; margin-bottom: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav h2 { margin: 0; font-size: 16px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: 12px; color: var(--text-muted); }
.cal-legend .item { display: flex; align-items: center; }

/* ---------- Auth page ---------- */

.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1c1712 0%, #2a1f16 60%, #3a2417 100%);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  padding: 32px 28px;
}
.auth-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card .brand img { width: 34px; height: auto; }
.auth-card .brand strong { font-size: 16px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 12.5px; margin: -16px 0 20px; }

.app-footer {
  margin-left: var(--sidebar-w);
  padding: 18px 32px 28px;
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-header .menu-toggle { display: inline-block; }
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0);
    width: 78vw; max-width: 280px;
  }
  body.nav-open .app-sidebar { transform: translateX(0); box-shadow: 0 0 0 9999px rgba(0,0,0,0.35); }
  .app-main, .app-footer { margin-left: 0; padding-left: 18px; padding-right: 18px; }
  .grid-cols-4, .grid-cols-3 { grid-template-columns: 1fr 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .cal-grid { grid-template-columns: repeat(7, minmax(38px, 1fr)); }
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-chip { font-size: 9px; }
}

@media (max-width: 480px) {
  .grid-cols-4, .grid-cols-3 { grid-template-columns: 1fr; }
}
