/* =========================================================
   Superior Wash Tools — design system
   ========================================================= */

:root {
  /* Brand — muted reds and blues drawn from the Superior Wash logo. */
  --brand-blue:      #1e3a8a;     /* deep but not navy */
  --brand-blue-600:  #1d4ed8;     /* primary action */
  --brand-blue-700:  #1e40af;     /* primary hover */
  --brand-blue-50:   #eef2ff;     /* tinted backgrounds */

  --brand-red:       #b91c1c;     /* subdued red, used for accents only */
  --brand-red-700:   #991b1b;
  --brand-red-50:    #fef2f2;

  /* Neutrals — slate-tinted greys for a calm, professional feel. */
  --bg:              #f6f8fb;
  --surface:         #ffffff;
  --surface-2:       #f8fafc;
  --border:          #e2e8f0;
  --border-strong:   #cbd5e1;
  --text:            #0f172a;
  --text-muted:      #475569;
  --text-subtle:     #94a3b8;

  /* Semantic */
  --success:         #15803d;
  --success-bg:      #f0fdf4;
  --warning:         #b45309;
  --warning-bg:      #fffbeb;
  --danger:          var(--brand-red);
  --danger-bg:       var(--brand-red-50);

  /* Division accent — Dallas = green, FW = red */
  --dallas:          #15803d;
  --dallas-700:      #166534;
  --dallas-50:       #f0fdf4;

  /* Geometry */
  --radius-sm:       4px;
  --radius:          8px;
  --radius-lg:       12px;

  --shadow-xs:       0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:       0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:          0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg:       0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.06);

  --font-sans:       -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
                     Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-h:        60px;
  --tab-h:           48px;
}

/* =========================================================
   Reset / base
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* =========================================================
   Layout
   ========================================================= */

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.main {
  padding: 32px 0;
}

.main .container {
  display: block;
  padding: 0 24px;
}

/* =========================================================
   Header
   ========================================================= */

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.brand-mark.large {
  width: 56px;
  height: 56px;
  font-size: 22px;
  border-radius: var(--radius);
}

.brand-name { color: var(--text); }
.brand-suffix {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
  position: relative;
}
.brand-suffix::before {
  content: "/";
  margin-right: 6px;
  color: var(--text-subtle);
  font-weight: 300;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-name {
  color: var(--text-muted);
  font-size: 13px;
}

/* =========================================================
   Tab strip
   ========================================================= */

.tab-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--tab-h);
}
.tab-strip .container {
  height: 100%;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0 24px;
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: color 120ms, border-color 120ms;
  cursor: pointer;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
  color: var(--brand-blue-700);
  border-bottom-color: var(--brand-blue-600);
}
.tab.disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
}

/* =========================================================
   Page header (titles)
   ========================================================= */

.page-head {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}
.page-subtitle {
  margin: 0;
  color: var(--text-muted);
  max-width: 720px;
}

/* =========================================================
   Cards
   ========================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
}
.card-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.card-body {
  padding: 22px;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--brand-blue-600);
  outline-offset: 2px;
}

.btn-large {
  padding: 11px 22px;
  font-size: 14.5px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--brand-blue-600);
  color: #fff;
  border-color: var(--brand-blue-600);
}
.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  background: var(--brand-blue-700);
  border-color: var(--brand-blue-700);
}

.btn-secondary {
  background: var(--surface);
  color: var(--brand-blue-700);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled),
.btn-secondary:focus-visible:not(:disabled) {
  background: var(--brand-blue-50);
  border-color: var(--brand-blue-600);
}

.btn-danger {
  background: var(--surface);
  color: var(--brand-red);
  border-color: var(--brand-red);
}
.btn-danger:hover:not(:disabled) {
  background: var(--brand-red-50);
  border-color: var(--brand-red-700);
  color: var(--brand-red-700);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Plain link styled like a button */
.btn-link {
  display: inline-flex;
  align-items: center;
  color: var(--brand-blue-700);
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* =========================================================
   Action row (groups of buttons)
   ========================================================= */

.action-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.action-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 280px;
  min-width: 280px;
}

.action-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.action-checkbox input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
.action-checkbox:hover { color: var(--text); }

.action-note {
  font-size: 12px;
  color: var(--text-subtle);
  margin: 4px 0 0;
}

/* "Skipped N crews" — itemized with reasons + per-crew Run anyway button */
.skipped-block {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
}
.skipped-head { margin: 0 0 8px; font-weight: 600; color: #92400e; }
.skipped-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.skipped-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid #fde68a;
}
.skipped-item:first-child { border-top: 0; }
.skipped-info { flex: 1; min-width: 0; }
.skipped-info strong { color: #92400e; }
.skipped-reason { color: var(--text-muted); }

/* inline form (no margins, sits next to other buttons/links) */
.inline-form {
  display: inline-block;
  margin: 0;
  padding: 0;
}

/* destructive link-style action — red on hover */
.btn-danger-link {
  color: var(--text-subtle);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
.btn-danger-link:hover { color: var(--brand-red); }

/* run-block: each timestamped run inside a date in Past Runs */
.run-block {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.run-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.run-time { font-weight: 600; color: var(--text); font-size: 14px; }
.run-meta-sm { color: var(--text-muted); font-size: 12px; }
.ml-auto { margin-left: auto; }

/* Past runs: nicer collapsible expander */
.run-day {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
  overflow: hidden;
}
.run-day[open] { box-shadow: var(--shadow-xs); }
.run-day-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.run-day-summary::-webkit-details-marker { display: none; }
.run-day-summary::before {
  content: "›";
  display: inline-block;
  width: 20px;
  height: 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-subtle);
  transition: transform 0.15s ease;
  text-align: center;
  line-height: 18px;
}
.run-day[open] .run-day-summary::before {
  transform: rotate(90deg);
}
.run-day-summary:hover { background: var(--surface-2); }
.run-day-summary .run-date { flex: 1; font-weight: 600; color: var(--text); }
.run-day-summary .run-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* Phase 4: Drive sync UI */
.drive-banner {
  margin: 12px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.drive-ok {
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  color: var(--success);
}
.drive-partial {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  color: var(--warning);
}
.drive-err {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--danger);
}

.drive-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  border: 1px solid #c7d2fe;
  font-weight: 500;
  vertical-align: middle;
}
.drive-tag-err {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}


/* =========================================================
   Customers tab
   ========================================================= */

.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn-icon {
  display: inline-block;
  margin-right: 4px;
  font-weight: 700;
}
.upload-form { display: inline-block; margin: 0; }

/* --- Stat strip --- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.stat-card-muted { background: var(--surface-2); }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Filter bar --- */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.search-row {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
@media (max-width: 720px) {
  .search-row { grid-template-columns: 1fr; }
}
.search-input-wrap {
  position: relative;
  min-width: 0;
}
.select-narrow { width: 100%; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 16px;
}
.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px var(--brand-blue-50);
}
.select {
  padding: 10px 28px 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23475569' d='M0 0l5 6 5-6z'/></svg>") no-repeat right 10px center;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--brand-blue-600); box-shadow: 0 0 0 3px var(--brand-blue-50); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}
.chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  margin: 0;
}
button.chip { line-height: 1.4; }
.chip:hover { background: var(--brand-blue-50); color: var(--brand-blue-700); border-color: #c7d2fe; }
.chip-active {
  background: var(--brand-blue-600);
  color: #fff;
  border-color: var(--brand-blue-600);
}
.chip-active:hover { background: var(--brand-blue-700); color: #fff; border-color: var(--brand-blue-700); }

/* Weekly Reports section on the Crew Reports page */
.weekly-form {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.weekly-row-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
}
.weekly-quickpicks { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.weekly-anchor-wrap { display: flex; align-items: center; gap: 8px; }
.weekly-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.weekly-range-row .week-picker { min-width: 160px; }
.weekly-buttons-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Centered variants — used in Crew Reports → Weekly Reports section so the
   quickpicks, the From/To pickers, and the build buttons all line up
   vertically down the middle of the card. */
.weekly-quickpicks-centered { justify-content: center; }
.weekly-range-centered     { justify-content: center; }
.weekly-buttons-centered   { justify-content: center; }

/* Detailer rate sub-section on the Pay Rates page — sits below the main
   3-tier matrix and only shows the 3 line items that detailers actually
   get paid for. Visually separated so it doesn't look like a 4th column. */
.rates-detailer-section {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rates-section-head {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
}
.rates-section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}
.rates-table-detailer { width: 100%; }

/* Custom-date row on the Generate card — sits underneath the Today /
   Yesterday buttons and lets the user pick any past date. */
.custom-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.custom-date-row .week-picker { min-width: 160px; }

.weekly-history { margin-top: 18px; }
.weekly-history-head {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.weekly-list { list-style: none; margin: 0; padding: 0; }
.weekly-item {
  display: grid;
  grid-template-columns: 110px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 6px;
  font-size: 13px;
}
.weekly-item-kind {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
}
.weekly-item-kind-time-sheets { background: var(--brand-blue-50); color: var(--brand-blue-700); }
.weekly-item-kind-dallas-wos  { background: var(--dallas-50);     color: var(--dallas-700); }
.weekly-item-kind-fw-wos      { background: var(--brand-red-50);  color: var(--brand-red-700); }
.weekly-item-kind-other       { background: var(--surface-2);     color: var(--text-muted); }
.weekly-item-name { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-item-meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.weekly-item-actions { display: flex; gap: 8px; align-items: center; }
.btn-small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.btn-dallas {
  background: var(--dallas);
  color: #fff;
  border: 1px solid var(--dallas);
}
.btn-dallas:hover { background: var(--dallas-700); }
.btn-fw {
  background: var(--brand-red);
  color: #fff;
  border: 1px solid var(--brand-red);
}
.btn-fw:hover { background: var(--brand-red-700); }


/* Division chips — Dallas = green, Fort Worth = red, All stays brand blue */
.chip-dallas.chip-active        { background: var(--dallas); border-color: var(--dallas); }
.chip-dallas.chip-active:hover  { background: var(--dallas-700); border-color: var(--dallas-700); }
.chip-fw.chip-active            { background: var(--brand-red); border-color: var(--brand-red); }
.chip-fw.chip-active:hover      { background: var(--brand-red-700); border-color: var(--brand-red-700); }
.chip-toggle { user-select: none; }
.chip-spacer { flex: 1; }

/* --- Customer table --- */
.customer-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.customer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.customer-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.customer-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.customer-table tbody tr:last-child td { border-bottom: 0; }
.customer-row { cursor: pointer; transition: background 0.1s; }
.customer-row:hover { background: var(--brand-blue-50); }
.row-inactive { opacity: 0.55; }

.col-name  { width: 24%; }
.col-addr  { width: 28%; color: var(--text-muted); }
.col-div   { width: 60px; }
.col-freq  { width: 100px; }
.col-pay   { width: 80px; }
.col-tags  { width: auto; }
.col-edit  { width: 40px; text-align: right; }

.cust-name { font-weight: 600; color: var(--text); }
.cust-sub  { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.cust-addr { font-size: 13px; }

.div-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.div-pill-d { background: var(--dallas-50);     color: var(--dallas-700); }
.div-pill-f { background: var(--brand-red-50); color: var(--brand-red-700); }

.cust-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  margin: 1px 3px 1px 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}
.tag-nfi     { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.tag-hourly  { background: #fdf4ff; color: #86198f; border-color: #f5d0fe; }
.tag-trip    { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.tag-garbage { background: var(--brand-red-50); color: var(--brand-red-700); border-color: #fecaca; }

.row-edit-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-subtle);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.customer-row:hover .row-edit-btn { color: var(--brand-blue-700); }
.row-edit-btn:hover {
  background: var(--brand-blue-50);
  border-color: #c7d2fe;
  color: var(--brand-blue-700);
}

/* --- Empty state --- */
.empty-state-large {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
}
.empty-state-large h3 { margin: 12px 0 6px; }
.empty-state-large p  { color: var(--text-muted); margin: 6px 0; }
.empty-state-icon {
  font-size: 36px;
  color: var(--text-subtle);
  margin-bottom: 8px;
}

/* --- Drawer --- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.drawer-title { margin: 0; font-size: 18px; }
.drawer-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
}
.drawer-close:hover { background: var(--surface-2); color: var(--text); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
}
.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.drawer-foot-spacer { flex: 1; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-field { display: flex; flex-direction: column; }
.form-field-full { grid-column: 1 / -1; }
.form-field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.form-field .req { color: var(--brand-red); }
.form-field input[type="text"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px var(--brand-blue-50);
}
.form-field textarea { resize: vertical; min-height: 56px; }

.form-field-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-2);
  transition: background 0.12s, border-color 0.12s;
}
.toggle-label:hover { background: var(--brand-blue-50); border-color: #c7d2fe; }
.toggle-label input { margin-top: 4px; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }


/* --- Review banner + needs-review marker --- */
.review-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  margin: 18px 0;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}
.review-banner-text {
  flex: 1;
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
}
.review-banner-text strong { color: #92400e; display: block; margin-bottom: 2px; }

.btn-warning {
  background: var(--warning);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-warning:hover { background: #92400e; }

.row-needs-review .col-name .cust-name { color: var(--text); }
.row-needs-review { background: #fffbeb33; }

.chip-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.chip-warning:hover { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
.chip-warning.chip-active { background: var(--warning); color: #fff; border-color: var(--warning); }

.chip-count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-weight: 700;
}
.chip-warning.chip-active .chip-count { background: rgba(255, 255, 255, 0.25); }

.tag-review  { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.tag-qj      { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.tag-csv     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tag-merged  { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

.div-pill-empty {
  background: var(--surface-2);
  color: var(--text-subtle);
  border: 1px dashed var(--border-strong);
  font-weight: 500;
}


/* --- Reset / danger menu --- */
.reset-menu {
  position: relative;
  margin: 0;
}
.btn-icon-only {
  width: 38px;
  padding: 9px 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.reset-menu summary { list-style: none; }
.reset-menu summary::-webkit-details-marker { display: none; }
.reset-menu-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 280px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.reset-menu-body form { margin: 0 0 8px; }
.reset-menu-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}
.reset-menu-sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* --- Cleaner admin menu (Payroll ⋯ button) --- */
.admin-menu { position: relative; margin: 0; }
.admin-menu summary { list-style: none; }
.admin-menu summary::-webkit-details-marker { display: none; }
.admin-menu-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 320px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.admin-menu-group { padding: 8px 4px; }
.admin-menu-group + .admin-menu-group {
  border-top: 1px solid var(--border);
}
.admin-menu-heading {
  padding: 4px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}
.admin-menu form { margin: 0; }
.admin-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.1s;
}
.admin-menu-item:hover { background: var(--brand-blue-50); }
.admin-menu-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}
.admin-menu-danger { color: var(--brand-red); }
.admin-menu-danger:hover { background: var(--brand-red-50); }

.btn-danger-outline {
  background: transparent;
  color: var(--brand-red);
  border: 1px solid var(--brand-red);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-danger-outline:hover {
  background: var(--brand-red);
  color: #fff;
}


/* =========================================================
   Settings — sub-tab strip + Employees + Pay Rates
   ========================================================= */

.sub-tab-strip {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 22px;
  padding: 4px 0 0;
}
.sub-tab {
  padding: 10px 18px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.12s, border-color 0.12s;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  color: var(--brand-blue-700);
  border-bottom-color: var(--brand-blue-600);
}
.sub-tab.disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Pay Rates matrix --- */
.rates-form { margin-top: 12px; }
.rates-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rates-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.rates-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rates-table tbody tr:last-child td { border-bottom: 0; }
.rates-row:hover { background: var(--brand-blue-50); }
.rates-row-xtra    { background: #fffaf0; }
.rates-row-manual  { background: #f8fafc; }
.rates-row-ttb     { background: #f0f9ff; }
.rates-col-num     { width: 40px; color: var(--text-subtle); }
.rates-col-name    { font-weight: 500; }
.rates-col-cat     { width: 90px; }
.rates-col-rate    { width: 140px; text-align: right; }

.rate-input-wrap {
  position: relative;
  max-width: 100px;
  margin-left: auto;
}
.rate-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.rate-input {
  width: 100%;
  padding: 7px 8px 7px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: right;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rate-input:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px var(--brand-blue-50);
}

.cat-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
  border: 1px solid transparent;
}
.cat-ttb     { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.cat-special { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.cat-xtra    { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cat-manual  { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }

.rates-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.rates-legend {
  font-size: 12px;
  color: var(--text-muted);
}

.pin-save-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pin-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pin-input {
  width: 80px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.2em;
  background: var(--surface);
}
.pin-input:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px var(--brand-blue-50);
}


/* =========================================================
   Payroll tab
   ========================================================= */

.payroll-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.week-pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  font-size: 13px;
}
.week-picker {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  cursor: pointer;
}
.payroll-toolbar-spacer { flex: 1; }
.view-toggle { display: flex; gap: 6px; }

.payroll-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .payroll-layout { grid-template-columns: 1fr; }
}

.payroll-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: var(--shadow-xs);
}
.sidebar-head {
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.sidebar-item:hover { background: var(--brand-blue-50); }
.sidebar-item.active {
  background: var(--brand-blue-600);
  color: #fff;
  font-weight: 600;
}
.sidebar-item.active .sidebar-tag {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: transparent;
}
/* Subtle color cue when filtered by division — Dallas = green,
   Fort Worth = red. "All" keeps the default brand-blue. */
.sidebar-item.div-d.active        { background: var(--dallas); }
.sidebar-item.div-d.active:hover  { background: var(--dallas-700); }
.sidebar-item.div-d:hover         { background: var(--dallas-50); }
.sidebar-item.div-f.active        { background: var(--brand-red-700); }
.sidebar-item.div-f.active:hover  { background: var(--brand-red); }
.sidebar-item.div-f:hover         { background: var(--brand-red-50); }
.sidebar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.sidebar-tag.tag-driver       { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.sidebar-tag.tag-helper_old   { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.sidebar-tag.tag-helper_new   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.sidebar-empty { padding: 16px; color: var(--text-muted); font-size: 13px; }

.payroll-sheet { min-width: 0; }

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 14px 18px;
  border-bottom: 0;
}
.sheet-employee-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.sheet-employee-tier {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.sheet-week-of { text-align: right; }
.sheet-week-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.sheet-week-value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sheet-warnings {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.sheet-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.sheet-warnings li { margin: 2px 0; }

.sheet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 0;
  overflow: hidden;
}
.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sheet-table thead th {
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.sheet-table thead th.sheet-col-num,
.sheet-table thead th.sheet-col-name { text-align: left; }
.sheet-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.sheet-table tbody tr:last-child td { border-bottom: 0; }
.sheet-row:hover { background: var(--brand-blue-50); }
.sheet-row-xtra   td { background: #fffaf0; }
.sheet-row-manual td { background: #f8fafc; }
.sheet-row-ttb    td { background: #f0f9ff; }
.sheet-row-deduct td { background: #fff7ed; padding: 12px 14px; }
.sheet-row-grand  td {
  background: var(--brand-blue-50);
  font-weight: 700;
  padding: 12px 14px;
}
.sheet-grand-total { font-size: 16px; color: var(--brand-blue-700); }

.sheet-col-num   { width: 36px; color: var(--text-subtle); text-align: left; }
.sheet-col-name  { text-align: left; }
.sheet-col-day   {
  width: 50px;
  font-size: 12px;
  background: var(--surface);
}
.sheet-day-date {
  display: block;
  font-weight: 400;
  color: var(--text-subtle);
  font-size: 10px;
}
.sheet-col-qty   { width: 56px; }
.sheet-col-rate  { width: 64px; color: var(--text-muted); }
.sheet-col-total { width: 80px; }
.sheet-col-manual{ width: 72px; }
.has-qty { font-weight: 600; }
.has-amt { font-weight: 600; color: var(--text); }
.has-deduct { color: var(--brand-red); font-weight: 600; }

.deduct-fields {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.deduct-field { display: inline-flex; align-items: center; gap: 8px; }
.deduct-field-grow { flex: 1; }
.deduct-label-text {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.deduct-money-wrap {
  position: relative;
  display: inline-block;
}
.deduct-dollar {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 13px;
  pointer-events: none;
}
.deduct-amount {
  width: 100px;
  padding: 7px 10px 7px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: right;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}
.deduct-amount:focus,
.deduct-label-input:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px var(--brand-blue-50);
}
.deduct-label-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  text-transform: none;
  background: var(--surface);
}
.deduct-clear-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  color: var(--text-subtle);
  font-weight: 700;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.deduct-clear-btn:hover {
  background: var(--brand-red-50);
  color: var(--brand-red);
  border-color: var(--brand-red);
}

/* +/- stepper for manual QTY (whole-number-only, click-protected via tabindex) */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.qty-btn {
  width: 22px;
  height: 26px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  background: var(--surface);
  color: var(--text);
  transition: background 0.1s, color 0.1s;
}
.qty-btn-minus { color: var(--brand-red); }
.qty-btn-plus  { color: var(--success); }
.qty-btn-minus:hover { background: var(--brand-red-50); }
.qty-btn-plus:hover  { background: var(--success-bg); }
.qty-btn:active      { transform: translateY(1px); }
.manual-input {
  width: 38px;
  padding: 4px 4px;
  border: 0;
  font-size: 12px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: transparent;
  pointer-events: none;     /* click-protector: typing into it is disabled */
}
.manual-input-touched { font-weight: 600; color: var(--brand-blue-700); }

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}


.print-only { display: none; }
.print-hide { /* visible on screen, hidden in print (set via @media below) */ }
.deduct-print { font-size: 12px; }
.deduct-print-reason {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.sheet-grand-label {
  text-align: right;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-right: 18px !important;
}

/* --- Print: only the active payroll sheet, sized to one page --- */
@media print {
  /* Browser-controlled headers/footers (the page URL + date) can only be
     hidden by the user via Print dialog → "More settings" → uncheck
     "Headers and footers". We can't disable from CSS, but we can make
     the rest fit one page by shrinking aggressively. */
  body {
    background: #fff;
    font-size: 9.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .app-header,
  .tab-strip,
  .sub-tab-strip,
  .flash-stack,
  .page-head,
  .payroll-toolbar,
  .payroll-sidebar,
  .sheet-foot,
  .sheet-warnings,
  .no-print,
  .print-hide,
  .print-hide-row {
    display: none !important;
  }
  .print-only { display: block !important; }

  .payroll-layout    { display: block; }
  .print-area        { width: 100%; margin: 0; padding: 0; }
  .container         { max-width: none; padding: 0; margin: 0; }
  .main              { padding: 0; }
  .sheet-head, .sheet-card { box-shadow: none; }
  .sheet-head { padding: 6px 8px; border-radius: 0; border-bottom: 1px solid #000; }
  .sheet-employee-name { font-size: 14pt; }
  .sheet-employee-tier { font-size: 9pt; }
  .sheet-week-of { font-size: 9pt; }
  .sheet-week-value { font-size: 13pt; }

  .sheet-table { font-size: 9pt; }
  .sheet-table thead th { padding: 4px 6px; font-size: 7.5pt; }
  .sheet-table tbody td { padding: 3px 6px; }

  /* Hide the manual + column when printing — that's an editing affordance */
  .sheet-col-manual { display: none !important; }

  .sheet-row-grand td {
    background: #e8f0ff !important;
    font-size: 11pt;
    padding: 8px 10px !important;
  }
  .sheet-grand-label { padding-right: 12px !important; }
  .sheet-row-deduct td { background: #fff7ed !important; padding: 8px 10px !important; }

  @page {
    size: letter portrait;
    margin: 0.4in;
  }
}

/* "Generate anyway?" empty-state confirm block */
.confirm-block {
  margin-top: 16px;
  padding: 16px;
  background: var(--brand-blue-50);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
}
.confirm-block p { margin: 0 0 8px; }
.confirm-block p.muted {
  color: var(--text-muted);
  font-size: 13px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hint {
  margin: 16px 0 0;
  padding: 10px 12px;
  background: var(--brand-blue-50);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  color: var(--brand-blue-700);
  font-size: 13px;
}
.hint strong { color: var(--brand-blue); }

/* =========================================================
   Job in-progress / result UI
   ========================================================= */

.job-running {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.job-running-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.job-target {
  font-weight: 500;
  color: var(--text);
  margin-left: 10px;
}

.progress-bar {
  position: relative;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, var(--brand-blue-600), var(--brand-blue-700));
  border-radius: 999px;
  transition: width 360ms ease;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
#job-progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text);
}

.btn-x {
  font-size: 18px;
  line-height: 1;
  margin-right: 4px;
}

.job-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.job-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.job-result-head .ml-auto { margin-left: auto; }

.job-result-message {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.job-error-detail {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--brand-red-700);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  margin: 0;
}

/* Status badges --------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-running {
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  border-color: #c7d2fe;
}
.badge-running::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-blue-600);
  margin-right: 6px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.badge-done {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}
.badge-cancelled {
  background: #f1f5f9;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.badge-error {
  background: var(--danger-bg);
  color: var(--brand-red-700);
  border-color: #fecaca;
}

/* =========================================================
   Past runs / PDF list
   ========================================================= */

.run-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.run-day {
  border-bottom: 1px solid var(--border);
}
.run-day:last-child { border-bottom: 0; }

.run-day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.run-day-summary::-webkit-details-marker { display: none; }
.run-day-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 10px;
  color: var(--text-subtle);
  transition: transform 150ms ease;
}
.run-day[open] .run-day-summary::before {
  transform: rotate(90deg);
}

.run-date {
  font-weight: 500;
  color: var(--text);
}
.run-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.pdf-list {
  list-style: none;
  margin: 4px 0 12px 26px;
  padding: 0;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}
.pdf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.pdf-item:last-child { border-bottom: 0; }
.pdf-name {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.pdf-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state p { margin: 0; }

/* =========================================================
   Forms
   ========================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

/* =========================================================
   Auth (login) layout
   ========================================================= */

body.auth-layout {
  background:
    radial-gradient(circle at 0% 0%, rgba(30, 64, 175, 0.06), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(185, 28, 28, 0.04), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.auth-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.auth-footnote {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 14px 0 0;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form .btn-full {
  margin-top: 4px;
}

/* =========================================================
   Flash messages
   ========================================================= */

.flash-stack { margin-bottom: 16px; }

.flash {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid transparent;
  margin-bottom: 8px;
}
.flash-error {
  color: var(--brand-red-700);
  background: var(--danger-bg);
  border-color: #fecaca;
}
.flash-success {
  color: var(--success);
  background: var(--success-bg);
  border-color: #bbf7d0;
}
.flash-warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: #fde68a;
}

/* =========================================================
   Tooltips (data-tooltip on disabled buttons)
   ========================================================= */

[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}
