:root {
  --bg: #f4f6f7; --card: #fff; --ink: #14202b; --muted: #5d6b78; --line: #dde3e8;
  --accent: #0f766e; --accent-ink: #fff; --warn: #b45309; --warn-bg: #fef3c7; --ok-bg: #d1fae5; --off-bg: #e5e7eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1418; --card: #17212a; --ink: #e8eef2; --muted: #93a3b0; --line: #2a3742;
    --accent: #2dd4bf; --accent-ink: #042f2b; --warn: #fbbf24; --warn-bg: #3a2c08; --ok-bg: #0b3a30; --off-bg: #26313a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom));
}
header { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 4px; }
h1 { font-size: 22px; margin: 0; }
.sync { font-size: 12px; color: var(--muted); }
.sync.bad { color: var(--warn); }
.weeknav { display: flex; align-items: center; gap: 8px; padding: 6px 16px; }
.weeknav div { flex: 1; text-align: center; font-weight: 600; }
.weeknav button { width: 44px; height: 44px; font-size: 26px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
main { padding: 0 16px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-name { font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--off-bg); }
.chip.ok { background: var(--ok-bg); }
.chip.ot { background: var(--warn-bg); color: var(--warn); }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
button.btn {
  flex: 1; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600;
}
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.btn:disabled { opacity: .4; }
.form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.form.single { grid-template-columns: 1fr; }
label { font-size: 13px; color: var(--muted); display: block; }
input[type=time], input[type=number], input[type=text], input[type=password] {
  width: 100%; min-height: 44px; font: inherit; padding: 6px 8px; margin-top: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.span3 { grid-column: 1 / -1; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tfoot td { font-weight: 800; border-bottom: 0; }
h2 { font-size: 15px; margin: 18px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.wk { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.wk b { font-variant-numeric: tabular-nums; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { flex: 1; min-height: 56px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; }
.tabs button.on { color: var(--accent); }
[hidden] { display: none !important; }
.login { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.login-buttons { display: grid; gap: 10px; margin: 20px 0; }
.login-buttons a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn { flex: 1; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; }
a.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.local-form { margin: 24px 0; }
.local-form label { margin-top: 10px; }
.err { color: var(--warn); font-weight: 600; margin: 10px 0 0; }
/* Provider buttons follow Google's and Microsoft's published sign-in button styles (light and dark). */
a.sso { display: flex; align-items: center; justify-content: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 4px; text-decoration: none; border: 1px solid; }
a.sso svg { flex: none; }
a.sso.google { background: #fff; border-color: #dadce0; color: #3c4043; font: 500 14px/1 Roboto, "Segoe UI", Arial, sans-serif; letter-spacing: .25px; }
a.sso.microsoft { background: #fff; border-color: #8c8c8c; color: #5e5e5e; font: 600 15px/1 "Segoe UI", -apple-system, Roboto, sans-serif; }
a.sso:active { filter: brightness(.94); }
@media (prefers-color-scheme: dark) {
  a.sso.google { background: #131314; border-color: #8e918f; color: #e3e3e3; }
  a.sso.microsoft { background: #2f2f2f; border-color: #2f2f2f; color: #fff; }
}

/* ---- visual polish ---- */
:root { --hero1: #0f766e; --hero2: #134e4a; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06); --amber: #d97706; --green: #059669; --grey: #9aa6b2; }
@media (prefers-color-scheme: dark) { :root { --hero1: #115e59; --hero2: #0b2f2c; --shadow: 0 1px 2px rgba(0,0,0,.4); --amber: #fbbf24; --green: #34d399; --grey: #5b6b78; } }
body { padding-top: 0; background: var(--bg); }
.hero { display: block; background: linear-gradient(160deg, var(--hero1), var(--hero2)); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 18px; border-radius: 0 0 26px 26px; box-shadow: var(--shadow); }
.hero > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-top { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 0 4px; }
.hero h1 { font-size: 26px; letter-spacing: -.3px; }
.hero .sync { color: rgba(255,255,255,.75); }
.hero .sync.bad { color: #fde68a; }
.weeknav { padding: 8px 0 4px; }
.weeknav div { color: #fff; }
.weeknav button { background: rgba(255,255,255,.16); border: 0; color: #fff; border-radius: 12px; }
.weeknav button:active { background: rgba(255,255,255,.28); }
.hero-sum { padding-top: 10px; }
.hs-label { font-size: 13px; opacity: .8; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.hs-main { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hs-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; opacity: .92; margin-top: 4px; }
.hs-todo { background: rgba(255,255,255,.2); border-radius: 99px; padding: 1px 10px; font-weight: 600; }
main { padding-top: 6px; }
.card { border-radius: 18px; box-shadow: var(--shadow); border-color: transparent; padding: 14px 16px; }
.card.day { border-left: 5px solid var(--grey); }
.card.day.ok { border-left-color: var(--green); }
.card.day.ot { border-left-color: var(--amber); }
.card.day.pending { border-left-color: var(--grey); }
.card.day.nonwork, .card.day.off { opacity: .85; }
.card.day.today { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.dayhead { display: flex; gap: 14px; align-items: flex-start; }
.dnum { flex: none; width: 48px; text-align: center; background: var(--bg); border-radius: 12px; padding: 6px 0; line-height: 1.1; }
.dnum b { display: block; font-size: 22px; }
.dnum span { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.dmain { flex: 1; min-width: 0; }
.day-name { font-size: 17px; }
.chip { white-space: nowrap; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.actions .wide { grid-column: 1 / -1; }
button.btn { min-height: 48px; border-radius: 14px; font-size: 16px; }
button.btn.primary { box-shadow: 0 2px 8px rgba(15,118,110,.3); }
button.btn.done { background: var(--ok-bg); border-color: transparent; color: var(--green); }
button.btn:active { transform: scale(.98); }
.tabs { background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -1px 0 var(--line); border-top: 0; }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; min-height: 58px; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }
h2 { margin-top: 22px; }

/* Time inputs on iPhone have a wide intrinsic size: let them shrink to their grid column. */
.form > div { min-width: 0; }
input[type=time], input[type=number], input[type=text], input[type=password] { min-width: 0; -webkit-appearance: none; appearance: none; }
input[type=time] { text-align: left; }
.hero h1 { font-size: 22px; min-width: 0; }
.hero-top { gap: 12px; }
.hero .sync { flex: none; }

/* Today stands out: tinted card, filled date block and a pill. */
.card.day.today { background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.card.day.today .dnum { background: var(--accent); color: var(--accent-ink); }
.card.day.today .dnum span { color: var(--accent-ink); opacity: .85; }
.today-pill { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
