@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/Inter.ttf') format('truetype');
}

:root {
  color-scheme: light;
  --canvas: #f5f6fb;
  --primary: #4342c8;
  --primary-hover: #3736b4;
  --card: #ffffff;
  --ink: #1c2240;
  --muted: #535e7b;
  --line: #e2e6f2;
  --line-strong: #cbd2e6;
  --slate: #181b34;
  --accent: #bcc9ff;
  --accent-dark: #393975;
  --signal: #444fc2;
  --soft: #edf0ff;
  --radius: 18px;
  font: 14px/1.5 Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #5965db; outline-offset: 3px; }
a { color: inherit; }
img { display: block; width: 100%; object-fit: cover; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.4rem, 4.5vw, 4.15rem); font-weight: 700; letter-spacing: -.077em; }
h2 { font-size: 1.18rem; letter-spacing: -.04em; font-weight: 680; }
h3 { font-size: .98rem; letter-spacing: -.02em; font-weight: 670; }
.muted { color: var(--muted); }
small, .small { font-size: .8rem; }
.workspace { display: grid; grid-template-columns: 219px minmax(0, 1fr); min-height: 100dvh; container: workspace / inline-size; }
.sidebar {
  position: sticky; top: 0; z-index: 4; height: 100dvh; padding: 25px 16px 20px;
  background: radial-gradient(120% 55% at 0% 0%, #373b70 0%, transparent 70%), var(--slate);
  color: #f0f2ff; display: flex; flex-direction: column; gap: 35px;
}
.brand { display: flex; align-items: center; gap: 10px; padding-left: 4px; letter-spacing: -.034em; font-weight: 675; font-size: 1.08rem; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; color: #262956; display: grid; place-items: center; background: var(--accent); }
.brand-mark .icon { width: 21px; height: 21px; }
.nav { display: grid; gap: 6px; }
.nav button, .side-button {
  display: flex; width: 100%; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 9px; border: 1px solid transparent;
  text-align: left; background: transparent; color: #d9def6; font-weight: 560; min-height: 42px;
}
.nav button:hover, .side-button:hover { background: #ffffff12; }
.nav button[aria-current="page"] { background: #ffffff16; border-color: #ffffff18; color: #f3f4ff; }
.nav button[aria-current="page"] .icon { color: var(--accent); }
.nav button[aria-current="page"]::after { content: ""; margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.sidebar-end { margin-top: auto; }
.options { position: relative; }
.options summary { cursor: pointer; list-style: none; }
.options summary::-webkit-details-marker { display: none; }
.options[open] summary { background: #ffffff12; border-color: #ffffff26; }
.options-list {
  position: absolute; bottom: calc(100% + 7px); left: 0; display: grid; width: max-content; min-width: 187px; padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 33px #161e4a3c; color: var(--ink); background: var(--card);
}
.options-list .button {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; border: 0; border-radius: 7px;
  padding: 8px 10px; min-height: 40px; text-decoration: none; font-size: .86rem; font-weight: 600;
}
.options-list .button:hover { background: var(--soft); }
.local-status { border-top: 1px solid #ffffff1c; display: flex; align-items: center; gap: 7px; margin: 14px 6px 0; padding-top: 15px; color: #b9c3e4; font-size: .75rem; }
.local-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a0b6ff; }
.main { width: min(100%, 1580px); margin: 0 auto; padding: 23px clamp(22px, 4vw, 63px) 52px; min-width: 0; outline: none; }
.demo-control { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.demo-switch {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 7px 10px 7px 12px;
  border: 1px solid #dc8a92; border-radius: 11px; background: #fff0f2; color: #8c2233; font-weight: 670;
}
.demo-switch[aria-checked="true"] { background: #a62339; border-color: #a62339; color: #fff; }
.demo-switch:hover { border-color: #861830; }
.demo-switch[aria-checked="true"]:hover { background: #931e33; }
.demo-state { margin-left: auto; font-size: .79rem; font-weight: 600; }
.demo-track { display: flex; align-items: center; flex: 0 0 43px; height: 24px; border-radius: 16px; padding: 3px; background: #efd0d5; }
.demo-track::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #a62339; }
.demo-switch[aria-checked="true"] .demo-track { justify-content: flex-end; background: #771426; }
.demo-switch[aria-checked="true"] .demo-track::before { background: #fff; }
.page-head, .section-head, .actions, .week-control, .dialog-head, .list-title {
  display: flex; align-items: center; gap: 11px;
}
.page-head { margin: 25px 0 24px; justify-content: space-between; align-items: flex-end; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: .96rem; }
.page-head .actions { justify-content: flex-end; }
.section-head, .dialog-head { justify-content: space-between; }
.section-head { margin-bottom: 15px; }
.section-head h2 { display: flex; align-items: center; gap: 7px; }
.section-head h2 .icon { color: var(--signal); }
.actions { flex-wrap: wrap; }
.button, .icon-button {
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--card); color: var(--ink); display: inline-flex;
  align-items: center; justify-content: center; gap: 7px; padding: 9px 13px; min-height: 40px; text-decoration: none; font-weight: 625; white-space: nowrap;
  transition: border-color .16s, background-color .16s;
}
.icon-button { width: 38px; min-height: 38px; padding: 0; flex: 0 0 auto; }
.icon-button:hover, .button:hover { border-color: #8996d6; background-color: #f2f4ff; }
.button.primary {
  color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 10px #3836a927;
}
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button.ghost { background: transparent; }
.button.ghost:hover { background: #e9edfc; }
.button.danger { color: #9a2c22; }
.button.small { min-height: 32px; padding: 5px 9px; font-size: .79rem; }
.small .icon { width: 15px; height: 15px; }
.text-button { padding: 1px 0; border: 0; background: transparent; color: #3b48b8; font-weight: 675; text-underline-offset: 3px; }
.text-button:hover { text-decoration: underline; }
.week-control { gap: 7px; border: 1px solid var(--line); padding: 3px; border-radius: 12px; background: #eef1fa; }
.week-control .icon-button { width: 33px; min-height: 33px; border-color: transparent; }
.week-control .period { min-width: 96px; text-align: center; white-space: nowrap; font-weight: 640; font-size: .86rem; padding-inline: 4px; text-transform: capitalize; }

.metrics { display: grid; grid-template-columns: 1.58fr 1fr 1fr; gap: 13px; margin-bottom: 20px; }
.metric {
  position: relative; isolation: isolate; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px 17px; min-width: 0; background: var(--card);
}
.metric-main {
  background: radial-gradient(110% 200% at 100% 0%, #464ba1 0%, transparent 68%), #1c2157;
  color: #fff; border-color: #363b7d;
}
.metric-main::after {
  content: ""; position: absolute; inset: 0 0 0 45%; z-index: -1; opacity: .16; pointer-events: none;
  background-image: linear-gradient(to right, #ffffff5f 1px, transparent 1px), linear-gradient(to bottom, #ffffff5f 1px, transparent 1px);
  background-size: 21px 21px; mask-image: linear-gradient(90deg, transparent, black);
}
.metric-main::before {
  content: ""; position: absolute; inset: -55% -15% -65% 38%; z-index: -1; pointer-events: none;
  border-radius: 50%; border: 1px solid #d0d6ff22; box-shadow: 0 0 0 24px #c5d1ff0c, 0 0 0 53px #c5d1ff0b, 0 0 0 84px #c5d1ff0a;
  transform: rotate(-26deg);
}
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .79rem; font-weight: 605; }
.metric-label .icon { width: 16px; height: 16px; }
.metric-main .metric-label, .metric-main .metric-hint { color: #e6eaff; }
.metric-main .metric-value { color: #f4f6ff; }
.metric-value { font-size: clamp(1.8rem, 3.4vw, 2.85rem); letter-spacing: -.077em; font-variant-numeric: tabular-nums; font-weight: 685; line-height: 1.13; margin: 8px 0 4px; white-space: nowrap; }
.metric-hint { color: var(--muted); font-size: .77rem; margin-top: 5px; }
.metric-meter { height: 4px; width: min(100%, 250px); margin: 10px 0 6px; border-radius: 20px; overflow: hidden; background: #ffffff36; }
.metric-meter span { display: block; height: 100%; border-radius: inherit; background: #a8b6ff; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(215px, .85fr); gap: 14px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; padding: 18px; box-shadow: 0 2px 8px #26356907; }
.card-stack { display: grid; gap: 13px; }
.week-card { padding-bottom: 4px; }
.week-card .section-head { margin-bottom: 11px; }
.week-card .week-control { margin-bottom: 12px; justify-content: space-between; }
.week-card .week-control .period { flex: 1; }
.day-list { margin: 0 -18px; }
.day-header, .day-row { display: grid; grid-template-columns: minmax(91px, 1.2fr) minmax(82px, .95fr) minmax(47px, .54fr) minmax(43px, .6fr) 24px; gap: 8px; align-items: center; padding: 0 17px; }
.day-header { color: var(--muted); font-size: .74rem; font-weight: 595; background: #f2f4fb; min-height: 33px; border-bottom: 1px solid var(--line); }
.day-row { min-height: 52px; border: 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; background: transparent; font-size: .87rem; }
.day-row:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.day-row:hover { background: #edf0fc; }
.day-name { display: grid; gap: 2px; min-width: 0; }
.day-name strong { text-transform: capitalize; }
.day-row .day-name strong, .day-row .day-hours { font-weight: 660; }
.day-row .date { color: var(--muted); font-size: .72rem; }
.day-row .day-time { color: var(--muted); white-space: nowrap; }
.day-row .day-hours { font-variant-numeric: tabular-nums; }
.day-row .edit-icon { margin-left: auto; color: #4654a4; display: grid; place-items: center; }
.day-row .edit-icon .icon { width: 15px; height: 15px; }
.day-row.is-today .day-name strong { color: #3443a8; }
.day-row.is-today .date::after { content: " · Aujourd’hui"; }
.day-absence, .absence-label { color: #694711; }
.distribution { display: grid; gap: 14px; }
.distribution-line .list-title { justify-content: space-between; font-size: .83rem; gap: 8px; }
.distribution-line .list-title span { overflow-wrap: anywhere; }
.distribution-line .list-title strong { white-space: nowrap; font-weight: 665; }
.track { height: 6px; background: #ebeffa; border-radius: 20px; overflow: hidden; margin-top: 6px; }
.bar { background: #5267dd; height: 100%; border-radius: 20px; }
.distribution-line:nth-child(2n) .bar { background: #9a73e3; }
.distribution-line:nth-child(3n) .bar { background: #8094cf; }
.period-bars .distribution-line .bar { background: #596ee6; }
.month-card .month-value { margin: 4px 0 10px; font-size: 1.6rem; font-weight: 690; letter-spacing: -.052em; }
.month-title { text-transform: capitalize; }
.loading, .empty { padding: 16px 0; color: var(--muted); }

.agenda-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(223px, .72fr); gap: 14px; align-items: start; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekday { text-align: center; padding: 4px 0 5px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.calendar-cell {
  display: flex; flex-direction: column; align-items: start; justify-content: space-between; gap: 4px; min-height: 66px; min-width: 0;
  padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: #f6f7fc; text-align: left; font-variant-numeric: tabular-nums;
}
.calendar-cell span { font-weight: 610; }
.calendar-cell small { font-size: .72rem; line-height: 1.15; white-space: nowrap; }
.calendar-cell.worked-cell { background: #edf0ff; }
.calendar-cell:hover { border-color: #8995de; }
.calendar-cell.overflow-month { color: #627093; background: #f9faff; }
.calendar-cell[aria-current="date"] span { color: #3547ad; text-decoration: underline; text-underline-offset: 3px; }
.calendar-cell[aria-pressed="true"] { background: #e2e7ff; border-color: #777de0; color: #262e6a; }
.hours-label { color: #394bbb; font-weight: 640; }
.agenda-detail .section-head h2 span { text-transform: capitalize; }
.agenda-detail > .actions { margin-top: 16px; }
.agenda-total { font-size: 2.65rem; line-height: 1.15; font-weight: 690; letter-spacing: -.08em; margin-bottom: 14px; }
.timeline-labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.timeline { position: relative; height: 8px; border-radius: 9px; background: #6678de; margin: 5px 0 8px; overflow: hidden; }
.timeline span { position: absolute; height: 100%; min-width: 2px; background: #d7c1ff; }
.agenda-assignments { margin-top: 16px; }
.private-note { margin-top: 12px; overflow-wrap: anywhere; padding: 8px 10px; border-radius: 8px; background: #edf0fb; color: var(--muted); }

.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #eef1fc; }
.segmented button { min-height: 32px; padding: 4px 10px; border: 1px solid transparent; border-radius: 7px; font-weight: 625; background: transparent; color: var(--muted); }
.segmented button[aria-pressed="true"] { border-color: var(--line-strong); background: var(--card); color: var(--ink); box-shadow: 0 1px 2px #212b2312; }

.filter-panel { margin-bottom: 20px; }
.filter-controls { display: grid; grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(100px, 1fr)); gap: 9px; }
.search-box { position: relative; display: block; }
.search-box .icon { position: absolute; top: 11px; left: 9px; color: var(--muted); }
.search-box input[type=search] { padding-left: 33px; }
.filter-foot { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.site-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.client-block { margin: 0 0 21px; }
.client-block .section-head { margin-bottom: 10px; }
.site-card { padding: 15px 17px; display: flex; flex-direction: column; gap: 8px; }
.site-card .list-title { justify-content: space-between; align-items: flex-start; }
.site-card .list-title strong { color: #3e50bb; white-space: nowrap; }
.site-address { color: var(--muted); font-size: .8rem; display: flex; gap: 5px; align-items: start; overflow-wrap: anywhere; }
.site-address .icon { width: 15px; height: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: #f0f2fa; color: #4d5981; padding: 3px 8px; border: 1px solid #e1e6f5; border-radius: 18px; font-size: .74rem; overflow-wrap: anywhere; }
.tag-type { color: var(--accent-dark); border-color: #d8dafe; background: #eeedff; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: auto; padding-top: 7px; }
.site-footer .text-button { font-size: .82rem; }
.site-info { margin-bottom: 13px; display: grid; gap: 12px; }
.location-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.location-box p { color: var(--muted); overflow-wrap: anywhere; }
.location-box a { margin-left: auto; }
.location-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: #434fbb; background: var(--soft); }
.site-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 13px; align-items: start; }
.history { display: grid; }
.history > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.history > div span:first-child { text-transform: capitalize; overflow-wrap: anywhere; }
.history > div strong { white-space: nowrap; }

.export-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(188px, .65fr); gap: 14px; align-items: start; }
.export-layout .actions { margin-top: 14px; }
.export-layout .week-control { width: max-content; margin-bottom: 12px; }
.export-note { width: 100%; min-height: 220px; resize: vertical; background: #f5f7fe; border: 1px solid var(--line); border-radius: 10px; padding: 13px; color: var(--ink); font: .9rem/1.7 ui-monospace, monospace; }
.backup-box + .backup-box { margin-top: 12px; }
.backup-box p { margin: 7px 0 12px; }
dialog { border: 1px solid var(--line-strong); border-radius: 17px; padding: 19px; width: min(94vw, 530px); max-height: min(92dvh, 768px); color: var(--ink); background: var(--card); box-shadow: 0 20px 65px #202c254f; }
body.phone-mode dialog { width: min(94vw, 393px); }
dialog::backdrop { background: #222c2475; }
.dialog-head { align-items: flex-start; margin-bottom: 14px; }
.dialog-head h2 { margin-top: 6px; }
#dialog-title:first-letter { text-transform: uppercase; }
.fields { display: grid; gap: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { display: grid; gap: 4px; font-size: .84rem; font-weight: 610; min-width: 0; }
.field small { font-weight: 470; }
input:not([type=checkbox]), select, textarea:not(.export-note) { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); padding: 8px 9px; min-height: 40px; }
textarea:not(.export-note) { resize: vertical; }
.check { display: flex; align-items: center; gap: 7px; font-size: .88rem; }
.check input { width: 17px; height: 17px; accent-color: var(--signal); }
.net { padding: 8px 10px; border-radius: 8px; background: var(--soft); color: #3b469b; font-size: .82rem; font-weight: 600; }
.reuse-hours { justify-self: start; }
.allocation-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(74px, .42fr) 35px; align-items: end; gap: 7px; margin-top: 6px; }
.allocation-row .icon-button { min-height: 40px; width: 35px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dialog-footer .danger { margin-right: auto; }
.form-error, .slot-error { color: #9f2a25; font-size: .85rem; }
.form-error:empty, .slot-error:empty, [hidden] { display: none !important; }
.photo-full { max-height: 65dvh; object-fit: contain; background: var(--soft); border-radius: 9px; }
#toast { position: fixed; z-index: 8; bottom: 20px; right: 19px; max-width: min(390px, calc(100vw - 38px)); background: #252b60; color: #fff; border-radius: 9px; padding: 11px 13px; box-shadow: 0 8px 20px #1a292133; font-weight: 570; font-size: .85rem; }
#toast:empty { display: none; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 177px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .main { padding-inline: 21px; }
}
@media (max-width: 760px) { .workspace { display: block; } }
@media (min-width: 761px) {
  body.phone-mode { background: #e7eaf6; }
  .phone-mode .workspace {
    display: block; width: min(100%, 424px); margin: 13px auto; min-height: calc(100dvh - 26px);
    border: 1px solid #c5cdea; background: var(--canvas); border-radius: 21px; box-shadow: 0 14px 35px #24382a24;
  }
}
@container workspace (max-width: 940px) {
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  .dashboard .card-stack { grid-template-columns: 1fr 1fr; }
  .agenda-layout { grid-template-columns: minmax(0, 1fr); }
}
@container workspace (max-width: 760px) {
  .sidebar { height: auto; padding: 6px 9px; border-radius: 0 0 12px 12px; flex-direction: row; align-items: center; gap: 6px; }
  .phone-mode .sidebar { border-radius: 18px 18px 10px 10px; }
  .brand { display: none; }
  .nav { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .nav button { justify-content: center; gap: 4px; padding: 4px 2px; font-size: .79rem; min-height: 42px; }
  .nav button[aria-current="page"]::after { display: none; }
  .nav .icon { width: 15px; height: 15px; }
  .sidebar-end { margin-top: 0; }
  .side-button { padding: 6px; width: 39px; height: 40px; min-height: 40px; justify-content: center; border-color: #ffffff28; }
  .side-button .icon { width: 17px; height: 17px; }
  .side-button span, .local-status { display: none; }
  .options-list { top: calc(100% + 7px); left: auto; right: 0; bottom: auto; }
  .main { padding: 10px 11px 26px; }
  .demo-control { margin-bottom: 9px; }
  .demo-switch { width: 100%; }
  h1 { font-size: clamp(2.24rem, 8cqw, 2.7rem); }
  .page-head { margin: 16px 0; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .page-head .button { min-height: 35px; padding: 6px 9px; font-size: .82rem; }
  .page-head .actions { gap: 5px; justify-content: flex-start; }
  .page-head p { margin-top: 4px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
  .metric { padding: 9px 11px; border-radius: 12px; }
  .metric-main { grid-column: 1 / -1; }
  .metric-label { font-size: .75rem; }
  .metric-value { margin-top: 4px; font-size: 1.72rem; }
  .metric-main .metric-value { font-size: 2.32rem; }
  .metric-meter { margin-top: 7px; }
  .dashboard, .dashboard .card-stack, .site-detail-grid, .export-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .site-grid { gap: 8px; grid-template-columns: minmax(0, 1fr); }
  .card { padding: 13px; border-radius: 13px; }
  .week-card { padding-bottom: 3px; }
  .day-list { margin: 0 -13px; }
  .day-header, .day-row { grid-template-columns: minmax(64px, 1.05fr) minmax(71px, .98fr) minmax(40px, .60fr) minmax(36px, .6fr) 14px; gap: 4px; padding-inline: 9px; }
  .day-row { min-height: 47px; font-size: .76rem; }
  .day-row.is-today .date::after { content: ""; }
  .day-row .date { font-size: .67rem; }
  .day-header { font-size: .67rem; }
  .calendar-grid { gap: 3px; }
  .calendar-cell { min-height: 44px; padding: 3px 2px; align-items: center; gap: 2px; font-size: .82rem; border-radius: 7px; }
  .calendar-cell small { font-size: .65rem; }
  .calendar-card { padding-inline: 9px; }
  .calendar-card .section-head { padding-inline: 2px; }
  .segmented button { font-size: .8rem; padding-inline: 7px; }
  .filter-controls { grid-template-columns: 1fr 1fr; gap: 6px; }
  .filter-controls select { font-size: .8rem; padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::after, *::before { transition: none !important; } }

.count-pill {
  min-width: 22px; border-radius: 18px; padding: 3px 7px; background: #edf0fb; color: #485483;
  font-size: .72rem; font-weight: 650; letter-spacing: 0; white-space: nowrap; text-align: center;
}
.photo-filters { margin-bottom: 24px; }
.photo-filter-fields { display: grid; grid-template-columns: 1fr 1.16fr .82fr; gap: 10px; }
.photo-filters .filter-foot { justify-content: space-between; flex-wrap: wrap; }
.photo-group { margin-bottom: 27px; }
.photo-group h2:first-letter, .photo-caption small:first-letter { text-transform: uppercase; }
.photo-group .section-head { align-items: flex-end; }
.photo-group-heading { display: grid; gap: 3px; min-width: 0; }
.photo-group-client {
  color: #5940a2; font-family: Georgia, "Noto Serif", serif; font-size: 1.32rem;
  font-weight: 600; line-height: 1.18; overflow-wrap: anywhere;
}
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.photo-tile {
  border: 1px solid var(--line); border-radius: 15px; background: var(--card); padding: 0; text-align: left;
  min-width: 0; overflow: hidden; box-shadow: 0 3px 14px #2635690a; transition: box-shadow .16s, border-color .16s;
}
.photo-tile:hover { border-color: #99a4da; box-shadow: 0 6px 20px #26356918; }
.photo-tile .picture { aspect-ratio: 4 / 3; }
.picture { background: #edf0fa; overflow: hidden; display: grid; place-items: center; width: 100%; min-width: 0; position: relative; }
.picture img { height: 100%; width: 100%; object-fit: cover; }
.photo-caption { display: grid; gap: 3px; padding: 10px 11px 11px; }
.photo-caption strong, .photo-caption small { overflow-wrap: anywhere; }
.photo-caption strong { color: var(--ink); font-size: .86rem; line-height: 1.26; font-weight: 650; }
.photo-caption small { color: var(--muted); font-size: .74rem; }
.photo-unavailable { height: 100%; width: 100%; display: grid; place-content: center; gap: 5px; justify-items: center; color: #4e5986; font-size: .68rem; padding: 5px; text-align: center; }
.photo-unavailable .icon { width: 21px; height: 21px; }
.photo-empty { display: grid; justify-items: center; gap: 9px; padding: 37px 14px; text-align: center; }
.photo-empty-icon { display: grid; place-items: center; width: 47px; height: 47px; margin-bottom: 4px; border-radius: 13px; background: #edf0ff; color: #4654b7; }
.photo-empty-icon .icon { width: 23px; height: 23px; }
.photo-empty .button { margin-top: 5px; }
.project-photos > .button { margin-bottom: 12px; }
.project-photos .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.calendar-day-number { display: flex; justify-content: space-between; align-items: center; gap: 3px; width: 100%; }
.upload-box { position: relative; min-height: 111px; background: #f1f3ff; color: #39458f; border: 1px dashed #a3afe3; border-radius: 12px; display: grid; justify-items: center; align-content: center; gap: 4px; padding: 10px; text-align: center; cursor: pointer; }
.upload-box:hover { background: #e9edff; }
.upload-box:focus-within { outline: 2px solid var(--signal); outline-offset: 2px; }
.upload-box .icon { width: 21px; height: 21px; }
.upload-box span { font-size: .78rem; }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; height: 100%; cursor: pointer; }
.upload-selection { overflow-wrap: anywhere; color: var(--muted); }
.upload-selection:empty { display: none; }
dialog.photo-dialog { width: min(94vw, 780px); }
body.phone-mode dialog.photo-dialog { width: min(94vw, 405px); }
.photo-dialog .picture { border-radius: 12px; min-height: 100px; }
.photo-dialog .photo-full { height: auto; max-height: 62dvh; object-fit: contain; }
.photo-view-meta { display: grid; gap: 4px; margin-top: 12px; }
.photo-view-meta p:nth-child(2):first-letter { text-transform: uppercase; }
.photo-view-meta .small a { text-underline-offset: 2px; }
.button.solid-danger { color: #ffffff; background: #9a2c37; border-color: #9a2c37; }
.button.solid-danger:hover { background: #862531; }
@container workspace (max-width: 920px) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container workspace (max-width: 760px) {
  .photo-grid { gap: 8px; }
  .photo-tile { border-radius: 12px; }
  .photo-caption { padding: 7px 8px 9px; }
  .photo-filters { margin-bottom: 17px; }
  .photo-filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }

  .photo-group { margin-bottom: 20px; }
  .photo-group .section-head { margin-bottom: 9px; }
  .calendar-day-number { justify-content: center; }
}

.view-head, .calendar-controls, .report-controls { display: flex; align-items: center; gap: 8px; }
.view-head { margin-bottom: 16px; gap: 14px; flex-wrap: wrap; }
.view-head h1 { font-size: clamp(1.55rem, 3vw, 2.4rem); }
.agenda-head .calendar-controls { margin-left: auto; }
.calendar-controls select { width: auto; max-width: 106px; font-weight: 600; }
.period-picker { background: transparent; border: 0; min-height: 34px; text-decoration: underline dotted; text-underline-offset: 4px; }
.period-picker:hover { color: var(--primary); }
.stats-period { margin-bottom: 14px; }
.date-actions, .day-save { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-card { max-width: 615px; }
.day-card .section-head { margin-bottom: 11px; }
.day-card .section-head h2 { display: block; }
.day-card h2:first-letter { text-transform: uppercase; }
.day-form { gap: 9px; }
.day-form [data-work-fields] { gap: 8px; }
.day-form .danger { color: #9a2c22; justify-self: start; }
.day-form .net { display: block; }
.day-form .dialog-footer { margin-top: 0; }
.day-save { border-top: 1px solid var(--line); padding-top: 9px; }
.day-save output { color: var(--accent-dark); font-weight: 650; }
.day-save .button { min-height: 43px; }
.day-options summary, .slot-pause summary { cursor: pointer; }
.day-options summary { width: fit-content; min-height: 33px; padding-block: 6px; font-size: .83rem; font-weight: 600; color: var(--muted); }
.day-options > .fields { padding: 7px 0; }
.slot-list { display: grid; gap: 8px; }
.work-slot { min-width: 0; margin: 0; padding: 9px; display: grid; gap: 7px; background: #f8f9fe; border: 1px solid var(--line); border-radius: 10px; }
.slot-heading { display: flex; justify-content: space-between; align-items: center; font-size: .81rem; }
.slot-heading .icon-button { min-height: 31px; width: 32px; }
.slot-list[data-count="1"] .slot-heading { display: none; }
.slot-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(82px, .38fr); gap: 8px; }
.pause-stepper { position: relative; min-width: 0; }
.pause-stepper input[type=number], .pause-clock input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.pause-stepper input::-webkit-inner-spin-button, .pause-clock input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.pause-stepper input[type=number] { padding-right: 31px; }
.pause-arrows {
  position: absolute; inset: 1px 1px 1px auto; display: grid; width: 28px; grid-template-rows: 1fr 1fr;
  border-left: 1px solid var(--line); border-radius: 0 7px 7px 0; background: #f2f4fc;
}
.pause-arrows button { border: 0; background: transparent; display: grid; place-items: center; padding: 0; color: #354297; }
.pause-arrows button:first-child { border-bottom: 1px solid var(--line); }
.pause-arrows button:hover { background: #e4e9ff; }
.pause-arrows button .icon { width: 14px; height: 14px; transform: rotate(90deg); }
.pause-arrows button:first-child .icon { transform: rotate(-90deg); }
.pause-clock { display: grid; grid-template-columns: minmax(34px, .8fr) auto minmax(55px, 1.2fr); align-items: center; gap: 4px; width: min(100%, 142px); }
.pause-clock > input[type=number] { padding-inline: 5px; text-align: center; }
.pause-clock .pause-stepper input[type=number] { padding-left: 5px; }
.slot-pause { width: fit-content; max-width: 100%; }
.slot-pause .field { margin-top: 5px; }
.slot-tools { display: flex; flex-wrap: wrap; align-items: start; column-gap: 16px; row-gap: 4px; }
.slot-pause summary { min-height: 34px; padding-block: 7px; }
.slot-upload { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 3px 0; min-height: 34px; cursor: pointer; }
.slot-upload input[type=file] { position: absolute; inset: 0; opacity: 0; min-height: 0; cursor: pointer; }
.slot-upload:focus-within { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
.slot-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.slot-preview { position: relative; min-width: 0; }
.slot-preview .picture { border-radius: 7px; aspect-ratio: 1; }
.slot-preview .icon-button { position: absolute; top: 3px; right: 3px; width: 26px; min-height: 26px; border-radius: 7px; }
.slot-preview .icon-button .icon { width: 14px; height: 14px; }
.recap-date { color: var(--muted); font-weight: 580; }
.recap-date:first-letter { text-transform: uppercase; }
.recap-total { display: grid; gap: 2px; background: var(--soft); border-radius: 10px; margin-top: 10px; padding: 10px 12px; color: var(--accent-dark); }
.recap-total strong { font-size: 1.8rem; letter-spacing: -.04em; line-height: 1.15; }
.recap-total span { font-size: .8rem; }
.recap-history { margin-top: 12px; }
.slot-add { justify-self: start; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.slot-add .icon { width: 15px; height: 15px; }
.year-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.year-month {
  display: grid; gap: 4px; justify-items: start; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #f6f7fc; text-transform: capitalize; text-align: left;
}
.year-month:hover { background: #edf0ff; border-color: #a4ace8; }
.year-month span { font-size: 1.36rem; font-weight: 660; letter-spacing: -.05em; }
.year-month small { color: var(--muted); text-transform: none; }
.report-controls { align-items: end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 11px; }
.report-controls .week-control { margin-bottom: 0; }
.report-date { max-width: 100%; width: 238px; }
.report-range { margin-bottom: 10px; font-weight: 650; }
.report-missing { margin-bottom: 10px; padding: 8px 10px; border: 1px solid #ebd9bd; border-radius: 9px; color: #6c4a19; background: #fff8e9; }
.report-prompt { margin-top: 10px; }
.client-list-title { min-width: 0; }
.client-link {
  color: #5940a2; font-family: Georgia, "Noto Serif", serif; font-size: 1.38rem;
  font-weight: 600; line-height: 1.18; white-space: normal; text-align: left; overflow-wrap: anywhere;
}
.client-link .icon, .site-link .icon { width: 15px; height: 15px; margin-left: 5px; }
.site-link { text-align: left; color: var(--ink); }
.site-client-action { margin: -11px 0 13px; }
.client-photo-tools { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.client-photo-tools .photo-filter-fields { grid-template-columns: minmax(160px, 1fr) minmax(138px, .8fr); }
.client-photos .photo-group:last-child { margin-bottom: 0; }
@container workspace (max-width: 760px) {
  .view-head { margin-bottom: 9px; gap: 7px; }
  .agenda-head h1 { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .agenda-head .calendar-controls { width: 100%; margin-left: 0; }
  .calendar-controls .week-control { gap: 3px; flex: 1; justify-content: space-between; min-width: 0; }
  .calendar-controls .period { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .calendar-controls select { min-height: 41px; }
  .agenda-head > .button { margin-left: auto; }
  .view-head:has(.segmented) { justify-content: space-between; }
  .stats-period { margin-bottom: 9px; }
  .day-card { padding: 11px; }
  .day-form input, .day-form select, .day-form textarea { font-size: 16px; }
  .day-save .button { padding-inline: 9px; font-size: .84rem; }
  .year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .year-month { padding: 9px; }
  .client-photo-tools .photo-filter-fields { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container workspace (max-width: 350px) {
  .nav .icon { display: none; }
  .day-save output { font-size: .81rem; }
}

@media (max-width: 760px), (pointer: coarse) {
  /* WebKit's native date/time control has an intrinsic width on iOS. */
  .field { grid-template-columns: minmax(0, 1fr); }
  .field input[type="date"], .field input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 8px;
  }
  .field input::-webkit-date-and-time-value { min-height: 1.2em; text-align: left; }
  .field input:not([type="checkbox"]), .field select, .field textarea,
  .pause-clock input, .pause-stepper input, .calendar-scope select {
    font-size: 16px;
  }
  .work-slot .form-grid input[type="time"] { min-height: 44px; font-variant-numeric: tabular-nums; }
}

@media (max-width: 760px) {
  dialog {
    position: fixed;
    inset: calc(var(--dialog-visible-top, 0px) + var(--dialog-visible-height, 100dvh) / 2) 0 auto;
    transform: translateY(-50%);
    margin: 0 auto;
    max-width: calc(100% - 24px);
    max-height: calc(var(--dialog-visible-height, 100dvh) - 24px);
    padding: 14px;
    overscroll-behavior: contain;
  }
  dialog.entity-dialog { width: min(calc(100% - 24px), 390px); }
  .entity-dialog .dialog-head { align-items: center; margin-bottom: 10px; }
  .entity-dialog .dialog-head h2 { margin-top: 0; }
  .entity-dialog .dialog-footer { flex-wrap: nowrap; margin-top: 12px; }
  .entity-dialog .dialog-footer .button { min-height: 44px; }
}

.time-parts { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 3px; }
.time-parts select { min-height: 44px; padding-inline: 4px; font-size: 16px; font-variant-numeric: tabular-nums; }
#client-results { margin-top: 10px; }
#client-results .client-link { text-align: left; overflow-wrap: anywhere; }
.client-photo-tools > .field { flex: 1 1 140px; max-width: 210px; }
