:root {
  color-scheme: light;
  --page: #f2eee6;
  --page-top: #e4ebdf;
  --facet-sage: #5c8c732a;
  --facet-sand: #b19c632b;
  --facet-veil: #f2eee6a8;
  --panel-facet-a: #5c8c7314;
  --panel-facet-b: #b19c6315;
  --panel-facets: conic-gradient(from 45deg at 50% 50%,
    var(--panel-facet-a) 0deg 90deg, transparent 90deg 180deg,
    var(--panel-facet-b) 180deg 270deg, transparent 270deg);
  --surface: #ffffff;
  --field: #f7faf8;
  --ink: #142d26;
  --muted: #50665d;
  --line: #d9e4de;
  --input-line: #aebfb6;
  --accent: #136448;
  --accent-ink: #ffffff;
  --soft: #e4f2ea;
  --hero-start: #173f35;
  --hero-end: #176249;
  --hero-muted: #d1eade;
  --danger: #98372a;
  --danger-soft: #fcebe6;
  --shadow: 0 2px 4px #163b2410, 0 10px 24px #163b2408;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #18191b;
  --page-top: #2c2d30;
  --facet-sage: #c4c7cc23;
  --facet-sand: #a0a3aa1b;
  --facet-veil: #18191ba8;
  --panel-facet-a: #f0f1f618;
  --panel-facet-b: #bbc0c711;
  --surface: #252629;
  --field: #1e1f21;
  --ink: #f3f3f4;
  --muted: #c5c6ca;
  --line: #424348;
  --input-line: #74767d;
  --accent: #e1e2e5;
  --accent-ink: #202125;
  --soft: #37393e;
  --hero-start: #34353a;
  --hero-end: #45474d;
  --hero-muted: #e2e3e7;
  --danger: #ffb8aa;
  --danger-soft: #482c27;
  --shadow: 0 6px 24px #0003;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--page); }
body {
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
  background-color: var(--page);
  background-image:
    linear-gradient(180deg, transparent, var(--facet-veil) 740px),
    conic-gradient(from 45deg at 50% 50%,
      var(--facet-sage) 0deg 90deg, transparent 90deg 180deg,
      var(--facet-sand) 180deg 270deg, transparent 270deg),
    linear-gradient(180deg, var(--page-top), var(--page) 420px);
  background-size: auto, clamp(92px, 14vw, 156px) clamp(92px, 14vw, 156px), auto;
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

main {
  position: relative;
  max-width: 1160px;
  margin: auto;
  padding: 32px clamp(14px, 4vw, 34px);
}
.masthead {
  display: flex;
  min-height: 78px;
  align-items: center;
  padding-right: 155px;
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  display: grid;
  position: relative;
  place-items: center;
  flex: 0 0 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--accent);
  color: var(--accent-ink);
}
.brand-mark::before {
  content: "";
  width: 23px;
  height: 23px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 8px;
  left: 22px;
  top: 16px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.eyebrow { font-size: .8rem; font-weight: 650; color: var(--muted); }
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 3px 0 0; font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: -.045em; }
h2 { margin: 0 0 18px; font-size: clamp(1.15rem, 2.5vw, 1.35rem); letter-spacing: -.02em; }
p { overflow-wrap: break-word; }
a { color: var(--accent); text-underline-offset: 3px; }
small, .muted, .note, .timestamp, footer { color: var(--muted); }
.note, .timestamp, footer { font-size: .875rem; }
.note { margin-top: 16px; }
footer { margin: 24px 0; line-height: 1.75; }

.appearance-settings { position: absolute; top: 38px; right: clamp(14px, 4vw, 34px); }
.appearance-settings label { margin: 0; }
.appearance-settings select { width: 130px; margin-top: 4px; }
.card, dialog, .accountbar, .installbar {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card { padding: clamp(16px, 3vw, 26px); }
.authcard { max-width: 480px; margin: 24px auto; }
.accountbar, .installbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.accountbar > span { overflow-wrap: anywhere; }
.accountbar > div { display: flex; flex-wrap: wrap; gap: 8px; }
.installbar { background: var(--soft); }
.installbar p { margin: 3px 0 0; color: var(--muted); font-size: .875rem; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.manager .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats > .card { padding: clamp(13px, 2.5vw, 23px); }
.stats small { display: block; font-size: .8rem; line-height: 1.4; }
.hero {
  background-image: var(--panel-facets), linear-gradient(125deg, var(--hero-start), var(--hero-end));
  background-size: 104px 104px, auto;
  color: white;
  border-color: transparent;
}
.hero small { color: var(--hero-muted); }
.value {
  margin-top: 6px;
  font-size: clamp(1.45rem, 4vw, 2.45rem);
  line-height: 1.12;
  font-weight: 710;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.leave-balance { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0; gap: 8px; }
.leave-balance > div { padding: 8px; border-radius: 10px; background: var(--field); }
.leave-balance .value { font-size: clamp(1.15rem, 3vw, 1.55rem); }
.layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 20px; }
.months, .summary { margin-top: 20px; }
.summary { margin-bottom: 20px; }
.toolbar, .headingrow, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.toolbar, .headingrow { justify-content: space-between; }
.toolbar { margin-bottom: 16px; }
.toolbar select { width: auto; margin: 0; }
.actions { margin-top: 16px; }
.copy-workday { margin-bottom: 15px; }

label { display: block; margin-bottom: 15px; font-size: .875rem; font-weight: 620; min-width: 0; }
fieldset { min-width: 0; }
input, select, textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--input-line);
  border-radius: 11px;
  background: var(--field);
  color: var(--ink);
  font: 16px/1.35 system-ui, sans-serif;
}
input::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0; accent-color: var(--accent); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Keep native date and time controls inside their columns on iOS. */
input:is([type="date"], [type="month"], [type="time"]) {
  height: 46px;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
}
input::-webkit-date-and-time-value { min-width: 0; min-height: 1.2em; text-align: center; margin: 0; }
input::-webkit-datetime-edit { display: inline-flex; justify-content: center; min-width: 0; padding: 0; }

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 14px;
  background: var(--soft);
  color: var(--ink);
  font: 650 .875rem/1.25 system-ui, sans-serif;
  cursor: pointer;
}
button.primary, .installbar button { background: var(--accent); color: var(--accent-ink); }
button.primary { width: 100%; }
button.secondary { background: var(--surface); border-color: var(--input-line); }
button.tiny, button.password-toggle { background: var(--soft); color: var(--ink); }
button.tiny { font-size: .8rem; }
button.password-toggle { min-height: 34px; bottom: 6px; padding: 5px 9px; border-color: var(--input-line); font-size: .75rem; }
button.danger { background: #a43e32; color: white; }
button.danger-light { background: var(--danger-soft); color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(.94); } }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.scroll { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: .8rem; background: var(--field); color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--field); }
td:nth-child(2) { overflow-wrap: anywhere; }
.layout td:nth-child(2) { min-width: 100px; max-width: 240px; }
.empty { text-align: center; padding: 24px 10px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters label { flex: 1; min-width: 150px; margin: 0; }
.archive-filter { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; }
.account-actions { min-width: 170px; }
.account-actions button { margin: 3px 3px 3px 0; }
.detail td:nth-child(3), #requestrows td:first-child { min-width: 120px; overflow-wrap: anywhere; }
.readonly { color: var(--muted); font-size: .875rem; }
.link { font-size: .875rem; }

dialog {
  width: calc(100% - 28px);
  max-width: 450px;
  max-height: 85vh;
  max-height: 85dvh;
  padding: clamp(16px, 4vw, 28px);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #0a1713aa; }
dialog .primary { margin-top: 10px; }
dialog.profile-dialog { max-width: 760px; }
.profile-group { border-top: 1px solid var(--line); }
.profile-group legend { padding-right: 8px; }
#recoverycode { font: .8rem monospace; }
#authmessage, #passwordmessage, #createmessage, #chefmessage, #loginmessage,
#chefpasswordmessage, #editmessage, #deletemessage, .negative { color: var(--danger); }
.positive { color: var(--accent); }
#message, #authmessage, #loginmessage, #passwordmessage { min-height: 1.4em; }

.requestcalendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  max-width: 490px;
}
.requestcalendar button { padding: 6px 0; }
.requestcalendar button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.requestcalendar .weekday { text-align: center; font-size: .8rem; padding: 4px 0; color: var(--muted); }
.requestcalendar .weekend { border-color: var(--input-line); }

@media (max-width: 800px) { .layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  main { padding-top: 18px; }
  .masthead { min-height: 60px; padding-right: 0; margin-bottom: 12px; }
  .appearance-settings { position: static; display: flex; justify-content: flex-end; margin-bottom: 14px; }
  .appearance-settings label { display: flex; align-items: center; gap: 8px; }
  .appearance-settings select { width: auto; margin: 0; }
  .brand { gap: 10px; }
  .manager .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manager .stats > .hero { grid-column: 1 / -1; }
  .filters > label, .filters > .password-field { flex: 1 1 100%; }
  .accountbar { align-items: flex-start; }
  .accountbar > div { width: 100%; }
}

.favorite-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin-bottom: 15px;
}
.favorite-tools label { flex: 1 1 200px; margin: 0; }
.favorite-tools button { min-height: 46px; }
.favorite-message { margin: -5px 0 15px; }
#sitehoursrows td:first-child { overflow-wrap: anywhere; }
#sitehoursrows td:last-child { white-space: nowrap; }

.work-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 14px;
}
.work-block legend { padding: 0 5px; font-weight: 650; }
.entry-blocks { padding-inline-start: 1em; margin: 0; }
.entry-blocks li + li { margin-top: 4px; }

.calendar-subscription { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.calendar-subscription summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.calendar-subscription [data-calendar-link-panel] { margin-top: 14px; }
.team-calendar { table-layout: fixed; }
.team-calendar th, .team-calendar td { padding: 5px 3px; text-align: center; vertical-align: top; }
.team-calendar td { height: 42px; }
.team-calendar time { display: block; }
.team-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 1px 5px;
  background: hsl(var(--person-hue) 70% 83%);
  color: #12251f;
  font-size: .78rem;
  font-weight: 750;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.team-calendar .team-badge { display: block; width: fit-content; margin: 2px auto; }
.team-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; }
.team-legend li { overflow-wrap: anywhere; }
.team-month { margin: 0; }

.team-status-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .875rem; }
.team-status-legend .team-badge { --person-hue: 148; }
.team-status-legend .pending { margin-inline-start: 8px; }
.team-badge.pending {
  background: transparent;
  border: 1px dashed hsl(var(--person-hue) 45% 46%);
  color: var(--ink);
}
.team-calendar a { display: block; text-decoration: none; }
.leave-overlaps { margin: 0; padding-inline-start: 1em; }
.leave-overlaps li + li { margin-top: 4px; }
#leavereviewrows tr:target { background: var(--soft); }

#workspace, #dashboard { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.app-nav {
  position: fixed;
  z-index: 4;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  max-width: 680px;
  margin-inline: auto;
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px #102b201b;
}
.app-nav a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 3px;
  border-radius: 8px;
  color: var(--accent);
  font-size: clamp(.69rem, 2.8vw, .875rem);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.app-nav a:hover, .app-nav a:focus-visible { background: var(--soft); }
.app-nav a[aria-current="location"] {
  background: var(--accent);
  color: var(--accent-ink);
}
#entrysection, #entriessection, #leavesection, #monthsection,
#teamsection, #applicationssection, #sitesection, #reportssection { scroll-margin-top: 12px; }

.block-net, .day-totals div { display: flex; justify-content: space-between; gap: 12px; }
.block-net { margin: 0 0 12px; color: var(--muted); font-size: .875rem; }
.block-net strong, .day-totals dd { color: var(--ink); font-variant-numeric: tabular-nums; }
.day-totals { margin: 0 0 16px; padding: 12px; background: var(--field); border-radius: 12px; }
.day-totals dd { margin: 0; font-weight: 700; }
.day-totals .day-total { font-weight: 700; }
.day-totals div:not([hidden]) + .day-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.day-check { color: var(--danger); margin-top: 0; }

.workblock-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
#switchsiteerror:empty { display: none; }

.existing-day {
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.existing-day p { margin: 0; }
.existing-day button { margin-top: 8px; }

.workday-templates {
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.workday-templates summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.workday-templates[open] summary { margin-bottom: 12px; }
.template-picker { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 15px; }
.template-picker label { flex: 1 1 200px; margin: 0; }
.template-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#templatemessage:empty { display: none; }

#bulktemplatedialog { max-width: 540px; }
.bulk-preview { margin: 0; padding-inline-start: 20px; }
.bulk-preview li + li { margin-top: 4px; }
#bulkstatus:empty { display: none; }

.time-warnings {
  margin: 0 0 14px;
  padding: 10px 12px 10px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
}
#bulktimewarnings { margin-top: 12px; }
.time-warnings li + li { margin-top: 4px; }

.card:not(.hero), .leave-balance > div, .scroll, .team-calendar {
  background-image: var(--panel-facets);
  background-size: 104px 104px;
}
.scroll, .team-calendar { background-color: var(--surface); }
.scroll tbody tr:nth-child(even), .team-calendar tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--field) 48%, transparent);
}
.requestcalendar button:not([aria-pressed="true"]) {
  background-image: var(--panel-facets);
  background-size: 100% 100%;
}
html[data-theme="dark"] dialog::backdrop { background: #101012b8; }
html[data-theme="dark"] .app-nav { box-shadow: 0 -4px 24px #0005; }

.account-menu {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.account-menu summary { padding: 9px 12px; min-height: 44px; cursor: pointer; color: var(--muted); }
.account-menu strong { color: var(--ink); margin-inline-start: 6px; overflow-wrap: anywhere; }
.account-menu-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 12px; }
.employee #installbar { margin-top: 20px; }

.entry-cards { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.entry-card { padding: 13px; box-shadow: none; overflow-wrap: anywhere; }
.entry-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-weight: 700; }
.entry-card-heading strong { color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-card p { margin: 6px 0; color: var(--muted); }
.entry-card summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.entry-card .entry-blocks { margin-top: 8px; font-size: .875rem; }
.entry-card-actions { margin-top: 8px; }

@media (max-width: 680px) {
  .employee .masthead { min-height: 50px; margin-bottom: 7px; }
  .employee .appearance-settings { margin-bottom: 8px; }
  .employee #workspace > .stats { margin: 12px 0; }
  .employee #entrysection { margin-top: 12px; }
}

.chef-card .entry-card-heading > span { min-width: 0; }
.chef-card summary { padding: 7px 0; }
.chef-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#leavecards > li:target { border-color: var(--accent); }

.desktop-install { display: none; }

@media (min-width: 1024px) {
  main { max-width: 1520px; padding-inline: 28px; }
  main:has(#workspace:not([hidden]), #dashboard:not([hidden])) { padding-inline-start: 224px; }
  .masthead { padding-right: 325px; }
  .appearance-settings { display: flex; gap: 10px; align-items: flex-end; right: 28px; }
  .desktop-install { display: inline-block; min-height: 46px; }
  .app-nav {
    inset: 134px auto auto max(28px, calc((100vw - 1520px) / 2 + 28px));
    grid-template-columns: minmax(0, 1fr);
    width: 170px;
    margin: 0;
    padding: 8px;
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
  .app-nav a {
    justify-items: start;
    padding-inline: 12px;
    font-size: .9rem;
    text-align: left;
  }
  #workspace, #dashboard { padding-bottom: 24px; }
  .employee #installbar { display: none; }
}

@media (min-width: 1180px) {
  #workspace, #dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  #workspace > *, #dashboard > * { grid-column: 1 / -1; min-width: 0; }
  #workspace > #entrysection, #workspace > #leavesection,
  #dashboard > #sitesection, #dashboard > #reportssection {
    grid-column: auto;
    align-self: start;
    margin: 0 !important;
  }
}

.chef-tasks { margin-bottom: 20px; }
.chef-tasks .task-link, .chef-tasks summary {
  display: block;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 650;
}
.chef-tasks details { margin-top: 8px; }
.chef-tasks summary { display: list-item; cursor: pointer; }
.chef-tasks details label { max-width: 260px; margin-top: 12px; }

#monthpreviewdialog { max-width: 660px; }
.month-preview-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}
.month-preview-totals div { padding: 8px 10px; background: var(--soft); border-radius: 9px; }
.month-preview-totals dt { color: var(--muted); font-size: .85rem; }
.month-preview-totals dd { margin: 0; font-weight: 700; }
#previewdays .tiny { margin-top: 8px; }
#previewmessage:empty { display: none; }

.report-handoff { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.report-handoff h3 { margin: 0; }
.report-handoff-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.report-handoff-rows li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.report-handoff-rows li div { min-width: 0; overflow-wrap: anywhere; }
.report-handoff-rows p { margin: 0; color: var(--muted); font-size: .85rem; }
#reporthandoffmessage:empty { display: none; }

.report-filter { margin: 0 0 10px; }
.report-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.required-mark { color: var(--accent); font-weight: 800; }
.required-note { margin-top: 0; }

.request-day { min-width: 0; }
.request-day > button { width: 100%; }
.request-day-team { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.request-day-team .team-badge { padding-inline: 3px; margin-top: 2px; }
#teamleavestatus:empty { display: none; }
