:root {
  --bg: #15130E;
  --surface: #1E1B14;
  --surface-alt: #262218;
  --gold: #C6A15B;
  --gold-bright: #E4C580;
  --text: #F3EEE2;
  --text-muted: #A79C86;
  --sage: #7A9471;
  --rust: #B0512D;
  --divider: #37331F;
  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

button, input, textarea, select { font-family: inherit; }

.brand-mark {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin: 0;
}

/* ---------- LOGIN ---------- */
.view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
}
.login-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  margin: 4px 0 28px;
}
#form-login label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
#form-login input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 4px;
  color: var(--text);
  font-size: 1rem;
}
#form-login input:focus {
  outline: none;
  border-color: var(--gold);
}
.error-text {
  color: var(--rust);
  font-size: 0.85rem;
  margin: -6px 0 16px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 4px;
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  background: var(--gold);
  color: #1A160C;
}
.btn-primary:active { background: var(--gold-bright); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
}
.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-block { width: 100%; margin-top: 8px; }

/* ---------- APP SHELL ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--divider);
}
.header-user {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.main-content {
  flex: 1;
  padding: 20px;
  padding-bottom: 90px;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--divider);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  border-top: 2px solid transparent;
}
.tab-btn.active {
  color: var(--gold-bright);
  border-top-color: var(--gold);
}

/* ---------- SECTION TITLES ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0 0 4px;
}
.section-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 20px;
}

/* ---------- CHECKLIST (nhân viên) ---------- */
.checklist-group {
  margin-bottom: 28px;
}
.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.checklist-header h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0;
}
.checklist-progress {
  font-size: 0.78rem;
  color: var(--gold);
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.checklist-item .num {
  color: var(--text-muted);
  font-size: 0.8rem;
  width: 18px;
  flex-shrink: 0;
  padding-top: 2px;
}
.checklist-item .box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--bg);
  margin-top: 1px;
}
.checklist-item.done .box { background: var(--gold); }
.checklist-item.done .desc { color: var(--text-muted); text-decoration: line-through; }
.desc { flex: 1; padding-top: 1px; font-size: 0.95rem; }

.status-pill {
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.status-pill.pending .status-dot, .status-pill.in_progress .status-dot { background: var(--gold); }
.status-pill.submitted .status-dot { background: var(--gold-bright); }
.status-pill.approved .status-dot { background: var(--sage); }
.status-pill.rejected .status-dot { background: var(--rust); }

/* ---------- LIST ROWS (manager) ---------- */
.list-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
}
.list-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.list-row-title { font-weight: 600; font-size: 0.95rem; }
.list-row-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; }
.row-actions .btn { padding: 8px 14px; font-size: 0.82rem; }

/* ---------- FORMS (manager) ---------- */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 24px;
}
.form-panel label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.form-panel input, .form-panel select, .form-panel textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.92rem;
}
.item-row { display: flex; gap: 8px; margin-bottom: 8px; }
.item-row input { flex: 1; margin-top: 0; }
.item-row button { flex-shrink: 0; }
.icon-btn {
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  color: var(--text-muted);
  border-radius: 4px;
  width: 40px;
  cursor: pointer;
}

/* ---------- KPI TABLE ---------- */
.kpi-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.kpi-tabs button {
  background: none;
  border: 1px solid var(--divider);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
}
.kpi-tabs button.active { border-color: var(--gold); color: var(--gold-bright); }
table.kpi-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.kpi-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}
.kpi-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--divider); }
.kpi-table td:first-child, .kpi-table th:first-child { padding-left: 0; }
.kpi-rate { color: var(--gold); font-weight: 600; }

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 30px 0;
  text-align: center;
}

.date-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.date-picker input {
  background: var(--surface);
  border: 1px solid var(--divider);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 4px;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-alt);
  border: 1px solid var(--gold);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 50;
}
