/* A-Group marketing calendar. Tokens from ../AGroup/DESIGN.md: holding black, Lavender Mist,
   each brand in its own colour, Mikado Yellow for focus only. */
@font-face { font-family: 'Montserrat'; font-weight: 100 900; font-display: swap; src: url(/fonts/montserrat-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Montserrat'; font-weight: 100 900; font-display: swap; src: url(/fonts/montserrat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Regular.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Medium.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Bold.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

:root {
  color-scheme: dark;
  --bg: #212121;
  --s1: #272727;
  --s2: #2e2e2e;
  --s3: #363636;
  --weekend: #292929;
  --line: rgb(233 234 239 / 0.1);
  --line-strong: rgb(233 234 239 / 0.18);
  --fg: #e9eaef;
  --muted: #a3a4a7;
  --dim: #85868a;
  --accent: #ffc107;
  --danger: #ff8a7a;
  --agroup: #e9eaef; --agroup-ink: #212121;
  --astay: #f05e49; --astay-ink: #212121;
  --aspace: #9d2a31; --aspace-ink: #ffffff;
  --amarket: #7033ff; --amarket-ink: #ffffff;
  --tint: var(--astay);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail: 18.75rem;
  --panel: 23.75rem;
  --font: 'Montserrat', 'Plex Arabic', ui-sans-serif, system-ui, sans-serif;
  font-size: 100%;
}
:root:lang(ar) { --font: 'Plex Arabic', 'Montserrat', ui-sans-serif, system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 0.375rem; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 400 0.875rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:lang(ar) body { font-size: 0.9375rem; line-height: 1.7; }
::selection { background: var(--fg); color: var(--bg); }
* { scrollbar-width: thin; scrollbar-color: #444 transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
bdi { unicode-bidi: isolate; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 0.9375rem; height: 0.9375rem; }
[dir='rtl'] .flip { transform: scaleX(-1); }
.next .i { transform: scaleX(-1); }
[dir='rtl'] .next .i { transform: none; }
[dir='rtl'] .prev .i { transform: scaleX(-1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
.nw { white-space: nowrap; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 2.25rem; padding: 0 1rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-weight: 500; white-space: nowrap;
  text-decoration: none; transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { background: var(--s2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { background: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger.is-armed { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-ghost { border-color: transparent; }
.icon-btn { width: 2.25rem; padding: 0; }
.seg { display: inline-flex; padding: 0.1875rem; border: 1px solid var(--line-strong); border-radius: 999px; }
.seg button, .seg label {
  position: relative; display: inline-flex; align-items: center; gap: 0.375rem; height: 1.75rem; padding: 0 0.875rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.seg button:hover, .seg label:hover { color: var(--fg); }
.seg [aria-pressed='true'], .seg label:has(input:checked) { background: var(--s3); color: var(--fg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

.field { display: grid; gap: 0.375rem; }
.field > span, .label { color: var(--muted); font-weight: 500; font-size: 0.8125rem; }
.input {
  width: 100%; height: 2.5rem; padding: 0 0.875rem; border: 1px solid var(--line-strong); border-radius: 0.625rem;
  background: var(--s1); transition: border-color 160ms var(--ease);
}
textarea.input { height: auto; min-height: 6.5rem; padding: 0.625rem 0.875rem; resize: vertical; line-height: 1.55; }
.input:hover { border-color: rgb(233 234 239 / 0.3); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input::placeholder { color: var(--dim); }
select.input { appearance: none; padding-inline-end: 2.25rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 1.125rem) 1.0625rem, calc(100% - 0.8125rem) 1.0625rem; }
[dir='rtl'] select.input { background-position: 0.8125rem 1.0625rem, 1.125rem 1.0625rem; }
input[type='date'].input, input[type='time'].input { font-variant-numeric: tabular-nums; }
::-webkit-calendar-picker-indicator { filter: invert(0.85); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 500; }
.check input { width: 1.125rem; height: 1.125rem; accent-color: var(--fg); margin: 0; }
.err { color: var(--danger); font-weight: 500; min-height: 1.4em; }

/* ---------- Status marks ---------- */
.mark { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mark.live { color: var(--fg); }
.m-fill { fill: currentColor; stroke: none; }
.m-knock { stroke: var(--knock, var(--bg)); stroke-width: 1.9; }
.mark.planned { stroke: var(--muted); }
.mark.skipped { stroke: var(--dim); stroke-width: 1.8; }
.mark.none { color: rgb(233 234 239 / 0.28); }

/* ---------- Login ---------- */
.login { position: relative; min-height: 100%; display: grid; align-items: center; overflow: hidden; padding: 2rem clamp(1.25rem, 6vw, 6rem); }
.login-mark { position: absolute; inset-inline-end: -6vw; top: 50%; translate: 0 -50%; width: min(52vw, 80vh); aspect-ratio: 737 / 667; fill: #2c2c2c; pointer-events: none;
  animation: write 1.1s var(--ease) both; }
@keyframes write { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.login form { position: relative; width: min(100%, 24rem); display: grid; gap: 1.125rem; }
.login .wordmark { width: 9.5rem; height: auto; display: block; margin-bottom: 1.5rem; }
.login h1 { font-size: 2.25rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
:lang(ar) .login h1 { letter-spacing: 0; line-height: 1.35; }
.login .lead { color: var(--muted); font-size: 1rem; margin-top: -0.5rem; max-width: 30ch; }
.login .btn { height: 2.75rem; margin-top: 0.25rem; }
.login .lang { position: absolute; top: 1.25rem; inset-inline-end: clamp(1.25rem, 6vw, 6rem); }

/* ---------- App shell ---------- */
.app {
  height: 100%; display: grid; grid-template-rows: 3.5rem minmax(0, 1fr); grid-template-columns: var(--rail) minmax(0, 1fr) 0;
  transition: grid-template-columns 260ms var(--ease);
}
.app.has-panel { grid-template-columns: var(--rail) minmax(0, 1fr) var(--panel); }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; padding: 0 1rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.625rem; width: calc(var(--rail) - 1rem); flex: none; text-decoration: none; font-weight: 500; }
.brand svg { width: 1.5rem; height: auto; fill: var(--fg); }
.brand b { font-weight: 700; }
.nav { display: flex; align-items: center; gap: 0.25rem; }
.month-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; margin-inline-start: 0.5rem; white-space: nowrap; }
:lang(ar) .month-title { letter-spacing: 0; }
.top .spacer { flex: 1; }
.avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--s2); font-weight: 700; display: grid; place-items: center; }
.menu {
  position: fixed; margin: 0; inset: auto; min-width: 14rem; padding: 0.375rem; border: 1px solid var(--line-strong); border-radius: 0.875rem;
  background: var(--s1); color: var(--fg); box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
}
.menu-head { padding: 0.5rem 0.75rem 0.625rem; border-bottom: 1px solid var(--line); margin-bottom: 0.375rem; }
.menu-head span { display: block; color: var(--muted); font-size: 0.8125rem; }
.menu > button, .menu > a, .menu .opt { display: flex; align-items: center; gap: 0.625rem; width: 100%; padding: 0.5rem 0.75rem; border: 0; border-radius: 0.5rem; background: none; text-align: start; text-decoration: none; }
.menu > button:hover, .menu > a:hover, .menu .opt:hover { background: var(--s2); }

/* ---------- Rail: the paper sheet ---------- */
.rail { grid-row: 2; display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); }
.rail-scroll { flex: 1; overflow-y: auto; padding: 0.75rem 0.5rem 1rem; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--cols, 5), 1.5rem); align-items: center; gap: 0 0.125rem; }
.rail-all { width: 100%; height: 2.5rem; padding: 0 0.75rem; border: 0; border-radius: 0.625rem; background: none; text-align: start; font-weight: 700; display: flex; align-items: center; justify-content: space-between; text-decoration: none; }
.rail-head { padding: 1rem 0.75rem 0.375rem; color: var(--muted); font-size: 0.6875rem; font-weight: 600; position: sticky; top: -0.75rem; background: var(--bg); z-index: 1; }
.rail-head abbr { text-decoration: none; text-align: center; }
.group h2 { display: flex; align-items: center; gap: 0.5rem; padding: 0.875rem 0.75rem 0.375rem; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.group h2 .b-img, .group h2 .b-ic { width: 1.25rem; height: 1.25rem; border-radius: 0.3125rem; }
.b-ic { display: inline-grid; place-items: center; flex: none; background: var(--b); }
.b-ic svg { width: 66%; height: auto; fill: var(--bi); }
.add-in-group { display: flex; align-items: center; gap: 0.375rem; width: 100%; padding: 0.375rem 0.75rem; border: 0; border-radius: 0.625rem; background: none; color: var(--muted); font-weight: 500; text-align: start; }
.add-in-group:hover { background: var(--s1); color: var(--fg); }
.page-row { width: 100%; min-height: 2.375rem; padding: 0.25rem 0.75rem; border-radius: 0.625rem; text-decoration: none; transition: background-color 160ms var(--ease); }
.page-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.page-row .mark { justify-self: center; }
.page-row:hover, .rail-all:hover { background: var(--s1); }
.page-row[aria-current='page'], .rail-all[aria-current='page'] { background: var(--s2); }
.page-row[aria-current='page'] { box-shadow: inset 0 0 0 1px var(--tint); }
.page-row[aria-current='page'] .name { font-weight: 700; }
.rail-foot { border-top: 1px solid var(--line); padding: 0.75rem 1.25rem 1rem; display: grid; gap: 0.75rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.875rem; color: var(--muted); font-size: 0.75rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.3125rem; }
.legend .mark { width: 0.9375rem; height: 0.9375rem; }
.add-page { display: grid; gap: 0.5rem; }
.add-page .input { height: 2.25rem; }
.add-page div { display: flex; gap: 0.5rem; }

/* ---------- Main ---------- */
.main { grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.head { padding: 1.125rem 1.5rem 1rem; display: grid; gap: 0.875rem; }
.head-title { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.head-title .b-img, .head-title .b-ic { width: 2.5rem; height: 2.5rem; border-radius: 0.625rem; flex: none; }
.head h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
:lang(ar) .head h1 { letter-spacing: 0; line-height: 1.35; }
.head .sub { color: var(--muted); }
.head-title .btn { margin-inline-start: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.125rem; padding: 0 0.875rem 0 0.625rem; border: 1px solid var(--line-strong);
  border-radius: 999px; background: transparent; font-weight: 500; transition: background-color 160ms var(--ease);
}
[dir='rtl'] .chip { padding: 0 0.625rem 0 0.875rem; }
.chip:hover { background: var(--s2); }
.chip .st { color: var(--muted); font-weight: 400; }
.chip-link { display: inline-flex; align-items: center; justify-content: center; width: 2.125rem; height: 2.125rem; margin-inline-start: -0.375rem; border-radius: 50%; color: var(--muted); }
.chip-link:hover { color: var(--fg); background: var(--s2); }
.head-edit { display: grid; gap: 0.75rem; max-width: 40rem; grid-template-columns: 1fr 12rem; }
.head-edit .full { grid-column: 1 / -1; }
.head-edit .actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; }
.head-edit .actions .btn-danger { margin-inline-start: auto; }
.status-pop { width: 17rem; padding: 0.5rem; }
.status-pop .opt { justify-content: flex-start; }
.status-pop .opt[aria-checked='true'] { background: var(--s2); }
.status-pop .opt[aria-checked='true']::after { content: ''; margin-inline-start: auto; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--fg); }
.status-pop form { display: grid; gap: 0.5rem; padding: 0.625rem 0.5rem 0.25rem; border-top: 1px solid var(--line); margin-top: 0.375rem; }
.status-pop .input { height: 2.25rem; }

/* ---------- Calendar ---------- */
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 1.5rem 1.25rem; }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); color: var(--muted); font-size: 0.75rem; font-weight: 600; padding-bottom: 0.5rem; }
.dow span { padding-inline-start: 0.625rem; }
.month { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(min-content, auto);
  border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); overflow-y: auto; }
.day { position: relative; min-width: 0; min-height: 6.25rem; padding: 0.375rem 0.375rem 0.5rem; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.1875rem; }
.day.weekend { background: var(--weekend); }
.day.out .num { color: var(--dim); }
.day-add { position: absolute; inset: 0; border: 0; background: transparent; border-radius: 0; z-index: 0; transition: background-color 160ms var(--ease); }
.day-add:hover { background: rgb(233 234 239 / 0.04); }
.day-add:focus-visible { outline-offset: -2px; }
.num { position: relative; z-index: 1; align-self: flex-start; min-width: 1.75rem; height: 1.625rem; padding: 0 0.3125rem; display: inline-grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.num svg { position: absolute; inset-inline-start: 0; bottom: -0.125rem; width: 100%; height: 0.4375rem; fill: var(--tint); transition: fill 200ms var(--ease); }
[dir='rtl'] .num svg { transform: scaleX(-1); }
.draw .today .num svg, .draw .week-head .num svg { animation: draw 700ms 150ms var(--ease) both; }
@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.today .num { color: var(--fg); font-weight: 700; }
.post {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 0.0625rem;
  flex: none; width: 100%; min-height: 1.5rem; padding: 0.1875rem 0.4375rem;
  border: 1px solid var(--b); border-radius: 0.4375rem; background: var(--b); color: var(--bi); font-size: 0.75rem; font-weight: 600; line-height: 1.3; text-align: start;
  transition: filter 160ms var(--ease), transform 160ms var(--ease);
}
:lang(ar) .post { font-size: 0.8125rem; }
.post:hover { filter: brightness(1.08); }
.post:active { transform: scale(0.98); }
/* Icon and time stay together on line one; the title gets its own two lines and keeps its opening words in either script. */
.post .when { display: flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.post .t { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.85; }
.post .ttl { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; max-width: 100%; text-align: start; }

.post .i { width: 0.8125rem; height: 0.8125rem; flex: none; stroke-width: 2; }
.post.done { background: transparent; color: var(--fg); }
.post.done .t { opacity: 1; color: var(--muted); }
.post.done .done-i { color: var(--b); }
/* .b-<id> { --b, --bi, --bt } come from app.js (brands are data). */
.post.done .done-i { color: var(--bt); }
.more { position: relative; z-index: 1; align-self: flex-start; border: 0; background: none; padding: 0.0625rem 0.4375rem; border-radius: 0.375rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.more:hover { color: var(--fg); background: var(--s2); }
.dots { display: none; }
.empty-note { color: var(--muted); padding: 0 0 0.75rem; }

/* Week: hour rows × day columns; posts are moments, so they sit inside their hour. */
.week { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line); }
.week-head, .week-row { display: grid; grid-template-columns: 3.5rem repeat(7, minmax(0, 1fr)); }
.week-head { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); }
.week-head > div { padding: 0.5rem 0.625rem; display: flex; align-items: baseline; gap: 0.375rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.week-head .num { font-size: 1.125rem; color: var(--fg); }
.week-row > .hr { color: var(--dim); font-size: 0.6875rem; font-variant-numeric: tabular-nums; padding: 0.25rem 0.5rem 0; text-align: end; }
.slot { position: relative; min-height: 3rem; padding: 0.25rem; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.1875rem; }
.slot.weekend { background: var(--weekend); }
.slot.now { box-shadow: inset 0 2px 0 var(--tint); }

/* ---------- Composer panel ---------- */
.panel { position: relative; grid-row: 2; grid-column: 3; min-width: 0; overflow: hidden; background: var(--s1); }
.has-panel .panel { border-inline-start: 1px solid var(--line); }
.panel-inner { width: var(--panel); height: 100%; display: flex; flex-direction: column; opacity: 0; transition: opacity 200ms var(--ease); }
.has-panel .panel-inner { opacity: 1; }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem 0.5rem; }
.panel h2 { font-size: 1.125rem; font-weight: 700; }
.panel form { flex: 1; overflow-y: auto; padding: 0.5rem 1.25rem 1.25rem; display: grid; align-content: start; gap: 1rem; }
.panel .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.plats { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.plat { position: relative; display: inline-flex; align-items: center; gap: 0.375rem; height: 2rem; padding: 0 0.75rem 0 0.5rem; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
[dir='rtl'] .plat { padding: 0 0.5rem 0 0.75rem; }
.plat input { position: absolute; opacity: 0; pointer-events: none; }
.plat .mark { width: 0.9375rem; height: 0.9375rem; }
.plat:has(input:checked) { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.plat:has(input:checked) .mark.live { color: var(--bg); --knock: var(--fg); }
.plat:has(input:checked) .mark:not(.live) { stroke: var(--bg); color: var(--bg); }
.plat:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel .seg { width: 100%; }
.panel .seg label { flex: 1; justify-content: center; }
.panel footer { display: flex; gap: 0.5rem; align-items: center; padding-top: 0.25rem; }
.panel footer .btn-danger { margin-inline-start: auto; }
.panel .meta { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Settings ---------- */
.settings { flex: 1; overflow-y: auto; padding: 1.5rem 1.5rem 3rem; }
.settings section { max-width: 46rem; padding: 1.5rem 0; border-top: 1px solid var(--line); }
.settings section:first-of-type { border-top: 0; padding-top: 0.5rem; }
.settings h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.25rem; }
.settings .hint { color: var(--muted); margin-bottom: 1rem; max-width: 60ch; }
.list { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.list-row .who b { font-weight: 600; }
.list-row .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
.list-row .who bdi { color: var(--muted); }
.team .list-row .acts { display: grid; grid-template-columns: 8rem 11rem auto 6.5rem; }
.list-row .acts { display: flex; gap: 0.375rem; align-items: center; }
.list-row .input { height: 2.25rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-top: 1rem; }
.inline-form .field { flex: 1 1 10rem; }
.inline-form .input { height: 2.25rem; }
.brand-edit { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.brand-edit .b-img, .brand-edit .b-ic { width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; flex: none; }
.swatch { width: 2.25rem; height: 2.25rem; flex: none; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: none; cursor: pointer; }
.swatch::-webkit-color-swatch-wrapper { padding: 0.1875rem; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch::-moz-color-swatch { border: 0; border-radius: 50%; }
.swatch-field { flex: none !important; }
.tag { display: inline-block; padding: 0.0625rem 0.5rem; border-radius: 0.5rem; background: var(--s2); color: var(--muted); font-size: 0.75rem; font-weight: 600; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 1.25rem; left: 50%; translate: -50% 1rem; padding: 0.625rem 1.125rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 600;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4); opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease), translate 200ms var(--ease); z-index: 10; }
.toast.on { opacity: 1; translate: -50% 0; }

/* ---------- Narrower screens ---------- */
@media (max-width: 75rem) {
  :root { --rail: 16rem; --panel: 21rem; }
  .brand { width: auto; }
}
@media (max-width: 56rem) {
  .app, .app.has-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); transition: none; }
  .top { flex-wrap: wrap; height: auto; padding: 0.625rem 1rem; gap: 0.5rem; }
  .brand b, .brand span { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .month-title { font-size: 1.0625rem; }
  .top .hide-sm { display: none; }
  .rail { grid-row: 2; border: 0; border-bottom: 1px solid var(--line); }
  .rail-scroll { display: flex; gap: 0.375rem; overflow-x: auto; overflow-y: hidden; padding: 0.5rem 1rem; }
  .rail-head, .group h2, .page-row .mark, .rail-foot, .add-in-group { display: none; }
  .group { display: contents; }
  .rail-all, .page-row { display: inline-flex; width: auto; flex: none; height: 2.25rem; min-height: 0; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 0.875rem; }
  .main { grid-row: 3; }
  .head { padding: 1rem; }
  .head h1 { font-size: 1.375rem; }
  .cal { padding: 0 0.5rem 1rem; }
  .main { overflow-y: auto; }
  .cal, .month { flex: none; overflow: visible; }
  .day { min-height: 4rem; }
  .day .post, .day .more { display: none; }
  .dots { display: flex; flex-wrap: wrap; gap: 0.1875rem; position: relative; z-index: 1; pointer-events: none; padding-inline-start: 0.3125rem; }
  .dots i { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--b); }
  .day.picked { box-shadow: inset 0 0 0 2px var(--tint); }
  .day-list { display: grid; gap: 0.375rem; padding: 1rem 0.5rem 0; }
  .day-list h3 { font-size: 1rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
  .day-list .post { min-height: 2.5rem; font-size: 0.875rem; padding: 0.375rem 0.75rem; }
  .panel { position: fixed; inset: 0; z-index: 5; border: 0; display: none; }
  .has-panel .panel { display: block; }
  .panel-inner { width: 100%; opacity: 1; }
  .week-head, .week-row { grid-template-columns: 2.75rem repeat(7, minmax(2.75rem, 1fr)); }
  .week .post .ttl, .week .post .t { display: none; }
  .head-edit { grid-template-columns: 1fr; }
  .team .list-row .acts { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 56.01rem) { .day-list { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}
