:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f8fafb;
  --surface-hover: #eef2f6;
  --ink: #17202a;
  --muted: #6b7785;
  --subtle: #97a1ac;
  --line: #dde3e9;
  --line-strong: #cbd3dc;
  --brand: #2667d8;
  --brand-strong: #1755bd;
  --brand-soft: #eaf1fd;
  --success: #138a66;
  --danger: #c83d4d;
  --warning: #b7791f;
  --shadow: 0 12px 34px rgba(22, 34, 49, .10);
  --shadow-soft: 0 3px 14px rgba(22, 34, 49, .08);
  --radius: 8px;
  --column-width: 216px;
  --hour-height: 64px;
  --timeline-height: 832px;
  --appointment-font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --appointment-font-size: 10px;
  --badge-font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --badge-font-size: 10px;
  --member-name-font-size: 11px;
  --member-avatar-size: 30px;
  --column-color-intensity: 8%;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.environment-banner {
  background: #9a3412;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  left: 50%;
  letter-spacing: .08em;
  padding: 4px 14px;
  position: fixed;
  text-transform: uppercase;
  top: 0;
  transform: translateX(-50%);
  z-index: 1000;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11161d;
  --surface: #181f28;
  --surface-raised: #202934;
  --surface-muted: #151b23;
  --surface-hover: #26313d;
  --ink: #edf2f7;
  --muted: #a8b3c0;
  --subtle: #778391;
  --line: #303b47;
  --line-strong: #42505e;
  --brand: #6d9ff5;
  --brand-strong: #8bb3f7;
  --brand-soft: #1d3151;
  --success: #42c59b;
  --danger: #f07886;
  --warning: #e2ad50;
  --shadow: 0 18px 40px rgba(0, 0, 0, .36);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, .26);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { outline-color: var(--brand); }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
[hidden] { display: none !important; }

.timeline-board, .agenda-list, .month-grid, .badge-palette, .week-shortcuts {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.timeline-board input, .timeline-board textarea {
  -webkit-user-select: text;
  user-select: text;
}
.timeline-board select {
  -webkit-user-select: auto;
  user-select: auto;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 24px; line-height: 1.2; margin-bottom: 0; }
h3 { font-size: 16px; margin-bottom: 4px; }
p { color: var(--muted); }
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; margin-bottom: 7px; text-transform: uppercase; }
.optional { color: var(--subtle); font-size: 12px; font-weight: 500; }

.primary-button, .secondary-button, .danger-button, .icon-button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.primary-button { background: var(--brand); border: 1px solid var(--brand); color: #fff; font-weight: 700; }
.primary-button:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.secondary-button { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-weight: 650; }
.secondary-button:hover, .icon-button:hover { background: var(--surface-hover); }
.danger-button { background: transparent; border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); font-weight: 700; }
.danger-button:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.icon-button { background: var(--surface); border: 1px solid var(--line); height: 38px; min-width: 38px; padding: 0 9px; }
.compact { min-height: 34px; padding: 0 11px; }
.wide-button { width: 100%; }
.button-pair { display: flex; }
.button-pair .icon-button { border-radius: 0; }
.button-pair .icon-button:first-child { border-radius: 7px 0 0 7px; }
.button-pair .icon-button:last-child { border-left: 0; border-radius: 0 7px 7px 0; }

label { color: var(--muted); display: grid; font-size: 12px; font-weight: 700; gap: 7px; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
input[type="color"] { padding: 4px; }
input[type="range"] { accent-color: var(--brand); background: transparent; border: 0; box-shadow: none; min-height: 24px; padding: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); min-height: auto; width: auto; }

.login-shell { background: var(--surface); display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(380px, .85fr); min-height: 100vh; }
.login-brand { background: #182a45; color: #fff; display: grid; grid-template-columns: auto 1fr; overflow: hidden; padding: 58px; position: relative; }
.login-brand::before { background: radial-gradient(circle at center, rgba(87, 143, 240, .34), transparent 68%); content: ""; height: 700px; position: absolute; right: -260px; top: -230px; width: 700px; }
.brand-mark { align-items: center; background: var(--brand); border-radius: 7px; color: #fff; display: inline-flex; font-size: 13px; font-weight: 850; height: 38px; justify-content: center; width: 38px; }
.brand-mark-large { background: #fff; color: #1d4f9f; height: 48px; margin-right: 18px; width: 48px; }
.login-brand h1 { font-size: clamp(42px, 5vw, 72px); font-weight: 780; line-height: .98; margin-top: 52px; position: relative; }
.login-brand .eyebrow { color: #9fc1fb; margin-top: 7px; position: absolute; }
.login-preview { bottom: 54px; left: 58px; position: absolute; right: 58px; }
.preview-day { border-bottom: 1px solid rgba(255,255,255,.2); color: #afbed0; font-size: 11px; font-weight: 800; letter-spacing: .1em; padding-bottom: 12px; }
.preview-columns { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); height: 150px; padding-top: 12px; }
.preview-columns span { background: linear-gradient(to bottom, rgba(255,255,255,.07), rgba(255,255,255,.02)); border-left: 2px solid var(--tone); border-radius: 3px; position: relative; }
.preview-columns span::after { background: var(--tone); border-radius: 3px; content: ""; height: 34px; left: 8px; opacity: .85; position: absolute; right: 8px; top: calc(18px + var(--i, 0) * 12px); }
.preview-columns span:nth-child(2)::after { top: 60px; }
.preview-columns span:nth-child(3)::after { top: 38px; }
.preview-columns span:nth-child(4)::after { top: 78px; }
.login-panel { align-content: center; display: grid; gap: 18px; justify-self: center; max-width: 420px; padding: 48px; width: 100%; }
.login-copy { margin-bottom: 10px; }
.login-copy h2 { font-size: 30px; }
.form-error { color: var(--danger); font-size: 13px; margin: -4px 0 0; min-height: 18px; }
.account-form-note { background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 4px; color: var(--muted); font-size: 11px; margin: 0; padding: 9px 10px; }
.security-note { color: var(--subtle); font-size: 12px; margin: 2px 0 0; text-align: center; }
.mobile-brand { align-items: center; display: none; font-weight: 800; gap: 10px; }

.app-shell { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 100vh; }
.side-rail { align-items: center; background: #17202b; color: #dbe5f0; display: flex; flex-direction: column; height: 100vh; padding: 18px 10px; position: sticky; top: 0; z-index: 80; }
.side-rail .brand-mark { margin-bottom: 30px; }
.side-rail nav { display: grid; gap: 8px; width: 100%; }
.rail-button { align-items: center; background: transparent; border: 0; border-radius: 7px; color: #8fa0b3; display: flex; flex-direction: column; font-size: 20px; gap: 3px; min-height: 54px; padding: 7px 4px; }
.rail-button small { font-size: 9px; font-weight: 700; }
.rail-button:hover { background: #222e3b; color: #fff; }
.rail-button.active { background: #253b5a; color: #9ec1ff; }
.rail-footer { margin-top: auto; }
.avatar-button { background: #dbe8fb; border: 0; border-radius: 50%; color: #1e4f9d; font-size: 11px; font-weight: 850; height: 36px; width: 36px; }
.workspace { min-width: 0; }
.topbar { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; height: 68px; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 70; }
.topbar-title { align-items: center; display: flex; gap: 14px; }
.topbar-title h1 { font-size: 17px; margin: 0; }
.sync-state { align-items: center; color: var(--muted); display: inline-flex; font-size: 11px; gap: 5px; }
.sync-state i { background: var(--success); border-radius: 50%; height: 6px; width: 6px; }
.topbar-actions { align-items: center; display: flex; gap: 9px; }
.screen { padding: 20px 24px 28px; }

.planning-toolbar { align-items: center; display: flex; gap: 20px; justify-content: space-between; }
.date-navigation, .view-controls { align-items: center; display: flex; gap: 10px; }
.view-controls { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.badge-palette { align-items: center; display: flex; flex: 1 1 390px; gap: 6px; justify-content: flex-end; margin-right: 12px; min-width: 0; }
.badge-palette-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.badge-palette-items { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 620px; overflow: visible; scrollbar-width: none; }
.badge-palette-items::-webkit-scrollbar { display: none; }
.badge-palette-chip { align-items: center; background: color-mix(in srgb, var(--badge-color) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--badge-color) 42%, var(--line)); border-radius: 12px; color: color-mix(in srgb, var(--badge-color) 82%, var(--ink)); display: inline-flex; flex: 0 0 auto; font-family: var(--badge-font-family); font-size: max(8px, calc(var(--badge-font-size) - 1px)); font-weight: 800; gap: 4px; height: 25px; padding: 0 8px; }
.badge-palette-chip span { font-size: 10px; }
.badge-palette-chip:hover { background: color-mix(in srgb, var(--badge-color) 18%, var(--surface)); }
.badge-palette-chip.dragging { opacity: .48; }
.creation-mode-control { align-items: center; display: flex; flex: 0 0 auto; gap: 7px; margin-left: 6px; }
.creation-mode-control > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.compact-segmented button { min-height: 27px; padding-inline: 9px; }
.date-picker-label { background: transparent; color: var(--ink); display: block; font-size: 17px; font-weight: 760; min-width: 190px; padding: 5px 10px; position: relative; }
.date-picker-label input { cursor: pointer; inset: 0; opacity: 0; position: absolute; }
.segmented { background: var(--surface-hover); border: 1px solid var(--line); border-radius: 7px; display: inline-flex; padding: 3px; }
.segmented button { background: transparent; border: 0; border-radius: 5px; color: var(--muted); font-size: 12px; font-weight: 700; min-height: 31px; padding: 0 13px; }
.segmented button.active { background: var(--surface); box-shadow: 0 1px 4px rgba(20, 30, 45, .11); color: var(--ink); }
.zoom-control { align-items: center; display: flex; gap: 6px; grid-auto-flow: column; min-width: 136px; }
.zoom-control input { width: 92px; }
.filter-row { align-items: center; display: flex; gap: 16px; justify-content: space-between; margin: 16px 0 12px; min-height: 36px; }
.member-filters { display: flex; gap: 7px; max-width: calc(100% - 280px); overflow-x: auto; scrollbar-width: none; }
.member-filters::-webkit-scrollbar { display: none; }
.member-filter { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); display: flex; flex: 0 0 auto; font-size: 11px; font-weight: 700; gap: 6px; min-height: 31px; padding: 0 9px; }
.member-filter i { background: var(--member-color); border-radius: 50%; height: 7px; width: 7px; }
.member-filter.active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); color: var(--brand); }
.search-box { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; display: flex; gap: 6px; padding: 0 9px; width: 260px; }
.search-box input { border: 0; box-shadow: none; font-size: 12px; min-height: 34px; padding: 5px; }

.timeline-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); height: calc(100vh - 208px); min-height: 500px; overflow: hidden; position: relative; }
.timeline-scroll { height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--line-strong) transparent; }
.timeline-frame.has-week-shortcuts .timeline-scroll { height: calc(100% - 62px); }
.timeline-board { display: flex; min-height: 100%; min-width: max-content; position: relative; }
.timeline-end-spacer { flex: 0 0 calc(100vw - 170px); height: 1px; min-width: 300px; pointer-events: none; }
.time-ruler { background: var(--surface); border-right: 1px solid var(--line-strong); flex: 0 0 58px; left: 0; position: sticky; width: 58px; z-index: 45; }
.time-ruler-spacer { background: var(--surface); border-bottom: 1px solid var(--line); height: 112px; position: sticky; top: 0; z-index: 50; }
.time-ruler-body { height: var(--timeline-height); position: relative; }
.time-label { color: var(--subtle); font-size: 10px; position: absolute; right: 9px; transform: translateY(-7px); }
.time-label::after { background: var(--line); content: ""; height: 1px; left: calc(100% + 9px); position: absolute; top: 7px; width: 9px; }
.day-group { display: grid; grid-template-columns: repeat(var(--member-count), var(--column-width)) 42px; grid-template-rows: 48px 64px var(--timeline-height); position: relative; }
.day-group + .day-group { border-left: 2px solid var(--line-strong); }
.day-banner { align-items: center; background: var(--surface-muted); border-bottom: 1px solid var(--line); display: flex; gap: 7px; grid-column: 1 / -1; justify-content: space-between; left: auto; padding: 0 18px 0 12px; position: sticky; top: 0; z-index: 42; }
.day-banner strong { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; }
.day-banner span { color: var(--muted); font-size: 10px; }
.day-banner-meta { align-items: center; display: flex; gap: 8px; min-width: 0; }
.day-banner-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-width-value { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); flex: 0 0 auto; font-size: 9px; font-weight: 800; min-width: 78px; padding: 3px 7px; text-align: center; }
.day-group.today .day-banner { background: var(--brand-soft); color: var(--brand); }
.day-group.today .day-banner::before { background: var(--brand); bottom: -1px; content: ""; height: 2px; left: 0; position: absolute; right: 0; }
.day-width-handle { bottom: 0; cursor: ew-resize; position: absolute; right: -4px; top: 0; width: 9px; z-index: 3; }
.day-width-handle::after { background: color-mix(in srgb, var(--brand) 45%, transparent); bottom: 10px; content: ""; opacity: 0; position: absolute; right: 4px; top: 10px; transition: opacity .15s; width: 2px; }
.day-banner:hover .day-width-handle::after { opacity: 1; }
.member-header { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); container-type: inline-size; display: flex; gap: 8px; min-width: 0; padding: 8px 12px 8px 10px; position: sticky; top: 48px; z-index: 41; }
.member-header.colored-header { background: var(--member-header-color); color: #fff; }
.member-header.colored-header .member-heading span { color: rgba(255, 255, 255, .82); }
.member-header.colored-header .member-avatar { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); color: #fff; }
.member-width-handle { bottom: 0; cursor: ew-resize; position: absolute; right: -4px; top: 0; width: 9px; z-index: 4; }
.member-width-handle::after { background: color-mix(in srgb, var(--brand) 55%, transparent); bottom: 10px; content: ""; opacity: 0; position: absolute; right: 4px; top: 10px; transition: opacity .15s; width: 2px; }
.member-header:hover .member-width-handle::after { opacity: 1; }
.resizing-planning-width, .resizing-planning-width * { cursor: ew-resize !important; user-select: none !important; }
.member-avatar { align-items: center; background: color-mix(in srgb, var(--member-color) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--member-color) 35%, var(--line)); border-radius: 50%; color: var(--member-color); display: flex; flex: 0 0 var(--member-avatar-size); font-size: max(8px, calc(var(--member-avatar-size) * .34)); font-weight: 850; height: var(--member-avatar-size); justify-content: center; }
.member-heading { min-width: 0; }
.member-heading strong, .member-heading span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-heading strong { font-size: var(--member-name-font-size); }
.member-heading span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.member-column { background-color: var(--surface); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) / 4 - 1px), color-mix(in srgb, var(--line) 50%, transparent) calc(var(--hour-height) / 4 - 1px), color-mix(in srgb, var(--line) 50%, transparent) calc(var(--hour-height) / 4)), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) - 1px), var(--line) calc(var(--hour-height) - 1px), var(--line) var(--hour-height)); border-right: 1px solid var(--line); height: var(--timeline-height); overflow: hidden; position: relative; }
.member-column.column-style-soft { background-color: color-mix(in srgb, var(--member-color) var(--column-color-intensity), var(--surface)); }
.member-column.column-style-solid { background-color: color-mix(in srgb, var(--member-color) var(--column-color-intensity), var(--surface)); box-shadow: inset 3px 0 var(--member-header-color); }
.member-column.column-style-gradient { background-color: var(--surface); background-image: linear-gradient(90deg, color-mix(in srgb, var(--member-color) var(--column-color-intensity), transparent), transparent 78%), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) / 4 - 1px), color-mix(in srgb, var(--line) 50%, transparent) calc(var(--hour-height) / 4 - 1px), color-mix(in srgb, var(--line) 50%, transparent) calc(var(--hour-height) / 4)), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) - 1px), var(--line) calc(var(--hour-height) - 1px), var(--line) var(--hour-height)); }
.member-column.column-style-outline { background-color: var(--surface); box-shadow: inset 3px 0 var(--member-header-color); }
.member-column.column-style-none { background-color: var(--surface); }
.member-column.editable { cursor: crosshair; }
.timeline-frame.quick-mode .member-column.editable { cursor: cell; }
.member-column.selecting { cursor: ns-resize; touch-action: none; }
.member-column.badge-drop-target { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brand) 58%, transparent); }
.member-column.badge-stretch-target { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brand) 72%, transparent); }
.slot-target-selection { background: color-mix(in srgb, var(--brand) 18%, transparent); border: 2px solid var(--brand); border-radius: 4px; left: 3px; pointer-events: none; position: absolute; right: 3px; z-index: 28; }
.member-column.unavailable { background-color: var(--surface-muted); }
.presence-band { background: color-mix(in srgb, var(--presence-color) 5%, transparent); border-left: 2px solid var(--presence-accent-color); left: 0; pointer-events: none; position: absolute; right: 0; }
.presence-band-label { color: var(--subtle); font-size: 8px; font-weight: 750; left: 7px; overflow: hidden; position: absolute; right: 6px; text-overflow: ellipsis; top: 4px; white-space: nowrap; }
.presence-fixed-label { color: color-mix(in srgb, var(--member-color) 72%, var(--ink)); font-size: 8px; font-weight: 800; height: 18px; left: 7px; line-height: 18px; overflow: hidden; pointer-events: none; position: absolute; right: 6px; text-overflow: ellipsis; transform: translateY(2px); white-space: nowrap; z-index: 3; }
.appointment-card { background: var(--appointment-color); border: 0; border-left: 3px solid color-mix(in srgb, var(--appointment-color) 70%, #000); border-radius: 5px; box-shadow: 0 2px 6px rgba(20, 30, 45, .14); color: #fff; cursor: grab; font-family: var(--appointment-font-family); left: 4px; min-height: 24px; overflow: hidden; padding: 5px 7px; position: absolute; right: 4px; text-align: left; touch-action: none; z-index: 5; }
.appointment-card:hover { box-shadow: 0 6px 16px rgba(20, 30, 45, .22); filter: saturate(1.07); z-index: 8; }
.selected-planning-item { outline: 3px solid color-mix(in srgb, var(--brand) 75%, #fff); outline-offset: 2px; z-index: 32 !important; }
.member-column.has-expanded-appointment { overflow: visible; z-index: 31; }
.appointment-card.appointment-expanded { height: auto !important; min-height: var(--appointment-collapsed-height); overflow: visible; z-index: 33 !important; }
.appointment-card:active { cursor: grabbing; }
.appointment-card.dragging { opacity: .72; z-index: 20; }
.appointment-card.cancelled { filter: grayscale(.7); opacity: .58; text-decoration: line-through; }
.appointment-card .appointment-time { display: block; font-size: max(7px, calc(var(--appointment-font-size) - 1px)); font-weight: 800; line-height: 1.1; }
.appointment-title-row { align-items: baseline; display: flex; margin-top: 3px; min-width: 0; }
.appointment-card .appointment-title { display: block; flex: 0 1 auto; font-size: var(--appointment-font-size); font-weight: 750; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appointment-more-dots { display: none; flex: 0 0 auto; font-size: 6px; letter-spacing: 1px; margin-left: 3px; }
.appointment-card.has-hidden-content:not(.appointment-expanded) .appointment-more-dots { display: inline; }
.appointment-card.appointment-expanded .appointment-title-row { display: block; }
.appointment-card.appointment-expanded .appointment-title,
.appointment-card.appointment-expanded .appointment-meta { overflow: visible; text-overflow: clip; white-space: normal; }
.appointment-card .appointment-meta { display: block; font-size: max(7px, calc(var(--appointment-font-size) - 2px)); line-height: 1.2; margin-top: 3px; opacity: .86; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planning-badge { background: color-mix(in srgb, var(--badge-color) 84%, #fff); border: 1px solid color-mix(in srgb, var(--badge-color) 70%, #18202b); border-radius: 3px; box-shadow: 0 1px 4px rgba(20, 30, 45, .15); color: #fff; font-family: var(--badge-font-family); left: 3px; min-height: 3px; overflow: hidden; padding: 0; position: absolute; right: 3px; touch-action: none; z-index: 9; }
.planning-badge.editable-badge { cursor: grab; }
.planning-badge.multi-member-badge { border-radius: 0; }
.planning-badge.multi-member-badge.first-member-badge { border-radius: 3px 0 0 3px; right: -1px; }
.planning-badge.multi-member-badge.last-member-badge { border-radius: 0 3px 3px 0; left: -1px; }
.planning-badge.multi-member-badge:not(.first-member-badge):not(.last-member-badge) { left: -1px; right: -1px; }
.planning-badge.dragging { cursor: grabbing; opacity: .68; z-index: 35; }
.planning-badge-content { align-items: center; display: flex; height: 100%; justify-content: center; min-height: 0; overflow: hidden; text-align: center; width: 100%; }
.planning-badge-content b { flex: 0 0 auto; }
.planning-badge-content strong { overflow: hidden; text-overflow: ellipsis; }
.planning-badge.slot-badge .planning-badge-content { font-size: max(7px, calc(var(--badge-font-size) - 2px)); gap: 3px; justify-content: flex-start; line-height: 1; padding: 0 4px; white-space: nowrap; }
.planning-badge.range-badge { background: color-mix(in srgb, var(--badge-color) 60%, var(--surface)); border-width: 2px; color: color-mix(in srgb, var(--badge-color) 76%, var(--ink)); opacity: .9; z-index: 4; }
.planning-badge.range-badge .planning-badge-content { flex-direction: column; font-size: var(--badge-font-size); gap: 7px; padding: 10px; }
.planning-badge.range-badge .planning-badge-content b { font-size: calc(var(--badge-font-size) + 5px); }
.badge-resize-handle { cursor: ns-resize; height: 7px; left: 0; position: absolute; right: 0; z-index: 3; }
.badge-resize-handle.top { top: 0; }
.badge-resize-handle.bottom { bottom: 0; }
.badge-stretch-handle { bottom: 0; cursor: ew-resize; position: absolute; top: 0; width: 9px; z-index: 5; }
.badge-stretch-handle.left { left: 0; }
.badge-stretch-handle.right { right: 0; }
.badge-stretch-handle::after { background: rgba(255, 255, 255, .86); bottom: 3px; content: ""; opacity: .7; position: absolute; top: 3px; width: 2px; }
.badge-stretch-handle.left::after { left: 2px; }
.badge-stretch-handle.right::after { right: 2px; }
.slot-selection { background: color-mix(in srgb, var(--brand) 19%, transparent); border: 1px dashed color-mix(in srgb, var(--brand) 78%, var(--surface)); border-radius: 5px; left: 3px; pointer-events: none; position: absolute; right: 3px; z-index: 18; }
.slot-selection-label { background: var(--brand); border-radius: 3px; color: #fff; font-size: 8px; font-weight: 800; left: 5px; padding: 2px 5px; position: absolute; top: 4px; white-space: nowrap; }
.quick-draft { background: color-mix(in srgb, var(--draft-color) 25%, transparent); border: 2px solid var(--draft-color); border-radius: 4px; left: 3px; min-height: 3px; overflow: visible; position: absolute; right: 3px; z-index: 30; }
.quick-draft.saving { opacity: .65; pointer-events: none; }
.quick-draft-editor { background: var(--surface-raised); border: 1px solid color-mix(in srgb, var(--draft-color) 55%, var(--line)); border-top: 3px solid var(--draft-color); border-radius: 8px; box-shadow: 0 12px 30px rgba(20, 30, 45, .28); color: var(--ink); display: grid; gap: 7px; left: -2px; padding: 9px; position: absolute; right: -2px; top: calc(100% + 6px); z-index: 2; }
.quick-draft.opens-up .quick-draft-editor { bottom: calc(100% + 6px); top: auto; }
.quick-draft-head { align-items: center; display: flex; gap: 7px; justify-content: space-between; min-width: 0; }
.quick-draft-head > span:first-child { align-items: baseline; display: flex; gap: 7px; min-width: 0; }
.quick-draft-head strong { color: var(--ink); font-size: 11px; white-space: nowrap; }
.quick-draft-head small { color: var(--muted); font-size: 9px; font-weight: 750; white-space: nowrap; }
.quick-draft-actions { display: inline-flex; gap: 4px; }
.quick-draft-actions button { align-items: center; background: var(--surface-hover); border: 1px solid var(--line); border-radius: 4px; color: var(--muted); display: inline-flex; font-size: 11px; height: 23px; justify-content: center; padding: 0; width: 25px; }
.quick-draft-actions button:first-child { background: var(--draft-color); border-color: var(--draft-color); color: #fff; }
.quick-draft-actions button:hover { border-color: var(--draft-color); color: var(--ink); }
.quick-draft-actions button:first-child:hover { color: #fff; filter: brightness(1.05); }
.quick-draft-field { color: var(--muted); display: grid; font-size: 9px; font-weight: 750; gap: 3px; }
.quick-draft input, .quick-draft select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink); font-size: 11px; height: 32px; min-width: 0; outline: none; padding: 4px 7px; width: 100%; }
.quick-draft input:focus, .quick-draft select:focus { border-color: var(--draft-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--draft-color) 20%, transparent); }
.quick-draft input.invalid { border-color: #ff9a9a; box-shadow: 0 0 0 2px rgba(229, 72, 77, .35); }
.quick-draft-hint { color: var(--subtle); font-size: 8px; line-height: 1.2; }
.resize-handle { cursor: ns-resize; height: 6px; left: 0; position: absolute; right: 0; z-index: 2; }
.resize-handle.top { top: 0; }
.resize-handle.bottom { bottom: 0; }
.now-line { background: #e5484d; height: 1px; left: 0; pointer-events: none; position: absolute; right: 0; z-index: 15; }
.now-line::before { background: #e5484d; border-radius: 50%; content: ""; height: 6px; left: -3px; position: absolute; top: -2px; width: 6px; }
.add-column-header { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; justify-content: center; position: sticky; top: 48px; z-index: 41; }
.add-column-button { background: var(--surface-hover); border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--brand); font-size: 18px; height: 31px; width: 31px; }
.add-column-track { align-items: flex-start; background: var(--surface-muted); display: flex; height: var(--timeline-height); justify-content: center; padding-top: 78px; }
.add-column-track span { color: var(--subtle); font-size: 9px; white-space: nowrap; writing-mode: vertical-rl; }
.scroll-actions { bottom: 18px; display: flex; gap: 7px; pointer-events: none; position: absolute; right: 18px; }
.scroll-actions button { box-shadow: var(--shadow-soft); pointer-events: auto; }
.floating { border-radius: 50%; }
.timeline-frame.has-week-shortcuts .scroll-actions,
.timeline-frame.has-week-shortcuts .selection-toolbar { bottom: 78px; }
.week-shortcuts { align-items: center; background: var(--surface-raised); border-top: 1px solid var(--line); bottom: 0; display: grid; gap: 8px; grid-template-columns: 32px auto minmax(0, 1fr) auto 32px; height: 62px; left: 0; padding: 8px 12px; position: absolute; right: 0; z-index: 55; }
.week-shortcuts-month { color: var(--ink); font-size: 10px; font-weight: 850; min-width: 92px; text-transform: capitalize; }
.week-shortcuts-month.next { text-align: right; }
.week-shortcut-list { display: flex; gap: 6px; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px; scrollbar-color: var(--line-strong) transparent; }
.week-shortcut, .week-shortcut-arrow { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.week-shortcut { border-radius: 6px; flex: 0 0 auto; font-size: 9px; font-weight: 750; min-height: 34px; padding: 0 10px; white-space: nowrap; }
.week-shortcut:hover, .week-shortcut-arrow:hover { background: var(--surface-hover); color: var(--ink); }
.week-shortcut.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 9px color-mix(in srgb, var(--brand) 24%, transparent); }
.week-shortcut-arrow { align-items: center; border-radius: 50%; display: inline-flex; font-size: 24px; height: 30px; justify-content: center; line-height: 1; padding: 0; width: 30px; }
.week-shortcut-arrow svg { display: block; fill: none; height: 20px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 20px; }
.selection-toolbar { align-items: center; backdrop-filter: blur(8px); background: color-mix(in srgb, var(--surface-raised) 94%, transparent); border: 1px solid var(--line-strong); border-radius: 8px; bottom: 18px; box-shadow: var(--shadow); display: flex; gap: 5px; left: 74px; max-width: calc(100% - 210px); padding: 6px; position: absolute; z-index: 60; }
.selection-toolbar-label { font-size: 10px; font-weight: 750; max-width: 250px; overflow: hidden; padding: 0 7px; text-overflow: ellipsis; white-space: nowrap; }
.selection-toolbar button { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 9px; font-weight: 750; min-height: 28px; padding: 0 8px; white-space: nowrap; }
.selection-toolbar button:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.selection-toolbar button[data-selection-action="delete"] { color: var(--danger); }
.selection-toolbar button[data-selection-action="delete"]:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); color: var(--danger); }
.selection-toolbar button[data-selection-action="clear"] { font-size: 14px; min-width: 28px; padding: 0; }

.agenda-view, .month-view { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: calc(100vh - 208px); overflow: hidden; }
.agenda-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 20px 22px; }
.agenda-heading h2 { font-size: 20px; }
.count-pill { background: var(--surface-hover); border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 700; padding: 5px 10px; }
.agenda-list { padding: 0 22px 24px; }
.agenda-day { border-bottom: 1px solid var(--line); cursor: zoom-in; display: grid; grid-template-columns: 150px 1fr; padding: 18px 0; }
.agenda-date strong, .agenda-date span { display: block; text-transform: capitalize; }
.agenda-date strong { font-size: 13px; }
.agenda-date span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.agenda-items { display: grid; gap: 8px; }
.agenda-item { align-items: center; background: var(--surface-muted); border-left: 3px solid var(--appointment-color); border-radius: 5px; cursor: pointer; display: grid; font-family: var(--appointment-font-family); gap: 10px; grid-template-columns: 92px minmax(150px, 1fr) 160px 120px; min-height: 54px; padding: 8px 12px; }
.agenda-item:hover { background: var(--surface-hover); }
.agenda-item .time { font-size: max(8px, calc(var(--appointment-font-size) - 1px)); font-weight: 800; }
.agenda-item .title { font-size: var(--appointment-font-size); font-weight: 750; }
.agenda-item .meta { color: var(--muted); font-size: 10px; }
.month-weekdays { background: var(--surface-muted); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(7, 1fr); }
.month-weekdays span { color: var(--muted); font-size: 10px; font-weight: 800; padding: 10px; text-align: center; text-transform: uppercase; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); grid-template-rows: repeat(6, minmax(112px, 1fr)); min-height: calc(100vh - 249px); }
.month-day { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); cursor: zoom-in; min-width: 0; padding: 8px; }
.month-day.outside { background: var(--surface-muted); opacity: .56; }
.month-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.month-number { align-items: center; display: flex; font-size: 11px; font-weight: 800; height: 22px; justify-content: center; margin-left: auto; width: 22px; }
.month-day.today .month-number { background: var(--brand); border-radius: 50%; color: #fff; }
.month-event { background: color-mix(in srgb, var(--appointment-color) 15%, var(--surface)); border-left: 2px solid var(--appointment-color); border-radius: 3px; color: var(--ink); cursor: pointer; display: block; font-family: var(--appointment-font-family); font-size: max(8px, calc(var(--appointment-font-size) - 1px)); margin-top: 4px; overflow: hidden; padding: 3px 5px; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.month-more { color: var(--muted); font-size: 9px; margin: 5px 0 0; }

.section-heading { align-items: end; display: flex; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { font-size: 28px; }
.admin-tabs { margin-bottom: 16px; }
.admin-panel { display: grid; gap: 16px; }
.admin-team-actions { display: flex; justify-content: flex-end; }
.admin-summary { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.metric-card span { color: var(--muted); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.metric-card strong { display: block; font-size: 24px; margin-top: 7px; }
.member-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.member-table { border-collapse: collapse; min-width: 780px; width: 100%; }
.member-table th { background: var(--surface-muted); color: var(--muted); font-size: 10px; letter-spacing: .05em; padding: 11px 14px; text-align: left; text-transform: uppercase; }
.member-table td { border-top: 1px solid var(--line); font-size: 12px; padding: 11px 14px; }
.member-table tr.member-row-new td { animation: member-created 2.8s ease both; }
@keyframes member-created {
  0%, 45% { background: color-mix(in srgb, var(--success) 16%, var(--surface)); }
  100% { background: transparent; }
}
.member-cell { align-items: center; display: flex; gap: 9px; }
.member-cell strong, .member-cell small { display: block; }
.member-cell small { color: var(--muted); margin-top: 2px; }
.role-pill, .status-pill { background: var(--surface-hover); border-radius: 11px; color: var(--muted); display: inline-block; font-size: 9px; font-weight: 800; padding: 4px 8px; text-transform: capitalize; }
.status-pill.active { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-actions button { background: transparent; border: 0; color: var(--muted); font-size: 17px; }
.admin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 16px; }
.card-heading p { font-size: 11px; margin-bottom: 0; }
.catalog-grid, .settings-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.catalog-list { display: grid; gap: 8px; }
.catalog-item { align-items: center; background: var(--surface-muted); border-radius: 6px; display: flex; min-height: 48px; padding: 8px 10px; }
.color-swatch { background: var(--swatch); border-radius: 4px; height: 24px; margin-right: 10px; width: 24px; }
.catalog-item strong { font-size: 12px; }
.catalog-item span:nth-last-child(2) { color: var(--muted); font-size: 10px; margin-left: auto; margin-right: 10px; }
.catalog-item button { background: transparent; border: 0; color: var(--muted); font-size: 17px; }
.badge-admin-list { display: grid; gap: 8px; margin-top: 8px; }
.badge-admin-item { align-items: center; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px; display: grid; gap: 14px; grid-template-columns: minmax(170px, 1fr) minmax(130px, .7fr) auto auto; min-height: 58px; padding: 9px 11px; }
.badge-admin-item > span:nth-child(2) strong, .badge-admin-item > span:nth-child(2) small { display: block; }
.badge-admin-item > span:nth-child(2) strong { font-size: 11px; }
.badge-admin-item > span:nth-child(2) small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.badge-admin-preview { align-items: center; background: color-mix(in srgb, var(--badge-color) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--badge-color) 42%, var(--line)); border-radius: 5px; color: color-mix(in srgb, var(--badge-color) 80%, var(--ink)); display: inline-flex; font-size: 11px; font-weight: 800; gap: 7px; min-height: 33px; padding: 5px 9px; width: fit-content; }
.badge-admin-preview b { font-size: 13px; }
.form-card { align-content: start; display: grid; gap: 14px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-hint { color: var(--subtle); font-size: 9px; font-weight: 600; }
.member-check-grid { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px; display: grid; gap: 5px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 220px; overflow: auto; padding: 7px; }
.member-check-choice { align-items: center; background: var(--surface); border: 1px solid transparent; border-radius: 6px; cursor: pointer; display: flex; gap: 7px; min-width: 0; padding: 7px; }
.member-check-choice:has(input:checked) { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 42%, var(--line)); }
.member-check-choice input { flex: 0 0 auto; }
.member-check-choice .member-avatar { --member-avatar-size: 24px; }
.member-check-choice strong { color: var(--ink); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-grid { align-items: end; grid-template-columns: 1fr 1.4fr; }
.switch-row { align-items: center; background: var(--surface-muted); border-radius: 6px; display: flex; justify-content: space-between; padding: 10px 11px; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--ink); font-size: 12px; }
.switch-row small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.switch-row input[role="switch"] { appearance: none; background: var(--line-strong); border: 0; border-radius: 11px; height: 22px; padding: 0; position: relative; width: 38px; }
.switch-row input[role="switch"]::after { background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); content: ""; height: 18px; left: 2px; position: absolute; top: 2px; transition: transform .16s ease; width: 18px; }
.switch-row input[role="switch"]:checked { background: var(--brand); }
.switch-row input[role="switch"]:checked::after { transform: translateX(16px); }
.compact-switch { min-height: 40px; }
.setting-highlight { border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--line)); box-shadow: inset 3px 0 var(--brand); }
.settings-submit { display: flex; grid-column: 1 / -1; justify-content: flex-end; }
.typography-settings-card { grid-column: 1 / -1; }
.typography-preview { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 12px; }
.appointment-font-preview { background: var(--brand); border-radius: 5px; color: #fff; font-family: var(--appointment-font-family); font-size: var(--appointment-font-size); font-weight: 750; padding: 10px; }
.badge-font-preview { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line)); border-radius: 5px; color: var(--warning); font-family: var(--badge-font-family); font-size: var(--badge-font-size); font-weight: 800; padding: 10px; text-align: center; }
.text-style-settings-card { grid-column: 1 / -1; }
.text-style-page-tabs { align-self: start; justify-self: start; }
.text-style-page-tabs button { white-space: nowrap; }
.text-style-editor { display: grid; gap: 10px; }
.text-style-page { display: grid; gap: 10px; }
.text-style-section { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.text-style-section[open] { background: var(--surface); border-color: var(--line-strong); }
.text-style-section summary { align-items: center; cursor: pointer; display: flex; gap: 12px; justify-content: space-between; list-style: none; padding: 12px 14px; }
.text-style-section summary::-webkit-details-marker { display: none; }
.text-style-section summary::after { color: var(--muted); content: "+"; font-size: 18px; font-weight: 500; }
.text-style-section[open] summary::after { content: "−"; }
.text-style-section summary strong, .text-style-section summary small { display: block; }
.text-style-section summary strong { color: var(--ink); font-size: 12px; }
.text-style-section summary small { color: var(--muted); font-size: 10px; font-weight: 600; margin-top: 3px; }
.text-style-section-body { border-top: 1px solid var(--line); padding: 14px; }
.text-style-controls { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.text-style-color-field { color: var(--muted); display: grid; font-size: 12px; font-weight: 700; gap: 7px; }
.text-style-color-controls { align-items: center; display: grid; gap: 7px; grid-template-columns: 52px 1fr; min-height: 40px; }
.text-style-color-controls input[type="color"] { height: 40px; min-height: 40px; }
.text-style-auto-color { align-items: center; display: flex; font-size: 10px; gap: 6px; }
.text-style-preview { background: var(--surface-muted); border: 1px dashed var(--line-strong); border-radius: 6px; display: block; margin-top: 12px; min-height: 42px; overflow: hidden; padding: 11px 12px; text-overflow: ellipsis; white-space: nowrap; }
.backup-state { align-items: center; background: color-mix(in srgb, var(--success) 8%, var(--surface)); border-radius: 6px; display: flex; gap: 10px; margin-bottom: 14px; padding: 12px; }
.backup-state p { font-size: 10px; margin: 3px 0 0; }
.status-icon { align-items: center; background: var(--success); border-radius: 50%; color: #fff; display: flex; height: 26px; justify-content: center; width: 26px; }
.audit-list { max-height: 430px; overflow: auto; }
.audit-event { border-top: 1px solid var(--line); display: grid; gap: 7px; grid-template-columns: 115px 1fr auto; padding: 9px 0; }
.audit-event:first-child { border-top: 0; }
.audit-event time, .audit-event span { color: var(--muted); font-size: 10px; }
.audit-event strong { font-size: 11px; }
.schedule-editor { overflow-x: auto; }
.schedule-grid { display: grid; gap: 1px; grid-template-columns: 170px repeat(7, minmax(105px, 1fr)); min-width: 940px; }
.schedule-cell { background: var(--surface-muted); min-height: 52px; padding: 7px; }
.schedule-cell[data-schedule-member] { cursor: pointer; }
.schedule-cell[data-schedule-member]:hover { background: var(--surface-hover); }
.schedule-cell.heading { color: var(--muted); font-size: 10px; font-weight: 800; min-height: 32px; text-align: center; text-transform: uppercase; }
.schedule-cell.member-name { align-items: center; display: flex; font-size: 11px; font-weight: 750; gap: 7px; }
.schedule-rule { background: var(--surface); border: 0; border-left: 2px solid var(--rule-color); border-radius: 3px; color: var(--ink); display: block; font-size: 9px; margin-bottom: 3px; overflow: hidden; padding: 4px; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.empty-state { color: var(--muted); padding: 24px; text-align: center; }

@container (max-width: 145px) {
  .member-heading span { display: none; }
  .member-header { gap: 6px; padding-inline: 7px 10px; }
}

@container (max-width: 112px) {
  .member-header { gap: 4px; padding-inline: 5px 9px; }
  .member-header .member-avatar { --member-avatar-size: 22px; }
  .member-heading strong { font-size: max(8px, calc(var(--member-name-font-size) - 1px)); }
}

.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); color: var(--ink); max-height: calc(100vh - 36px); max-width: 680px; padding: 0; width: calc(100% - 28px); }
.modal::backdrop { background: rgba(9, 15, 23, .62); backdrop-filter: blur(2px); }
.small-modal { max-width: 520px; }
.modal form { display: grid; gap: 14px; padding: 22px; }
.modal-header { align-items: start; display: flex; justify-content: space-between; }
.modal-header h2 { font-size: 22px; }
.close-button { border: 0; font-size: 22px; height: 32px; min-height: 32px; min-width: 32px; }
.modal-actions { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 9px; grid-template-columns: auto 1fr auto auto; margin: 4px -22px -22px; padding: 14px 22px; }
.modal hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.format-choice { border: 0; display: grid; gap: 8px; margin: 0; padding: 0; }
.format-choice legend { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.format-choice label { align-items: center; background: var(--surface-muted); border: 1px solid transparent; border-radius: 6px; display: flex; gap: 10px; padding: 10px; }
.format-choice label:has(input:checked) { border-color: var(--brand); }
.format-choice strong, .format-choice small { display: block; }
.format-choice small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.account-popover { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 7px; bottom: 60px; box-shadow: var(--shadow); left: 18px; min-width: 210px; padding: 10px; position: fixed; z-index: 100; }
.account-identity { border-bottom: 1px solid var(--line); padding: 5px 7px 10px; }
.account-identity strong, .account-identity span { display: block; }
.account-identity span { color: var(--muted); font-size: 10px; margin-top: 3px; text-transform: capitalize; }
.account-popover button { background: transparent; border: 0; color: var(--ink); font-size: 12px; font-weight: 700; padding: 10px 7px 5px; text-align: left; width: 100%; }
.account-popover button:hover { color: var(--brand); }
.account-popover .logout-action { color: var(--danger); }
.toast-region { bottom: 20px; display: grid; gap: 8px; position: fixed; right: 20px; width: min(360px, calc(100% - 40px)); z-index: 130; }
.toast { align-items: start; animation: toast-in .2s ease both; background: var(--surface-raised); border: 1px solid var(--line); border-left: 3px solid var(--success); border-radius: 7px; box-shadow: var(--shadow); display: flex; font-size: 12px; gap: 9px; padding: 12px; }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 60px minmax(0, 1fr); }
  .side-rail { padding-inline: 6px; }
  .screen { padding: 16px; }
  .topbar { padding-inline: 16px; }
  .topbar-title .sync-state { display: none; }
  .planning-toolbar { align-items: stretch; flex-direction: column; }
  .view-controls { justify-content: space-between; }
  .timeline-frame { height: calc(100vh - 252px); }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid, .settings-grid { grid-template-columns: 1fr; }
  .settings-submit { grid-column: 1; }
  .text-style-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .login-shell { display: block; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; margin-bottom: 40px; }
  .app-shell { display: block; }
  .side-rail { bottom: 0; flex-direction: row; height: 60px; left: 0; padding: 5px 14px; position: fixed; right: 0; top: auto; z-index: 100; }
  .side-rail .brand-mark { display: none; }
  .side-rail nav { display: flex; gap: 8px; }
  .rail-button { min-height: 48px; min-width: 62px; }
  .rail-footer { margin-left: auto; margin-top: 0; }
  .topbar { height: 60px; }
  .topbar-title h1 { font-size: 14px; }
  .topbar-actions .secondary-button { display: none; }
  .topbar-actions .primary-button { font-size: 0; min-width: 38px; padding: 0; }
  .topbar-actions .primary-button span { font-size: 19px; }
  .screen { padding: 12px 12px 76px; }
  .date-navigation { display: grid; grid-template-columns: auto auto 1fr; }
  .date-picker-label { font-size: 14px; min-width: 0; }
  .view-controls { overflow-x: auto; }
  .zoom-control { display: none; }
  .filter-row { margin-top: 10px; }
  .member-filters { max-width: 100%; }
  .search-box { display: none; }
  .timeline-frame { height: calc(100vh - 232px); min-height: 420px; }
  .week-shortcuts { grid-template-columns: 30px minmax(0, 1fr) 30px; padding-inline: 8px; }
  .week-shortcuts-month { display: none; }
  .selection-toolbar { left: 56px; max-width: none; overflow-x: auto; right: 10px; }
  .selection-toolbar-label { display: none; }
  .time-ruler { flex-basis: 48px; width: 48px; }
  .filter-row { min-height: 31px; }
  .agenda-day { grid-template-columns: 1fr; gap: 12px; }
  .agenda-item { grid-template-columns: 70px 1fr; }
  .agenda-item .meta:nth-last-child(-n+2) { display: none; }
  .month-view { overflow-x: auto; }
  .month-weekdays, .month-grid { min-width: 760px; }
  .section-heading { align-items: start; gap: 12px; }
  .section-heading h2 { font-size: 23px; }
  .admin-tabs { max-width: 100%; overflow-x: auto; }
  .admin-team-actions { justify-content: stretch; }
  .admin-team-actions .primary-button { width: 100%; }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .text-style-page-tabs { max-width: 100%; overflow-x: auto; }
  .text-style-controls { grid-template-columns: 1fr; }
  .modal form { padding: 18px; }
  .modal-actions { margin: 4px -18px -18px; padding: 12px 18px; }
  .form-grid.two, .form-grid.three, .color-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
