:root {
  color-scheme: light;
  --canvas: #f5f3e9;
  --paper: #fffefa;
  --ink: #252919;
  --mute: #5e6452;
  --line: #dfe2d3;
  --forest: #283d21;
  --forest-active: #3a502b;
  --forest-dark: #222c1b;
  --mint: #d6e6a3;
  --light: #ebf1db;
  --soft: #dee7cd;
  --yellow: #f4e8cf;
  --warn: #76521f;
  --red: #8d3b2d;
  --rose: #f4e2da;
  --radius: 18px;
  --shadow: 0 18px 48px #222c1b33;
  font-family: "Neue", "DM Sans", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
a { color: inherit; }
:focus-visible { outline: 3px solid #6d8445; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.9vw, 3.15rem); line-height: 1.09; letter-spacing: -.04em; }
h2 { font-size: clamp(1.35rem, 2.3vw, 1.78rem); line-height: 1.15; letter-spacing: -.03em; }
h3 { font-size: 1rem; line-height: 1.3; }
p { line-height: 1.5; }
[hidden] { display: none !important; }
.loading { padding: 36px; }
.dim { color: var(--mute); }
.small { font-size: .81rem; }
.stack { display: grid; gap: 16px; }
.line { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.negative { color: var(--red); }

.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--forest-dark);
  color: white;
  padding: 23px 21px 19px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
}
.brand { display: inline-flex; align-items: flex-start; flex-direction: column; gap: 3px; }
.wordmark { font-size: 2rem; line-height: 1; letter-spacing: -.07em; font-weight: 760; }
.brand small { display: block; color: var(--soft); font-size: .74rem; line-height: 1.25; }
.nav { display: grid; gap: 5px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--soft);
  background: transparent;
  border: 0;
  padding: 9px 11px;
  border-radius: 9px;
  min-height: 40px;
  font-size: .89rem;
  font-weight: 660;
}
.nav button:hover, .nav button.active { background: var(--forest-active); color: white; }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.sidebar-foot .line { padding: 9px 0 0; border-top: 1px solid #414a38; flex-wrap: nowrap; }
.avatar {
  background: var(--soft);
  color: var(--forest);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: .74rem;
  font-weight: 750;
  flex: none;
}
.sidebar-foot p { color: var(--soft); }
.sidebar-foot .btn { background: transparent; color: white; border-color: #58634d; }
.workspace { min-width: 0; }
.topbar {
  padding: 9px clamp(17px, 3vw, 40px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  min-height: 53px;
}
.topbar strong { font-size: .85rem; }
.topbar .small { font-variant-numeric: tabular-nums; }
.content { padding: 25px clamp(17px, 3vw, 40px) 42px; max-width: 1560px; margin-inline: auto; }
.page-heading { margin-bottom: 23px; align-items: flex-end; }
.page-heading p { margin-top: 7px; color: var(--mute); }
.hero {
  padding: 24px 25px;
  background: var(--forest);
  color: white;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}
.hero h1 { font-size: clamp(2rem, 4.1vw, 3.35rem); }
.hero .hero-date { margin: 0 0 7px; color: var(--soft); font-size: .73rem; font-weight: 750; text-transform: uppercase; letter-spacing: .025em; }
.hero p { margin-top: 8px; color: var(--soft); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; min-width: 0; }
.grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.payroll-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 105px; display: grid; gap: 7px; align-content: center; }
.metric strong { font-size: clamp(1.25rem, 2.6vw, 2.05rem); font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
.table-wrap table { border-collapse: collapse; width: 100%; text-align: left; font-size: .85rem; min-width: 510px; }
.table-wrap th, .table-wrap td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap th { background: #f1f3e8; color: var(--mute); font-size: .75rem; font-weight: 760; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td select { min-width: 100px; width: 100%; padding: 7px; }
.table-wrap td input:not([type=checkbox]) { width: 100%; min-width: 88px; padding: 7px; }
.schedule-table table { border-collapse: separate; border-spacing: 6px; min-width: 810px; }
.schedule-table th, .schedule-table td { border: 0; padding: 0; }
.schedule-table th { padding: 7px 8px; background: var(--paper); }
.schedule-table th:first-child, .schedule-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); min-width: 130px; padding-inline: 7px; }
.shift-cell { display: grid; align-content: center; gap: 2px; min-height: 54px; padding: 7px 8px; border-radius: 8px; line-height: 1.2; font-size: .81rem; }
.shift-cell .small { font-size: .72rem; }
.shift-cell select { border-color: transparent; background-color: transparent; }
.shift-cell.opening, .shift-cell:has(option:checked[data-tone=opening]) { background: var(--light); color: var(--forest); }
.shift-cell.closing, .shift-cell:has(option:checked[data-tone=closing]) { background: var(--canvas); }
.shift-cell.long, .shift-cell:has(option:checked[data-tone=long]) { background: var(--yellow); color: var(--warn); }
.schedule-actions { justify-content: flex-end; }

.list { display: grid; margin-top: 10px; }
.list-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.list-row p { margin-top: 3px; }
.pill { display: inline-flex; align-items: center; background: var(--light); color: var(--forest); border-radius: 7px; font-size: .75rem; font-weight: 750; padding: 5px 8px; white-space: nowrap; }
.pill.warn { background: var(--yellow); color: var(--warn); }
.pill.bad { background: var(--rose); color: var(--red); }
.pill.neutral { background: var(--canvas); color: var(--mute); }
.btn {
  border: 1px solid var(--forest);
  color: white;
  background: var(--forest);
  font-weight: 700;
  min-height: 41px;
  border-radius: 9px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  font-size: .86rem;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn.light { background: var(--mint); color: var(--forest-dark); border-color: var(--mint); }
.btn.subtle { background: transparent; border-color: transparent; color: var(--forest); padding-inline: 6px; }
.btn.danger { background: var(--paper); border-color: #e5c4b9; color: var(--red); }
.btn:disabled:hover { filter: none; }
.empty { margin-top: 12px; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--mute); font-size: .9rem; }
.notice { padding: 12px 14px; background: var(--yellow); border: 1px solid #ead9b9; border-radius: 9px; color: var(--warn); font-size: .86rem; }
.notice.error { background: var(--rose); border-color: #e7cdc4; color: var(--red); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields label, .field { display: grid; gap: 6px; font-size: .87rem; font-weight: 680; }
.wide { grid-column: 1 / -1; }
input, textarea, select { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-width: 0; max-width: 100%; line-height: 1.25; }
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox] { accent-color: var(--forest); width: 16px; height: 16px; }
.check { display: flex !important; align-items: center; gap: 8px; line-height: 1.4; }
.muted-line { height: 1px; background: var(--line); margin: 4px 0; }
.tagline { font-size: .77rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 760; color: var(--mute); }

.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-banner { color: white; background: var(--forest-dark); display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(24px, 5vw, 66px); gap: 30px; }
.login-banner h1 { font-size: clamp(2.6rem, 5.6vw, 5.3rem); }
.login-banner p { color: var(--soft); margin-top: 12px; }
.login-panel { display: grid; align-content: center; justify-items: center; padding: 27px; }
.login-form { width: min(100%, 370px); gap: 17px; }
.login-form p { margin-top: 6px; }
.login-form input { min-height: 44px; }
.quick-login { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.quick-login .line { gap: 6px; }
.quick-login .btn { font-size: .78rem; min-height: 34px; }

.staff-shifts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 15px; }
.shift-card { display: grid; gap: 14px; background: var(--forest); color: white; border-color: var(--forest); }
.shift-card .dim, .shift-card .shift-summary { color: var(--soft); }
.shift-time { font-size: clamp(1.85rem, 5.5vw, 2.65rem); letter-spacing: -.045em; font-weight: 640; font-variant-numeric: tabular-nums; }
.punch-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 110px)); gap: 13px; }
.punch-columns div { display: grid; gap: 5px; }
.punch-columns strong { font-variant-numeric: tabular-nums; }
.shift-card .btn { min-height: 44px; width: 100%; }
.staff-home .card .btn.secondary { width: 100%; }
.pay-detail { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; font-size: .89rem; }
.pay-detail .total { font-weight: 800; border-top: 1px solid var(--line); padding-top: 9px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(720px, calc(100% - 24px)); max-height: 90vh; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #222c1b99; }
.modal-body { padding: 20px; }
.modal-header { margin-bottom: 15px; }
.modal-actions { margin-top: 15px; justify-content: flex-end; }
.modal-body [role=alert] { margin-top: 13px; }
.icon-button { background: var(--light); border: 0; border-radius: 8px; width: 35px; height: 35px; color: var(--forest); font-size: 1.15rem; }
.print-only { display: none; }
#toast { position: fixed; right: 18px; bottom: 18px; z-index: 99; max-width: calc(100vw - 36px); }
#toast > div { padding: 13px 15px; border-radius: 9px; box-shadow: var(--shadow); background: var(--forest); color: white; font-size: .89rem; }
#toast > div.error { background: var(--red); }

@media (min-width: 641px) {
  .staff-home { max-width: 710px; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 180px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .layout { display: block; }
  .topbar { padding: 9px 16px; min-height: 42px; }
  .sidebar { height: auto; position: static; padding: 12px 15px 8px; gap: 9px; }
  .wordmark { font-size: 1.7rem; }
  .nav { display: flex; overflow: auto; padding-bottom: 3px; }
  .nav button { min-height: 37px; gap: 5px; padding: 6px 8px; white-space: nowrap; font-size: .78rem; }
  .nav svg { width: 14px; height: 14px; }
  .sidebar-foot { position: absolute; top: 10px; right: 14px; display: block; }
  .sidebar-foot .line { display: none; }
  .sidebar-foot .btn { min-height: 34px; padding: 5px 8px; font-size: .75rem; }
  .content { padding-top: 19px; }
  .hero { padding: 18px 15px; }
  .card { padding: 15px; }
  .metric { min-height: 92px; }
  .login { display: block; }
  .login-banner { min-height: 0; padding: 20px; gap: 21px; }
  .login-banner h1 { font-size: 2.7rem; }
  .login-panel { padding: 24px 16px; }
  .fields { gap: 10px; }
  .modal-body { padding: 15px; }
  .layout[data-role=staff] .sidebar { color: var(--ink); background: var(--canvas); padding: 18px 18px 2px; }
  .layout[data-role=staff] .brand small { display: none; }
  .layout[data-role=staff] .sidebar-foot .btn { color: var(--forest); border-color: var(--line); }
  .layout[data-role=staff] .topbar { background: var(--canvas); border: 0; padding: 8px 18px; }
  .layout[data-role=staff] .nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    padding: 8px 11px max(8px, env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }
  .layout[data-role=staff] .nav button { justify-content: center; color: var(--forest); white-space: nowrap; text-align: center; min-height: 40px; }
  .layout[data-role=staff] .nav button.active, .layout[data-role=staff] .nav button:hover { background: var(--light); }
  .layout[data-role=staff] .nav svg { display: none; }
  .layout[data-role=staff] .content { padding: 9px 18px 80px; }
  .layout[data-role=staff] .shift-card { padding: 18px; }
  body:has(.layout[data-role=staff]) #toast { bottom: 64px; }
}
@media print {
  body:has(dialog[open]) #app, body:has(dialog[open]) #toast, .modal-actions, .modal-header button { display: none !important; }
  dialog[open] { display: block; position: relative; margin: 0; width: 100%; max-width: none; max-height: none; box-shadow: none; overflow: visible; border: 0; }
  dialog::backdrop { background: transparent; }
  .print-only { display: block; }
}
