:root {
  /* Light theme only. Brand blue sampled from the logo: #0129EC. */
  color-scheme: light;
  --bg: #f1f4fb; --surface: #ffffff; --ink: #0d1530; --muted: #5b6683;
  --line: #e7eaf3; --field: #ffffff; --field-line: #d5dbea;
  --accent: #0129ec; --on-accent: #fff; --soft: #eaeeff; --warm: #b4570f; --danger: #b4232b;
  --band: linear-gradient(160deg, #0129ec 0%, #2a4dff 100%); --on-band: #fff; --on-band-soft: rgb(255 255 255 / .18);
  --shadow: 0 1px 2px rgb(13 21 48 / .05), 0 8px 24px -12px rgb(13 21 48 / .16);
  --lift: 0 8px 18px -8px rgb(1 41 236 / .55);
  --gutter: max(16px, calc(50% - 304px));
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.icon { display: inline-flex; }
.icon svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Band */
header, #month-bar { background: #0129ec; color: var(--on-band); padding-inline: var(--gutter); }
header {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
h1 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; }
h1::before {
  content: ''; width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: url(/icon-192.png) center / cover; box-shadow: 0 0 0 2px rgb(255 255 255 / .35);
}
#month-bar {
  position: sticky; top: 0; z-index: 2; margin-top: -1px;
  display: flex; align-items: center; justify-content: space-between; padding-block: 10px 22px;
  border-radius: 0 0 28px 28px; box-shadow: 0 12px 28px -18px rgb(1 41 236 / .9);
}
body.gate h1::before { display: none; }
body.gate header, header:has(+ #month-bar[hidden]) { border-radius: 0 0 28px 28px; padding-bottom: 16px; }
h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; text-transform: capitalize; }
#install { padding: 4px 14px; min-height: 32px; font-size: .85rem; }

main { max-width: 640px; margin: 0 auto; padding: 20px 16px 16px; }
#ios-hint { margin-bottom: 12px; padding: 12px 14px; background: var(--soft); border-radius: 14px; font-size: .9rem; }

/* Controls */
button {
  min-height: 50px; padding: 8px 18px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700;
  box-shadow: var(--lift);
  transition: transform .15s cubic-bezier(.16, 1, .3, 1), background-color .15s, opacity .15s;
}
button:active { transform: scale(.98); }
@media (hover: hover) { button:hover { opacity: .92; } }
button.wide { display: block; width: 100%; }
button.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--field-line); }
button.danger, button.on-band, button.back, button.link, button.seg, button.item, nav button, .team-member button { box-shadow: none; }
button.danger { background: transparent; color: var(--danger); width: 100%; margin-top: 6px; }
button.on-band { background: var(--on-band-soft); color: var(--on-band); }
#month-bar button { width: 44px; min-height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
#month-bar button:focus-visible, #install:focus-visible { outline-color: var(--on-band); }
button.back { background: none; color: var(--accent); padding: 0 8px 0 0; min-height: 44px; display: inline-flex; align-items: center; gap: 2px; }

label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 12px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; min-height: 48px;
  font: inherit; font-size: 1rem; color: inherit; caret-color: var(--accent);
  background: var(--field); border: 1.5px solid var(--field-line); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--soft); }
.check input:focus { box-shadow: none; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.inline { display: flex; gap: 8px; }
.inline input { margin: 0; flex: 1; min-width: 0; }

/* Lists */
.list { background: var(--surface); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.list li + li { border-top: 1px solid var(--line); }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 64px; padding: 10px 14px; border-radius: 0; text-align: left;
  background: transparent; color: var(--ink); font-weight: 400;
}
.item:focus-visible { outline-offset: -3px; }
.item:active { transform: none; background: var(--soft); }
.item-text { min-width: 0; flex: 1; }
.item-label { display: block; font-weight: 600; }
.item-label::first-letter { text-transform: uppercase; }
.item-detail { display: block; font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.avatar {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: var(--soft); color: var(--accent); font-weight: 700;
}
.chevron { color: var(--muted); }

/* Day sheet */
dialog {
  margin: auto auto 0; width: 100%; max-width: 100%; border: 0; border-radius: 26px 26px 0 0;
  padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--ink);
}
dialog::before {
  content: ''; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
  border-radius: 99px; background: var(--line);
}
dialog[open] { animation: rise .26s cubic-bezier(.16, 1, .3, 1); }
dialog::backdrop { background: rgb(13 21 48 / .45); backdrop-filter: blur(3px); }
@keyframes rise { from { transform: translateY(32px); opacity: .4; } }
#day-title { font-size: 1.25rem; margin-bottom: 14px; }
#day-title::first-letter { text-transform: uppercase; }
#start, #end { font-size: 1.25rem; font-weight: 600; }
#day-duration { min-height: 1.5em; margin-bottom: 12px; font-size: 1.05rem; font-weight: 700; color: var(--accent); }
@media (min-width: 560px) {
  dialog { margin: auto; max-width: 420px; border-radius: 24px; padding-bottom: 20px; }
  dialog::before { display: none; }
}

/* Calendar: one white card holding the weekday row and the days. */
.cal-head, .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--surface); padding-inline: 10px; }
.cal-head {
  padding-top: 14px; padding-bottom: 6px; border-radius: 22px 22px 0 0; box-shadow: 0 -6px 18px -14px rgb(13 21 48 / .18);
  text-align: center; font-size: .7rem; font-weight: 700; letter-spacing: .06em; color: var(--muted);
}
.calendar { padding-bottom: 10px; border-radius: 0 0 22px 22px; box-shadow: var(--shadow); }
.cal-day {
  position: relative; min-height: 52px; padding: 7px 2px 6px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: transparent; color: var(--ink); box-shadow: none; font-weight: 600;
}
.cal-day:active { transform: scale(.94); }
.cal-day .num { font-size: .98rem; line-height: 1.1; }
.cal-day .dur { font-size: .6875rem; font-weight: 800; line-height: 1; color: var(--accent); }
.cal-day.filled { background: var(--soft); color: var(--ink); }
.cal-day.filled .dur { color: var(--accent); }
.cal-day.today { background: var(--accent); color: var(--on-accent); box-shadow: var(--lift); }
.cal-day.today .dur, .cal-day.today .abs { color: var(--on-accent); }
.cal-day.official::after, .legend .dot {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warm);
}
.cal-day.official::after { position: absolute; top: 5px; inset-inline-end: 5px; }
.legend { display: flex; align-items: center; gap: 6px; margin: 10px 6px 0; font-size: .8rem; color: var(--muted); }
.legend .dot { display: inline-block; }
.panel.total-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--band); color: var(--on-band); font-weight: 600; box-shadow: var(--lift);
}
.total-panel strong { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; color: var(--on-band); }
.holiday-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.holiday-list li:first-child { border-top: 0; padding-top: 0; }
.holiday-list strong { display: block; }
.holiday-list strong::first-letter { text-transform: uppercase; }
.holiday-total { font-weight: 600; }
.hint { margin-top: 10px; font-size: .85rem; color: var(--muted); }
.sub { display: block; color: var(--muted); font-size: .875rem; }
.num { text-align: right; white-space: nowrap; font-weight: 600; }


/* Transmissions */
.section-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 12px; }
.panel { background: var(--surface); border-radius: 20px; padding: 18px; margin-top: 16px; box-shadow: var(--shadow); }
.panel h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }
.panel form + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.panel p { color: var(--muted); margin-bottom: 14px; }
.none { color: var(--muted); padding: 2px 0 2px; }

.session-title { font-size: 1.375rem; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.members { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

details { margin-top: 10px; }
summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-weight: 600; color: var(--accent); cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
details input { margin: 0 0 10px; }
details .panel { margin-top: 4px; }

.messages { margin-top: 16px; }
.messages li { background: var(--surface); border-radius: 18px 18px 18px 6px; padding: 12px 14px; margin: 0 36px 10px 0; box-shadow: var(--shadow); }
.messages li.mine { background: var(--soft); border-radius: 18px 18px 6px 18px; margin: 0 0 10px 36px; box-shadow: none; }
.messages li.empty { background: none; box-shadow: none; }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: .8125rem; color: var(--muted); margin-bottom: 4px; }
.meta strong { color: var(--ink); font-size: .875rem; }
.messages li.mine .meta { color: var(--ink); }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Onboarding and subscription */
body.gate #month-bar, body.gate nav, body.gate main > section:not(#onboarding), body.gate #banner { display: none !important; }
#onboarding h2 { margin: 8px 0 14px; text-transform: none; }
.brand { display: block; width: 64px; height: 64px; margin: 8px 0 4px; border-radius: 16px; box-shadow: var(--shadow); }
.segments { display: flex; gap: 4px; padding: 4px; background: var(--line); border-radius: 14px; }
.seg { flex: 1; min-height: 44px; padding: 4px; border-radius: 10px; background: transparent; color: var(--ink); }
.seg.on { background: var(--surface); box-shadow: var(--shadow); }
.recovery {
  margin: 4px 0 14px; padding: 14px; border-radius: 12px; background: var(--soft); text-align: center;
  font: 700 1.2rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; color: var(--ink) !important;
  overflow-wrap: anywhere;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .9rem; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.check a, .legal-links a { color: var(--accent); text-underline-offset: 3px; }
.legal-links { margin: 18px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }
.lead { font-weight: 700; color: var(--accent) !important; }
button.link { display: block; margin: 8px auto 0; background: none; color: var(--accent); }
button.danger-link { margin: 0; padding: 4px 8px; color: var(--danger); }
button:disabled { opacity: .45; cursor: default; }
button.ghost:disabled { opacity: 1; color: var(--muted); }
#banner { margin-bottom: 12px; padding: 10px 14px; background: var(--soft); border-radius: 12px; font-size: .9rem; font-weight: 600; }
#banner.alert { background: var(--danger); color: var(--surface); }
.panel input[readonly] { margin: 0 0 10px; }
.spaced { margin-top: 22px; }
.plan { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px; }
.plan .item-text { overflow-wrap: anywhere; }
.price { text-align: right; font-size: 1.1rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.price small { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); }
.plan > button:not(.link) { min-height: 44px; padding: 6px 12px; font-size: .875rem; }

/* Settings and right-to-left */
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 40px; min-height: 40px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
#settings h3 { font-size: 1.2rem; margin-bottom: 14px; }
[dir="rtl"] #prev .icon, [dir="rtl"] #next .icon, [dir="rtl"] .back .icon, [dir="rtl"] .chevron { transform: scaleX(-1); }
.legal-links p { margin: 0 0 4px; }

/* Shifts, month status and team */
.month-status { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: var(--soft); font-size: .9rem; font-weight: 600; }
.month-status.correction { background: var(--danger); color: var(--surface); }
.day-shifts li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.day-shifts li.editing strong { color: var(--accent); }
.day-shifts li:last-child { margin-bottom: 10px; }
.shift-actions { display: flex; gap: 2px; }
.shift-actions .link, .team .link { margin: 0; padding: 4px 8px; }
.shift-form-title { font-size: 1rem; margin: 6px 0 10px; }
#submit-month { margin-top: 16px; }
.team-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.team-head .section-title { margin: 0; }
.team-head button { min-height: 40px; padding: 6px 12px; font-size: .85rem; }
.team-member details { padding: 0; }
.team-member summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; color: var(--ink); list-style: none; cursor: pointer; }
.team-member summary::-webkit-details-marker { display: none; }
.team-detail { padding: 0 14px 14px; }
.team-detail table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 10px; }
.team-detail th, .team-detail td { padding: 6px 4px; text-align: start; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.team-notes { font-size: .9rem; margin-bottom: 10px; white-space: pre-wrap; }
.badge { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--line); color: var(--ink); }
.badge.submitted { background: var(--warm); color: var(--surface); }
.badge.validated { background: var(--accent); color: var(--on-accent); }
.badge.correction { background: var(--danger); color: var(--surface); }

/* Absences */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h3 { margin: 0; }
button.small { min-height: 38px; padding: 4px 12px; font-size: .82rem; }
.cal-day.absence:not(.filled) { background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day .abs { font-size: .6875rem; font-weight: 800; color: var(--accent); line-height: 1; }
.badge.pending { background: var(--warm); color: var(--surface); }
.badge.approved { background: var(--accent); color: var(--on-accent); }
.badge.refused { background: var(--danger); color: var(--surface); }
.holiday-list li .badge { margin-inline-start: 0; }
.request .sub { display: block; }

/* Photos in handovers */
.message-photo { display: block; width: 100%; max-height: 420px; object-fit: contain; margin-top: 8px; border-radius: 10px; background: var(--line); }
.photo-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.photo-preview img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; }
.photo-preview .link { margin: 0; }

/* Notification settings */
.notification-settings { margin: 6px 0 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.notification-settings h4 { margin: 0 0 8px; font-size: 1rem; }
.notification-settings .hint { margin: 0 0 10px; }

/* Referral and presentation link */
.discover { display: block; margin: 14px 0 0; text-align: center; font-weight: 600; color: var(--accent); text-underline-offset: 3px; }

/* Employees */
.employee { flex-wrap: wrap; }
.employee-actions { display: flex; gap: 4px; margin-inline-start: auto; }
.employee-actions .link { margin: 0; padding: 4px 8px; }
.credentials { border: 2px solid var(--accent); }
.credentials .recovery { font-size: 1.05rem; }

/* Urgence */
.emergency-line { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.emergency-line:active { background: var(--soft); }
.emergency-line:focus-visible { outline-offset: -3px; }
.emergency-number {
  flex: none; min-width: 72px; padding: 7px 10px; border-radius: 10px; text-align: center;
  background: var(--danger); color: var(--surface); font-size: 1.15rem; font-weight: 800;
}
#tab-urgence input[type="search"] { margin: 0 0 10px; }
.country { padding: 10px 14px; }
.services { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 2px; font-size: .85rem; color: var(--muted); }
.call { display: inline-block; padding: 6px 2px; color: var(--accent); font-weight: 700; text-decoration: none; }

/* Tab bar */
/* Floating tab bar. */
nav {
  position: fixed; z-index: 2; display: flex; max-width: 608px; margin: 0 auto;
  inset: auto 8px calc(8px + env(safe-area-inset-bottom)); padding: 4px;
  background: rgb(255 255 255 / .94); backdrop-filter: blur(12px);
  border-radius: 24px; box-shadow: 0 10px 30px -10px rgb(13 21 48 / .3), 0 0 0 1px var(--line);
}
nav button {
  flex: 1; min-width: 0; min-height: 56px; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; color: var(--muted); font-size: .6875rem; font-weight: 700; letter-spacing: -.01em; border-radius: 18px;
}
nav button > :last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav .icon { padding: 2px 14px; border-radius: 999px; transition: background-color .2s, color .2s; }
nav button[aria-current] { color: var(--accent); }
nav button[aria-current] .icon { background: var(--accent); color: var(--on-accent); }

/* Documents */
nav button { position: relative; }
nav button[data-new]::after { content: ''; position: absolute; top: 6px; inset-inline-end: calc(50% - 22px); width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.doc-list li { flex-wrap: wrap; }
.doc-list li > div:first-child { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
.doc-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
@media (max-width: 420px) { nav { inset-inline: 4px; padding: 3px; } nav .icon { padding: 2px 10px; } }
.doc-actions .badge { margin: 0; }
.holiday-list .sub { display: block; font-size: .82rem; color: var(--muted); }
.picker { border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--field-line); background: var(--surface); }
.picker summary { padding: 12px 14px; min-height: 44px; font-weight: 700; cursor: pointer; }
.picker-list { display: grid; gap: 10px; padding: 4px 14px 14px; max-height: 220px; overflow: auto; }
.plan-line { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.plan-line input { min-width: 0; }
.plan-line input[type=date] { grid-column: 1 / -1; }
.plan-line .wide-cell { grid-column: 1 / -1; display: flex; gap: 8px; }
.plan-line .wide-cell input { flex: 1; }
#doc-dialog form { display: grid; gap: 12px; max-height: 80dvh; overflow: auto; }
#doc-dialog h3 { margin: 0; }

#toast {
  position: fixed; z-index: 3; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom));
  padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* Monthly / yearly choice */
.seg small { display: block; font-size: .6875rem; font-weight: 700; color: var(--accent); }
.plan .item-detail { overflow-wrap: anywhere; }
