:root {
  --bg: #f8f7f6;
  --surface: #ffffff;
  --surface-2: #fbfaf9;
  --line: #e7e4e2;
  --line-strong: #d8d3d0;
  --text: #25211f;
  --muted: #746d69;
  --faint: #9f9792;
  --accent: #b21616;
  --accent-hover: #941111;
  --accent-soft: #fbefed;
  --chocolate: #693f36;
  --cream: #fff2d8;
  --success: #2f6b4f;
  --warning: #9a6514;
  --danger: #b42318;
  --focus: #2563eb;
  --sidebar: 232px;
  --radius: 12px;
  --shadow: 0 12px 35px rgba(48, 35, 31, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.4; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: #fcfbfa; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; z-index: 20; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 8px 10px; }
.brand-mark { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: white; font-size: 17px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-copy { min-width: 0; }
.brand-name { font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav { display: grid; gap: 4px; }
.nav-button { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: 9px; padding: 0 11px; cursor: pointer; text-align: left; color: #5d5753; }
.nav-button:hover { background: #f2efed; color: var(--text); }
.nav-button.active { background: #eee9e6; color: var(--text); font-weight: 650; }
.nav-icon { width: 19px; height: 19px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.nav-icon svg { width: 18px; height: 18px; stroke-width: 1.8; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; background: #e9e5e2; color: var(--muted); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; padding: 0 7px; }
.sync-state { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; min-height: 24px; }
.sync-dot { width: 7px; height: 7px; background: #6b9b7e; border-radius: 50%; }
.sync-state.pending .sync-dot { background: var(--warning); }
.sync-state.error .sync-dot { background: var(--danger); }
.version { color: var(--faint); font-size: 11px; }

.main { min-width: 0; }
.page { min-height: 100vh; padding: 24px clamp(16px, 2vw, 32px) 48px; }
.page-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.page-title { margin: 0; font-size: clamp(22px, 2.3vw, 28px); letter-spacing: -.035em; line-height: 1.15; }
.page-kicker { color: var(--muted); margin: 5px 0 0; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.section-title { font-size: 17px; margin: 0; letter-spacing: -.015em; }
.section-copy { color: var(--muted); margin: 4px 0 0; }

.button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 560; white-space: nowrap; }
.button:hover:not(:disabled) { border-color: #c9c2be; background: #faf8f7; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { border-color: var(--accent); color: white; background: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.ghost:hover { background: #f1eeec; color: var(--text); }
.button.danger { color: var(--danger); }
.button.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; cursor: pointer; }
.icon-button:hover { background: #f6f3f2; }
.icon-button svg, .button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 13px; }
.toolbar-group { display: inline-flex; align-items: center; gap: 4px; }
.period-label { min-width: 198px; font-weight: 650; font-size: 15px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: #ece8e5; }
.segmented button { min-width: 44px; min-height: 32px; padding: 0 9px; border: 0; background: transparent; border-radius: 7px; color: var(--muted); cursor: pointer; }
.segmented button.active { background: white; color: var(--text); box-shadow: 0 1px 3px rgba(45,35,31,.12); font-weight: 650; }
.toolbar-spacer { flex: 1; }
.range-picker { display: flex; align-items: center; gap: 8px; margin: -3px 0 13px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: white; width: fit-content; }
.range-picker label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.range-picker input { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; }

.filter-bar { border: 1px solid var(--line); background: rgba(255,255,255,.72); border-radius: var(--radius); padding: 9px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { min-width: 220px; flex: 1 1 260px; position: relative; }
.search-box input { width: 100%; height: 36px; padding: 0 12px 0 36px; border: 0; background: transparent; border-radius: 8px; color: var(--text); }
.search-box svg { position: absolute; left: 11px; top: 9px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; pointer-events: none; }
.filter-select { height: 36px; max-width: 180px; padding: 0 30px 0 10px; border: 1px solid transparent; border-radius: 8px; background-color: transparent; color: #5d5753; cursor: pointer; }
.filter-select:hover, .filter-select.active { border-color: var(--line); background-color: white; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; background: #eeeae8; color: #5d5753; font-size: 12px; }
.filter-chip button { border: 0; background: none; cursor: pointer; padding: 0; color: inherit; line-height: 1; }

.calendar-surface { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.calendar-week + .calendar-week { border-top: 5px solid var(--bg); }
.promotion-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 3px 0; padding: 8px 5px 5px; background: #fdfcfb; min-height: 33px; border-bottom: 1px solid var(--line); }
.promotion-bar { min-width: 0; height: 24px; margin: 0 3px; padding: 3px 9px; border-radius: 6px; background: #f4e2de; border: 1px solid #ead2cc; color: #67342e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; cursor: pointer; text-align: left; z-index: 2; }
.promotion-bar:hover { background: #efd7d1; }
.promotion-bar.campaign-bar { background: #eee6df; border-color: #ded0c5; color: #513c32; }
.days-grid { display: grid; grid-template-columns: repeat(7, minmax(138px, 1fr)); }
.day-column { min-width: 0; min-height: 280px; border-right: 1px solid var(--line); background: #fff; }
.day-column:last-child { border-right: 0; }
.day-column.today { background: #fefcfb; }
.day-column.outside-month { background: #faf9f8; color: var(--faint); }
.calendar-surface.month .day-column { min-height: 190px; }
.calendar-surface.month .day-head { height: 38px; padding-block: 5px; }
.calendar-surface.month .task-counter { min-height: 25px; margin-top: 5px; }
.calendar-surface.month .content-card .card-body { padding: 6px; }
.calendar-surface.month .content-card .card-title { min-height: 18px; -webkit-line-clamp: 1; }
.calendar-surface.month .content-card .card-foot { display: none; }
.calendar-surface.month .card-channel { height: 21px; }
.more-day { width: 100%; min-height: 28px; border: 0; background: #f4f1ef; border-radius: 7px; color: var(--muted); cursor: pointer; }
.day-head { height: 52px; padding: 9px 10px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 3; }
.day-name { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.day-number { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; font-weight: 700; }
.today .day-number { background: var(--accent); color: white; }
.day-add { margin-left: auto; width: 27px; height: 27px; border: 0; background: transparent; color: var(--faint); border-radius: 7px; cursor: pointer; font-size: 18px; }
.day-add:hover { background: #f0ecea; color: var(--text); }
.task-counter { width: calc(100% - 16px); min-height: 32px; margin: 7px 8px 0; padding: 5px 8px; border: 0; border-radius: 8px; background: #f7f5f4; color: #5f5854; display: flex; align-items: center; gap: 7px; cursor: pointer; text-align: left; font-size: 12px; }
.task-counter:hover { background: #efebe9; }
.task-counter.overdue::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.task-progress { margin-left: auto; width: 26px; height: 3px; background: #ded9d6; border-radius: 3px; overflow: hidden; }
.task-progress i { display: block; height: 100%; background: #6e8c7b; }
.cards { padding: 7px; display: grid; gap: 7px; }
.content-card { min-width: 0; border: 1px solid var(--line); background: #fff; border-radius: 10px; overflow: hidden; cursor: pointer; text-align: left; box-shadow: 0 1px 0 rgba(36,28,25,.02); }
.content-card:hover { border-color: #ccc4bf; box-shadow: 0 4px 12px rgba(55,40,35,.06); }
.card-channel { height: 25px; padding: 4px 8px; display: flex; align-items: center; gap: 5px; background: var(--channel, #eee); color: #4b403d; font-size: 11px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-body { padding: 8px; }
.card-title { min-height: 36px; font-weight: 620; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: 8px; display: flex; gap: 5px; align-items: center; justify-content: space-between; }
.status-chip { display: inline-flex; align-items: center; max-width: 100%; min-height: 22px; padding: 2px 7px; border-radius: 99px; background: #f1eeec; color: #655e5a; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-chip.ready, .status-chip.published, .status-chip.done { background: #e5f1ea; color: #285c43; }
.status-chip.overdue { background: #fae8e6; color: #96271e; }
.status-chip.review, .status-chip.production, .status-chip.in_progress { background: #fff2d8; color: #765015; }
.card-time { color: var(--faint); font-size: 11px; }
.empty-calendar { padding: 70px 20px; text-align: center; color: var(--muted); }

.mobile-calendar { display: none; }
.mobile-overview-card { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px; }
.mobile-overview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mobile-overview-head strong { font-size: 14px; }
.mobile-overview-head span { color: var(--muted); font-size: 11px; }
.mobile-weekdays { display: none; }
.mobile-overview { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
.mobile-weekdays span { padding-bottom: 5px; color: var(--faint); font-size: 10px; text-align: center; text-transform: uppercase; }
.mobile-overview { gap: 4px; }
.mobile-date-cell { position: relative; flex: 0 0 54px; height: 64px; padding: 5px 3px; border: 1px solid transparent; background: #faf8f7; border-radius: 9px; color: var(--text); cursor: pointer; scroll-snap-align: center; }
.mobile-date-weekday { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.mobile-date-cell:hover { background: #f4f0ee; }
.mobile-date-cell.selected { border-color: var(--accent); background: #fff7f6; box-shadow: 0 0 0 1px rgba(134,25,20,.08); }
.mobile-date-cell.today .mobile-date-number { background: var(--accent); color: white; }
.mobile-date-number { width: 23px; height: 23px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.mobile-cell-count { position: absolute; right: 5px; bottom: 4px; min-width: 15px; height: 14px; padding: 0 4px; border-radius: 8px; background: #e9dedb; color: #5e4038; display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.mobile-cell-signals { position: absolute; left: 7px; bottom: 7px; height: 6px; display: flex; align-items: center; gap: 3px; }
.task-signal, .content-signal { width: 5px; height: 5px; border-radius: 50%; background: #756b66; display: inline-block; }
.content-signal { background: #b99b91; }
.promo-signal { width: 11px; height: 3px; border-radius: 2px; background: var(--accent); display: inline-block; }
.mobile-overview-legend { margin-top: 9px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 10px; }
.mobile-overview-legend span { display: inline-flex; align-items: center; gap: 4px; }
.mobile-selected-day { margin-top: 10px; }
.mobile-day { border: 1px solid var(--line); background: white; border-radius: 12px; overflow: hidden; }
.mobile-day-head { padding: 11px 13px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.mobile-day-head strong { text-transform: capitalize; }
.mobile-day .promotion-bar { display: block; margin: 7px 9px 0; width: calc(100% - 18px); }
.mobile-day .task-counter { margin: 7px 9px 0; width: calc(100% - 18px); }
.mobile-day .cards { padding: 9px; }
.mobile-day-empty { padding: 14px 8px; color: var(--muted); font-size: 13px; text-align: center; }
.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 10px 0 12px; }
.pdf-status { padding: 10px 12px; border-radius: 9px; background: #f4f1ef; color: var(--muted); font-size: 13px; }
.install-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; line-height: 1.45; }
.ios-banner { position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; width: min(460px,calc(100vw - 24px)); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px; font-size: 12px; }
.ios-banner span { flex: 1; }.ios-banner button { border: 0; background: transparent; color: var(--accent); cursor: pointer; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 12px; }
.panel-card { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 15px; }
.panel-card.clickable { cursor: pointer; }
.panel-card.clickable:hover { border-color: #cbc4bf; box-shadow: 0 5px 18px rgba(50,37,32,.05); }
.panel-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-card h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.panel-card p { margin: 8px 0 0; color: var(--muted); }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.mini-avatar { width: 25px; height: 25px; border-radius: 50%; display: inline-grid; place-items: center; color: white; font-size: 11px; font-weight: 700; }
.progress-bar { height: 5px; border-radius: 5px; background: #eeeae8; overflow: hidden; margin-top: 12px; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.task-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }
.task-views { display: grid; align-content: start; gap: 3px; position: sticky; top: 20px; }
.task-view-button { border: 0; background: transparent; border-radius: 8px; min-height: 38px; padding: 0 10px; text-align: left; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.task-view-button.active { background: white; color: var(--text); font-weight: 650; }
.task-group { margin-bottom: 24px; }
.task-group-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; color: #514a46; font-size: 13px; text-transform: uppercase; letter-spacing: .045em; }
.task-list { border: 1px solid var(--line); background: white; border-radius: 12px; overflow: hidden; }
.task-row { min-height: 55px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #fdfcfc; }
.task-row.done .task-row-title { color: var(--muted); text-decoration: line-through; }
.check { width: 22px; height: 22px; border: 1.5px solid #bdb5b0; background: white; border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.check.checked { background: var(--success); border-color: var(--success); color: white; }
.task-row-main { min-width: 0; cursor: pointer; }
.task-row-title { font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 3px; }
.priority-high { color: var(--danger); }
.task-row-actions { display: flex; align-items: center; gap: 5px; }

.empty-state { border: 1px dashed var(--line-strong); border-radius: 13px; padding: 48px 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.5); }
.empty-state h3 { color: var(--text); margin: 0 0 5px; }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 760px); gap: 25px; }
.settings-nav { display: grid; gap: 3px; align-content: start; position: sticky; top: 20px; }
.settings-nav button { min-height: 38px; border: 0; border-radius: 8px; padding: 0 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.settings-nav button.active { background: white; color: var(--text); font-weight: 650; }
.settings-section { border: 1px solid var(--line); background: white; border-radius: 13px; padding: 20px; margin-bottom: 14px; }
.settings-section h2 { margin: 0; font-size: 17px; }
.settings-section > p { margin: 5px 0 18px; color: var(--muted); }
.settings-list { border-top: 1px solid var(--line); }
.settings-item { min-height: 54px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.settings-item-main { flex: 1; }
.settings-item small { display: block; color: var(--muted); }
.danger-zone { border-color: #efd5d1; }

.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(31,24,22,.34); animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; z-index: 90; width: min(520px, 100vw); height: 100dvh; background: white; box-shadow: -14px 0 38px rgba(43,32,28,.15); display: flex; flex-direction: column; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(25px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { min-height: 66px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.drawer-head-title { flex: 1; min-width: 0; }
.drawer-head-title h2 { margin: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px; overscroll-behavior: contain; }
.drawer-foot { min-height: 65px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; display: flex; align-items: center; gap: 8px; }
.drawer-foot .save-status { color: var(--muted); font-size: 12px; margin-right: auto; }
.modal { position: fixed; z-index: 95; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 28px)); max-height: min(760px, calc(100dvh - 28px)); overflow: auto; background: white; border-radius: 14px; box-shadow: var(--shadow); }
.modal-head { padding: 17px 19px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-body { padding: 19px; }
.modal-foot { padding: 13px 19px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: white; }

.form { display: grid; gap: 15px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 12px; font-weight: 650; color: #5d5652; }
.field input, .field textarea, .field select { width: 100%; min-height: 41px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; color: var(--text); padding: 9px 10px; }
.field textarea { min-height: 112px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #9d918b; outline: 2px solid rgba(37,99,235,.12); }
.field small { color: var(--muted); }
.field-error { color: var(--danger) !important; }
.field input.invalid { border-color: var(--danger); }
.section-box { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 2px; }
.section-box summary { cursor: pointer; font-weight: 680; list-style: none; display: flex; justify-content: space-between; }
.section-box summary::-webkit-details-marker { display: none; }
.section-box summary::after { content: "+"; color: var(--muted); }
.section-box[open] summary::after { content: "−"; }
.section-box .section-content { margin-top: 14px; display: grid; gap: 13px; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.inline-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.comments { display: grid; gap: 8px; }
.comment { border-radius: 9px; background: #f7f5f4; padding: 9px 10px; }
.comment small { display: block; color: var(--muted); margin-top: 4px; }
.char-count { justify-self: end; color: var(--faint); font-size: 11px; margin-top: -4px; }
.history-list { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.history-item { padding-left: 15px; position: relative; }
.history-item::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #c4bcb7; position: absolute; left: 1px; top: 5px; }

.popover { position: fixed; z-index: 110; min-width: 210px; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.popover button { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; border-radius: 7px; padding: 0 10px; cursor: pointer; text-align: left; }
.popover button:hover { background: #f4f1ef; }
.popover button.danger { color: var(--danger); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 5px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 150; display: grid; gap: 8px; width: min(390px, calc(100vw - 36px)); pointer-events: none; }
.toast { pointer-events: auto; min-height: 50px; border: 1px solid var(--line); background: #2e2825; color: white; border-radius: 11px; box-shadow: var(--shadow); padding: 10px 12px; display: flex; align-items: center; gap: 10px; animation: toastIn .2s ease; }
.toast.error { background: #7f211b; }
.toast.success { background: #285b43; }
.toast span { flex: 1; }
.toast button { border: 0; background: rgba(255,255,255,.12); color: white; border-radius: 7px; min-height: 30px; padding: 0 9px; cursor: pointer; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

.login-page { min-height: 100vh; padding: 20px; display: grid; place-items: center; background: #f8f6f5; }
.login-card { width: min(410px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 14px 50px rgba(47,34,29,.08); }
.login-card .brand-mark { width: 42px; height: 42px; margin-bottom: 20px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { color: var(--muted); margin: 7px 0 22px; }
.login-card .button { width: 100%; margin-top: 14px; }

.preview-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-height: 300px; overflow-y: auto; }
.preview-row { min-height: 46px; display: grid; grid-template-columns: 100px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.preview-row:last-child { border-bottom: 0; }
.preview-date { color: var(--muted); font-size: 12px; }
.preview-state { font-size: 11px; border-radius: 99px; background: #eeeae8; padding: 3px 7px; }
.preview-state.new { background: #e7f1eb; color: #285c43; }
.preview-state.conflict { background: #fae8e6; color: #96271e; }

.mobile-nav { display: none; }
.mobile-fab { display: none; }

@media (max-width: 1050px) {
  :root { --sidebar: 76px; }
  .brand-copy, .nav-button > span:not(.nav-icon):not(.nav-badge), .sidebar-footer .sync-state span, .sidebar-footer .version { display: none; }
  .sidebar { padding-inline: 10px; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-button { justify-content: center; padding-inline: 0; }
  .nav-badge { position: absolute; margin: -24px 0 0 24px; }
  .sidebar-footer { justify-items: center; }
  .days-grid { overflow-x: auto; grid-template-columns: repeat(7, minmax(150px, 1fr)); }
  .promotion-grid { grid-template-columns: repeat(7, minmax(150px,1fr)); overflow-x: auto; }
}

@media (max-width: 767px) {
  :root { --sidebar: 0px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .page { min-height: calc(100vh - 64px); padding: 16px 12px 30px; }
  .page-head { align-items: center; margin-bottom: 16px; }
  .page-kicker { display: none; }
  .page-title { font-size: 22px; }
  .page-actions .button:not(.primary) { display: none; }
  .toolbar { gap: 7px; }
  .period-label { min-width: 0; flex: 1; order: -1; font-size: 14px; }
  .toolbar .segmented { order: 4; width: 100%; }
  .toolbar .segmented button { flex: 1; }
  .calendar-modes button { min-width: 0; padding-inline: 7px; }
  .range-picker { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; }
  .range-picker label { display: grid; gap: 3px; }
  .range-picker input { width: 100%; min-width: 0; }
  .toolbar-spacer { display: none; }
  .filter-bar { padding: 6px; }
  .search-box { flex-basis: 100%; }
  .filter-select { flex: 1 1 40%; max-width: none; }
  .task-filters .filter-select { flex-basis: 46%; }
  .calendar-surface { display: none; }
  .mobile-calendar { display: block; }
  .panel-grid { grid-template-columns: 1fr; }
  .task-layout, .settings-layout { display: block; }
  .task-views { display: flex; overflow-x: auto; position: static; margin: 0 -12px 14px; padding: 0 12px; }
  .task-view-button { white-space: nowrap; }
  .settings-nav { display: flex; overflow-x: auto; position: static; margin: 0 -12px 15px; padding: 0 12px; }
  .settings-nav button { white-space: nowrap; }
  .settings-section { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .drawer-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .drawer-body { padding: 16px 14px; }
  .modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 13px; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; min-height: calc(62px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); backdrop-filter: blur(12px); }
  .mobile-nav button { min-width: 0; border: 0; background: transparent; color: var(--muted); display: grid; place-content: center; gap: 2px; justify-items: center; font-size: 10px; border-radius: 8px; }
  .mobile-nav button.active { color: var(--accent); }
  .mobile-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .mobile-fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 66; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(134,25,20,.3); font-size: 28px; cursor: pointer; }
  .toast-region { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; width: calc(100vw - 24px); }
  .preview-row { grid-template-columns: 80px minmax(0,1fr); }
  .preview-state { grid-column: 2; justify-self: start; }
}

@media print {
  .sidebar, .mobile-nav, .mobile-fab, .page-actions, .toolbar, .filter-bar, .active-filters { display: none !important; }
  .app-shell { display: block; }
  .page { padding: 0; }
  .calendar-surface { border: 0; }
}
