/* HKS TechLabs look (hkstechlabs.com): Poppins, brand orange #FF8800 on white, dark #161616 text,
   warm cream accents, 16px rounded cards. Fonts are self-hosted so the page never needs Google. */
@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/poppins-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #fef7eb;
  --surface: #ffffff;
  --ink: #161616;
  --muted: #6b6b6b;
  --line: #ece5da;
  --field-line: #d8d0c3;
  --press: #fff3e3;
  --accent: #ff8800;          /* brand orange: buttons, ticks, highlights */
  --accent-press: #e87b00;
  --on-accent: #ffffff;
  --accent-ink: #b35500;      /* orange for text on white (readable) */
  --ok: #15803d;              /* on time */
  --warn: #c2410c;            /* late / early */
  --on-warn: #ffffff;
  --error: #b91c1c;
  --error-bg: #fdecec;
  --success-bg: #fff1df;
  --away: #4338ca;            /* leave / WFH / field visit */
  --grey-badge: #5c5c60;
  --focus: rgba(255, 136, 0, 0.4);

  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: var(--sans);

  /* Staff screens are sized to fit one phone screen without scrolling. */
  --key-h: clamp(48px, 8.8dvh, 78px);
  --gap: clamp(8px, 1.6dvh, 16px);

  font-family: var(--sans);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

/* Dark mode follows the phone's setting. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121212;
    --bg-soft: #1b1712;
    --surface: #1c1c1c;
    --ink: #f3f3f3;
    --muted: #a9a9a9;
    --line: #2d2d2d;
    --field-line: #474747;
    --press: #2a2117;
    --accent: #ff8800;
    --accent-press: #ff9d2e;
    --on-accent: #161616;
    --accent-ink: #ffa645;
    --ok: #4ade80;
    --warn: #fb923c;
    --on-warn: #1a0d00;
    --error: #f87171;
    --error-bg: #3a1a1a;
    --success-bg: #2a2015;
    --away: #a5b4fc;
    --grey-badge: #6e6e73;
    --focus: rgba(255, 136, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* One screen, no page scrolling: the app is exactly the viewport's height. */
.app {
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 20px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
/* While typing (the on-screen keyboard shrinks the screen), or on very short screens, allow scrolling. */
.app:has(textarea:focus, input:focus) { overflow-y: auto; }
@media (max-height: 540px) { .app { overflow-y: auto; height: auto; min-height: 100dvh; } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.brand { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--gap); flex: none; }
.logo { height: 34px; width: auto; display: block; }
.brand-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line);
}
body[data-view="note"] .brand,
body[data-view="request"] .brand { display: none; }

.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.view[hidden] { display: none; }

h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(24px, 3.6dvh, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
h1:focus { outline: none; }
.sub { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.sub[hidden] { display: none; }
.foot { margin: 8px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.section-title { font-size: 14px; font-weight: 600; margin: 0 0 8px; }

/* Anything wrapped in .bottom sits at the bottom of the screen. */
.bottom { margin-top: auto; padding-top: var(--gap); flex: none; }

/* ---------- Check in / out  vs  My attendance ---------- */
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex: none;
  padding: 4px; margin: 0 0 var(--gap); border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.mode-btn {
  min-height: 42px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.mode-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- PIN ---------- */
.pin-status { height: 28px; display: flex; align-items: center; justify-content: center; margin: var(--gap) 0; flex: none; }
.dots { display: flex; gap: 22px; }
.dots[hidden] { display: none; }
.dots span {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ink); background: transparent;
  transition: background 0.12s, border-color 0.12s;
}
.dots span.filled { background: var(--accent); border-color: var(--accent); }
.dots.error span { border-color: var(--error); }
.dots.shake { animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.message {
  font-size: 14px; line-height: 1.35; font-weight: 500;
  border-radius: 12px; padding: 9px 14px; margin: 0 0 var(--gap);
}
.message[hidden] { display: none; }
.view-pin .message.error {
  align-self: center; text-align: center;
  color: var(--error); background: var(--error-bg);
  border-radius: 999px; padding: 8px 18px;
}
.view-note .message.error,
.view-request .message.error,
.view-choose .message.error { color: var(--error); background: var(--error-bg); }
.view-choose .message.error { text-align: center; }
.view-pin .message.info {
  align-self: stretch; text-align: center;
  color: var(--ink); background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
}
.message.success { color: var(--accent-ink); background: var(--success-bg); font-weight: 600; margin: 10px 0 0; }

.actions-row { display: flex; gap: 10px; margin: 0 0 var(--gap); }
.actions-row[hidden] { display: none; }
.actions-row .btn { flex: 1; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.4dvh, 12px) 14px;
  flex: none;
}
.key {
  height: var(--key-h);
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: clamp(22px, 3.4dvh, 28px); font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.08s, transform 0.08s, border-color 0.08s;
}
.key:active { background: var(--press); border-color: var(--accent); transform: scale(0.97); }
.key:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.key-spacer { height: var(--key-h); }
.pin-foot { margin-top: auto; padding-top: 8px; }

/* ---------- Welcome / confirm ---------- */
.hero { display: flex; align-items: center; gap: 14px; flex: none; }
.tick {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
}
.tick-warn { background: var(--warn); color: var(--on-warn); }
.greeting { font-size: clamp(22px, 3.2dvh, 27px); margin-bottom: 6px; }
.badge {
  display: inline-block;
  padding: 3px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--on-accent);
  background: var(--accent);
}
.badge.neutral { background: var(--grey-badge); color: #fff; }
.badge.warn { background: var(--warn); color: var(--on-warn); }
.badge.bad { background: var(--error); color: var(--bg); }
.badge.small { font-size: 12px; padding: 2px 9px; }
.view-confirm .sub { margin-top: 10px; }

.time-card, .week-card {
  margin-top: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(12px, 1.8dvh, 18px) 18px;
  flex: none;
}
.time-card { background: var(--bg-soft); }
.week-card { padding: 12px 12px 10px; }
.week-card[hidden] { display: none; }
.date { margin: 0; color: var(--muted); font-size: 13px; }
.big-time {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(38px, 6.2dvh, 54px); line-height: 1.05; letter-spacing: -0.02em;
  margin: 2px 0 6px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.big-time .ampm { font-size: 0.42em; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.range-row { margin: 0; display: flex; flex-direction: column; gap: 1px; }
.range-row[hidden] { display: none; }
.range-label { font-size: 12px; color: var(--muted); }
.range { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.worked { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.worked[hidden] { display: none; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.hint[hidden] { display: none; }
.view-confirm .time-card .hint { margin-top: 0; }

.link {
  align-self: flex-start;
  background: none; border: 0; padding: 6px 0; margin-top: 6px;
  color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  min-height: 40px; flex: none;
}
.link[hidden] { display: none; }
.link-center { align-self: center; margin: 4px auto 0; text-align: center; font-size: 14px; display: block; }

/* ---------- My week strip ---------- */
.week {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 2px;
}
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 0; border-radius: 10px; min-width: 0; }
.wk-is-today { background: var(--bg-soft); }
.wk-day { font-size: 12px; font-weight: 600; color: var(--muted); }
.wk-is-today .wk-day { color: var(--ink); }
.wk-mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: transparent; display: inline-block; }
.wk-sub { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-ontime .wk-mark { background: var(--ok); border-color: var(--ok); }
.wk-late .wk-mark { background: var(--warn); border-color: var(--warn); }
.wk-late .wk-sub { color: var(--warn); font-weight: 600; }
.wk-out-only .wk-mark { border-color: var(--ok); }
.wk-leave .wk-mark { background: var(--away); border-color: var(--away); }
.wk-leave .wk-sub { color: var(--away); font-weight: 600; }
.wk-holiday .wk-mark { border-style: dashed; border-color: var(--muted); }
.wk-absent .wk-mark { border-color: var(--error); }
.wk-absent .wk-sub { color: var(--error); }
.wk-today .wk-mark { border-style: dashed; border-color: var(--accent); }
.wk-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.wk-key { display: inline-flex; align-items: center; gap: 4px; }
.wk-key .wk-mark { width: 9px; height: 9px; border-width: 2px; }
.week-card .section-title { margin-bottom: 6px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 50px; border-radius: 12px; border: 1px solid transparent;
  font-family: var(--sans); font-size: 16px; font-weight: 600;
  cursor: pointer; padding: 0 16px;
}
.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:active { opacity: 0.85; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-press); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--field-line); font-weight: 500; }
.btn-outline:active { background: var(--press); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:active { background: var(--press); }

/* ---------- Note & request forms ---------- */
.back {
  align-self: flex-start;
  background: none; border: 0; padding: 4px 0; margin: 0 0 8px;
  color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  min-height: 40px; flex: none;
}
.back[hidden] { display: none; }
.view-note .sub { margin-bottom: var(--gap); }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
textarea, input[type="date"], input[type="month"], input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="time"], select {
  width: 100%;
  border: 1px solid var(--field-line); border-radius: 12px; padding: 11px 14px;
  font-family: var(--sans); font-size: 16px; line-height: 1.4; color: var(--ink); background: var(--surface);
}
textarea { resize: none; }
.view-note textarea { flex: 1; min-height: 100px; }
.view-request textarea { min-height: 64px; height: clamp(64px, 10dvh, 110px); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.counter { text-align: right; color: var(--muted); font-size: 12px; margin: 4px 0 0; font-variant-numeric: tabular-nums; }

.form { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 8px; }
.field { margin-bottom: var(--gap); min-width: 0; }
.field[hidden] { display: none; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-row.single { grid-template-columns: 1fr; }
.choice { border: 0; margin: 0 0 var(--gap); padding: 0; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-item {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 6px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.choice-grid input:checked + .choice-item { border-color: var(--accent); background: var(--success-bg); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-grid input:focus-visible + .choice-item { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- My attendance ---------- */
.me-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -4px; padding: 0 4px 4px;
}
.me-scroll > .week-card:first-child, .me-col-main > .week-card:first-child { margin-top: 8px; }
.month-card { padding: 12px 14px; }
.month-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.month-head .section-title { margin: 0; text-align: center; flex: 1; }
.month-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.month-btn:disabled { opacity: 0.3; cursor: default; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats.stats-3 { grid-template-columns: repeat(3, 1fr); }
#me-leave .section-title { margin: 0 0 8px; text-align: center; }
#me-leave[hidden] { display: none; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px; border-radius: 12px; background: var(--bg-soft); text-align: center; }
.stat-n { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.stat.warn .stat-n { color: var(--warn); }
.stat.away .stat-n { color: var(--away); }
.stat.bad .stat-n { color: var(--error); }
.month-hours { margin: 8px 0 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.45; }
.days { list-style: none; margin: 6px 0 0; padding: 0; border-top: 1px solid var(--line); }
.days[hidden] { display: none; }
.day { display: grid; grid-template-columns: 88px 1fr; gap: 1px 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.day:last-child { border-bottom: 0; }
.day-date { font-weight: 600; grid-row: span 2; }
.day-state { font-weight: 600; }
.day-times { color: var(--muted); font-variant-numeric: tabular-nums; }
.day-late .day-state, .day-out-only .day-state { color: var(--warn); }
.day-absent .day-state { color: var(--error); }
.day-leave .day-state, .day-upcoming .day-state { color: var(--away); }
.day-ontime .day-state { color: var(--ok); }

.requests-title { margin-top: 14px; }
.requests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.request { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.request-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.request-type { font-weight: 600; font-size: 15px; }
.request-dates, .request-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.request-empty { color: var(--muted); font-size: 14px; }

/* ---------- Short phones: tighter still ---------- */
@media (max-height: 720px) {
  .sub#pin-sub { display: none; }
  .wk-legend { display: none; }
  .tick { width: 44px; height: 44px; }
  .btn { min-height: 46px; }
  .view-confirm .sub { font-size: 14px; }
}

button:focus-visible, .link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .spinner { animation: spin 1.6s linear infinite !important; }
}

/* ---------- Check in / Check out choice ---------- */
.tick-soft { background: var(--bg-soft); color: var(--accent-ink); }
.choose-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: var(--gap); }
.choose-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: clamp(96px, 16dvh, 140px); padding: 12px; border-radius: 18px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform 0.08s ease, background 0.15s ease;
}
.choose-btn svg { width: 34px; height: 34px; color: var(--accent-ink); }
.choose-btn.suggested { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.choose-btn.suggested svg { color: var(--on-accent); }
.choose-btn:active:not(:disabled) { transform: scale(0.97); }
.choose-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.choose-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#choose-message { margin-top: 10px; }
#choose-status { margin: 6px 0 0; }

/* Request form: three kinds side by side; the half choice only for Half Day */
.choice-grid.choice-3 { grid-template-columns: repeat(3, 1fr); }
.choice[hidden] { display: none; }

/* ---------- Desktop mode (wide screen with a mouse). Phones and tablets keep the layout above. ---------- */
.desk-side { display: none; }
.me-col { display: contents; }
.extra-card { display: none !important; }

@media (min-width: 1024px) and (min-height: 600px) and (hover: hover) and (pointer: fine) {
  body {
    display: grid; grid-template-columns: minmax(340px, 36%) 1fr; justify-content: stretch;
    min-height: 100vh; background: var(--bg-soft);
  }
  .desk-side {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 36px;
    padding: 44px 48px; background: #161616; color: #f3f3f3; overflow: hidden;
  }
  .desk-side::after {
    content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 136, 0, 0.35), transparent 70%); pointer-events: none;
  }
  .desk-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
  .desk-logo { height: 40px; width: auto; background: #fff; border-radius: 12px; padding: 5px 8px; }
  .desk-hero { margin-top: auto; }
  .desk-kicker { margin: 0 0 10px; color: #ff8800; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
  .desk-title { margin: 0; font-size: clamp(28px, 2.6vw, 40px); line-height: 1.15; font-weight: 700; max-width: 14em; }
  .desk-date { margin: 16px 0 0; color: #b8b2a8; font-size: 15px; }
  .desk-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: s; }
  .desk-steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; }
  .desk-steps li::before {
    content: counter(s); grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 136, 0, 0.16);
    color: #ff8800; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  }
  .desk-steps b { font-size: 15px; }
  .desk-steps span { color: #b8b2a8; font-size: 13.5px; }
  .desk-foot { margin: 0 0 auto; color: #8c877f; font-size: 13px; }

  .app {
    align-self: center; justify-self: center; width: min(480px, calc(100% - 64px)); max-width: none;
    height: auto; min-height: 0; margin: 40px 0; padding: 32px 36px; overflow: visible;
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
    box-shadow: 0 1px 2px rgba(22, 22, 22, 0.04), 0 12px 40px rgba(22, 22, 22, 0.08);
  }
  .app .brand { display: none; }
  :root { --key-h: 64px; --gap: 14px; }

  /* My attendance: two columns, attendance on the left, requests and extra hours on the right. */
  body[data-view="me"] .app { width: min(1080px, calc(100% - 64px)); }
  body[data-view="me"] .me-scroll {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start;
    overflow: visible; margin: 0; padding: 0;
  }
  .me-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .me-col .week-card { margin: 0; }
  .me-col-main > .week-card:first-child { margin-top: 0; }
  .requests-title { margin-top: 0; }
  .extra-card:not([hidden]) { display: block !important; }
  body[data-view="me"] .bottom { padding-top: 20px; }
  body[data-view="me"] .bottom.btn-row { max-width: 420px; margin-right: auto; }
}

/* Extra hours card */
.extra-total { margin: 0 0 12px; font-weight: 600; text-align: center; color: var(--accent-ink); }
.extra-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--line); }
.extra-fields { display: grid; grid-template-columns: 1fr 0.7fr; gap: 10px; }
.extra-fields .field { margin: 0; }
.extra-note-field { grid-column: 1 / -1; }
.extra-fields input { width: 100%; }
.extra-actions { display: flex; gap: 10px; }
.extra-actions .btn { flex: 1; }
.extra-actions [hidden] { display: none; }
.extra-list { list-style: none; margin: 12px 0 0; padding: 0; }
.extra-item { display: grid; grid-template-columns: 96px 56px 1fr auto; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.extra-item:first-child { border-top: 0; }
.extra-item.editing { background: var(--success-bg); border-radius: 10px; }
.extra-date { color: var(--muted); }
.extra-hours { font-weight: 700; }
.extra-note { min-width: 0; overflow-wrap: anywhere; }
.extra-edit { padding: 4px 8px; font-size: 14px; }

/* Install the app (shown only when the browser can install it, or on iPhone) */
.install-btn { margin-top: 4px; font-size: 13px; }
.install-btn[hidden] { display: none; }

/* Work details: task rows */
.extra-tasks { display: flex; flex-direction: column; gap: 6px; }
.task-row { display: flex; gap: 6px; }
.task-row input { flex: 1; min-width: 0; }
.task-remove { flex: none; width: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.task-remove:hover { color: var(--error); border-color: var(--error); }
.extra-add-task { align-self: flex-start; margin-top: 4px; padding: 4px 0; font-size: 14px; }
.extra-note-field { display: flex; flex-direction: column; }
ul.extra-note { margin: 0; padding-left: 18px; }
ul.extra-note li { margin: 1px 0; }
.extra-item { align-items: start; }

.extra-actions-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.extra-delete { padding: 4px 8px; font-size: 14px; color: var(--error); }

/* Work details: one growing box */
#extra-note { width: 100%; min-height: 76px; max-height: 260px; resize: none; overflow-y: auto; line-height: 1.45; }
.extra-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.extra-hint kbd { font: inherit; font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

/* Extra hours (employee): task + hours rows and the calculated total */
.extra-sum-field .extra-sum { margin: 0; min-height: 48px; display: flex; align-items: center; font-size: 22px; font-weight: 700; color: var(--accent-ink); }
.task-head { display: grid; grid-template-columns: 1fr 76px 40px; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.task-row { display: grid; grid-template-columns: 1fr 76px 40px; gap: 6px; }
.task-row input { width: 100%; min-width: 0; }
.task-h { display: inline-block; min-width: 46px; margin-right: 6px; color: var(--accent-ink); }
