:root {
  --orange: #F26522;
  --orange-strong: #C94E12;
  --orange-light: #F9BA9C;
  --orange-wash: #FDE7DA;
  --grey: #E6E7E8;
  --charcoal: #1A1A1A;
  --charcoal-soft: #333333;
  --text: #1A1A1A;
  --paper: #FBF8F5;
  --surface: #FFFFFF;
  --surface-2: #F3EEE8;
  --border: #E3DDD5;
  --muted: #716B63;
  --green: #2E7D53;
  --green-wash: #E4F2EA;
  --amber: #B8790A;
  --amber-wash: #FBF0DD;
  --red: #C43D3D;
  --red-wash: #FBEAE8;
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 2px rgba(26,20,14,0.06), 0 6px 20px -8px rgba(26,20,14,0.16);
}

* { box-sizing: border-box; }

/* The `hidden` attribute (used by push-notifications.js to show/hide the
   enable/disable/test buttons) is only a display:none default in the
   browser's own stylesheet - any component class that sets its own
   `display` (e.g. .btn's display:inline-flex) silently wins over it by
   cascade order otherwise, since both have the same specificity. Without
   this override, a "hidden" button still renders. */
[hidden] { display: none !important; }

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-strong); }

.num, .stat .num, td input[type=number] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ app shell -- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand-badge {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 8px; box-shadow: var(--shadow); flex-shrink: 0;
}
.brand-badge img { display: block; height: 22px; width: auto; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 500; }
.topbar-title h1 { margin: 1px 0 0; font-size: 17px; font-weight: 600; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange-wash); color: var(--orange-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  border: 1px solid var(--orange-light); text-decoration: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px -12px rgba(26,20,14,0.2);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 8px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); border-radius: 10px; flex: 1;
  text-decoration: none; font-family: inherit;
}
.tab.active { color: var(--orange-strong); }
.tab .tlabel { font-size: 10.5px; font-weight: 500; }
form.tab-logout-form { display: contents; }
form.tab-logout-form button.tab { width: 100%; }

.shell { max-width: 1180px; margin: 0 auto; }
main { padding: 16px; }
main.has-tabbar { padding-bottom: 90px; }

@media (min-width: 880px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; align-items: start; }
  .tabbar {
    position: sticky; top: 57px; bottom: auto;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 2px; width: 220px; height: calc(100vh - 57px);
    border-top: none; border-right: 1px solid var(--border);
    padding: 16px 10px; box-shadow: none;
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; }
  .tab.active { background: var(--orange-wash); }
  .tab .tlabel { font-size: 13px; }
  main { padding: 20px 28px 40px; }
  main.has-tabbar { padding-bottom: 40px; }
}

h1 { font-size: 21px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 16px; margin: 26px 0 10px; font-weight: 600; }
p.subtitle { color: var(--muted); margin: 0 0 20px; font-size: 13.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.flash {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.flash.success { background: var(--green-wash); color: var(--green); border: 1px solid #BFE6C8; }
.flash.error { background: var(--red-wash); color: var(--red); border: 1px solid #F0C6C0; }

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

th, td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: center;
}

th {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

th.group {
  background: var(--charcoal);
}

td.rowlabel, th.rowlabel { text-align: left; }

tr.weekend td { background: var(--orange-wash); }
tr.totals td { background: var(--surface-2); font-weight: 600; }

.table-scroll { overflow-x: auto; }

input[type=number], input[type=text], input[type=date], input[type=email], input[type=password], select, textarea {
  font-family: inherit;
  /* 16px stops iOS Safari auto-zooming the page when a field is focused -
     anything smaller triggers the zoom on every tap into a form field. */
  font-size: 16px;
  padding: 11px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 1px;
}

input[type=number] { width: 70px; text-align: right; font-family: var(--font-mono); }

table input[type=number] { width: 64px; padding: 5px 6px; min-height: 0; }
table input[type=text] { width: 140px; padding: 5px 6px; min-height: 0; }

label { font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.field { margin-bottom: 14px; }
.field .help { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: normal; margin-top: 4px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.checkbox-field input { width: auto; }
.checkbox-field label { margin: 0; text-transform: none; font-size: 13.5px; letter-spacing: normal; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { opacity: 0.5; }
.btn.secondary { background: var(--charcoal); }
.btn.outline { background: transparent; color: var(--charcoal); border: 1px solid var(--border); }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 14px; font-size: 12.5px; }

.period-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.period-nav .label { font-weight: 600; font-size: 15px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.pill.pending { background: var(--amber-wash); color: var(--amber); }
.pill.approved { background: var(--green-wash); color: var(--green); }
.pill.rejected { background: var(--red-wash); color: var(--red); }
.pill.cancelled { background: var(--surface-2); color: var(--muted); }
.pill.accent { background: var(--orange-wash); color: var(--orange-strong); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 150px;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 23px; font-weight: 600; }
.stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

footer.foot {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  padding: 24px 10px 90px;
}
@media (min-width: 880px) { footer.foot { padding-bottom: 24px; } }

.notice {
  background: var(--orange-wash);
  border: 1px solid var(--orange-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.offline-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.offline-banner .btn { flex-shrink: 0; }

.small-text { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--charcoal);
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 500;
}
.tabs a.active { background: var(--orange); color: #fff; font-weight: 600; }

/* ---------------------------------------------------- team calendar --- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 4px;
}
.cal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 56px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-day.out-of-month { background: var(--surface-2); opacity: 0.55; }
.cal-day.weekend { background: var(--paper); }
.cal-day.today { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.cal-day-num { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-entry {
  font-size: 10px;
  line-height: 1.35;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--orange-wash);
  color: var(--orange-strong);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-entry.shutdown { background: var(--surface-2); color: var(--muted); }
@media (min-width: 620px) {
  .cal-day { min-height: 84px; padding: 6px; }
  .cal-day-num { font-size: 13px; }
  .cal-entry { font-size: 11.5px; padding: 2px 8px; }
}

/* -------------------------------------------------------- weekly view --- */
.week-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.week-nav .week-label { font-weight: 600; font-size: 16px; text-align: center; }
.week-nav .week-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.day-cards { display: flex; flex-direction: column; gap: 10px; }
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.day-card.weekend { background: var(--orange-wash); border-color: var(--orange-light); }
.day-card.today { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), var(--shadow); }

/* Each day is a native <details> element: tap the summary row to expand -
   no custom JS needed, and it works the same in iOS Safari as everywhere
   else. Today (and any day with data already entered) starts open; the
   rest start collapsed so a long pay period doesn't turn into an endless
   scroll of empty fields on a phone screen. */
.day-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.day-card summary::-webkit-details-marker { display: none; }
.day-card .day-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: relative; padding-right: 22px;
}
.day-card .day-head::after {
  content: "";
  position: absolute; right: 0; top: 50%;
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.15s ease;
}
.day-card[open] .day-head::after { transform: translateY(-35%) rotate(-135deg); }
.day-card .day-head-main { display: flex; flex-direction: column; gap: 2px; }
.day-card .day-head .dname { font-weight: 600; font-size: 14.5px; }
.day-card .day-head .ddate { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.day-card .day-head-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dbadge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.dbadge.hrs { background: var(--orange-wash); color: var(--orange-strong); }
.dbadge.money { background: var(--green-wash); color: var(--green); }
.dbadge.note { background: var(--surface-2); color: var(--charcoal-soft); font-family: var(--font); }
.dbadge.empty { background: var(--surface-2); color: var(--muted); font-family: var(--font); font-weight: 500; }

.day-card .day-body {
  padding: 4px 16px 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.day-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 12px;
}
.day-grid .field { margin-bottom: 0; }
.day-grid .field input { width: 100%; text-align: left; }
.day-grid .field.notes { grid-column: 1 / -1; }
@media (min-width: 480px) {
  .day-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 620px) {
  .day-grid { grid-template-columns: repeat(6, 1fr); }
  .day-grid .field.notes { grid-column: span 3; }
}

/* Fixed (not sticky) so the Save button stays reachable with one thumb no
   matter how far down a long pay period the employee has scrolled - a
   sticky element only stays put within its own parent's box, which here
   is a couple of thousand pixels tall on a full pay period view. */
.save-bar {
  position: fixed; left: 0; right: 0; bottom: 74px; z-index: 20;
  display: flex; justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 60%, rgba(251,248,245,0) 100%);
  pointer-events: none;
}
.save-bar .btn { pointer-events: auto; width: 100%; max-width: 440px; padding: 14px 22px; font-size: 15.5px; box-shadow: var(--shadow); }
.save-bar-spacer { height: 92px; }
@media (min-width: 880px) {
  .save-bar {
    position: sticky; bottom: 0; justify-content: flex-end;
    padding: 4px 0 0; background: none;
  }
  .save-bar .btn { width: auto; max-width: none; }
  .save-bar-spacer { height: 0; }
}

/* ------------------------------------------------------- holiday form --- */
.form-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px;
}
@media (max-width: 380px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.segmented {
  position: relative;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.segmented input[type=radio] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.segmented label {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 6px;
  border-right: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  text-transform: none; letter-spacing: normal;
  color: var(--charcoal-soft);
  cursor: pointer;
  text-align: center;
  transition: background 0.1s ease, color 0.1s ease;
}
.segmented label:last-of-type { border-right: none; }
.segmented input[type=radio]:checked + label { background: var(--orange); color: #fff; }
.segmented input[type=radio]:focus-visible + label { outline: 2px solid var(--orange); outline-offset: -2px; }

/* ---------------------------------------------------- holiday requests --- */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
}
.req-main {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.req-dates { font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.req-arrow { color: var(--muted); }
.req-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.req-days { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.req-note { margin: 8px 0 0; }
.req-cancel-form { margin: 10px 0 0; }

.legal-note {
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 6px;
}
