/* ============================================================
   Santa Lucia Group — Tronc Calculator
   Flat corporate SaaS theme: white / black / blue.
   No rounded corners, no shadows, no gradients.
   FOH = blue · BOH = slate
   ============================================================ */

:root {
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --line: #d5dbe3;
  --line-soft: #e5e9ef;

  --ink: #13161a;
  --ink-dim: #5b6572;
  --ink-faint: #8a94a1;

  --blue: #1a5fd0;
  --blue-hover: #14479e;
  --blue-tint: #eaf1fc;

  --slate: #454c56;
  --slate-tint: #eef0f3;

  --danger: #c0392b;

  --font-main: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

.page-glow { display: none; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------- Header ---------------- */

.site-header {
  max-width: 1280px;
  margin: 0 auto 4px;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  width: 40px; height: 40px;
  color: var(--blue);
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }

.brand-name {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-top: 2px;
}

.week-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-control label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

/* ---------------- View tabs ---------------- */

.view-nav {
  display: flex;
  gap: 2px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line);
}

.view-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-dim);
  cursor: pointer;
}
.view-tab:hover { color: var(--ink); }
.view-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------------- Cards ---------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 22px 24px;
  margin-top: 22px;
}

.card-head { margin-bottom: 16px; }
.card-head.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.card-note {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
  max-width: 62ch;
}

/* ---------------- Inputs ---------------- */

input, select, button {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 11px;
  color: var(--ink);
  width: 100%;
}

input::placeholder { color: var(--ink-faint); }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 0;
  border-color: var(--blue);
}

input[type="date"] { width: auto; }

input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6572' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.field > label, .field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-dim);
}

.daily-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.total-pool {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}

.daily-table input[type="number"] {
  width: 120px;
  text-align: right;
}
.daily-table .daily-day { font-weight: 600; }
.daily-table .daily-day-total { font-weight: 600; color: var(--ink); }

/* ---------------- Split slider ---------------- */

.split-block { margin-top: 24px; }

.split-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 9px;
}

.split-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.split-label { font-size: 14px; color: var(--ink-dim); }
.split-label strong { font-size: 16px; margin: 0 2px; }
.split-label .dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin: 0 6px 1px;
}
.split-label.foh strong { color: var(--blue); }
.split-label.foh .dot { background: var(--blue); }
.split-label.boh strong { color: var(--slate); }
.split-label.boh .dot { background: var(--slate); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #cfd6df;
  cursor: pointer;
  margin: 8px 0 10px;
  padding: 0;
  border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--blue);
  border: none;
  border-radius: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--blue);
  border: none;
  border-radius: 0;
}

.split-bar {
  height: 7px;
  background: var(--slate);
  overflow: hidden;
  opacity: 0.35;
}
.split-bar-foh {
  height: 100%;
  width: 70%;
  background: var(--blue);
}

/* ---------------- Stats row ---------------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat.foh { border-top: 3px solid var(--blue); }
.stat.boh { border-top: 3px solid var(--slate); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.stat-value {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
}
.stat.foh .stat-value { color: var(--blue); }
.stat.boh .stat-value { color: var(--slate); }

.stat-sub { font-size: 12px; color: var(--ink-faint); }

/* ---------------- Main grid ---------------- */

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 22px;
  align-items: start;
}
.main-grid .card { margin-top: 22px; }

@media (max-width: 1020px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

tfoot td {
  border-bottom: none;
  border-top: 1px solid var(--line);
  font-weight: 700;
  color: var(--ink);
  padding-top: 9px;
}

.empty-msg {
  color: var(--ink-faint);
  font-size: 14px;
  padding: 16px 6px 4px;
  margin: 0;
}

/* Roster table inline inputs */

.roster-table input[type="text"],
.roster-table input[type="number"],
.roster-table select {
  padding: 5px 8px;
  font-size: 14px;
  background: transparent;
  border-color: transparent;
}
.roster-table input:hover, .roster-table select:hover { border-color: var(--line); }
.roster-table input:focus-visible, .roster-table select:focus-visible {
  background: #fff;
  border-color: var(--blue);
  outline: 2px solid var(--blue);
  outline-offset: -1px;
}
.roster-table input[type="number"] { width: 62px; text-align: right; }
.roster-table .name-input { min-width: 130px; }
.roster-table select { min-width: 150px; }

.dept-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: 1px;
}
.dept-tag.foh { background: var(--blue-tint); color: var(--blue-hover); }
.dept-tag.boh { background: var(--slate-tint); color: var(--slate); }

tr.dept-divider td {
  background: #f7f9fb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  padding: 7px 10px 5px;
  border-bottom: 1px solid var(--line);
}
tr.dept-divider.foh td { color: var(--blue); }
tr.dept-divider.boh td { color: var(--slate); }

/* ---------------- Buttons ---------------- */

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f0f3f7; border-color: #b9c2cd; }

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }

.btn-ghost { color: var(--ink-dim); }
.btn-ghost:hover { color: var(--ink); }

.btn-danger {
  color: var(--ink-faint);
  border-color: transparent;
  background: transparent;
  padding: 5px 9px;
  font-size: 16px;
  line-height: 1;
}
.btn-danger:hover { color: var(--danger); background: #fbeae8; border-color: #ecc8c4; }

.btn-link {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------------- Add member form ---------------- */

.add-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.add-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr 0.6fr 0.7fr auto;
  gap: 11px;
  align-items: end;
}

@media (max-width: 760px) {
  .add-grid { grid-template-columns: 1fr 1fr; }
}

.add-btn-field { justify-content: flex-end; }

/* ---------------- Results ---------------- */

.dept-results { margin-bottom: 24px; }
.dept-results:last-child { margin-bottom: 0; }

.dept-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 9px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.dept-title::before {
  content: "";
  width: 9px; height: 9px;
}
.dept-results.foh .dept-title { color: var(--blue); }
.dept-results.foh .dept-title::before { background: var(--blue); }
.dept-results.boh .dept-title { color: var(--slate); }
.dept-results.boh .dept-title::before { background: var(--slate); }

.results-table .share-cell { font-weight: 700; color: var(--ink); }
.results-table .hourly-cell { color: var(--ink-dim); }

.dept-empty {
  color: var(--ink-faint);
  font-size: 13px;
  padding: 8px 6px;
  margin: 0;
}

.results-warning {
  background: #fdf3e7;
  border: 1px solid #edd3ae;
  color: #7a5a24;
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 16px;
}

.grand-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 13px;
  font-size: 17px;
  font-weight: 700;
}
.grand-total-row .amount { color: var(--blue); }

/* ---------------- History ---------------- */

.history-table td { color: var(--ink-dim); }
.history-table td:first-child { color: var(--ink); font-weight: 600; }

/* ---------------- Footer ---------------- */

.site-footer {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.site-footer p {
  font-size: 12px;
  color: var(--ink-faint);
  max-width: 82ch;
  margin: 0;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: #fff;
  border: 1px solid var(--blue);
  color: var(--ink);
  padding: 10px 18px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Report modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(19, 22, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: #fff;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.report-meta { margin: 0 0 14px; font-size: 13px; color: var(--ink-dim); }

/* ---------------- Login overlay ---------------- */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}
.login-overlay[hidden] { display: none; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 32px 30px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.login-card .login-mark { width: 44px; height: 44px; color: var(--blue); margin: 0 auto; }
.login-card h2 { font-size: 18px; margin: 0; }
.login-card p { font-size: 13px; color: var(--ink-dim); margin: 0; }
.login-error { color: var(--danger) !important; font-weight: 600; }

/* ---------------- Boot error banner ---------------- */

.boot-error {
  background: #fdecea;
  border: 1px solid #e5b3ae;
  color: #8a3a32;
  padding: 12px 16px;
  margin-top: 22px;
  font-size: 14px;
  font-weight: 600;
}
.boot-error[hidden] { display: none; }

/* ---------------- Reports ---------------- */

.report-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
  gap: 14px;
  margin-bottom: 18px;
}

.report-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.report-chip {
  background: #f7f9fb;
  border: 1px solid var(--line-soft);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}
.report-chip-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.report-chip-value { font-size: 19px; font-weight: 700; color: var(--ink); }

.report-sub {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin: 20px 0 8px;
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------------- Print ---------------- */

@media print {
  body { background: #fff; font-size: 12px; }
  .add-form, .actions, .site-footer, .modal-backdrop, .login-overlay, .view-nav,
  #viewSettings, .week-control, .btn, input[type="range"], .split-bar { display: none !important; }

  main, .site-header { max-width: 100%; padding: 0 10px; }
  .site-header { border-bottom: 1px solid #ccc; }
  .main-grid { grid-template-columns: 1fr; }
  .roster-table input, .roster-table select {
    border: none !important; background: none; padding: 0;
    appearance: none; -webkit-appearance: none;
  }
}
