:root {
  --primary: #8b3c19;
  --dark: #8b3c19;
  --medium: #b47458;
  --gold: #fdd14d;
  --gold-strong: #fcbe2c;
  --accent: #dd8908;
  --cream: #fefcf4;
  --soft-cream: #fcf0c9;
  --light-gold: #f9e291;
  --soft-brown: #b47458;
  --ink: #3a1c12;
  --muted: #96796b;
  --line: #efdfbd;
  --bg: #fefcf4;
  --card: #ffffff;
  --shadow: 0 12px 32px rgba(180, 116, 88, .12);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.sidebar-toggle { position: absolute; opacity: 0; pointer-events: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; flex: 0 0 260px; flex-direction: column; width: 260px; height: 100vh; padding: 22px 15px 18px; overflow-y: auto; background: linear-gradient(180deg, var(--cream), var(--soft-cream)); color: var(--primary); border-right: 1px solid var(--light-gold); box-shadow: 5px 0 26px rgba(180, 116, 88, .1); }
.sidebar-head { display: flex; align-items: flex-start; justify-content: center; min-height: 190px; padding-bottom: 16px; position: relative; }
.brand { display: inline-flex; flex-direction: column; align-items: center; color: var(--primary); font-weight: 800; letter-spacing: -.03em; }
.brand img { display: block; width: 140px; height: auto; }
.brand-caption { margin-top: -4px; color: var(--medium); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-close { display: none; color: var(--primary); font-size: 28px; line-height: 1; cursor: pointer; }
.sidebar-label { margin: 0 10px 10px; color: var(--medium); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-label-spaced { margin-top: 22px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 11px; border: 1px solid transparent; border-radius: 11px; color: var(--primary); font-size: 13px; font-weight: 650; transition: background .18s ease, color .18s ease, transform .18s ease; }
.side-nav a:hover { background: var(--light-gold); color: var(--primary); transform: translateX(2px); }
.side-nav a.active { background: var(--gold); color: var(--primary); box-shadow: 0 7px 18px rgba(180, 116, 88, .16); }
.nav-icon { display: inline-grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; color: var(--medium); }
.nav-icon svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.side-nav a.active .nav-icon { color: var(--primary); }
.sidebar-footer { display: grid; gap: 6px; margin-top: auto; padding: 15px 11px 0; border-top: 1px solid var(--light-gold); color: var(--medium); font-size: 11px; }
.sidebar-status { display: flex; align-items: center; gap: 7px; color: var(--primary); font-weight: 650; }
.sidebar-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(221, 137, 8, .13); }
.sidebar-backdrop { display: none; }

.app-main { min-width: 0; flex: 1; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 18px; padding: 14px clamp(18px, 3vw, 42px); border-bottom: 1px solid var(--line); background: rgba(254, 252, 244, .94); backdrop-filter: blur(12px); }
.topbar-left, .top-actions { display: flex; align-items: center; gap: 13px; }
.topbar-heading { display: grid; gap: 1px; }
.topbar-heading span { color: var(--soft-brown); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.topbar-heading strong { color: var(--dark); font-size: 18px; letter-spacing: -.03em; }
.menu-toggle { display: none; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--primary); font-size: 20px; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.user-avatar { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 10px; border-radius: 999px; background: var(--soft-cream); color: var(--primary); font-weight: 700; }
.user-role { color: var(--soft-brown); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 32px clamp(18px, 3vw, 42px) 60px; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin: 1px 0 2px; color: var(--dark); font-size: 28px; letter-spacing: -.04em; }
.page-head p { margin: 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); color: var(--primary); padding: 9px 13px; border-radius: 9px; font-weight: 700; white-space: nowrap; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { border-color: var(--soft-brown); transform: translateY(-1px); }
.button-primary { border-color: var(--gold-strong); background: var(--gold); color: var(--primary); }
.button-primary:hover { border-color: var(--accent); background: var(--gold-strong); }
.button-ghost { padding: 6px 10px; border-color: var(--line); font-size: 12px; }
.button-small { padding: 7px 10px; font-size: 12px; }
.button-danger { border-color: #e8b6a8; background: #fff6f2; color: #a33d26; }
.button-danger:hover { border-color: #c96c55; background: #ffebe4; }
.button-wide { width: 100%; padding: 12px; }
.flash { margin-bottom: 18px; padding: 10px 13px; border: 1px solid var(--light-gold); border-radius: 10px; background: var(--soft-cream); color: var(--primary); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metric { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: var(--shadow); }
.metric.accent { border-color: var(--gold-strong); background: var(--gold); color: var(--primary); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric.accent span, .metric.accent small { color: var(--medium); }
.metric strong { display: block; margin: 7px 0; color: var(--primary); font-size: 23px; letter-spacing: -.04em; }
.metric.accent strong { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel { margin-bottom: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: var(--shadow); }
.panel h2 { margin: 0; color: var(--dark); font-size: 16px; letter-spacing: -.02em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-head h2 { margin: 0; }
.summary-list { display: grid; gap: 0; }
.summary-list > div { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list strong { color: var(--primary); font-size: 14px; }
.account-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.account-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); }
.account-item span, .account-item small { display: block; }
.account-item small { margin-top: 2px; color: var(--soft-brown); font-size: 10px; text-transform: uppercase; }
.account-item strong { display: block; margin-top: 8px; color: var(--primary); }
.table-wrap { overflow: auto; }
.table-wrap table { width: 100%; min-width: 560px; border-collapse: collapse; }
.table-wrap th { padding: 9px 8px; border-bottom: 1px solid var(--line); color: var(--soft-brown); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.table-wrap td { padding: 11px 8px; border-bottom: 1px solid #f7edda; vertical-align: top; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap small { display: block; color: var(--muted); font-size: 11px; }
.employee-table { min-width: 760px !important; }
.actions-cell { white-space: nowrap; }
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--soft-cream); color: var(--soft-brown); font-size: 11px; }
.tag.success { background: #f7df8a; color: var(--primary); }
.tag.warning { background: var(--light-gold); color: var(--primary); }
.danger-text { color: #a33d26; }
.success-text { color: var(--medium); }
.empty { margin: 0; padding: 13px 0; color: var(--muted); }

.filter-row, .inline-form { display: flex; align-items: end; gap: 10px; margin-bottom: 16px; }
.page-head .inline-form { margin-bottom: 0; }
.filter-row label, .inline-form label { flex: 0 0 auto; }
.filter-row input, .inline-form input { min-width: 145px; }
.form-panel { scroll-margin-top: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label, .filter-row label { display: flex; flex-direction: column; gap: 5px; color: var(--medium); font-size: 12px; font-weight: 700; }
.form-grid input, .form-grid select, .filter-row input, .inline-form input { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.form-grid input:focus, .form-grid select:focus, .filter-row input:focus, .inline-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(253, 209, 77, .28); }
.span-2 { grid-column: span 2; }
.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; }
.check-row input { accent-color: var(--accent); }
.form-actions { display: flex; align-items: end; justify-content: flex-end; }
.attendance-list { margin-bottom: 17px; }
.attendance-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.attendance-row:first-child { padding-top: 0; }
.attendance-row strong, .attendance-row small { display: block; }
.attendance-row small { color: var(--muted); font-size: 12px; }
.attendance-person { display: grid; gap: 3px; }
.attendance-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.attendance-choice input { accent-color: var(--accent); }
.pay-choice { color: var(--primary); font-weight: 800; }
.pay-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.pay-account { min-width: 145px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--ink); font-size: 12px; }
.wage-field { display: grid; grid-template-columns: auto 110px; align-items: center; gap: 7px; margin-top: 4px; color: var(--medium); font-size: 11px; font-weight: 700; }
.wage-input { width: 110px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff; color: var(--ink); font-size: 12px; }
.paid-hint { margin-top: 5px; color: var(--soft-brown); font-size: 11px; }
.attendance-payment-options { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; align-items: end; gap: 14px; margin-bottom: 17px; }
.attendance-payment-options label { display: grid; gap: 5px; color: var(--medium); font-size: 12px; font-weight: 700; }
.attendance-payment-options select { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.attendance-payment-options .hint { margin: 0; }
.closing-actions { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: 17px; }
.closing-actions input { flex: 1; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--ink); }

.modal { width: min(92vw, 520px); max-width: 520px; padding: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--card); color: var(--ink); box-shadow: 0 24px 80px rgba(58, 28, 18, .22); }
.modal-narrow { max-width: 430px; }
.modal::backdrop { background: rgba(35, 39, 42, .28); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .18s ease-out; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 22px 15px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #fffdf7, #fff8e6); }
.modal-head h2 { margin: 2px 0 0; color: var(--dark); font-size: 19px; letter-spacing: -.03em; }
.modal-close { display: inline-grid; flex: 0 0 auto; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--primary); font-size: 22px; line-height: 1; }
.modal-close:hover { border-color: var(--soft-brown); background: var(--soft-cream); }
.modal-form { display: grid; gap: 14px; padding: 20px 22px 22px; }
.modal-form label { display: grid; gap: 5px; color: var(--medium); font-size: 12px; font-weight: 700; }
.modal-form input, .modal-form textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.modal-form textarea { min-height: 78px; resize: vertical; }
.modal-form input:focus, .modal-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(253, 209, 77, .28); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.modal-divider { height: 1px; margin: 0 22px; background: var(--line); }
.modal-status-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 22px 21px; }
.modal-status-row strong, .modal-status-row small { display: block; }
.modal-status-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.modal-status-row form { margin: 0; }
.modal-note { margin: -2px 0 2px; color: var(--muted); font-size: 12px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 50% 0%, var(--soft-cream), var(--cream) 52%, #f8e8ba); }
.login-card { width: min(92vw, 410px); padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .94); box-shadow: 0 24px 70px rgba(95, 27, 6, .14); }
.login-brand { display: flex; justify-content: center; }
.login-brand img { display: block; width: min(100%, 260px); height: auto; }
.login-rule { display: flex; align-items: center; gap: 10px; margin: -5px 0 0; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .2em; text-align: center; }
.login-rule::before, .login-rule::after { content: ""; height: 1px; flex: 1; background: var(--light-gold); }
.login-card .muted { margin: 17px 0 24px; text-align: center; }
.stack { display: grid; gap: 15px; }
.stack label { display: grid; gap: 5px; color: var(--medium); font-size: 12px; font-weight: 700; }
.stack input { padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.stack input:focus { outline: 2px solid var(--light-gold); border-color: var(--accent); }

@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar-toggle:checked ~ .app-shell .sidebar { transform: translateX(0); }
.sidebar-toggle:checked ~ .app-shell .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(180, 116, 88, .24); }
  .sidebar-close, .menu-toggle { display: grid; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .account-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { min-height: 64px; padding: 11px 14px; }
  .topbar-heading strong { font-size: 16px; }
  .user-role { display: none; }
  .user-avatar { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .container { padding: 22px 14px 48px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .button { align-self: stretch; }
  .metric { padding: 13px; }
  .metric strong { font-size: 19px; }
  .metric-grid { gap: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .form-actions { justify-content: stretch; }
  .form-actions .button { width: 100%; }
  .attendance-row { align-items: flex-start; flex-direction: column; }
  .attendance-choice { white-space: normal; }
  .attendance-payment-options { grid-template-columns: 1fr; }
  .closing-actions { align-items: stretch; flex-direction: column; }
  .closing-actions input { width: 100%; }
  .modal { width: calc(100vw - 28px); }
  .modal-head { padding: 18px 16px 14px; }
  .modal-form { padding: 17px 16px 18px; }
  .modal-divider { margin: 0 16px; }
  .modal-status-row { align-items: stretch; flex-direction: column; padding: 15px 16px 18px; }
  .modal-status-row .button { width: 100%; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .panel { padding: 14px; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input { width: 100%; }
  .login-card { padding: 24px 20px; }
}
