/* The hidden attribute must always win. Without this, any class that sets display (e.g.
   .ts-toolbar { display: flex }) overrides it, and controls the code has hidden stay on
   screen: "Add a day" and "Fill blank days" showed on an Exported period (28 Sep 2026). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: #f3f4f6;
  color: #111;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
header h1 { margin: 0; font-size: 20px; font-weight: 600; }
#auth-controls { display: flex; align-items: center; gap: 12px; }
.user-name-inline { color: #4b5563; font-size: 14px; }
main { max-width: 1080px; margin: 32px auto; padding: 0 16px; }
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
button {
  background: #2563eb;
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
button:not(:disabled):hover { background: #1d4ed8; }
button:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }
#signout-btn { background: #6b7280; }
#signout-btn:hover { background: #4b5563; }
code { background: #eef2ff; padding: 2px 6px; border-radius: 3px; font-size: 13px; }
.error { color: #b91c1c; }

.setting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 24px;
}
.setting-grid div { display: flex; flex-direction: column; }
.setting-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 2px;
}

.ts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}
.ts-header h2 { margin: 0; font-size: 18px; }
.period-picker { display: flex; align-items: center; gap: 8px; }
.period-picker label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.period-picker select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.period-picker select:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.period-meta { color: #6b7280; font-size: 13px; margin: 4px 0 12px; }
.ts-status { color: #6b7280; font-size: 14px; margin: 12px 0; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; font-size: 13px; }
th { background: #f9fafb; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: #4b5563; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f9fafb; }

.status-Draft { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Submitted { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-EditedByPayroll { background: #ede9fe; color: #5b21b6; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Approved { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* Primary tabs (My Timesheet / Admin) */
.primary-tabs {
  display: flex;
  gap: 4px;
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 0 16px;
  border-bottom: 1px solid #e5e7eb;
}
.primary-tabs .ptab {
  background: transparent;
  color: #4b5563;
  border-radius: 6px 6px 0 0;
  padding: 10px 16px;
  font-weight: 500;
  border: 1px solid transparent;
  border-bottom: 0;
  margin-bottom: -1px;
}
.primary-tabs .ptab:hover { background: #eef2ff; color: #1e40af; }
.primary-tabs .ptab.active {
  background: #f3f4f6;
  color: #111;
  border-color: #e5e7eb;
}

/* Admin sub-tabs */
.subtabs {
  display: flex;
  gap: 4px;
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 0 16px;
}
.subtab {
  background: #fff;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
}
.subtab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.subtab[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Settings form */
.settings-help { color: #6b7280; font-size: 13px; margin: 0 0 16px; }
.settings-group {
  margin: 20px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}
.settings-group:first-child { margin-top: 0; }
.settings-form .form-row {
  display: grid;
  grid-template-columns: 240px 200px 1fr;
  align-items: center;
  gap: 12px 16px;
  padding: 6px 0;
}
.settings-form label { font-size: 14px; color: #111; cursor: help; }
.settings-form input, .settings-form select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  width: 100%;
}
.settings-form input:focus-visible, .settings-form select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.form-help { color: #6b7280; font-size: 12px; margin: 0; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
.status-success { color: #047857; }
.status-error   { color: #b91c1c; }
.status-info    { color: #4b5563; }

/* Filter chips (Employees tab) */
.filter-chips { display: flex; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.chip {
  background: #fff;
  color: #4b5563;
  border: 1px solid #d1d5db;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { background: #f3f4f6; }
.chip.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.badge-warn {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

.banner-warn {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.4;
}

.status-Open      { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Locked    { background: #e0e7ff; color: #3730a3; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Exported  { background: #f3f4f6; color: #4b5563; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }

.inline-edit {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 16px;
}
.inline-edit h3 { margin: 0 0 4px; font-size: 16px; }

#employees-paste summary { cursor: pointer; padding: 4px 0; }
#employees-paste-diff { width: 100%; margin-top: 8px; border-collapse: collapse; }
#employees-paste-diff th, #employees-paste-diff td { padding: 6px 10px; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 13px; }
.paste-row.paste-update          { background: #ecfdf5; }
.paste-row.paste-unchanged       { background: #f3f4f6; color: #6b7280; }
.paste-row.paste-unmatched-name  { background: #fef3c7; }
.paste-row.paste-bad-id          { background: #fee2e2; }
.paste-row.paste-conflicting-id  { background: #ffedd5; }
.paste-row.paste-parse-error     { background: #fee2e2; }
.paste-row.paste-imported        { background: #d1fae5; }
.paste-row.paste-failed          { background: #fee2e2; }

@media (max-width: 720px) {
  .settings-form .form-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .settings-form label { font-weight: 600; }
}

/* My Timesheet entries grid (S06r read + S10r edit-mode) */
.entries-table { table-layout: fixed; }
.entries-table th, .entries-table td {
  padding: 6px 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.entries-table th { white-space: nowrap; }
.entries-table .col-day      { width: 44px; }
.entries-table .col-date     { width: 96px; }
.entries-table .col-time     { width: 84px; }
.entries-table .col-break    { width: 76px; }
.entries-table .col-num      { width: 64px; }
.entries-table .col-cat      { width: 120px; }
.entries-table .col-notes    { width: auto; min-width: 80px; }
.entries-table .col-status   { width: 130px; }
.entries-table .col-actions  { width: 110px; }
.entries-table .col-emp      { width: 140px; }
/* Don't squash header text into adjacent columns when widths are tight. */
.entries-table thead th { overflow: hidden; text-overflow: ellipsis; }
.entries-table td        { overflow: hidden; text-overflow: ellipsis; }
.entries-table td.num        { font-variant-numeric: tabular-nums; }
.entries-table select.entry-input.entry-cat {
  font: inherit;
  height: 28px;
  padding: 2px 4px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.entries-table input.entry-input {
  font: inherit;
  height: 28px;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.entries-table input.entry-input.entry-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.entries-table input.entry-input.entry-time { text-align: center; }
.entries-table input.entry-input::placeholder { color: #9ca3af; }
.entries-table input.entry-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.18);
}
/* Kill native number-spinner chrome (defensive — we use type=text now). */
.entries-table input[type=number]::-webkit-outer-spin-button,
.entries-table input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.entries-table input[type=number] { -moz-appearance: textfield; }

.btn-row-submit,
.btn-row-done {
  font-size: 13px;
  padding: 0 12px;
  height: 28px;
  line-height: 28px;
  border-radius: 4px;
  box-sizing: border-box;
  border: 0;
  min-width: 92px;
  text-align: center;
}
.btn-row-submit:disabled { opacity: 0.5; cursor: default; }

.btn-row-done {
  background: #e5e7eb;
  color: #6b7280;
  cursor: default;
  font-weight: 500;
}

.entries-table tbody tr.row-locked > td { background: #f0f9ff; color: #475569; }
.entries-table tbody tr.row-locked > td.entry-actions-col { background: #f0f9ff; }

.ts-toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.ts-toolbar-hint { font-size: 12px; color: #6b7280; }
.btn-secondary {
  font-size: 13px;
  padding: 0 14px;
  height: 30px;
  line-height: 30px;
  background: #fff;
  color: #1e40af;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:not(:disabled):hover { background: #eef2ff; }
.btn-secondary:disabled { opacity: 0.5; cursor: default; }

.row-msg {
  font-size: 11px;
  line-height: 1.3;
  margin-top: 3px;
  white-space: normal;
  min-height: 0;
}
.row-msg:empty { display: none; }
.row-msg.muted   { color: #6b7280; }
.row-msg.success { color: #047857; }
.row-msg.error   { color: #b91c1c; }

.status-Draft           { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Submitted       { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-EditedByPayroll { background: #fde68a; color: #78350f; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-Approved        { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* ===== All Timesheets pivot grid ===== */
.pivot-legend { margin: 0 0 8px; }
.pivot-legend code { background: #eef2ff; padding: 1px 5px; }

.pivot-table { table-layout: fixed; }
.pivot-table th { vertical-align: bottom; }
.pivot-table .pivot-emp-col { width: 22%; text-align: left; }
.pivot-table .pivot-day-col { text-align: center; }
.pivot-table .pivot-day-name { font-size: 12px; font-weight: 700; color: #111; }
.pivot-table .pivot-day-date { font-size: 11px; font-weight: 400; color: #6b7280; margin-top: 2px; text-transform: none; letter-spacing: 0; }
.pivot-table .pivot-total-col { width: 80px; }
.pivot-table .pivot-emp { font-weight: 600; vertical-align: middle; }
.pivot-table .pivot-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  vertical-align: middle;
  background: #f9fafb;
}

.pivot-cell {
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  padding: 10px 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: background-color 80ms, opacity 80ms;
}
.pivot-cell .pivot-cell-text { display: inline-block; }
.pivot-cell .pivot-cell-plus { color: #9ca3af; margin: 0 2px; font-weight: 400; }

/* Cell tints — lighter than the pill versions so the cell reads as a background */
.pivot-cell.cell-status-Draft           { background: #fef9c3; }
.pivot-cell.cell-status-Submitted       { background: #dbeafe; }
.pivot-cell.cell-status-EditedByPayroll { background: #fde68a; }
.pivot-cell.cell-status-Approved        { background: #d1fae5; }
.pivot-cell.cell-status-unknown         { background: #f3f4f6; }
.pivot-cell--empty {
  background: #fff;
  color: #d1d5db;
  font-weight: 400;
}

.pivot-cell--clickable { cursor: pointer; }
.pivot-cell--clickable:hover {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.pivot-cell--editing {
  outline: 2px solid #1d4ed8;
  outline-offset: -2px;
  font-weight: 700;
}
.pivot-cell--dimmed { opacity: 0.28; }

/* Inline edit row */
.pivot-edit-row .pivot-edit-cell {
  background: #f9fafb;
  padding: 14px 18px;
  border-bottom: 2px solid #d1d5db;
}
.pivot-edit-form { display: flex; flex-direction: column; gap: 10px; }
.pivot-edit-meta { font-size: 13px; color: #4b5563; }
.pivot-edit-meta strong { color: #111; }
.pivot-edit-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px 12px;
}
.pivot-edit-fields label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  gap: 3px;
}
.pivot-edit-fields label.pivot-edit-notes { grid-column: 1 / -1; }
.pivot-edit-fields input,
.pivot-edit-fields select {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  color: #111;
}
.pivot-edit-fields input:focus-visible,
.pivot-edit-fields select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.pivot-edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}
.pivot-edit-actions .row-msg { margin-right: auto; }

/* My Timesheet period hero (S19r — replaces the old config strip) */
.period-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px 32px;
  align-items: start;
  margin: 8px 0 18px;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.period-hero-main { display: flex; flex-direction: column; gap: 14px; }
.period-hero-side { display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
.period-hero-block { display: flex; flex-direction: column; gap: 3px; }
.period-hero-block--end { align-items: flex-end; }
.period-hero-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.period-hero-week {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.period-hero-cutoff {
  font-size: 0.95rem;
  color: #475569;
}
.period-hero-cutoff strong { color: #0f172a; font-weight: 600; }
.period-hero-countdown {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}
.period-hero-countdown.is-overdue {
  background: #fee2e2;
  color: #991b1b;
}
.period-hero-status {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}
.period-hero-status.status-Locked   { background: #fef3c7; color: #92400e; }
.period-hero-status.status-Exported { background: #e0e7ff; color: #3730a3; }
.period-hero-total {
  color: #475569;
  font-size: 0.95rem;
}
.period-hero-total strong {
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 600;
}

@media (max-width: 720px) {
  .period-hero { grid-template-columns: 1fr; }
  .period-hero-side { align-items: flex-start; }
  .period-hero-block--end { align-items: flex-start; }
}

/* Utility classes replacing inline style attributes, so the CSP can stay style-src 'self'
   (ADR-0026, delivery plan 2.3). */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.paste-textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
