:root {
  --navy: #0c1e2c;
  --navy-2: #14304a;
  --navy-3: #1c3a57;
  --cream: #f6f1e7;
  --cream-2: #ede5d3;
  --teal: #9ed1d1;
  --teal-2: #7ab8b8;
  --error: #c0463a;
  --ok: #2e7d5b;
  --warn: #d6a550;
  --muted: rgba(246, 241, 231, 0.62);
  --line: rgba(246, 241, 231, 0.16);
  --radius: 14px;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 78px) env(safe-area-inset-left);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 36px;
}

[hidden] { display: none !important; }
.shell { display: block; }
.view { display: block; }

.brand { text-align: center; margin: 36px 0 30px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 12px;
  font-weight: 500;
}
.brand h1 { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.05; margin: 0; }
.brand h1 em, h2 em, h3 em { font-style: italic; color: var(--teal); }

h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0 0 18px; }
h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 18px 0 12px; }
h4 { font-family: var(--serif); font-weight: 500; font-size: 16px; margin: 14px 0 8px; color: var(--muted); letter-spacing: 0.04em; }

form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; border: 0; padding: 0; margin: 0; }
.field > span {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select, textarea {
  font: inherit; font-size: 16px;
  color: var(--cream);
  background: var(--navy-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
textarea { resize: vertical; min-height: 72px; }
input[type="date"], input[type="month"] { color-scheme: dark; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--teal) 50%), linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

button.primary {
  background: var(--teal); color: var(--navy);
  border: 0; border-radius: var(--radius);
  padding: 15px; font-size: 16px; font-weight: 600;
  cursor: pointer; min-height: 52px;
}
button.primary:disabled { opacity: 0.55; cursor: not-allowed; }

button.ghost {
  background: transparent; color: var(--cream);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; cursor: pointer;
}
button.ghost.small { padding: 6px 10px; font-size: 12px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0 22px; gap: 12px;
}
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { margin: 4px 0 0; font-family: var(--serif); font-size: 22px; font-style: italic; }

.status {
  margin: 0; padding: 11px 14px; border-radius: 10px; font-size: 14px;
}
.status.ok { background: rgba(46, 125, 91, 0.18); color: #b8e3cc; border: 1px solid rgba(46, 125, 91, 0.35); }
.status.queued { background: rgba(158, 209, 209, 0.12); color: var(--teal); border: 1px solid rgba(158, 209, 209, 0.3); }
.status.err { background: rgba(192, 70, 58, 0.18); color: #f0b5ae; border: 1px solid rgba(192, 70, 58, 0.4); }

.error { margin: 0; color: #f0b5ae; font-size: 14px; }
.muted { color: var(--muted); font-size: 14px; }
.legal-link { text-align: center; font-size: 12px; margin-top: 24px; color: var(--muted); }
.legal-link a { color: var(--teal); text-decoration: none; }
.legal-link a:hover { text-decoration: underline; }
.lang-toggle { text-align: center; margin-top: 8px; }

.bio-greeting {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--cream);
  margin: 8px 0 24px;
}
.big-bio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  font-size: 17px;
  margin-bottom: 12px;
}
.big-bio svg { flex-shrink: 0; }
code {
  background: rgba(158, 209, 209, 0.12); color: var(--teal);
  padding: 2px 6px; border-radius: 6px; font-size: 13px;
}

.card {
  background: var(--navy-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-top: 16px;
}

.banner {
  margin: 0 0 16px; padding: 11px 14px; border-radius: 10px; font-size: 13px;
  background: rgba(192, 70, 58, 0.18); color: #f0b5ae;
  border: 1px solid rgba(192, 70, 58, 0.4);
}
.banner.warn { background: rgba(214,165,80,.15); color: #ecd0a0; border-color: rgba(214,165,80,.4); }
.banner.demo { background: rgba(158,209,209,.1); color: var(--teal); border-color: rgba(158,209,209,.32); }

.demo-switch {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 18px; padding: 10px 12px;
  background: var(--navy-2); border: 1px dashed var(--line); border-radius: 10px;
}
.demo-switch label { display: contents; }
.demo-switch span { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.demo-switch select { padding: 9px 36px 9px 12px; font-size: 14px; }

/* ─── today ──────────────────────────────────────────────────────────────── */
.clock-card {
  background: linear-gradient(180deg, rgba(158, 209, 209, 0.08), rgba(158, 209, 209, 0));
  border: 1px solid var(--line); border-radius: 20px;
  padding: 24px 18px 22px; text-align: center; margin-bottom: 22px;
}
.clock-card .eyebrow { margin-bottom: 16px; }
.clock-button {
  display: block; width: 100%;
  background: var(--teal); color: var(--navy);
  border: 0; border-radius: 999px;
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 30px; padding: 26px 16px;
  cursor: pointer; min-height: 92px;
  transition: transform 0.05s ease;
}
.clock-button:active { transform: scale(0.98); }
.clock-button[data-state="out"] { background: var(--cream); }
.clock-button:disabled { opacity: 0.6; }

.summary, .stats {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 24px;
}
.stats { gap: 14px; flex-wrap: wrap; }
.stats > div { flex: 1 1 auto; min-width: 0; }
.stats.four { gap: 10px; }
.stats.four > div { flex: 1 1 calc(50% - 10px); }
@media (min-width: 480px) { .stats.four > div { flex: 1 1 calc(25% - 10px); } }
.summary .big, .stats .big {
  font-family: var(--serif); font-style: italic;
  font-size: 26px; margin: 4px 0 0;
  color: var(--teal); font-variant-numeric: tabular-nums;
}
.stats .big.positive { color: #8fdcb8; }
.stats .big.negative { color: #f0b5ae; }

.history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 0 12px;
}
#today-list, .card-list, .day-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
#today-list li {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
}
#today-list .row-label { font-size: 15px; color: var(--cream); }
#today-list .row-time {
  font-family: var(--serif); font-style: italic; font-size: 20px;
  color: var(--teal); font-variant-numeric: tabular-nums;
}

/* ─── view headers ────────────────────────────────────────────────────────── */
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 18px;
}
.view-head.simple { justify-content: flex-start; }
.view-head h2, .view-head h3 { margin: 0; }
.nav-arrow {
  background: var(--navy-2); border: 1px solid var(--line); color: var(--cream);
  width: 38px; height: 38px; border-radius: 50%; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─── week view ──────────────────────────────────────────────────────────── */
.day-list { margin-bottom: 18px; }
.day-row {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px;
  display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 12px;
  opacity: 0.55;
}
.day-row.has-hours { opacity: 1; }
.day-label { display: flex; flex-direction: column; }
.day-name {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.day-date { font-family: var(--serif); font-size: 22px; font-style: italic; color: var(--cream); }
.day-hours {
  font-family: var(--serif); font-style: italic; font-size: 20px;
  color: var(--teal); font-variant-numeric: tabular-nums;
}
.day-stamps { font-size: 12px; color: var(--muted); }

.upcoming-shifts { margin-top: 32px; }
.shift-row {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.shift-when { display: flex; flex-direction: column; gap: 2px; }
.shift-date {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.shift-time {
  font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.shift-location { font-size: 13px; color: var(--cream); }

/* ─── holidays view ──────────────────────────────────────────────────────── */
#holiday-form {
  background: var(--navy-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-top: 14px;
}
.holiday-row {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
}
.holiday-row.status-approved { border-color: rgba(46,125,91,.4); }
.holiday-row.status-rejected { border-color: rgba(192,70,58,.4); opacity: 0.85; }
.holiday-dates { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.holiday-dates .when {
  font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--cream);
}
.holiday-dates .count { font-size: 12px; color: var(--muted); }
.holiday-reason { grid-column: 1; font-size: 14px; color: var(--cream); }
.holiday-status { grid-column: 2; }
.holiday-note { grid-column: 1 / -1; font-size: 12px; }
.holiday-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.holiday-actions button { padding: 6px 12px; font-size: 12px; }
.holiday-row.status-cancelled { opacity: 0.6; }
.holiday-row.status-cancellation_pending { border-color: rgba(232, 165, 56, 0.5); }
.status-cancellation_pending { background: rgba(232,165,56,.18); color: #e8a538; border: 1px solid rgba(232,165,56,.35); padding: 3px 8px; border-radius: 999px; font-size: 11px; }
.cancel-banner { background: rgba(232,165,56,.18); color: #e8a538; padding: 6px 10px; border-radius: 6px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 10px; }
.approval-card.cancel-request { border-left: 3px solid #e8a538; }

/* ─── manager overview ───────────────────────────────────────────────────── */
.overview-head { margin-bottom: 12px; }
.overview-head h3 { margin: 0 0 4px; }
.overview-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 14px 0 18px;
}
.overview-summary > div {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px;
}
.overview-summary .big { font-family: var(--serif); font-style: italic; font-size: 26px; margin: 4px 0 0; color: var(--teal); }
.overview-table-wrap { overflow-x: auto; margin: 0 -12px; padding: 0 12px; }
.overview-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--navy-2); border-radius: 12px; overflow: hidden;
}
.overview-table th {
  text-align: left; padding: 10px 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.overview-table td {
  padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.overview-table tbody tr:last-child td { border-bottom: 0; }
.overview-table .ov-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-table .ov-name { display: flex; align-items: center; gap: 8px; }
.overview-table .ov-name strong { color: var(--cream); }
.overview-table .ov-job { font-size: 11px; }
.overview-table .small { font-size: 10px; }
.overview-table .positive { color: #6fd697; }
.overview-table .negative { color: #ff8989; }
.dot-in {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #6fd697; box-shadow: 0 0 0 3px rgba(111, 214, 151, 0.25);
  flex-shrink: 0; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }

.status-pill {
  display: inline-block;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.status-pill.status-pending  { background: rgba(214,165,80,.18); color: #ecd0a0; }
.status-pill.status-approved { background: rgba(46,125,91,.22); color: #b8e3cc; }
.status-pill.status-rejected { background: rgba(192,70,58,.22); color: #f0b5ae; }
.status-pill.status-cancelled { background: rgba(255,255,255,.08); color: var(--muted); }

/* ─── documents view ─────────────────────────────────────────────────────── */
.doc-section { margin-bottom: 24px; }
.doc-group { margin-bottom: 18px; }
.doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.doc-list li {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.doc-meta { min-width: 0; flex: 1; }
.doc-title {
  margin: 0 0 4px;
  font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--cream);
  text-transform: capitalize;
}

/* ─── manager view ───────────────────────────────────────────────────────── */
.mgr-tabs {
  display: flex; gap: 8px; margin-bottom: 18px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.mgr-tabs button {
  background: var(--navy-2); border: 1px solid var(--line); color: var(--cream);
  padding: 9px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.mgr-tabs button.active { background: var(--teal); color: var(--navy); border-color: var(--teal); }
.mgr-pane { margin-bottom: 28px; }

.approval-card {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  list-style: none;
}
.pending-weeks, .pending-holidays { padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.approval-head .who { margin: 0; font-family: var(--serif); font-style: italic; font-size: 20px; }
.approval-head .muted { font-size: 12px; margin: 2px 0 0; }
.approval-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.approval-body .eyebrow { margin: 0; }
.approval-body .big {
  margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 22px;
  color: var(--teal); font-variant-numeric: tabular-nums;
}
.approval-body .big.positive { color: #8fdcb8; }
.approval-body .big.negative { color: #f0b5ae; }
.approval-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── calendar ───────────────────────────────────────────────────────────── */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 14px 0;
}
.cal-head {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  text-align: center; padding: 6px 0;
}
.cal-day {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 8px;
  min-height: 78px; padding: 6px 5px; display: flex; flex-direction: column; gap: 3px;
}
.cal-day.empty { background: transparent; border: 0; }
.cal-num { font-size: 11px; color: var(--muted); }
.cal-tag {
  display: block; font-size: 10px; padding: 2px 6px; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-tag.holiday.approved { background: rgba(46,125,91,.32); color: #cdebd9; }
.cal-tag.holiday.pending { background: rgba(214,165,80,.25); color: #ecd0a0; }
.cal-tag.shift { background: rgba(158,209,209,.2); color: var(--teal); }

.cal-legend {
  display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted);
  margin-top: 14px;
}
.cal-legend i.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.cal-legend .holiday.approved { background: rgba(46,125,91,.7); }
.cal-legend .holiday.pending { background: rgba(214,165,80,.7); }
.cal-legend .shift { background: rgba(158,209,209,.6); }

/* ─── planning grid ──────────────────────────────────────────────────────── */
.planning-grid {
  display: grid; gap: 4px; margin-top: 14px;
  overflow-x: auto; min-width: 100%;
  font-size: 12px;
}
.pg-corner { background: transparent; }
.pg-head {
  background: var(--navy-2); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; padding: 6px;
}
.pg-day { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pg-date { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--cream); }
.pg-name {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; font-size: 13px; display: flex; align-items: center;
}
.pg-cell {
  background: var(--navy-3); border: 1px dashed var(--line); border-radius: 6px;
  min-height: 56px; padding: 4px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: background 0.1s;
}
.pg-cell:hover { background: var(--navy-2); }
.pg-shift {
  background: var(--teal); color: var(--navy); padding: 4px 6px; border-radius: 4px;
  font-size: 11px; line-height: 1.2;
}

/* ─── bottom tabs ───────────────────────────────────────────────────────── */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(12, 30, 44, 0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 8px) env(safe-area-inset-left);
  display: flex; justify-content: space-around;
  z-index: 100;
}
.tabs button {
  background: transparent; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 8px; cursor: pointer; font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; min-width: 56px;
}
.tabs button svg { stroke: currentColor; }
.tabs button.active { color: var(--teal); }
.tabs button[hidden] { display: none; }

/* ─── modal ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(8, 18, 27, 0.78); backdrop-filter: blur(6px);
}
.modal-card {
  position: relative; z-index: 1;
  background: var(--navy); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 22px; max-width: 420px; width: 100%;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}
.modal-card h3 { margin: 0 0 4px; font-size: 24px; }
.modal-card .muted { margin: 0 0 18px; }
.modal-card form { gap: 14px; }
.modal-card.wide { max-width: 540px; max-height: 88vh; overflow-y: auto; }
