:root {
  --ink: #172026;
  --muted: #65717a;
  --line: #d9e1e7;
  --surface: #fff;
  --soft: #eef4f7;
  --navy: #14324a;
  --teal: #0f7c80;
  --green: #4f8b54;
  --gold: #b4832c;
  --rose: #b65f65;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Noto Sans Thai", sans-serif; color: var(--ink); background: #f5f7f8; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #14324a 0%, #173f52 52%, #0f7c80 100%); }
.login-card { width: min(430px, 100%); display: grid; gap: 14px; padding: 24px; background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.36); box-shadow: 0 28px 80px rgba(7,31,46,.28); }
.password-login-form { display: grid; gap: 12px; padding-top: 4px; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.inline-check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.inline-check input { width: auto; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; color: white; background: var(--teal); font-weight: 800; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px; color: white; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand span, .small-line { display: block; color: var(--muted); font-size: 13px; }
.sidebar .brand span { color: rgba(255,255,255,.72); }
.nav-list { display: grid; gap: 8px; }
.nav-item { border: 0; padding: 13px 14px; text-align: left; color: #edf7f8; background: rgba(255,255,255,.08); border-left: 3px solid transparent; }
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,.18); border-left-color: var(--gold); }
.workspace { padding: 28px; min-width: 0; }
.topbar, .panel-head, .person-top, .pay-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar { margin-bottom: 18px; }
.top-actions, .action-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-weight: 700; font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 0; }
h2 { font-size: 18px; }
.view { display: none; }
.view.active { display: block; }
.metric-grid, .people-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.two-column, .admin-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); gap: 18px; }
.panel, .metric, .person-card, .mini-card, .table-panel { padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }
.primary-button, .ghost-button, .icon-button, .link-button { min-height: 40px; border: 1px solid transparent; padding: 0 14px; display: inline-grid; place-items: center; text-decoration: none; }
.primary-button { color: white; background: var(--teal); }
.ghost-button, .icon-button { color: var(--ink); background: var(--surface); border-color: var(--line); }
.danger-button { color: var(--rose); border-color: #eccbd0; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; color: var(--teal); border: 1px solid #b9dad8; background: #edf8f7; font-size: 12px; font-weight: 700; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); padding: 10px; background: var(--surface); color: var(--ink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.request-list, .notification-log, .payslip-card, .stack-form { display: grid; gap: 10px; margin-top: 14px; }
.profile-photo { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--line); background: var(--soft); }
.profile-photo.large { width: 92px; height: 92px; }
.person-card { display: grid; gap: 12px; }
.skill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.skill { padding: 5px 8px; background: var(--soft); font-size: 12px; }
.status { color: var(--green); font-weight: 700; }
.warning { color: var(--gold); }
.risk { color: var(--rose); }
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; background: #f9fbfb; }
.org-tree { overflow-x: auto; display: flex; gap: 14px; align-items: flex-start; }
.tree-node { min-width: 240px; padding: 12px; border: 1px solid var(--line); background: #fbfcfc; }
.tree-children { display: grid; gap: 10px; margin-top: 10px; }
.pay-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pay-row.total { color: var(--teal); font-size: 18px; border-bottom: 0; }
.stacked-panel { margin-top: 18px; }
.profile-summary { padding: 12px; background: #f9fbfb; border: 1px solid var(--line); }
.restore-form { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.report-row label { max-width: 220px; }
dialog { width: min(820px, calc(100vw - 24px)); border: 0; padding: 0; }
dialog::backdrop { background: rgba(16,31,42,.42); }
.dialog-card { display: grid; gap: 14px; padding: 20px; background: var(--surface); }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metric-grid, .people-grid, .two-column, .admin-layout, .form-row { grid-template-columns: 1fr; }
}
