:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --sidebar-bg: #0b1220;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-soft-border: rgba(37, 99, 235, 0.22);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.1);
  --ok-border: rgba(21, 128, 61, 0.24);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --warn-border: rgba(180, 83, 9, 0.24);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --danger-border: rgba(185, 28, 28, 0.24);
  --info: #0369a1;
  --info-soft: rgba(3, 105, 161, 0.08);
  --info-border: rgba(3, 105, 161, 0.22);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body, #app { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent-hover); }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100%;
}

.app-shell__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-shell__content { padding: 24px 28px 40px; }

.app-sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 16px;
}

.app-sidebar__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.app-sidebar__logo {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 15px;
}

.app-sidebar__subtitle {
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.app-sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  border: 1px solid transparent;
}

.app-sidebar__nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.app-sidebar__nav-link:hover { background: rgba(148, 163, 184, 0.12); }

.app-sidebar__nav-link--active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.4);
  color: #fff;
  font-weight: 600;
}

.app-sidebar__label {
  margin: 16px 11px 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.app-sidebar__footer {
  margin-top: 14px;
  padding: 9px 11px;
  font-size: 11px;
  color: var(--sidebar-muted);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-header__title { font-weight: 650; letter-spacing: -0.02em; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.breadcrumb b { color: var(--text); font-weight: 600; }
.breadcrumb__sep { color: var(--faint); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0 0 5px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 640px;
}

.page-head__actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card--flush { padding: 0; }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.card__title { margin: 0; font-size: 15px; font-weight: 650; }
.card__sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card__body { padding: 16px 18px; }
.card__foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.stack { display: grid; gap: 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat__num {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat__label { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stat--accent { border-color: var(--accent-soft-border); background: var(--accent-soft); }
.stat--accent .stat__num { color: var(--accent-hover); }
.stat--ok { border-color: var(--ok-border); background: var(--ok-soft); }
.stat--ok .stat__num { color: var(--ok); }
.stat--warn { border-color: var(--warn-border); background: var(--warn-soft); }
.stat--warn .stat__num { color: var(--warn); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn--primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
}

.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) { background: rgba(15, 23, 42, 0.05); }
.btn--sm { padding: 6px 10px; font-size: 12.5px; }

.btn--danger {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--surface);
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field[hidden] { display: none; }

.field input,
.field select,
.field textarea,
.input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: var(--surface);
  width: 100%;
}

.input--sm { padding: 6px 8px; width: 72px; border-radius: 8px; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.check-line input { margin-top: 2px; }

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.alert--error {
  border: 1px solid rgba(185, 28, 28, 0.25);
  background: rgba(185, 28, 28, 0.06);
  color: var(--danger);
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 14px;
}

.notice[hidden] { display: none; }

.notice p { margin: 4px 0 0; }

.notice--info {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}

.notice--warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
  color: var(--warn);
}

.notice--ok {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill--ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.pill--danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.pill--warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.pill--accent { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-soft-border); }
.pill--neutral { color: var(--muted); background: var(--surface-2); border-color: var(--border); }

.table-wrap { overflow: auto; }

.table-standard {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-standard th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
}

.table-standard td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-standard tr.is-today td { background: rgba(37, 99, 235, 0.06); }
.table-standard tfoot td { font-weight: 700; background: var(--surface-2); }
.table-standard th .th-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
}
.table-standard th .keep-case { text-transform: none; }
.input--price { width: 120px; }
.col-qty { width: 120px; cursor: pointer; }
.col-qty.is-locked { color: var(--faint); cursor: default; }
.col-actions { width: 1%; text-align: right; white-space: nowrap; }
.col-check { width: 52px; }

.checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
}

.checkbox[data-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox[data-checked="true"]::after {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.empty { padding: 36px 24px; text-align: center; color: var(--muted); }
.empty__title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.person__name { font-weight: 600; }
.person__sub { font-size: 12px; color: var(--muted); }

.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 20%, rgba(14, 165, 233, 0.14), transparent 50%),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px 22px 20px;
}

.login-card__logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
}

.login-card h1 { margin: 10px 0 6px; font-size: 22px; }
.login-form { display: grid; gap: 12px; margin-top: 14px; }

.pass-row { display: flex; gap: 8px; align-items: center; }
.pass-row input { flex: 1; }

.usermenu { position: relative; }

.usermenu__btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.usermenu__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.usermenu__name { display: block; font-weight: 600; font-size: 13px; text-align: left; }
.usermenu__role { display: block; font-size: 11px; color: var(--muted); text-align: left; }
.usermenu__caret { color: var(--faint); font-size: 10px; }

.usermenu__pop {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 50;
}

.usermenu__pop.is-open { display: block; }
.usermenu__head { padding: 9px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu__head-name { font-weight: 650; font-size: 13.5px; }
.usermenu__head-mail { font-size: 12px; color: var(--muted); margin-top: 2px; }

.usermenu__item {
  display: flex;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.usermenu__item:hover { background: var(--danger-soft); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 12px;
  background: rgba(15, 23, 42, 0.38);
}

.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.perm-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); }
.perm-list li { margin: 4px 0; }

.member-list { display: grid; gap: 8px; margin-top: 12px; }
.member-list a { text-decoration: none; color: inherit; }
.member-list a:hover .person__name { color: var(--accent-hover); }

.sched { width: 100%; border-collapse: collapse; font-size: 13px; }
.sched th {
  background: var(--surface-2);
  padding: 10px 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 600;
}
.sched th:first-child,
.sched td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.sched td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.sched td.is-weekend, .sched th.is-weekend { background: var(--surface-2); }
.sched__name { font-weight: 600; white-space: nowrap; }
.sched__role { font-size: 11.5px; color: var(--muted); }

.shift-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  min-width: 54px;
}

.shift-day { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid var(--accent-soft-border); }
.shift-night { background: rgba(99, 102, 241, 0.1); color: #4338ca; border: 1px solid rgba(99, 102, 241, 0.25); }
.shift-off { color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); }
.shift-empty { color: var(--faint); }

.shift-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.shift-btn:hover .shift-chip { outline: 2px solid var(--accent); outline-offset: 2px; }

.profile-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.profile-calendar__head {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0 8px;
}

.profile-calendar__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 78px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.profile-calendar__cell--empty { border: none; background: transparent; min-height: 0; padding: 0; }
.profile-calendar__cell.is-weekend { background: var(--surface-2); }
.profile-calendar__cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }

button.profile-calendar__cell {
  width: 100%;
  color: inherit;
  font: inherit;
}

.schedule-person {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.schedule-person:hover { background: var(--surface-2); }

.schedule-person__chevron {
  margin-left: auto;
  color: var(--faint);
  transition: transform 0.15s;
}

.schedule-person.is-open .schedule-person__chevron { transform: rotate(90deg); }

.schedule-person + .card__body { border-top: 1px solid var(--border); }

.fill-shift { display: flex; gap: 8px; margin-top: 6px; }
.fill-shift button { border: none; background: transparent; padding: 0; cursor: pointer; font: inherit; }
.fill-shift button.is-active .shift-chip { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-calendar__day { font-size: 13px; font-weight: 600; }

.legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.day-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.day-pills a { text-decoration: none; }

.pay-range {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pay-range .field { min-width: 168px; }
.pay-range .field select { min-width: 168px; }
.pay-range .btn { height: 42px; }

.pay-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr 0.7fr auto;
  gap: 10px;
  align-items: end;
}

.pay-form__actions { display: flex; gap: 8px; align-items: center; }

.date-entry { display: flex; gap: 6px; align-items: center; }
.date-entry .input { flex: 1; min-width: 0; }
.date-entry input[type="date"] {
  width: 42px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.date-entry input[type="date"]::-webkit-datetime-edit { display: none; }
.date-entry input[type="date"]::-webkit-calendar-picker-indicator { margin: 0; cursor: pointer; }

.pay-form .btn { margin-bottom: 1px; }

.select-inline select {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 28px 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  cursor: pointer;
}

@media (max-width: 980px) {
  .stat-grid, .split, .group-grid, .form-grid, .pay-form { grid-template-columns: 1fr; }
  .pay-range { justify-content: stretch; }
  .pay-range .field, .pay-range .btn { width: 100%; }
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-shell__content, .app-header { padding-left: 16px; padding-right: 16px; }
}
