/* Cores e tipografia seguem o Manual de Marca do Colégio Arquidiocesano Família de Nazaré. */
:root {
  --navy: #212F5C;
  --navy-deep: #141D38;
  --gold: #D6A542;
  --gold-deep: #A87C24;
  --teal: #048BA8;
  --slate: #7D869C;
  --sky: #A1D4F2;
  --paper: #EFEFEF;
  --card: #FFFFFF;
  --ink: #141D38;
  --muted: #5F6883;
  --line: #DADDE5;
  --serif: 'IvyPresto Headline', 'Ivy Presto Headline', 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 10px;
}

/* Categorias: cada uma define --c (cor forte) e --cs (fundo suave). */
.cat-feriado    { --c: #B4523A; --cs: #F6E6E1; }
.cat-avaliacao  { --c: #212F5C; --cs: #E3E6F0; }
.cat-reuniao    { --c: #048BA8; --cs: #DDF0F5; }
.cat-formacao   { --c: #7A5C9E; --cs: #ECE6F3; }
.cat-letivo     { --c: #7D869C; --cs: #EBEDF1; }
.cat-espiritual { --c: #C8962F; --cs: #F8EFD9; }
.cat-evento     { --c: #2F8F6B; --cs: #E0F1EA; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; color: var(--navy); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Cabeçalho ---------- */
.top {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; margin-right: auto; min-width: 0; }
.brand img { height: 46px; width: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font: 600 22px/1.1 var(--serif); letter-spacing: .01em; }
.brand-text strong span { color: var(--gold); }
.brand-text small { font-size: 11.5px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.views { display: flex; background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 3px; flex: none; }
.views button { border: 0; background: none; color: #fff; padding: 7px 16px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.views button:hover { background: rgba(255, 255, 255, .12); }
.views button.on { background: var(--gold); color: var(--navy-deep); font-weight: 600; }

.search { position: relative; flex: 0 1 240px; min-width: 130px; }
.search input {
  width: 100%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); color: #fff;
  border-radius: 999px; padding: 8px 14px; font: inherit;
}
.search input::placeholder { color: rgba(255, 255, 255, .65); }
.search input:focus { background: #fff; color: var(--ink); outline: none; border-color: var(--gold); }
.search input:focus::placeholder { color: var(--muted); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(420px, 92vw); max-height: 60vh; overflow: auto;
  background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(20, 29, 56, .28); padding: 6px;
}
.search-results p { margin: 6px 10px; color: var(--muted); font-size: 12px; }
.sr-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; border-left: 3px solid var(--c); }
.sr-item:hover { background: var(--cs); }
.sr-item b { flex: none; width: 76px; font-weight: 600; color: var(--navy); }

/* ---------- Barra de período e filtros ---------- */
.toolbar { padding: 18px 24px 6px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.period { display: flex; align-items: center; gap: 8px; }
.period h1 { font-size: 30px; line-height: 1.15; margin: 0 8px 0 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 20px; line-height: 1; color: var(--navy); padding: 0 0 2px; }
.icon-btn:hover:not(:disabled) { border-color: var(--navy); }
.ghost-btn { border: 1px solid var(--navy); background: none; color: var(--navy); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.ghost-btn:hover:not(:disabled) { background: var(--navy); color: #fff; }
.link-btn { border: 0; background: none; color: var(--teal); text-decoration: underline; padding: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.segmented { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented button { border: 0; background: none; padding: 5px 13px; border-radius: 999px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.segmented button.on { background: var(--navy); color: #fff; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px 4px 8px; font-size: 12.5px; white-space: nowrap; }
.chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chip small { color: var(--muted); font-size: 11px; }
.chip:hover { border-color: var(--c); }
.chip.off { background: transparent; color: var(--muted); text-decoration: line-through; }
.cat-bulk { display: inline-flex; gap: 2px; align-items: center; white-space: nowrap; font-size: 12.5px; }
.cat-bulk .link-btn:disabled { color: var(--muted); text-decoration: none; opacity: .7; }
.add-btn { padding: 7px 16px; margin-left: 4px; white-space: nowrap; }
.qtitle span { color: var(--gold-deep); font-size: .75em; }
.ag-item .place { display: block; }
.mday.can-add { cursor: pointer; }
.mday.can-add:hover { background: var(--sky); }
.chip.off i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--slate); }

main { flex: 1; padding: 12px 24px 32px; }
.loading, .empty { color: var(--muted); padding: 16px 4px; margin: 0; }
.utag { flex: none; font: 600 10px/1 var(--sans); padding: 2px 4px; border-radius: 4px; background: rgba(33, 47, 92, .12); color: var(--navy); letter-spacing: .03em; }

/* ---------- Mês ---------- */
.month-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.month-narrow { display: none; }
.mgrid { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.mg-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--navy); color: #fff; }
.mg-head span { padding: 8px 10px; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.mg-head .weekend { color: var(--gold); }
.mg-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 108px; border-top: 1px solid var(--line); }
.mg-cell { grid-row: 1 / -1; border-left: 1px solid var(--line); }
.mg-cell:first-child { border-left: 0; }
.mg-cell.weekend { background: #F7F7F9; }
.mg-cell.out { background: repeating-linear-gradient(135deg, #F4F4F6 0 6px, #EDEEF1 6px 7px); }
.mg-cell.holiday { background: var(--cat-feriado-soft, #FBF1EE); }
.mg-cell.today { box-shadow: inset 0 0 0 2px var(--gold); background: #FFFBF1; }
.mg-num { grid-row: 1; padding: 5px 8px 0; font-weight: 600; color: var(--navy); z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.mg-add { border: 0; background: var(--navy); color: #fff; width: 22px; height: 22px; border-radius: 50%; padding: 0 0 1px; font-size: 16px; line-height: 1; opacity: 0; }
.mg-week:hover .mg-add { opacity: .25; }
.mg-num:hover .mg-add, .mg-add:focus-visible { opacity: 1; }
@media (hover: none) { .mg-add { opacity: .35; } }
.mg-num span { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; }
.mg-num.today span { background: var(--gold); color: var(--navy-deep); }
.bar {
  z-index: 1; margin: 1.5px 5px; padding: 3px 6px; min-width: 0;
  display: flex; align-items: flex-start; gap: 4px; text-align: left;
  border: 0; border-left: 3px solid var(--c); border-radius: 5px; background: var(--cs); color: var(--navy-deep);
  font-size: 12px; line-height: 1.3;
}
.bar > span:not(.utag) { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bar time, .ag-item time { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar:hover { background: var(--c); color: #fff; }
.bar:hover .utag { background: rgba(255, 255, 255, .25); color: #fff; }
.bar.cont-l { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: 9px; }
.bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar.past { opacity: .62; }

.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.side h2 { font-size: 20px; margin-top: 4px; }
.virtue { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px 16px; border-left: 4px solid var(--gold); }
.virtue small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.virtue strong { font: italic 500 26px/1.2 var(--serif); color: var(--gold); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stats b { display: block; font: 600 26px/1.1 var(--serif); color: var(--navy); }
.stats span { font-size: 12px; color: var(--muted); }
.stats b small { font-size: 20px; color: var(--slate); }
.upnext { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.up-item { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px; padding: 8px 10px; }
.up-item:hover { background: var(--cs); }
.up-when { font-size: 11.5px; color: var(--muted); }
.up-when em { font-style: normal; font-weight: 600; color: var(--c); }
.up-title { font-weight: 500; display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }

/* ---------- Mini-calendário (3 meses e ano) ---------- */
.mini-wd, .mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mini-wd span { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--slate); padding-bottom: 3px; }
.mday {
  position: relative; aspect-ratio: 1 / 1; border: 0; border-radius: 6px; background: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; color: var(--ink); cursor: default;
}
.mday.weekend { color: var(--slate); }
.mday.has { cursor: pointer; background: #F3F4F8; font-weight: 600; color: var(--navy); }
.mday.has:hover { background: var(--sky); }
.mday.holiday { background: #F6E6E1; color: #8E3B27; }
.mday.today { box-shadow: 0 0 0 2px var(--gold); background: #FFF6DF; }
.mday em { display: flex; gap: 2px; height: 4px; }
.mday em b { width: 5px; height: 4px; border-radius: 2px; background: var(--c); }
.mini.big .mday { font-size: 13.5px; border-radius: 8px; }
.mini.big .mday em b { width: 6px; height: 5px; }
.mini.big .mday em { height: 5px; }

/* ---------- Agenda (lista) ---------- */
.agenda { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; }
.ag-day { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.ag-date { text-align: center; line-height: 1.1; }
.ag-date b { display: block; font: 600 22px/1 var(--serif); color: var(--navy); }
.ag-date span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ag-day.today .ag-date b { color: var(--gold-deep); }
.ag-day.today .ag-date span::after { content: ' · hoje'; color: var(--gold-deep); font-weight: 600; }
.ag-day.past { opacity: .55; }
.ag-items, .dlg-list { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ag-item {
  display: flex; align-items: baseline; gap: 6px; width: 100%; text-align: left;
  border: 0; border-left: 3px solid var(--c); background: var(--cs); border-radius: 5px; padding: 5px 8px; color: var(--navy-deep);
}
.ag-item > span:not(.utag) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ag-item small { flex: none; color: var(--muted); font-size: 11px; }
.ag-item:hover { background: var(--c); color: #fff; }
.ag-item:hover small { color: rgba(255, 255, 255, .85); }
.ag-item:hover .utag { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------- 3 meses ---------- */
.quarter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.qcol { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 4px solid var(--navy); }
.qcol.current { border-top-color: var(--gold); }
.qcol header { margin-bottom: 12px; min-height: 52px; }
.qcol header small { display: block; color: var(--muted); font-size: 12px; }
.qtitle { border: 0; background: none; padding: 0; font: 600 24px/1.2 var(--serif); color: var(--navy); }
.qtitle:hover { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Ano ---------- */
.ystats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ystats > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ystats b { display: block; font: 600 28px/1.1 var(--serif); color: var(--navy); }
.ystats span { font-size: 12px; color: var(--muted); }
.ystat-btn { border: 0; background: none; padding: 0; text-align: left; width: 100%; }
.ystat-btn:hover b { color: #B4523A; }

.timeline { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; --label: 178px; }
.timeline h2 { font-size: 20px; margin-bottom: 10px; }
.tl-body { position: relative; }
.tl-row, .tl-months { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); align-items: center; }
.tl-row { border-top: 1px solid #EEF0F4; }
.tl-label { font-size: 12.5px; display: flex; align-items: center; gap: 7px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tl-track { position: relative; height: 28px; }
.tl-months .tl-track { display: flex; height: 26px; }
.tl-months button { border: 0; background: none; padding: 0; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; position: relative; z-index: 2; }
.tl-months button:hover { color: var(--navy); text-decoration: underline; }
.tl-mark { position: absolute; top: 6px; height: 16px; min-width: 5px; border: 0; padding: 0; border-radius: 3px; background: var(--c); opacity: .9; z-index: 2; }
.tl-mark.past { opacity: .45; }
.tl-mark:hover { opacity: 1; outline: 2px solid var(--navy-deep); outline-offset: 1px; z-index: 3; }
.tl-overlay { position: absolute; inset: 0; padding-left: var(--label); pointer-events: none; }
.tl-overlay .tl-track { display: flex; height: 100%; }
.tl-overlay i:not(.tl-today) { border-left: 1px dashed #D5D9E2; }
.tl-today { position: absolute; top: 20px; bottom: 0; width: 2px; background: var(--gold); z-index: 1; }
.tl-today span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--navy-deep); font: 600 10px/1 var(--sans); font-style: normal; padding: 3px 6px; border-radius: 999px; }

.ygrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ycard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ycard.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.ycard header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ycard header em { font: italic 500 13px var(--serif); color: var(--gold-deep); }
.ycard .qtitle { font-size: 19px; }
.ycard footer { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* ---------- Rodapé, diálogo, dica ---------- */
.foot { padding: 12px 24px 18px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.foot a { color: var(--teal); }
.foot .ok::before, .foot .warn::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: #2F8F6B; }
.foot .warn::before { background: #B4523A; }

dialog { border: 0; border-radius: 14px; padding: 26px 26px 22px; width: min(480px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 24px 70px rgba(20, 29, 56, .4); }
dialog::backdrop { background: rgba(20, 29, 56, .55); }
.dlg-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.dlg-close:hover { color: var(--navy); background: var(--paper); }
.dlg-cat { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.dlg-cat i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
dialog h2 { font-size: 25px; line-height: 1.2; padding-right: 20px; }
.dlg-when { margin: 10px 0 8px; font-size: 15px; }
.dlg-meta { margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--paper); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 500; color: var(--navy); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { background: var(--navy); color: #fff; text-decoration: none; border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.btn:hover { background: var(--navy-deep); }
.dlg-raw { margin: 16px 0 0; font-size: 11.5px; color: var(--muted); }
.dlg-list { margin-top: 14px; }
.dlg-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 14px 0 12px; font-size: 14.5px; }
.dlg-facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding-top: 3px; }
.dlg-facts dd { margin: 0; }
.dlg-facts .notes { white-space: pre-wrap; }
.edit-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.danger-btn { border: 1px solid #B4523A; background: none; color: #B4523A; border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.danger-btn:hover, .danger-btn.solid { background: #B4523A; color: #fff; }
.danger-btn.solid:hover { background: #8E3B27; }
button.btn { border: 0; }

.form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); min-width: 0; }
.form label > input, .form label > select, .form label > textarea { display: block; margin-top: 4px; }
.form label small, .form legend small { font-weight: 400; color: var(--muted); }
.form input:not([type=checkbox]), .form select, .form textarea {
  font: 400 14.5px var(--sans); color: var(--ink); background: #fff; border: 1px solid #BFC4D1; border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold-deep); }
.form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form legend { font-size: 12.5px; font-weight: 600; color: var(--navy); padding: 0; margin-bottom: 4px; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; color: var(--ink); }
.form-error { margin: 0; color: #8E3B27; background: #F6E6E1; border-radius: 8px; padding: 8px 10px; font-size: 13px; }

.log { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow: auto; font-size: 13px; }
.log li { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.log-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.log-delete .log-what { color: #8E3B27; }
.log .link-btn { padding: 0; text-align: left; }
dialog { max-height: calc(100vh - 32px); overflow: auto; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--navy-deep); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 500; box-shadow: 0 10px 30px rgba(20, 29, 56, .4); max-width: calc(100vw - 32px); text-align: center; }

.tip { position: fixed; z-index: 50; max-width: 300px; background: var(--navy-deep); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.35; pointer-events: none; box-shadow: 0 8px 24px rgba(20, 29, 56, .35); }
.tip b { display: block; font-weight: 600; }
.tip > span { display: block; opacity: .75; }
.tip-ev { display: flex; gap: 6px; align-items: baseline; margin-top: 4px; }
.tip-ev i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tip .cat-avaliacao { --c: #A1D4F2; }

/* ---------- Telas menores ---------- */
@media (max-width: 1180px) {
  .ygrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .month-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 980px) {
  .month-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .quarter { grid-template-columns: minmax(0, 1fr); }
  .ygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { order: 3; flex: 1 1 100%; }
  .top { flex-wrap: wrap; gap: 10px 14px; padding: 10px 16px; }
  .toolbar, main, .foot { padding-left: 16px; padding-right: 16px; }
  .cats { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .filters { max-width: 100%; }
}
@media (max-width: 720px) {
  .month-wide { display: none; }
  .month-narrow { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
  .period h1 { font-size: 23px; }
  .brand-text small { display: none; }
  .views button { padding: 7px 12px; }
  .timeline { --label: 0px; padding: 12px; }
  .timeline .tl-label { display: none; }
  .tl-row, .tl-months { grid-template-columns: minmax(0, 1fr); }
  .ystats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ystats b { font-size: 22px; }
  .tl-months button { font-size: 9.5px; letter-spacing: 0; }
  .tip { max-width: 240px; }
}
@media (max-width: 460px) {
  .form-row { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr; gap: 0; }
  .ygrid { grid-template-columns: minmax(0, 1fr); }
  .ycard .mday { font-size: 14px; }
}

@media print {
  .top { position: static; }
  .views, .search, .filters, .foot, .icon-btn, #today, .side { display: none !important; }
  body { background: #fff; }
  .month-layout { grid-template-columns: 1fr; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.pw-banner { background: #FFF6DF; color: #6B4E0F; border-bottom: 1px solid #E9D49B; padding: 8px 24px; font-size: 13px; text-align: center; }
.users { list-style: none; margin: 14px 0; padding: 0; font-size: 13.5px; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.u-who { display: flex; flex-direction: column; min-width: 0; }
.u-who small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.u-act { display: flex; gap: 10px; }
.link-btn.danger { color: #B4523A; }
.form h3 { margin: 6px 0 0; font: 600 17px var(--serif); color: var(--navy); }
.form-ok { margin: 0 0 6px; color: #1F6B4F; background: #E0F1EA; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
