:root {
  --bg: #f6f5f3; --surface: #fff; --surface2: #f0eeeb; --line: #e3e0db; --text: #1c1b1a; --muted: #6d6a66;
  --accent: #c8102e; --accent-ink: #fff; --accent-soft: #fbe9ec; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2; --ok: #15803d;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --top: 56px; --tab: 0px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131314; --surface: #1d1d1f; --surface2: #28282b; --line: #343437; --text: #f1f0ee; --muted: #a09d98;
    --accent: #ff4d67; --accent-ink: #1a0a0d; --accent-soft: #3a1820; --warn: #fbbf24; --warn-bg: #3b2a08; --bad: #f87171; --bad-bg: #3f1616; --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body.modal { overflow: hidden; }
h1, h2, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
.admin-only { display: none !important; }
body.is-admin .admin-only { display: inline-flex !important; }
body.is-admin .palette.admin-only { display: none !important; }
body.is-admin p.admin-only { display: block !important; }

/* ── top bar & navigation ── */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 26px; height: 26px; border-radius: 7px; flex: none; background: var(--accent) url("/icon.svg") center/cover; }
.logo.big { width: 56px; height: 56px; border-radius: 14px; }
.nav { display: flex; gap: 2px; margin-left: 8px; flex: 1; }
.nav a { position: relative; display: flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 550; white-space: nowrap; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.badge { background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.sync:hover { background: var(--surface2); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync.off i { background: var(--warn); }
.sync.off { color: var(--warn); }
.sync:empty { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: 16px 16px calc(40px + var(--tab)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main.v-cal, main.v-matrix { max-width: none; }

@media (max-width: 860px) {
  :root { --top: 50px; --tab: calc(58px + env(safe-area-inset-bottom)); }
  /* backdrop-filter would turn the header into the containing block of the fixed tab bar */
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); justify-content: space-around; }
  .nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10.5px; font-weight: 600; }
  .nav a.on { background: none; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav .nav-matrix { display: none; }
  .nav .badge { position: absolute; top: 2px; left: 50%; margin-left: 4px; }
  .brand { flex: 1; }
  main { padding: 12px 12px calc(24px + var(--tab)); }
}

/* ── buttons & controls ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.icon { width: 36px; padding: 0; }
.btn.big { height: 46px; font-size: 16px; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px 0 10px; }
select, input[type=search], .form input, .form textarea, .login input { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); min-width: 0; }
select { padding-right: 26px; cursor: pointer; max-width: 100%; }
select.set { border-color: var(--accent); color: var(--accent); font-weight: 600; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface2); border-radius: 10px; flex: none; }
.seg button, .seg a { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 550; color: var(--muted); cursor: pointer; text-decoration: none; white-space: nowrap; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: 0; }
.filters input[type=search] { flex: 1; min-width: 110px; max-width: 240px; }
.filters select { max-width: 168px; }
.tools { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 860px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; flex-basis: 100%; scrollbar-width: none; padding-bottom: 2px; }
  .filters select { flex: none; max-width: 170px; }
  .tools .btn span { display: none; }
  .tools .btn { width: 36px; padding: 0; }
  .toolbar > .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar > .seg::-webkit-scrollbar { display: none; }
}

/* ── day strip ── */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.strip::-webkit-scrollbar, .filters::-webkit-scrollbar { display: none; }
.strip a { flex: none; width: 50px; padding: 5px 0 6px; text-align: center; text-decoration: none; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); line-height: 1.2; position: relative; }
.strip small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.strip b { font-size: 13px; font-weight: 650; }
.strip a.today { border-color: var(--accent); }
.strip a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.strip a.on small { color: inherit; opacity: .8; }
.strip a.star::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.strip a.on.star::after { background: var(--accent-ink); }

/* ── list & cards ── */
.group { margin-bottom: 18px; }
.gh { position: sticky; top: var(--top); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 9px 4px 7px; font-size: 15px; font-weight: 700; background: var(--bg); border-radius: 8px; }
.gh small { font-weight: 550; color: var(--muted); font-size: 12px; background: var(--surface2); padding: 1px 8px; border-radius: 10px; }
.gh em { font-style: normal; font-size: 11.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 10px; }
.gh em.today { background: var(--accent); color: var(--accent-ink); }
.gh .hrs { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: auto; }
.gh .hrs.over { color: var(--bad); }
.gh .mini { border: 0; background: var(--surface2); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; color: var(--muted); align-items: center; justify-content: center; }
.gh .mini:first-of-type { margin-left: auto; }
.gh.over { outline: 2px dashed var(--accent); background: var(--accent-soft); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.cards { display: grid; gap: 8px; }
.card { display: flex; gap: 12px; padding: 11px 13px 11px 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; position: relative; overflow: hidden; border: 1px solid transparent; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.card:hover { border-color: var(--line); }
.card.over { border-color: var(--accent); background: var(--accent-soft); }
.card.dragging, .blk.dragging { opacity: .45; }
.time { flex: none; width: 70px; padding-left: 14px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.time b { display: block; font-size: 15px; font-weight: 700; }
.time b.txt { font-size: 11.5px; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; padding-top: 2px; }
.time span { font-size: 12.5px; color: var(--muted); }
.time small { display: block; font-size: 11px; font-weight: 650; color: var(--accent); margin-bottom: 1px; white-space: nowrap; }
.body { flex: 1; min-width: 0; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.flag { display: inline-flex; vertical-align: -3px; margin-left: 6px; }
.flag .ic { width: 16px; height: 16px; }
.flag.warn { color: var(--bad); }
.flag.info { color: var(--warn); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.meta .loc { display: inline-flex; align-items: center; gap: 3px; color: var(--text); font-weight: 550; }
.meta .loc .ic { width: 13px; height: 13px; color: var(--muted); }
.meta .cat { color: var(--c); font-weight: 600; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 2px; border-radius: 14px; background: var(--surface2); font-size: 12.5px; font-weight: 550; border: 1px solid transparent; white-space: nowrap; }
.chip i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; font-size: 9.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.chip.co i { border-radius: 5px; }
.chip.me { background: var(--accent-soft); border-color: var(--accent); }
.chip em { font-style: normal; color: var(--muted); font-weight: 400; }
.chip.drag { cursor: grab; background: var(--surface); border-color: var(--line); }
.extra { font-size: 12.5px; color: var(--muted); }
.palette { align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; margin-bottom: 12px; background: var(--surface2); border-radius: 10px; font-size: 12.5px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { body.is-admin .palette.admin-only { display: flex !important; } }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { font-size: 17px; color: var(--text); margin-bottom: 4px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 2px; }

/* ── my plan ── */
.mehead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.mehead h1 { font-size: 20px; letter-spacing: -.01em; }
.mehead p { color: var(--muted); font-size: 13px; }
.mebtns { margin-left: auto; display: flex; gap: 8px; }
.avatar { font-style: normal; width: 46px; height: 46px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 11.5px; }
.next { display: block; text-decoration: none; padding: 12px 16px; background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); margin-bottom: 10px; }
.next small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.next b { font-size: 17px; }
.next span { display: block; font-size: 13.5px; opacity: .92; }
.mewarn { display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 10px 14px; background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); margin-bottom: 10px; font-weight: 600; font-size: 13.5px; }
.pick { max-width: 640px; margin: 30px auto; text-align: center; }
.pick h1 { font-size: 24px; margin-bottom: 6px; }
.pick p { color: var(--muted); margin-bottom: 22px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 600; }
.pick-grid button:hover { border-color: var(--c); }
.pick-grid i { font-style: normal; width: 44px; height: 44px; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ── calendar: day grid ── */
.dayhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dayhead h1 { font-size: 18px; flex: 1; text-align: center; letter-spacing: -.01em; }
.dayhead em { font-style: normal; font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 10px; vertical-align: 2px; }
.grid-scroll { position: relative; overflow: auto; max-height: calc(100vh - var(--top) - var(--tab) - 190px); max-height: calc(100dvh - var(--top) - var(--tab) - 190px); min-height: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { display: grid; grid-template-columns: 46px repeat(var(--cols), minmax(150px, 1fr)); min-width: min-content; }
.g-corner, .g-head { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); }
.g-corner, .g-gutter, .g-hours { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.g-corner { z-index: 6; }
.g-head { padding: 9px 8px; display: flex; align-items: center; gap: 6px; border-left: 1px solid var(--line); min-width: 0; }
.g-head b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-head small { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.over { color: var(--bad) !important; }
.g-gutter { border-bottom: 1px solid var(--line); font-size: 9.5px; color: var(--muted); padding: 6px 3px; text-align: right; line-height: 1.1; }
.g-top { max-height: 168px; overflow-y: auto; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; gap: 4px; background: var(--surface2); min-width: 0; }
.pill { font-size: 12px; padding: 4px 7px; border-radius: 6px; background: var(--surface); border-left: 3px solid var(--c); cursor: pointer; line-height: 1.25; overflow-wrap: anywhere; }
.pill small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.g-hours { position: sticky; }
.g-hours span { position: absolute; right: 5px; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-hours span:first-child { transform: none; }
.g-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); }
.g-col.over, .g-top.over { background-color: var(--accent-soft); }
.blk { position: absolute; padding: 3px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 3px solid var(--c); overflow: hidden; cursor: pointer; font-size: 12px; line-height: 1.25; box-shadow: 0 0 0 1px var(--surface); }
.blk:hover { z-index: 2; background: color-mix(in srgb, var(--c) 28%, var(--surface)); }
.blk.open { border-bottom: 2px dashed var(--c); }
.blk.f-warn { box-shadow: 0 0 0 1px var(--surface), inset 0 0 0 1.500px var(--bad); }
.blk small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.blk b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.blk span { display: block; color: var(--muted); font-size: 11px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 3; pointer-events: none; }

/* ── calendar: month ── */
.mw { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 4px 6px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mc { display: block; min-height: 108px; padding: 6px; background: var(--surface); text-decoration: none; position: relative; min-width: 0; }
.mc:hover { background: var(--surface2); }
.mc.none { background: var(--bg); }
.mc-h { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: 12.5px; }
.mc.today .mc-h b { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 0 7px; }
.mc-h em { font-style: normal; font-size: 10.5px; color: var(--accent); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-h small { margin-left: auto; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.mt { display: block; font-size: 11.5px; line-height: 1.3; padding: 1px 5px; margin-bottom: 2px; border-left: 3px solid var(--c); border-radius: 3px; background: color-mix(in srgb, var(--c) 10%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.mm { font-size: 11px; color: var(--muted); padding-left: 5px; }
.mn { display: none; }
@media (max-width: 700px) {
  .mc { min-height: 58px; padding: 5px 3px; text-align: center; }
  .mc-h { flex-direction: column; gap: 0; margin: 0; }
  .mc-h small, .mt, .mm { display: none; }
  .mc-h em { max-width: 100%; font-size: 8.5px; }
  .mn { display: inline-flex; margin-top: 3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
}

/* ── matrix & tables ── */
.mx-scroll { overflow: auto; max-height: calc(100vh - var(--top) - var(--tab) - 120px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.mx { width: 100%; }
.mx thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px; text-align: left; font-size: 12px; vertical-align: bottom; }
.mx th.mx-p { width: 34px; min-width: 34px; padding: 8px 2px; }
.mx th.mx-p span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.mx td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mx-day th { text-align: left; padding: 9px 8px 6px; background: var(--surface2); font-size: 12.5px; position: sticky; top: 0; }
.mx-t { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.mx-l { white-space: nowrap; font-weight: 550; }
.mx-v { min-width: 240px; cursor: pointer; }
.mx-v:hover { text-decoration: underline; }
.mx-v .dot { margin-right: 7px; width: 8px; height: 8px; }
.mx-c { text-align: center; border-left: 1px solid var(--line); color: var(--c); font-size: 15px; padding: 4px 0 !important; vertical-align: middle !important; }
body.is-admin .mx-c { cursor: pointer; }
body.is-admin .mx-c:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.mx-c.on { background: color-mix(in srgb, var(--c) 10%, transparent); }
.mx-none { text-align: center; color: var(--muted); padding: 40px !important; }
.load th, .load td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.load thead th { font-size: 11.5px; font-weight: 650; }
.load thead small { display: block; color: var(--muted); font-weight: 500; }
.load tbody th { text-align: left; position: sticky; left: 0; background: var(--surface); }
.load td a { text-decoration: none; display: block; }
.load td.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); }
.load td.high { background: var(--warn-bg); color: var(--warn); font-weight: 650; }
.load td.over { background: var(--bad-bg); font-weight: 700; }
.load td.sum { font-weight: 650; }

/* ── warnings ── */
.wsec { margin-bottom: 22px; }
.wsec h2 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wsec h2 small { font-size: 12px; color: var(--muted); background: var(--surface2); padding: 1px 8px; border-radius: 10px; }
.wlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wlist li { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px; }
.wlist li > .ic { margin-top: 1px; }
.wlist li.warn > .ic { color: var(--bad); }
.wlist li.info > .ic { color: var(--warn); }
.wlist a { display: block; color: var(--muted); text-decoration: none; margin-top: 2px; }
.wlist a:hover { color: var(--text); text-decoration: underline; }
.wlist a.more { display: inline; margin-left: 6px; text-decoration: underline; }
.allgood { padding: 14px 16px; background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); border-radius: var(--radius); font-weight: 600; margin-bottom: 18px; }

/* ── more / admin ── */
.more { max-width: 560px; margin: 0 auto; }
.more h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 20px 4px 8px; }
.menu { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu > * { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 15px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; text-decoration: none; cursor: pointer; font-weight: 550; }
.menu > *:last-child { border-bottom: 0; }
.menu > *:hover { background: var(--surface2); }
.menu .ic { color: var(--muted); }
.rows { display: grid; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); }
.row.off { opacity: .55; }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; }
.row-main small { color: var(--muted); }
.settings { max-width: 560px; }
@media (max-width: 600px) { .row { flex-wrap: wrap; } .row .btn { height: 32px; font-size: 13px; } }

/* ── login ── */
.login { max-width: 340px; margin: 12vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login h1 { font-size: 22px; letter-spacing: -.01em; margin-top: 6px; }
.login p { color: var(--muted); }
.login input[type=password] { width: 100%; height: 46px; font-size: 16px; text-align: center; }
.login .btn { width: 100%; }
.login a { font-size: 13px; color: var(--muted); }

/* ── sheets ── */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-box { position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .16s ease-out; }
.sheet-box.wide { max-width: 640px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface2); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); z-index: 2; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }
@media (max-width: 600px) {
  .sheet { align-items: flex-end; padding: 0; }
  .sheet-box { max-width: none !important; border-radius: 18px 18px 0 0; max-height: 92dvh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation-name: up; }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .sheet-box { animation: none; } }
.tsheet .over { color: var(--c) !important; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tsheet h1 { font-size: 20px; line-height: 1.25; margin: 2px 36px 14px 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.kv > span { color: var(--muted); font-size: 13px; }
.kv .chips { margin: 0; }
.tel { font-size: 12.5px; margin-right: 6px; }
.note { display: flex; gap: 8px; padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 10px; font-weight: 550; }
.note.warn { background: var(--bad-bg); color: var(--bad); }
.note.info { background: var(--warn-bg); color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.grow { flex: 1; }
.form h1 { font-size: 19px; margin: 0 36px 14px 0; }
.form > p { color: var(--muted); margin-bottom: 12px; }
.form label, .form .field { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.form .field > span { display: block; }
.form .field small { font-weight: 400; }
.form label input, .form label select, .form label textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; color: var(--text); }
.form input, .form select { height: 40px; font-size: 16px; }
.form input[type=color] { padding: 3px; width: 64px; }
.form textarea { height: auto; padding: 8px 10px; resize: vertical; font-size: 16px; }
.form input:disabled { opacity: .45; }
.form label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 500; align-self: end; height: 40px; }
.form label.check input { width: 18px; height: 18px; margin: 0; display: inline-block; }
.cols2, .cols3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cols3 { grid-template-columns: 1.300fr 1fr 1fr; }
.pickp { margin-top: 6px; }
.chip.tog { cursor: pointer; background: var(--surface); border: 1px solid var(--line); opacity: .7; font-family: inherit; height: 28px; }
.chip.tog i { filter: grayscale(1); opacity: .5; }
.chip.tog.on { opacity: 1; background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: var(--c); }
.chip.tog.on i { filter: none; opacity: 1; }
.copyrow { display: flex; gap: 6px; margin-top: 4px; }
.copyrow input { flex: 1; font-size: 13px; font-weight: 400; color: var(--text); }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab) + 18px); transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: #1c1b1a; color: #fff; font-size: 13.5px; font-weight: 550; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.toast.err { background: #b91c1c; }

@media print {
  .top, .toolbar, .strip, .palette, .toast { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .gh { position: static; }
}

/* ── week view, language switch, matrix highlight ── */
.grid.narrow { grid-template-columns: 46px repeat(var(--cols), minmax(132px, 1fr)); }
.g-head a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; }
.g-head a:hover b { text-decoration: underline; }
.g-head em { font-style: normal; font-size: 10.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-head.today b { color: var(--accent); }
.g-head.sel { box-shadow: inset 0 -2px var(--accent); }
.g-col.today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
.blk.fold { display: flex; align-items: center; justify-content: center; background: var(--surface2); border-left-color: var(--muted); color: var(--muted); text-decoration: none; font-size: 13px; }
.blk.fold:hover { background: var(--line); color: var(--text); }
.dayhead .range { font-weight: 500; color: var(--muted); font-size: 14px; margin-left: 6px; white-space: nowrap; }
.top .lang { margin: 0; padding: 2px; }
.top .lang button { padding: 4px 8px; font-size: 12px; font-weight: 650; }
.top .sync { margin-right: -6px; }
@media (max-width: 480px) { .top { gap: 8px; } .top .sync span { font-size: 11.5px; } }
.mx th.mx-p.me span { color: var(--accent); }
.mx-c.me { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mebtns { flex-wrap: wrap; }
.mx th.mx-p a { color: inherit; text-decoration: none; display: inline-block; }
.mx th.mx-p a:hover span { color: var(--accent); text-decoration: underline; }
