/* Gallery Leave Book — white-cube gallery wall: quiet neutrals, ink type, one ultramarine accent.
   Mobile first: bottom tab bar on phones, top navigation from 760px. */
:root {
  --wall: #f4f5f7; --paper: #ffffff; --ink: #15171c; --muted: #5b626e; --line: #dde1e7; --line-strong: #c4cad3;
  --accent: #2a3bd1; --accent-ink: #ffffff; --accent-soft: #e3e6fb;
  --lieu: #0d7f70; --lieu-soft: #d8f0ec; --other: #7b818c; --other-soft: #e8eaee;
  --hol: #a3610a; --hol-soft: #fbeed6; --off: #eceef2;
  --bad: #b42335; --bad-soft: #fbe3e6; --good: #1f7a3a; --good-soft: #dff2e5;
  --f-display: "Avenir Next", "Segoe UI Variable Display", "Helvetica Neue", Arial, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px; --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wall: #101216; --paper: #181b21; --ink: #eceef2; --muted: #9aa1ad; --line: #2a2f38; --line-strong: #3a414c;
    --accent: #8592ff; --accent-ink: #0d0f1a; --accent-soft: #252a52;
    --lieu: #43c7b2; --lieu-soft: #123a35; --other: #9aa1ad; --other-soft: #2a2f38;
    --hol: #e7a648; --hol-soft: #3b2c12; --off: #1f232a;
    --bad: #ff7084; --bad-soft: #3d1a20; --good: #5fcf83; --good-soft: #163522;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--wall); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(26px, 6vw, 36px); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.boot { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: 1100px; margin: 0 auto; min-height: 56px; display: flex; align-items: center; gap: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand svg { width: 28px; height: 28px; flex: none; }
.topnav { display: none; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--ink); background: var(--wall); }
.topnav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.topnav svg { width: 18px; height: 18px; }
.userbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); text-decoration: none; border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 14px; font-weight: 500; min-height: 40px; white-space: nowrap; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; }
.userbtn svg { width: 18px; height: 18px; flex: none; }
.userbtn[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pwwrap { position: relative; }
.pwwrap input { padding-right: 72px; font-family: var(--f-mono); }
.pwtoggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 10px; border: 0; border-radius: 8px; background: var(--wall); cursor: pointer; font-size: 14px; font-weight: 600; }
.notice { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; background: var(--hol-soft); border-radius: var(--radius); padding: 14px 16px; }
.creds { display: grid; gap: 10px; background: var(--good-soft); border-radius: 10px; padding: 14px; }
.creds .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.creds input { font-family: var(--f-mono); min-height: 44px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--paper); width: 100%; min-width: 0; }

main {
  max-width: 1100px; margin: 0 auto; display: grid; gap: 28px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px));
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar-h); text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
.tabbar a.book-tab span.ic { background: var(--ink); color: var(--paper); border-radius: 999px; width: 44px; height: 30px; display: grid; place-items: center; }
.tabbar a.book-tab svg { width: 20px; height: 20px; }

@media (min-width: 760px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  main { padding-block: 32px 64px; gap: 36px; }
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100% - 32px));
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 10px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.err { background: var(--bad); color: #fff; }
@media (min-width: 760px) { .toast { bottom: 24px; } }

/* ---------- common pieces ---------- */
.sec { display: grid; gap: 12px; min-width: 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 40px; }

.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 4px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: 14px; font-weight: 500; line-height: 1.3; }
.pill.vacation { background: var(--accent-soft); }
.pill.lieu { background: var(--lieu-soft); }
.pill.other { background: var(--other-soft); }
.pill.hol { background: var(--hol-soft); }
.pill.ok { background: var(--good-soft); }
.pill.bad { background: var(--bad-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--other); }
.dot.vacation { background: var(--accent); } .dot.lieu { background: var(--lieu); } .dot.other { background: var(--other); } .dot.hol { background: var(--hol); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { color: var(--muted); padding: 8px 0; }
.bar { height: 8px; border-radius: 4px; background: var(--off); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.lieu i { background: var(--lieu); }
.warn { color: var(--hol); } .bad { color: var(--bad); }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.signin .card { width: 100%; max-width: 400px; padding: 28px 24px; display: grid; gap: 18px; }
.signin .logo { width: 48px; height: 48px; }
.signin p { margin: 0; }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; }
.input, .field select, .field input[type=date], .field input[type=email], .field input[type=text], .field input[type=number] {
  width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--paper); font-size: 16px;
}
.code-input { font-family: var(--f-mono); font-size: 26px; letter-spacing: .35em; text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kinds label { position: relative; display: grid; gap: 2px; place-items: center; text-align: center; min-height: 64px; padding: 8px; border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: var(--paper); font-weight: 600; font-size: 15px; }
.kinds label small { font-weight: 400; font-size: 12px; color: var(--muted); }
.kinds input { position: absolute; opacity: 0; pointer-events: none; }
.kinds label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.kinds label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.summary { background: var(--wall); border-radius: 10px; padding: 14px; display: grid; gap: 4px; }
.summary b { font-size: 18px; }
.msg { font-size: 15px; }
.msg.err { color: var(--bad); }
.book-wrap { display: grid; gap: 20px; max-width: 560px; }
@media (max-width: 759px) {
  /* Keep "Book it" reachable above the tab bar while scrolling the form. */
  .book-wrap button[type=submit] { position: sticky; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
}
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; font-size: 14px; position: relative; }
.days input { position: absolute; opacity: 0; }
.days label:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- home ---------- */
.hello { display: grid; gap: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { display: grid; gap: 8px; align-content: start; }
.stat .big { font-family: var(--f-display); font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .big small { font-size: 16px; font-weight: 500; color: var(--muted); }
.daylist { display: grid; gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dayrow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: start; }
.dayrow:first-child { border-top: 0; }
.dayrow .dname { font-weight: 600; line-height: 1.3; }
.dayrow .dname span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); font-family: var(--f-mono); }
.dayrow.today { background: var(--accent-soft); }
.entries { display: grid; gap: 8px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.entry .what { display: grid; gap: 4px; min-width: 0; }
.entry .when { font-weight: 600; }
.entry .note { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.entry .side { display: grid; justify-items: end; gap: 6px; text-align: right; }
.entry .count { font-family: var(--f-mono); font-size: 14px; color: var(--muted); }
.entry.past { opacity: .65; }

/* ---------- calendar ---------- */
.cal-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.monthnav { display: flex; align-items: center; gap: 6px; }
.monthnav .m { font-family: var(--f-display); font-weight: 700; font-size: 18px; min-width: 150px; text-align: center; }
.iconbtn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.iconbtn svg { width: 20px; height: 20px; }
.scrollbox { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.grid th, .grid td { padding: 0; text-align: center; border-bottom: 1px solid var(--line); }
.grid thead th { background: var(--paper); font-weight: 500; color: var(--muted); padding: 6px 0 4px; min-width: 32px; width: 32px; }
.grid thead th b { display: block; font-family: var(--f-mono); font-size: 13px; color: var(--ink); font-weight: 500; }
.grid thead th.today, .grid thead th.today b { color: var(--accent); font-weight: 700; }
.grid .pn { position: sticky; left: 0; z-index: 1; background: var(--paper); text-align: left; padding: 0 10px; min-width: 96px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid var(--line); font-weight: 500; font-size: 13px; }
.grid tr.grp td { background: var(--wall); height: 24px; font-size: 10px; font-weight: 700; color: var(--hol); }
.grid tr.grp .pn { background: var(--wall); color: var(--muted); letter-spacing: .08em; font-size: 11px; }
.grid tr.me .pn { color: var(--accent); font-weight: 700; }
.c { height: 34px; position: relative; }
.c.tap { cursor: pointer; }
.c.tap:hover { box-shadow: inset 0 0 0 2px var(--line-strong); }
.c.off { background: repeating-linear-gradient(135deg, var(--off) 0 4px, transparent 4px 8px); }
.c.hol { background: var(--hol-soft); }
.c.hol::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--hol); }
.c.vacation { background: var(--accent); } .c.lieu { background: var(--lieu); } .c.other { background: var(--other); }
.c.half.vacation { background: linear-gradient(135deg, var(--accent) 50%, transparent 50%); }
.c.half.lieu { background: linear-gradient(135deg, var(--lieu) 50%, transparent 50%); }
.c.half.other { background: linear-gradient(135deg, var(--other) 50%, transparent 50%); }
.t { box-shadow: inset 1px 0 0 var(--accent), inset -1px 0 0 var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.sw.vacation { background: var(--accent); } .sw.lieu { background: var(--lieu); } .sw.other { background: var(--other); }
.sw.hol { background: var(--hol-soft); border-bottom: 3px solid var(--hol); }
.sw.off { background: repeating-linear-gradient(135deg, var(--off) 0 3px, transparent 3px 6px); }

/* ---------- team ---------- */
.people { display: grid; gap: 8px; }
.grouplabel { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-top: 8px; }
details.person { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
details.person > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 14px 16px; min-height: 64px; }
details.person > summary::-webkit-details-marker { display: none; }
details.person > summary .nm { font-weight: 700; font-size: 17px; }
details.person > summary .sub { font-size: 13px; color: var(--muted); }
details.person > summary .lft { text-align: right; }
details.person > summary .lft b { font-family: var(--f-display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
details.person > summary .lft span { display: block; font-size: 12px; color: var(--muted); }
details.person > summary .bar { grid-column: 1 / -1; }
details.person[open] > summary { border-bottom: 1px solid var(--line); }
.pbody { padding: 14px 16px 16px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.kv div { background: var(--wall); border-radius: 10px; padding: 10px 12px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; font-family: var(--f-mono); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- admin ---------- */
details.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
details.panel > summary { cursor: pointer; padding: 16px; font-family: var(--f-display); font-weight: 700; font-size: 18px; min-height: 56px; list-style-position: inside; }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
.pinner { padding: 16px; display: grid; gap: 14px; }
.adminrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.adminrow:first-child { border-top: 0; }
.adminrow .nm { font-weight: 600; }
.edit { grid-column: 1 / -1; background: var(--wall); border-radius: 10px; padding: 14px; display: grid; gap: 14px; }
.holgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.hollist { list-style: none; margin: 0; padding: 0; }
.hollist li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; align-items: start; }
.hollist li.offd { opacity: .55; }
.hollist li.offd .hn { text-decoration: line-through; }
.hollist .dt { font-family: var(--f-mono); font-size: 13px; }
.hollist .eff { display: block; font-size: 13px; color: var(--hol); }
.hollist .eff.plain { color: var(--muted); }
.hollist input { width: 22px; height: 22px; accent-color: var(--hol); }
.adjrow { display: grid; grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1.4fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.adjrow:first-child { border-top: 0; }
.adjrow input { min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--paper); width: 100%; min-width: 0; }
@media (max-width: 560px) { .adjrow { grid-template-columns: 1fr 92px; } .adjrow .adjnote { grid-column: 1 / -1; } .adjrow .btn { grid-column: 1 / -1; } }
.audit { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.audit li { padding: 8px 0; border-top: 1px solid var(--line); }
.audit li:first-child { border-top: 0; }
.audit time { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); display: block; }
.rules { color: var(--muted); font-size: 14px; max-width: 70ch; margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .c, .seg button, .topnav a { transition: background-color .15s, color .15s, box-shadow .15s, border-color .15s; }
}
