@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --blue: #0056b3;
  --blue-dark: #00458f;
  --blue-soft: #e8f1fb;
  --ink: #172033;
  --muted: #637086;
  --line: #e5eaf1;
  --surface: #fff;
  --page: #f4f7fb;
  --danger: #b42318;
  --radius: 18px;
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); margin: 8px 0 0; }
.small { font-size: 13px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 800; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 4px 12px rgba(0, 86, 179, .16); }
.button-primary:hover { background: var(--blue-dark); }
.button-outline { color: var(--blue); background: #fff; border-color: #c9d8e9; }
.button-outline:hover, .button-quiet:hover { background: var(--blue-soft); }
.button-quiet { color: #44536a; background: transparent; }
.button-danger-quiet { color: var(--danger); background: #fff5f4; border-color: #f4d2cf; }
.button-wide { width: 100%; margin-top: 7px; }

.login-page { display: flex; flex-direction: column; align-items: center; padding: 24px 24px 0; background: radial-gradient(circle at 20% 10%, #e3effc 0, transparent 40%), var(--page); }
.login-shell { display: grid; flex: 1; place-items: center; width: min(100%, 440px); }
.login-card { padding: 42px; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: 0 20px 65px rgba(22, 54, 91, .12); }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 15px; color: #fff; background: var(--blue); font-size: 25px; font-weight: 800; box-shadow: 0 8px 20px rgba(0, 86, 179, .2); }
.login-logo { display: block; width: 168px; height: 76px; margin: -6px 0 15px; padding: 8px; border-radius: 16px; object-fit: contain; object-position: left center; background: #17345a; }
.brand-logo { display: block; width: 58px; height: 48px; padding: 4px; border-radius: 12px; object-fit: contain; background: #17345a; }
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.login-card > .muted { margin: 8px 0 28px; font-size: 14px; }
.stack-form { display: grid; gap: 17px; }
.stack-form label, .field, .month-picker { display: grid; gap: 8px; color: #38465b; font-size: 12px; font-weight: 800; }
.stack-form input, .field input, .field textarea, .month-picker input { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #d9e1eb; border-radius: 12px; outline: none; color: var(--ink); background: #fff; font-size: 14px; font-weight: 500; transition: border .15s, box-shadow .15s; }
.stack-form input:focus, .field input:focus, .field textarea:focus, .month-picker input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.login-forgot { display: inline-flex; margin-top: 21px; color: var(--blue); font-size: 13px; font-weight: 800; text-decoration: none; }
.login-forgot:hover { text-decoration: underline; }
.login-footnote { margin: 28px 0 0; color: #8290a4; font-size: 11px; line-height: 1.6; }
.form-alert, .inline-alert, .dialog-alert { padding: 12px 14px; border: 1px solid #f1cbc7; border-radius: 12px; color: #8d1d16; background: #fff4f2; font-size: 13px; line-height: 1.5; }
.form-alert { margin: -8px 0 18px; }

.topbar { display: flex; height: 76px; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 5vw, 70px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 14px; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 11px; }
.main-nav { display: flex; align-items: center; gap: 5px; }
.main-nav a { padding: 9px 13px; border-radius: 999px; color: #526178; font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.main-nav a:hover { background: #f3f6fa; }
.main-nav a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
.topbar-actions, .heading-actions { display: flex; align-items: center; gap: 10px; }
.mobile-settings-link { display: none; }
.heading-actions { align-items: flex-end; }
.event-actions { display: flex; min-width: 0; align-items: center; gap: 8px; }
.event-actions #add-event { white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 8px 12px; border-radius: 99px; color: #46546a; background: #f4f7fb; font-size: 12px; font-weight: 700; }
.user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot, .legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #2caa72; }
.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 38px clamp(18px, 5vw, 70px) 54px; }
.app-page .page-content { padding-top: 30px; }
.app-page .page-heading { padding: 24px 26px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(135deg, #fff 0%, #f8fbff 100%); box-shadow: 0 10px 28px rgba(22,54,91,.06); }
.app-page .summary-card { border-radius: 18px; box-shadow: 0 8px 24px rgba(22,54,91,.04); }
.app-page .calendar-card { border-radius: 22px; border-color: #cfe0f4; background: linear-gradient(180deg,#f7fbff,#fff); box-shadow: 0 12px 32px rgba(22,54,91,.07); }
.app-page .calendar-title-row { margin-bottom: 16px; }
  .app-page .event-chip { border-left: 4px solid var(--blue) !important; border-radius: 13px; background: #fff; box-shadow: 0 3px 10px rgba(22,54,91,.045); }
.app-page .calendar-day { border-radius: 16px; }
.event-title-field > textarea.event-title-input { min-height: 44px; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-footer { margin-top: 8px; border-top: 1px solid var(--line); background: var(--surface); }
.support-footer-inner { width: min(1440px, 100%); min-height: 76px; margin: 0 auto; padding: 16px clamp(18px, 5vw, 70px); display: flex; justify-content: center; align-items: center; gap: 11px; color: var(--muted); font-size: 13px; }
.support-footer-icon { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 17px; font-weight: 800; }
.support-footer strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 13px; }
.support-footer-links { display: flex; flex-wrap: wrap; gap: 6px; }
.support-footer a { color: var(--muted); font-weight: 700; text-decoration: none; }
.support-footer a:hover { color: var(--blue); text-decoration: underline; }
.login-page .support-footer { width: 100vw; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.page-heading h1 { margin: 0; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.045em; }
.page-heading .muted { font-size: 13px; }
.month-picker { width: 180px; }
.month-picker input { padding: 9px 12px; min-height: 42px; }
.summary-row { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 13px; margin-bottom: 20px; }
.summary-card { display: flex; min-height: 90px; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.summary-card > div { display: grid; gap: 5px; min-width: 0; }
.summary-icon { display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 19px; font-weight: 800; }
.summary-icon-soft { color: #7586a0; background: #f1f4f8; }
.summary-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-card strong { font-size: 14px; line-height: 1.45; }
.summary-note strong { font-size: 12px; font-weight: 600; }
.calendar-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 28px rgba(22, 54, 91, .035); }
.calendar-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.calendar-title-row h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.legend-dot { background: var(--blue); }
.calendar-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; transition: opacity .15s ease; }
.calendar-grid.is-loading { opacity: .5; pointer-events: none; }
.weekday { padding: 0 9px 5px; color: #748196; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.calendar-day { display: flex; min-height: 136px; flex-direction: column; align-items: stretch; gap: 7px; padding: 10px; overflow: visible; border: 1px solid var(--line); border-radius: 14px; text-align: left; background: #fff; }
.calendar-day-clickable { cursor: pointer; }
.calendar-day-clickable:hover { border-color: #aec9e7; background: #fbfdff; box-shadow: 0 4px 14px rgba(22, 54, 91, .06); }
.calendar-day:not(.outside-month):hover { border-color: #aec9e7; background: #fbfdff; }
.calendar-day.outside-month { opacity: .36; background: #f7f9fb; }
.day-number { align-self: flex-start; display: grid; min-width: 26px; height: 26px; place-items: center; border-radius: 50%; color: #526178; font-size: 12px; font-weight: 800; }
.day-add { margin-top: auto; padding: 7px 4px; border: 0; border-radius: 8px; color: #96a1b2; text-align: left; background: transparent; font-size: 10px; font-weight: 700; }
.day-add:hover, .day-add:focus-visible { color: var(--blue); background: var(--blue-soft); }
.event-chip { display: grid; gap: 4px; padding: 9px; border: 1px solid #d0e1f4; border-left: 3px solid var(--blue); border-radius: 10px; color: var(--ink); text-align: left; background: #f1f7fd; }
.event-chip:hover { border-color: #9fc2e8; background: #eaf3fc; }
.event-time { color: var(--blue); font-size: 10px; font-weight: 800; }
.event-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: 11px; font-weight: 800; line-height: 1.4; }
.event-venue { color: var(--muted); font-size: 10px; }
.page-caption { margin: 15px 4px 0; color: #8a96a8; font-size: 11px; }

.event-dialog { width: min(680px, calc(100% - 28px)); max-height: min(92vh, 840px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(13, 37, 66, .24); }
.event-dialog::backdrop { background: rgba(20, 35, 54, .45); backdrop-filter: blur(3px); }
.reference-dialog { display: flex; width: min(680px, calc(100% - 28px)); max-height: min(88vh, 760px); flex-direction: column; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(13, 37, 66, .24); overscroll-behavior: contain; }
.reference-dialog:not([open]) { display: none; }
.reference-dialog::backdrop { background: rgba(20, 35, 54, .45); backdrop-filter: blur(3px); }
.reference-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 24px 8px; }
.reference-dialog-header h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.reference-dialog-body { display: grid; min-height: 0; grid-template-rows: auto auto minmax(110px, auto) auto auto; gap: 14px; overflow: hidden; padding: 8px 24px 24px; overscroll-behavior: contain; }
.reference-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #f5f8fc; }
.reference-tabs [role="tab"] { flex: 1 0 auto; min-height: 38px; padding: 0 12px; border: 0; border-radius: 10px; color: #596a82; background: transparent; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.reference-tabs [role="tab"][aria-selected="true"] { color: var(--blue); background: #e5f0fc; box-shadow: 0 1px 4px rgba(24, 64, 105, .08); }
.reference-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.reference-list { display: grid; min-height: 110px; max-height: min(38vh, 300px); align-content: start; gap: 7px; overflow-y: auto; overscroll-behavior: contain; padding: 0 3px 0 0; scrollbar-width: thin; scrollbar-color: #c5d2e1 transparent; }
.reference-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.reference-item-name { min-width: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.reference-item-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.reference-item-actions .button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.reference-item-actions .button { visibility: visible; opacity: 1; transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease; }
.reference-item-actions .button:active { transform: scale(.97); }
.reference-empty { margin: 0; padding: 18px 12px; border: 1px dashed #cbd7e5; border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.reference-status { padding: 10px 12px; border: 1px solid #cfe1f4; border-radius: 11px; color: #245785; background: #f0f7ff; font-size: 13px; }
.reference-status[hidden] { display: none; }
.reference-form { display: grid; gap: 8px; padding: 14px 10px 4px; border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -8px 18px rgba(22, 54, 91, .035); }
.reference-form label { color: #38465b; font-size: 12px; font-weight: 750; }
.reference-form input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid #d9e1eb; border-radius: 11px; outline: none; color: var(--ink); background: #fff; font: inherit; font-size: 14px; }
.reference-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.reference-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.catalog-save-button { display: inline-flex; justify-self: start; width: auto; min-width: 0; min-height: 28px; align-items: center; padding: 0 3px; border: 0; border-radius: 6px; color: #8290a2; background: transparent; box-shadow: none; font-size: 10px; font-weight: 600; opacity: 0; transform: translateY(-2px); transition: color .16s ease, background-color .16s ease, opacity .16s ease, transform .16s ease; }
.catalog-save-button.is-visible { opacity: .78; transform: translateY(0); }
.catalog-save-button:hover, .catalog-save-button:focus-visible { color: #53657c; background: #f5f8fc; opacity: 1; }
.catalog-save-button:active { transform: scale(.98); }
.catalog-save-button:focus-visible { outline: 3px solid rgba(0, 86, 179, .2); outline-offset: 2px; }
.event-title-field { position: relative; }
.event-title-suggestions { position: absolute; z-index: 35; top: calc(100% - 4px); right: 0; left: 0; display: grid; max-height: 180px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 10px 24px rgba(22, 54, 91, .13); }
.event-title-suggestions[hidden] { display: none; }
.event-title-suggestion { padding: 9px 11px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.event-title-suggestion:hover, .event-title-suggestion:focus { outline: none; background: #eef5fc; }
.catalog-open-trigger { width: 42px; min-width: 42px; min-height: 42px; padding: 0; }
.catalog-open-trigger svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.event-dialog form { display: flex; max-height: inherit; min-height: 0; flex-direction: column; padding: 0; }
.dialog-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #b9c5d4 transparent; padding: 0 24px 8px; }
.dialog-scroll::-webkit-scrollbar { width: 8px; }
.dialog-scroll::-webkit-scrollbar-track { margin-block: 6px; background: transparent; }
.dialog-scroll::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: #b9c5d4; background-clip: padding-box; }
.dialog-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; padding: 24px 24px 0; }
.dialog-header h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: #66748a; background: #f2f5f8; font-size: 23px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid > label { display: grid; min-width: 0; align-content: start; gap: 7px; color: #38465b; font-size: 13px; font-weight: 700; line-height: 1.4; }
.form-grid-field { display: grid; min-width: 0; align-content: start; gap: 7px; }
.form-grid-field > textarea { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 10px 13px; border: 1px solid #d9e1eb; border-radius: 12px; outline: none; color: var(--ink); background: #fff; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.45; transition: border .15s, box-shadow .15s; }
.form-grid-field > textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.form-grid-field > textarea::placeholder { color: #94a0b1; opacity: 1; }
.catalog-save-button { justify-self: start; margin-top: 2px; }
.catalog-save-button[hidden] { display: none; }
.form-grid-field > label { color: #38465b; font-size: 13px; font-weight: 700; line-height: 1.4; }
.form-grid > label > input, .form-grid > label > textarea,
.form-grid > label > .native-date-control > input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 13px; border: 1px solid #d9e1eb; border-radius: 12px; outline: none; color: var(--ink); background: #fff; font-size: 14px; font-weight: 500; line-height: 1.45; transition: border .15s, box-shadow .15s; }
.form-grid > label > input:not([type="date"]):not([type="month"]):not([type="time"]):not([type="datetime-local"]):not([type="week"]),
.form-grid > label > textarea { display: block; }
.form-grid > label > textarea { min-height: 96px; resize: vertical; }
.form-grid > label > input:focus, .form-grid > label > textarea:focus,
.form-grid > label > .native-date-control > input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.form-grid > label > input::placeholder, .form-grid > label > textarea::placeholder { color: #94a0b1; opacity: 1; }
.field-span-2 { grid-column: 1 / -1; }
.reference-status { color: var(--muted); font-size: 12px; font-weight: 500; }
.multi-combobox { position: relative; display: flex; min-height: 46px; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #d9e1eb; border-radius: 12px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; }
.multi-combobox:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.multi-combobox.is-limit-reached { border-color: #d92d20; box-shadow: 0 0 0 3px rgba(217, 45, 32, .1); }
.combobox-chips { display: contents; }
.combobox-chip { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; padding: 5px 8px 5px 10px; border: 1px solid #d6e6f8; border-radius: 999px; color: #174576; background: #eef6ff; font-size: 12px; font-weight: 600; line-height: 1.25; }
.combobox-chip span { overflow-wrap: anywhere; }
.combobox-chip button { display: grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--ink); background: transparent; font: inherit; font-size: 14px; font-weight: 500; line-height: 1; cursor: pointer; }
.combobox-chip button:hover { color: #000; background: transparent; }
.combobox-chip button:focus-visible { color: #000; background: transparent; outline: 2px solid rgba(0, 86, 179, .35); outline-offset: 1px; }
.combobox-input { flex: 1 1 180px; width: auto; min-width: 120px; min-height: 30px; padding: 3px 2px; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; font-size: 14px; font-weight: 500; }
.combobox-input::placeholder { color: #94a0b1; opacity: 1; }
.combobox-suggestions { position: absolute; z-index: 30; top: calc(100% + 5px); right: 0; left: 0; max-height: min(150px, 28vh); overflow: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid #d9e1eb; border-radius: 12px; background: #fff; box-shadow: 0 8px 20px rgba(22, 54, 91, .08); }
.combobox-option { display: block; width: 100%; min-height: 32px; padding: 5px 10px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; font-size: 13px; line-height: 1.35; text-align: left; cursor: pointer; }
.combobox-option:hover, .combobox-option[aria-selected="true"] { color: var(--ink); background: var(--page); }
.combobox-option-manual { margin-top: 4px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.combobox-empty { padding: 10px 11px; color: var(--muted); font-size: 13px; }
.dialog-footer { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; margin-top: 0; padding: 16px 24px 24px; border-top: 1px solid var(--line); background: #fff; }
.spacer { flex: 1; }
.dialog-alert { margin-top: 16px; }
.dialog-alert[hidden], .inline-alert[hidden] { display: none; }

.settings-content { max-width: 1440px; }
.settings-heading { align-items: center; }
.settings-heading .button { flex: 0 0 auto; }
.settings-form { display: grid; gap: 14px; }
.settings-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(22, 54, 91, .035); }
.settings-section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.settings-section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.settings-section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-step { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 800; }
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-fields .field-wide { grid-column: 1 / -1; }
.settings-fields .field textarea { min-height: 92px; resize: vertical; }
.field-invalid input, .field-invalid textarea { border-color: #d92d20 !important; }
.field-invalid small { color: #b42318; font-size: 11px; font-weight: 700; }
.settings-notice { margin-bottom: 16px; padding: 13px 16px; border: 1px solid #b7e3cc; border-radius: 12px; color: #176b42; background: #effaf4; font-size: 13px; font-weight: 700; }
.settings-error { display: grid; gap: 4px; margin: 0 0 16px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 2px 10px; }
.month-select-card { display: flex; align-items: end; gap: 20px; margin-bottom: 14px; }
.month-select-card .month-picker { width: 190px; flex: 0 0 auto; }
.month-select-card > .muted { margin: 0 0 10px; }
.approval-date-form { display: grid; grid-template-columns: minmax(220px, 380px) auto; align-items: end; gap: 12px; }
.approval-date-form .field { width: 100%; }
.approval-date-form .button { justify-self: start; }
.week-theme-list, .monthly-item-list { display: grid; gap: 12px; }
.week-theme-card, .monthly-item-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.week-theme-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.week-theme-heading strong { font-size: 13px; }
.week-theme-heading span { color: var(--muted); font-size: 12px; }
.managed-row { display: flex; align-items: start; gap: 8px; margin-top: 8px; }
.managed-edit-form { display: grid; min-width: 0; flex: 1; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.managed-edit-form > input, .monthly-item-form input, .monthly-item-form textarea { width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px; border: 1px solid #d9e1eb; border-radius: 11px; outline: none; color: var(--ink); background: #fff; font-size: 13px; font-weight: 500; }
.managed-edit-form > input:focus, .monthly-item-form input:focus, .monthly-item-form textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
.theme-create-form { margin-top: 10px; }
.button-small { min-height: 38px; padding: 0 14px; font-size: 12px; }
.monthly-item-card { display: grid; gap: 10px; }
.monthly-item-card h3 { margin: 0; font-size: 14px; }
.monthly-item-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(210px, 1fr); align-items: start; gap: 13px; }
.monthly-item-form .field { min-width: 0; }
.monthly-item-form textarea { min-height: 74px; resize: vertical; }
.monthly-item-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.monthly-delete-form { display: flex; justify-content: flex-end; }
.monthly-item-new { margin-top: 13px; border-color: #d0e1f4; background: #f5f9fe; }
.empty-state { margin: 0 0 14px; padding: 16px; border-radius: 12px; color: var(--muted); background: #f6f8fb; font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.print-page { background: #fff; }
.print-toolbar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 12px; padding: 12px max(18px, calc((100vw - 1150px) / 2)); border-bottom: 1px solid var(--line); background: #fff; }
.print-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.print-document { width: min(1150px, calc(100% - 40px)); margin: 26px auto 40px; color: #111; font-family: "Times New Roman", Times, serif; font-size: 11pt; }
.print-header { min-height: 128px; text-align: center; }
.print-header h1 { max-width: 760px; margin: 10px auto 4px; font-size: 20px; line-height: 1.3; }
.print-header > p { margin: 0; font-size: 20px; font-weight: 700; }
.approval { width: fit-content; margin: 8px 0 0 auto; text-align: right; font-size: 11pt; line-height: 1.45; }
.approval-signature-line { display: inline-block; width: 120px; margin-right: 4px; border-bottom: 1px solid #111; vertical-align: baseline; }
.monthly-section { margin: 8px 0 18px; }
.monthly-heading { margin: 0 0 8px; font-size: 11pt; }
.monthly-responsible { width: 100%; border-collapse: collapse; table-layout: fixed; }
.monthly-responsible th, .monthly-responsible td { height: 25px; border: 1px solid #111; padding: 3px 7px; font-size: 11pt; font-weight: 400; text-align: left; }
.monthly-responsible thead th { font-weight: 700; }
.monthly-responsible th:first-child, .monthly-responsible td:first-child { width: 66.67%; }
.monthly-responsible th:last-child, .monthly-responsible td:last-child { width: 33.33%; }
.monthly-note { margin: 20px 0 0; font-size: 11pt; font-weight: 700; }
.print-calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-calendar th, .print-calendar td { border: 1px solid #7e8792; vertical-align: top; }
.print-calendar th { padding: 6px 4px; background: #edf2f8; font-size: 14pt; }
.print-calendar td { padding: 5px; font-size: 11pt; line-height: 1.25; }
.print-calendar .print-date-row td { padding: 4px; text-align: center; vertical-align: middle; }
.print-calendar .print-theme-row td { padding: 4px; text-align: center; vertical-align: middle; }
.print-calendar .print-content-row td { height: 100px; }
.print-date { margin: 0; color: #0056b3; font-size: 14pt; font-weight: 400; }
.print-weekday { font-size: 14pt; font-weight: 400; }
.outside-month .print-date { color: #818a96; }
.print-theme { display: block; margin: 0; padding: 0; border: 0; font-size: 11pt; font-style: italic; font-weight: 700; line-height: 1.2; }
.print-event { display: block; font-weight: 400 !important; line-height: 1.15; }
.print-event + .print-event { margin-top: 12px; }
.print-event-title { font-size: 12pt; font-weight: 400 !important; line-height: 1.15; }
.print-event p { margin: 2px 0 0; font-size: 10pt; font-weight: 400 !important; line-height: 1.15; }
.print-event p b, .print-event p strong { font-weight: 400 !important; }
.print-time { color: #111; font-size: 12pt; font-weight: 400 !important; line-height: 1.15; white-space: nowrap; }
.print-time sup { position: relative; top: -.12em; margin-left: 1px; font-size: 75%; line-height: 0; vertical-align: super; font-weight: 400 !important; }
.signatures { display: grid; justify-items: center; gap: 10px; margin-top: 22px; font-size: 14pt; font-weight: 700; }
.signature-row { display: flex; max-width: 100%; align-items: baseline; justify-content: center; gap: 6px; white-space: nowrap; }
.signature-line { display: inline-block; width: 105px; flex: 0 0 105px; border-bottom: 1px solid #222; }
.signatures strong { font-weight: 700; }
.mobile-date { display: none; }

@media screen and (max-width: 734px) {
  .app-page .page-heading { padding: 18px; border-radius: 18px; }
  .app-page .calendar-card { padding: 14px; }
  .print-calendar, .print-calendar tbody, .print-calendar tr { display: block; width: 100%; }
  .print-calendar tbody.calendar-week { margin: 0 0 14px; }
  .print-calendar .print-date-row { display: none; }
  .print-calendar .print-theme-row { display: block; }
  .print-calendar .print-theme-row td { display: block; width: 100%; padding: 9px 12px; border: 1px solid #7e8792; border-radius: 12px 12px 0 0; }
  .print-calendar .print-content-row { display: block; }
  .print-calendar .print-content-row td { display: block; width: 100%; height: auto; min-height: 58px; margin-top: -1px; padding: 10px 12px; border: 1px solid #cbd4df; background: #fff; }
  .print-calendar .print-content-row td:first-child { border-radius: 12px 12px 0 0; }
  .print-calendar .print-content-row td:last-child { border-radius: 0 0 12px 12px; }
  .print-calendar .mobile-date { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 8px; color: #172033; font-size: 14pt; font-weight: 400; }
  .print-calendar .mobile-date span:last-child { color: #637086; font-size: 13px; font-weight: 500; }
  .print-calendar .print-event { display: block; }
  .print-calendar .print-event + .print-event { margin-top: 12px; padding-top: 0; border-top: 0; }
}

/* Keep room-conflict feedback visible above the event dialog on touch browsers. */
@media screen {
  #toast-region { position: fixed; z-index: 3000; }
  .floating-toast { z-index: 3001; }
  .event-dialog #toast-region {
    position: absolute; inset: 12px 12px auto; z-index: 3001;
    display: flex; justify-content: center; width: auto; height: auto;
    padding: 0; pointer-events: none;
  }
}

/* Shared decorative treatment for the planning and preview surfaces. */
@media screen {
  body.app-page, body.print-page { position: relative; isolation: isolate; }
  body.app-page::before, body.print-page::before {
    content: ""; position: fixed; z-index: -1; pointer-events: none;
    width: min(560px, 68vw); aspect-ratio: 1; right: -190px; top: 18vh;
    border-radius: 50%; border: 1px solid rgba(0, 86, 179, .07);
    box-shadow: 0 0 0 28px rgba(0, 86, 179, .025), 0 0 0 64px rgba(0, 86, 179, .018);
    background: radial-gradient(circle at center, rgba(222,238,255,.30), rgba(255,255,255,0) 68%);
  }
  .app-page .page-heading { position: relative; overflow: hidden; }
  .app-page .page-heading::after {
    content: ""; position: absolute; width: 190px; height: 190px; right: -58px; bottom: -145px;
    border: 1px solid rgba(0,86,179,.10); border-radius: 50%;
    box-shadow: 0 0 0 16px rgba(0,86,179,.035), 0 0 0 38px rgba(0,86,179,.022);
    pointer-events: none;
  }
  .app-page .heading-actions { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 8px; }
  .app-page .heading-actions > * { min-width: 0; }
  .app-page .heading-actions .button { flex: 0 0 auto; width: auto; min-height: 42px; padding: 0 14px; font-size: 12px; line-height: 1; text-align: center; white-space: nowrap; }
  .app-page .month-picker { flex: 0 0 156px; width: 156px; min-width: 156px; }
  .app-page .heading-actions #add-event { min-width: 156px; }
  .print-page .print-filter-bar { position: relative; overflow: hidden; }
}
@media screen and (min-width: 735px) and (max-width: 1180px) {
  .app-page .page-heading { align-items: stretch; flex-direction: column; }
  .app-page .heading-actions { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media screen and (max-width: 734px) {
  .app-page .heading-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .app-page .heading-actions .button, .app-page .heading-actions .month-picker { width: 100%; min-width: 0; }
  .app-page .heading-actions .button { min-height: 42px; white-space: nowrap; }
}

/* Clearer controls for the print-preview filters and settings forms. */
@media screen {
  .settings-fields .field input,
  .settings-fields .field textarea { font-size: 14px; line-height: 1.45; }
  .managed-edit-form > input,
  .monthly-item-form input,
  .monthly-item-form textarea,
  .approval-date-form input { font-size: 14px; line-height: 1.45; }
  .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1.5fr) minmax(180px, .75fr) auto auto;
  }
  .print-filter-bar .print-filter-reset {
    display: inline-flex; min-height: 42px; align-items: center; justify-content: center;
    padding: 0 14px; border-color: #c9d8e9; color: #40536d; background: #f7f9fc;
    font-size: 12px; font-weight: 750; white-space: nowrap;
  }
  .print-filter-bar .print-filter-reset:hover { border-color: #a9c5e4; color: var(--blue); background: var(--blue-soft); }
}

@media screen and (max-width: 734px) {
  .topbar .print-actions-menu > summary,
  .print-topbar .print-actions-menu > summary {
    min-height: 48px; gap: 9px; padding: 0 16px; font-size: 14px;
  }
  .topbar .print-actions-menu > summary svg,
  .print-topbar .print-actions-menu > summary svg { width: 20px; height: 20px; }
  .topbar .print-user-menu > summary { width: 44px; height: 44px; font-size: 17px; }
  .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
  .print-filter-bar .print-filter-search { grid-column: 1 / -1; }
  .print-filter-bar .print-filter-date { grid-column: 1; }
  .print-filter-bar .print-filter-submit { grid-column: 2; grid-row: auto; width: 100%; min-height: 46px; }
  .print-filter-bar .print-filter-reset { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .settings-fields .field input,
  .settings-fields .field textarea,
  .managed-edit-form > input,
  .monthly-item-form input,
  .monthly-item-form textarea,
  .approval-date-form input { font-size: 16px; }
}

@media screen and (max-width: 380px) {
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { grid-column: 1; grid-row: auto; }
}

/* Mobile print filters use a single track so native date controls cannot push the action button out of view. */
@media screen and (max-width: 734px) {
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px; }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { grid-column: 1; grid-row: auto; width: 100%; min-width: 0; }
  .print-filter-bar .print-filter-submit { min-height: 46px; }
  .print-filter-bar .print-filter-reset { min-height: 44px; }
  .print-filter-bar .print-filter-date input { width: 100%; min-width: 0; max-width: 100%; }
}

@media screen {
  .print-event { padding: 12px; }
  .print-time { margin: 3px 0 8px; padding: 5px 9px; border-radius: 9px; }
}

/* Align the themes/settings pages with the main plan and keep their actions tidy. */
@media screen {
  .theme-managed-row { align-items: end; }
  .theme-managed-row .managed-edit-form { align-items: end; }
  .theme-managed-row > form:last-child { align-self: end; }
  .theme-create-form { align-items: end; }
}

@media screen and (max-width: 734px) {
  .reference-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .reference-dialog-header { padding: 16px 16px 8px; }
  .reference-dialog-header h2 { font-size: 21px; }
  .reference-dialog-body { grid-template-rows: auto auto minmax(96px, 1fr) auto auto; gap: 12px; padding: 8px 16px 16px; }
  .reference-tabs { gap: 3px; }
  .reference-tabs [role="tab"] { min-height: 42px; padding: 0 10px; }
  .reference-item { align-items: flex-start; flex-direction: column; gap: 8px; }
  .reference-item-actions { width: 100%; }
  .reference-item-actions .button { flex: 1 1 0; min-height: 40px; }
  .reference-form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .reference-form-actions .button { min-height: 44px; }
  .app-page .heading-actions .event-actions { display: flex; width: 100%; min-width: 0; align-items: center; gap: 8px; }
  .app-page .heading-actions .event-actions #add-event { flex: 1 1 auto; width: auto; min-width: 0; }
  .app-page .heading-actions .event-actions .catalog-open-trigger { flex: 0 0 42px; justify-self: auto; width: 42px; min-width: 42px; padding: 0; }
  .catalog-save-button { justify-self: start; width: auto; min-width: 0; min-height: 32px; padding: 0 3px; white-space: normal; line-height: 1.25; text-align: left; }
  .settings-content { width: 100%; max-width: 1440px; }
  .settings-content .settings-heading > .button { width: 100%; align-self: stretch; }
  .settings-content .settings-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .settings-content .settings-actions > .button { width: 100%; }
  .theme-managed-row { align-items: stretch; }
  .theme-managed-row .managed-edit-form,
  .theme-create-form { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr); }
  .theme-managed-row .managed-edit-form > .button,
  .theme-create-form > .button { width: 100%; min-height: 44px; }
  .theme-managed-row > form:last-child { display: grid; width: 100%; }
  .theme-managed-row > form:last-child > .button { width: 100%; min-height: 44px; }
  .monthly-item-actions, .monthly-delete-form { width: 100%; }
  .monthly-item-actions > .button, .monthly-delete-form > .button { width: 100%; min-height: 44px; }
}

/* Shared form, native date-control and mobile-header sizing across app pages. */
@media screen {
  input[type="date"], input[type="month"], input[type="time"],
  input[type="datetime-local"], input[type="week"] {
    width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  }
  .managed-edit-form { align-items: end; }
  .managed-edit-form > textarea {
    display: block; width: 100%; min-width: 0; min-height: 54px; padding: 10px 12px;
    border: 1px solid #d9e1eb; border-radius: 11px; outline: none; color: var(--ink);
    background: #fff; font: inherit; font-size: 14px; line-height: 1.45; resize: vertical; overflow-wrap: anywhere;
  }
  .managed-edit-form > textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
  .settings-fields .field textarea { min-width: 0; max-width: 100%; min-height: 54px; resize: vertical; overflow-wrap: anywhere; }
  .settings-fields .field input, .settings-fields .field textarea,
  .managed-edit-form > input, .managed-edit-form > textarea,
  .monthly-item-form input, .monthly-item-form textarea { font-size: 14px; line-height: 1.45; }
  .month-picker, .approval-date-form, .print-filter-date, .form-grid > label { min-width: 0; }
}

@media screen and (max-width: 734px) {
  .topbar, .print-topbar {
    min-height: 72px; padding: 10px 14px; gap: 8px;
  }
  .topbar .brand, .print-topbar .brand { min-width: 0; gap: 9px; }
  .topbar .brand-logo, .print-topbar .brand-logo { width: 52px; height: 44px; border-radius: 13px; }
  .topbar .brand strong, .print-topbar .brand strong { font-size: 14px; }
  .topbar .brand small, .print-topbar .brand small { font-size: 11px; }
  .topbar-actions { min-width: 0; gap: 8px; }
  .topbar .print-actions-menu > summary, .print-topbar .print-actions-menu > summary {
    min-width: 96px; min-height: 50px; justify-content: center; gap: 8px; padding: 0 14px;
    border-radius: 16px; font-size: 14px; font-weight: 800;
  }
  .topbar .print-user-menu > summary { width: 46px; height: 46px; font-size: 18px; }
  .print-topbar .print-toolbar-actions .button,
  .dashboard-actions-menu .print-toolbar-actions .button,
  .dashboard-actions-menu .print-mobile-menu-links a { min-height: 48px; font-size: 14px; }
  .month-picker, .month-picker input, .approval-date-form input,
  .print-filter-bar .print-filters input[type="date"],
  .print-filter-bar .print-filters input[type="time"],
  .form-grid input[type="date"], .form-grid input[type="month"],
  .form-grid input[type="time"], .form-grid input[type="datetime-local"], .form-grid input[type="week"] {
    width: 100%; min-width: 0; max-width: 100%; min-height: 46px;
  }
  input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"], input[type="week"] { font-size: 16px; }
  .settings-fields .field input, .settings-fields .field textarea,
  .managed-edit-form > input, .managed-edit-form > textarea,
  .monthly-item-form input, .monthly-item-form textarea { min-width: 0; max-width: 100%; font-size: 16px; }
  .managed-edit-form > textarea, .settings-fields .field textarea { min-height: 58px; }
}

@media screen and (max-width: 380px) {
  .topbar, .print-topbar { padding-right: 10px; padding-left: 10px; }
  .topbar .brand, .print-topbar .brand { gap: 7px; }
  .topbar .brand-logo, .print-topbar .brand-logo { width: 48px; height: 42px; }
  .topbar .print-actions-menu > summary, .print-topbar .print-actions-menu > summary { min-width: 88px; padding: 0 10px; }
}

@media (max-width: 1050px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; flex-wrap: wrap; }
  .summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-note { grid-column: 1 / -1; }
  .calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .weekday { display: none; }
  .calendar-day { min-height: 125px; }
}
@media (max-width: 850px) {
  .topbar { height: auto; min-height: 70px; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 8px; }
  .brand { margin-right: auto; }
  .main-nav { order: 3; flex: 1 0 100%; justify-content: center; }
}
@media (max-width: 734px) {
  .topbar { display: grid; height: auto; min-height: 64px; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; padding: 9px 14px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-logo { width: 48px; height: 38px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 10px; }
  .user-chip { max-width: min(34vw, 130px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 8px; font-size: 11px; }
  .topbar-actions { gap: 2px; }
  .topbar-actions .button { min-height: 40px; padding: 0 10px; }
  .main-nav { display: none; }
  .mobile-settings-link { display: inline-flex; }
  .page-content { padding: 25px 14px 40px; }
  .page-heading { gap: 14px; margin-bottom: 20px; }
  .page-heading h1 { font-size: clamp(26px, 8vw, 34px); }
  .heading-actions { display: grid; grid-template-columns: 1fr; }
  .heading-actions > * { width: 100%; }
  .month-picker { width: 100%; grid-column: 1 / -1; }
  .summary-row { grid-template-columns: 1fr; }
  .summary-note { grid-column: auto; }
  .calendar-card { padding: 14px; }
  .calendar-title-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .calendar-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .calendar-day { display: grid; min-height: 50px; grid-template-columns: 54px minmax(0, 1fr); align-items: start; gap: 6px 8px; padding: 8px; }
  .calendar-day.outside-month { display: none; }
  .day-number { grid-row: 1 / span 2; min-width: 48px; height: 32px; border-radius: 9px; background: #f4f7fb; font-size: 12px; }
  .day-number::before { content: attr(data-weekday); margin-right: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
  .event-chip { grid-column: 2; padding: 8px; }
  .day-add { grid-column: 2; min-height: 36px; margin: 0; padding: 5px 7px; }
  .event-dialog { max-height: calc(100dvh - 16px); border-radius: 18px; }
  .event-dialog form { padding: 0; }
  .dialog-header { padding: 16px 16px 0; }
  .dialog-scroll { padding: 0 16px 8px; }
  .dialog-footer { padding: 12px 16px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .form-grid > label > input, .form-grid > label > textarea, .form-grid-field > textarea, .settings-fields input, .settings-fields textarea, .managed-edit-form > input, .monthly-item-form input, .monthly-item-form textarea, .stack-form input, .month-picker input { font-size: 16px; }
  .combobox-input { font-size: 16px; }
  .settings-fields { grid-template-columns: 1fr; }
  .settings-fields .field-wide { grid-column: auto; }
  .settings-card { padding: 17px; }
  .settings-actions { display: grid; grid-template-columns: 1fr; }
  .settings-actions .button { width: 100%; }
  .month-select-card { align-items: stretch; flex-direction: column; gap: 8px; }
  .month-select-card .month-picker { width: 100%; }
  .month-select-card > .muted { margin: 0; }
  .approval-date-form { grid-template-columns: 1fr; }
  .approval-date-form .button { width: 100%; }
  .managed-row { align-items: stretch; flex-direction: column; }
  .managed-row > form:last-child { display: flex; justify-content: flex-end; }
  .monthly-item-form { grid-template-columns: 1fr; }
  .monthly-item-actions { grid-column: auto; }
  .dialog-footer { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-footer .spacer { display: none; }
  .dialog-footer > .button-primary { grid-column: 1 / -1; grid-row: 1; }
  .dialog-footer > .button-danger-quiet { grid-column: 1; grid-row: 2; }
  .dialog-footer > [data-close-dialog] { grid-column: 2; grid-row: 2; }
  .button { min-height: 44px; }
  .print-document { width: calc(100% - 20px); margin-top: 12px; }
  .approval { width: 100%; text-align: left; }
  .print-header { min-height: auto; padding-bottom: 12px; }
  .signature-row { white-space: normal; flex-wrap: wrap; }
  .print-toolbar { align-items: flex-start; flex-direction: column; padding: 10px; }
  .print-toolbar-actions { width: 100%; justify-content: stretch; }
  .print-toolbar-actions .button { flex: 1 1 auto; }
  .login-page { min-height: 100svh; padding: 14px; }
  .login-card { padding: 26px 20px; border-radius: 20px; }
  .login-logo { width: 148px; height: 68px; margin-bottom: 13px; }
  .login-card h1 { font-size: clamp(24px, 7vw, 28px); line-height: 1.2; }
  .login-card > .muted { margin-bottom: 22px; }
  .stack-form { gap: 14px; }
  .stack-form input { font-size: 16px; }
  .login-footnote { margin-top: 22px; }
}

@page { size: A4 landscape; margin: 10mm; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-document { width: 100%; margin: 0; }
  .print-header { min-height: 104px; }
  .approval { width: fit-content; margin: 8px 0 0 auto; text-align: right; }
  .print-header h1 { font-size: 17px; }
  .print-header > p { font-size: 17px; }
  .print-calendar { page-break-inside: auto; }
  .print-calendar thead { display: table-header-group; }
  .print-calendar tr { page-break-inside: avoid; break-inside: avoid; }
  .print-calendar tbody.calendar-week { page-break-inside: avoid; break-inside: avoid; }
  .monthly-section, .signatures { page-break-inside: avoid; break-inside: avoid; }
  .print-calendar th { padding: 4px; font-size: 14pt; }
  .print-calendar .print-content-row td { height: 80px; padding: 4px; font-size: 11pt; }
  .print-calendar .print-event { display: block; font-weight: 400 !important; }
  .print-calendar .print-event + .print-event { margin-top: 12px; padding-top: 0; border-top: 0; }
  .print-calendar .print-event-title { font-size: 12pt; font-weight: 400 !important; }
  .print-calendar .print-event p { font-size: 10pt; font-weight: 400 !important; }
  .print-calendar .print-event p b, .print-calendar .print-event p strong { font-weight: 400 !important; }
  .print-calendar .print-time { font-size: 12pt; font-weight: 400 !important; }
  .print-empty-day { display: none !important; }
  .print-calendar .print-date-row td { height: auto; padding: 3px; font-size: 11pt; }
  .print-calendar .print-theme-row td { height: auto; padding: 4px; font-size: 11pt; }
  .print-date, .print-time { color: #111; }
  .signatures { page-break-inside: avoid; break-inside: avoid; }
}

@media screen {
  .print-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; }
  .print-toolbar-home { justify-self: start; align-self: end; white-space: nowrap; }
  .print-filters { display: grid; min-width: 0; grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr) auto; align-items: end; gap: 8px; }
  .print-filters label { display: grid; min-width: 0; gap: 4px; color: #526177; font-size: 11px; font-weight: 700; }
  .print-filters input { width: 100%; min-width: 0; height: 38px; padding: 7px 10px; border: 1px solid #d9e1eb; border-radius: 10px; outline: none; color: var(--ink); background: #fff; font-size: 13px; font-weight: 500; }
  .print-filters input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .1); }
  .print-filter-submit { min-height: 38px; padding: 0 14px; }
  .print-filter-search > .print-filter-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; }
  .print-filter-reset { color: var(--muted); font-size: 10px; font-weight: 600; text-decoration: none; }
  .print-filter-reset:hover { color: var(--blue); }
  .print-actions-menu { position: relative; justify-self: end; align-self: end; }
  .print-actions-menu > summary { display: none; }
  .is-admin-preview .print-toolbar { grid-template-columns: auto minmax(0, 1fr); }
  .is-admin-preview .print-toolbar-home { grid-column: 1; grid-row: 1; }
  .is-admin-preview .print-actions-menu { grid-column: 2; grid-row: 1; }
  .is-admin-preview .print-filters { grid-column: 1 / -1; grid-row: 2; }
  .print-filter-caption { margin: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
  .print-filter-empty { margin: 0 0 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: #fff; text-align: center; }
  .print-calendar.filter-results .print-content-row { grid-template-columns: 1fr; }
  .print-calendar.filter-results .print-content-row td { grid-column: 1 / -1; }
  .print-page { min-height: 100vh; background: var(--page); }
  .print-toolbar { position: sticky; top: 0; z-index: 20; align-items: center; padding-top: 12px; padding-bottom: 12px; border-bottom-color: rgba(219, 228, 239, .9); background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); }
  .print-document { width: min(1320px, calc(100% - 48px)); margin: 30px auto 56px; color: var(--ink); font-family: Manrope, "Segoe UI", sans-serif; font-size: 14px; }
  .print-header { position: relative; min-height: 166px; margin: 0 0 22px; padding: 30px 330px 30px 34px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 10px 28px rgba(22, 54, 91, .045); text-align: left; }
  .print-header h1 { max-width: 720px; margin: 0 0 8px; color: var(--ink); font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.035em; line-height: 1.22; }
  .print-header > p { margin: 0; color: var(--muted); font-size: 17px; font-weight: 600; line-height: 1.5; }
  .approval { position: absolute; top: 50%; right: 24px; width: 270px; margin: 0; padding: 16px 18px; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #f8fafd; font-size: 13px; line-height: 1.65; }
  .approval strong { color: var(--blue); font-size: 12px; letter-spacing: .07em; }
  .approval-signature-line { width: 88px; border-color: #97a5b8; }
  .print-calendar, .print-calendar tbody, .print-calendar tr { display: block; width: 100%; }
  .print-calendar tbody.calendar-week { display: block; margin: 0 0 16px; }
  .print-calendar tbody.calendar-week.has-week-theme { padding: 12px; border: 1px solid #dce8f5; border-radius: 19px; background: linear-gradient(145deg, #f6f9fe, #fff 72%); box-shadow: 0 7px 20px rgba(22, 54, 91, .045); }
  .print-calendar .print-date-row { display: none; }
  .print-calendar .print-theme-row { display: block; margin: 0 0 10px; }
  .print-calendar .has-week-theme .print-theme-row { padding: 8px 11px; border: 1px solid #dce8f5; border-radius: 11px; background: #edf4fc; }
  .print-calendar .print-theme-row td { display: block; width: 100%; padding: 0; border: 0; }
  .print-theme { display: flex; align-items: center; min-height: 0; padding: 0; border: 0; border-radius: 0; color: #315d88; background: transparent; font-family: Manrope, "Segoe UI", sans-serif; font-size: 12px; font-style: normal; font-weight: 800; line-height: 1.4; }
  .print-calendar .print-content-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
  .print-calendar .print-content-row td { display: block; min-width: 0; min-height: 154px; height: auto; padding: 12px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; box-shadow: 0 5px 16px rgba(22, 54, 91, .035); font-family: Manrope, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.5; }
  .print-calendar .outside-month { background: #f8fafd; }
  .mobile-date { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
  .mobile-date span:first-child { color: var(--blue); font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
  .mobile-date span:last-child { padding: 4px 7px; border-radius: 7px; color: var(--muted); background: var(--page); font-size: 10px; font-weight: 800; line-height: 1.2; }
  .print-event { display: block; margin: 0; padding: 10px; border: 1px solid #e2e8f0; border-radius: 12px; color: var(--ink); background: #f8fafd; box-shadow: 0 2px 8px rgba(22, 54, 91, .035); font-weight: 400; line-height: 1.45; }
  .print-event + .print-event { margin-top: 8px; padding-top: 10px; }
  .print-time { display: inline-flex; align-items: baseline; margin: 0 0 7px; padding: 4px 8px; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-family: Manrope, "Segoe UI", sans-serif; font-size: 13px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
  .print-time sup { position: relative; top: -.08em; margin-left: 1px; font-size: .72em; line-height: 0; vertical-align: super; font-weight: 800; }
  .print-event-title { display: block; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.4; }
  .print-event p { margin: 7px 0 0; color: #536176; font-size: 12px; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
  .print-event p strong { color: #25354b; font-weight: 800; }
  .print-empty-day { padding: 8px 0; color: #96a1b2; font-size: 12px; }
  .monthly-section { margin: 24px 0 0; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(22, 54, 91, .035); }
  .monthly-heading { margin: 0 0 12px; color: var(--ink); font-size: 16px; font-weight: 800; }
  .monthly-responsible { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; }
  .monthly-responsible th, .monthly-responsible td { height: auto; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font-family: Manrope, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.5; }
  .monthly-responsible thead th { color: #44536a; background: #f4f7fb; font-weight: 800; }
  .monthly-responsible tbody tr:last-child td { border-bottom: 0; }
  .monthly-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
  .signatures { margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fff; font-size: 13px; }
  .signature-row { gap: 10px; }
  .signature-line { border-color: #9aa7b8; }
  .signatures strong { color: var(--ink); }
}

@media screen and (max-width: 1050px) {
  .print-toolbar { grid-template-columns: auto minmax(0, 1fr); }
  .print-filters { grid-column: 1 / -1; grid-row: 2; }
  .print-actions-menu { grid-column: 2; grid-row: 1; }
  .print-calendar .print-content-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media screen and (max-width: 734px) {
  .print-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; }
  .print-toolbar-home { grid-column: 1; grid-row: 1; }
  .print-filters { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr) auto; }
  .print-filter-search { grid-column: 1 / -1; }
  .print-filter-date { grid-column: 1; }
  .print-filter-submit { grid-column: 2; grid-row: 2; align-self: end; }
  .print-actions-menu { grid-column: 2; grid-row: 1; justify-self: end; }
  .print-actions-menu > summary { display: flex; min-height: 42px; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid #c9d8e9; border-radius: 999px; color: var(--blue); background: #fff; font-size: 12px; font-weight: 800; list-style: none; cursor: pointer; }
  .print-actions-menu > summary::-webkit-details-marker { display: none; }
  .print-actions-menu > summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
  .print-actions-menu[open] > .print-toolbar-actions { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; display: grid; width: min(310px, calc(100vw - 28px)); grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 14px 32px rgba(20, 45, 75, .16); }
  .print-actions-menu .print-toolbar-actions .button { width: 100%; }
  .print-toolbar-actions .button { width: 100%; }
  .print-document { width: calc(100% - 24px); margin: 16px auto 32px; }
  .print-header { min-height: 0; margin-bottom: 14px; padding: 22px 18px; border-radius: 17px; }
  .print-header h1 { font-size: 22px; }
  .print-header > p { font-size: 15px; }
  .approval { position: static; width: 100%; margin: 16px 0 0; padding: 13px 14px; transform: none; }
  .print-calendar tbody.calendar-week { margin-bottom: 12px; }
  .print-calendar tbody.calendar-week.has-week-theme { padding: 9px; border-radius: 16px; }
  .print-calendar .print-theme-row { margin-bottom: 8px; }
  .print-calendar .print-content-row { grid-template-columns: 1fr; gap: 8px; }
  .print-calendar .print-content-row td { min-height: 0; padding: 12px; border-radius: 13px; }
  .print-event { padding: 10px; }
  .monthly-section { margin-top: 18px; padding: 16px; border-radius: 15px; }
  .monthly-responsible th, .monthly-responsible td { padding: 9px; font-size: 12px; }
  .signatures { align-items: stretch; gap: 12px; padding: 15px; }
  .signature-row { align-items: flex-start; justify-content: flex-start; gap: 6px; }
  .signature-line { width: 50px; flex-basis: 50px; }
}

@media screen {
  .print-topbar { position: relative; width: 100%; height: 76px; min-height: 76px; padding: 0 clamp(18px, 2.2vw, 36px); gap: 18px; }
  .print-topbar .brand { flex: 0 0 auto; }
  .print-main-nav { flex: 0 1 auto; margin-left: auto; }
  .print-header-actions { flex: 0 0 auto; gap: 8px; }
  .print-header-actions .user-chip { max-width: 220px; }
  .print-actions-menu { align-self: center; justify-self: auto; }
  .print-actions-menu > summary { display: none; }
  .print-mobile-menu-links { display: none; }
  .print-filter-bar { width: 100%; padding: 12px clamp(18px, 2.2vw, 36px); border-bottom: 1px solid var(--line); background: #fff; }
  .print-filter-bar .print-filters { display: grid; width: 100%; min-width: 0; grid-column: auto; grid-row: auto; grid-template-columns: minmax(0, 1.5fr) minmax(180px, .75fr) auto; align-items: end; gap: 12px; }
  .print-filter-bar .print-filter-submit { min-height: 42px; padding: 0 18px; }
  .print-filter-bar .print-filter-reset { font-size: 11px; }
  .print-filter-bar .print-filters input { height: 42px; font-size: 14px; }
}

@media screen and (max-width: 1400px) {
  .print-topbar { height: auto; min-height: 76px; flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
  .print-main-nav { order: 3; flex: 1 0 100%; justify-content: center; margin-left: 0; }
}

@media screen and (max-width: 734px) {
  .print-topbar { display: grid; min-height: 64px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 14px; }
  .print-topbar .brand { min-width: 0; gap: 8px; }
  .print-topbar .brand-logo { width: 48px; height: 38px; }
  .print-topbar .brand strong { font-size: 12px; }
  .print-topbar .brand small { font-size: 10px; }
  .print-main-nav, .print-header-user, .print-header-logout, .print-login-link { display: none; }
  .print-header-actions { display: flex; grid-column: 2; grid-row: 1; gap: 0; }
  .print-actions-menu { position: relative; grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
  .print-actions-menu > summary { display: flex; min-height: 40px; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid #c9d8e9; border-radius: 999px; color: var(--blue); background: #fff; font-size: 12px; font-weight: 800; list-style: none; cursor: pointer; }
  .print-actions-menu > summary::-webkit-details-marker { display: none; }
  .print-actions-menu > summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
  .print-actions-menu[open] > .print-toolbar-actions { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; width: min(310px, calc(100vw - 28px)); grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 14px 32px rgba(20, 45, 75, .16); }
  .print-actions-menu .print-toolbar-actions .button { width: 100%; }
  .print-mobile-menu-links { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .print-mobile-menu-links a { display: block; padding: 10px 11px; border-radius: 9px; color: #526178; font-size: 13px; font-weight: 700; text-decoration: none; }
  .print-mobile-menu-links a:hover { color: var(--blue); background: var(--blue-soft); }
  .print-menu-login { display: inline-flex; width: 100%; margin-bottom: 4px; }
  .print-filter-bar { padding: 10px 14px; }
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .print-filter-search { grid-column: 1 / -1; }
  .print-filter-date { grid-column: 1; }
  .print-filter-submit { grid-column: 2; grid-row: 2; align-self: end; }
}

@media screen {
  .print-page .print-header .approval,
  .print-page .print-document > .signatures { display: none; }
}

@media screen and (min-width: 735px) {
  .print-page .print-header { min-height: 0; padding-right: 34px; }
}

/* Print preview toolbar polish: quiet motion, clear hierarchy, and a real mobile scrim. */
@media screen {
  .print-topbar { z-index: 50; }
  .print-topbar .main-nav a,
  .print-topbar .button,
  .print-user-menu > summary,
  .print-user-popover a,
  .print-actions-menu > summary,
  .print-mobile-menu-links a {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease,
      box-shadow .18s ease, transform .18s ease;
  }
  .print-topbar .main-nav a:hover { transform: translateY(-1px); }
  .print-topbar .button:hover { transform: translateY(-1px); }
  .print-menu-login { display: none; }
  .print-menu-scrim { display: none; }
  .print-user-menu { position: relative; flex: 0 0 auto; }
  .print-user-menu > summary {
    display: grid; width: 38px; height: 38px; place-items: center;
    border: 1px solid #c9d8e9; border-radius: 50%; color: #fff;
    background: var(--blue); box-shadow: 0 3px 9px rgba(0, 86, 179, .15);
    font-size: 15px; font-weight: 800; cursor: pointer; list-style: none;
  }
  .print-user-menu > summary::-webkit-details-marker { display: none; }
  .print-user-menu > summary:hover,
  .print-user-menu[open] > summary { background: #123e79; box-shadow: 0 5px 14px rgba(0, 54, 115, .24); transform: translateY(-1px); }
  .print-user-popover {
    position: absolute; top: calc(100% + 9px); right: 0; z-index: 55;
    display: grid; min-width: 180px; gap: 7px; padding: 12px;
    border: 1px solid var(--line); border-radius: 14px; background: #fff;
    box-shadow: 0 14px 32px rgba(20, 45, 75, .16);
    animation: print-popover-in .18s ease both;
  }
  .print-user-popover span { color: #687991; font-size: 12px; }
  .print-user-popover a { padding: 8px 9px; border-radius: 9px; color: #526178; font-size: 13px; font-weight: 750; text-decoration: none; }
  .print-user-popover a:hover { color: var(--blue); background: var(--blue-soft); }
}

@keyframes print-curtain-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes print-menu-panel-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes print-menu-item-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes print-popover-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

@media screen and (max-width: 734px) {
  .print-topbar { position: sticky; top: 0; }
  .print-topbar .print-user-menu { display: none; }
  .print-actions-menu > summary { position: relative; z-index: 52; }
  .print-actions-menu[open] > summary {
    border-color: var(--blue); color: #fff; background: var(--blue);
    box-shadow: 0 5px 14px rgba(0, 86, 179, .22);
  }
  .print-actions-menu[open] > summary svg { transform: rotate(90deg); }
  .print-actions-menu > summary svg { transition: transform .22s ease; }
  .print-actions-menu[open] > .print-menu-scrim {
    position: fixed; inset: 72px 0 0; z-index: 35; display: block;
    width: 100%; height: calc(100dvh - 72px); padding: 0; border: 0;
    background: rgba(20, 38, 63, .28); backdrop-filter: blur(2px);
    animation: print-curtain-in .2s ease both;
  }
  .print-actions-menu[open] > .print-toolbar-actions {
    position: fixed; top: 81px; right: 14px; z-index: 51;
    max-height: calc(100dvh - 88px); overflow-y: auto; overscroll-behavior: contain;
    animation: print-menu-panel-in .22s cubic-bezier(.2, .75, .25, 1) both;
  }
  .print-actions-menu[open] .print-toolbar-actions > * { animation: print-menu-item-in .2s ease both; }
  .print-actions-menu[open] .print-toolbar-actions > *:nth-child(2) { animation-delay: 35ms; }
  .print-actions-menu[open] .print-toolbar-actions > *:nth-child(3) { animation-delay: 70ms; }
  .print-actions-menu[open] .print-toolbar-actions > *:nth-child(4) { animation-delay: 105ms; }
  .print-menu-login { display: inline-flex; }
}

@media screen and (prefers-reduced-motion: reduce) {
  .print-topbar *, .print-user-popover { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Subtle shared motion for the app, kept short and disabled by reduced-motion preferences. */
@keyframes site-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes site-dialog-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes site-backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes site-suggestion-enter { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

@media screen {
  .button {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease,
      box-shadow .18s ease, transform .18s ease;
  }
  .button:hover { transform: translateY(-1px); }
  .button:active { transform: translateY(0) scale(.985); }
  .main-nav a, .support-footer a, .icon-button, .combobox-option {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease,
      box-shadow .18s ease, transform .18s ease;
  }
  .main-nav a:hover { transform: translateY(-1px); }
  .summary-card, .calendar-card, .settings-card, .month-select-card {
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    animation: site-enter .28s ease both;
  }
  .summary-card:nth-child(2) { animation-delay: 35ms; }
  .calendar-card { animation-delay: 60ms; }
  .calendar-day, .event-chip, .combobox-chip {
    transition: border-color .18s ease, background-color .18s ease,
      box-shadow .18s ease, transform .18s ease;
  }
  .calendar-day:not(.outside-month):hover { transform: translateY(-1px); }
  .event-chip:hover { transform: translateY(-1px); }
  .combobox-suggestions:not([hidden]) { animation: site-suggestion-enter .14s ease both; }
  .event-dialog[open] { animation: site-dialog-enter .2s cubic-bezier(.2, .75, .25, 1) both; }
  .event-dialog[open]::backdrop { animation: site-backdrop-enter .18s ease both; }
  .reference-dialog[open] { animation: site-dialog-enter .2s cubic-bezier(.2, .75, .25, 1) both; }
  .reference-dialog[open]::backdrop { animation: site-backdrop-enter .18s ease both; }
  .login-card, .settings-content, .print-document { animation: site-enter .28s ease both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Mobile viewport safeguards for form controls and filtered print preview. */
@media screen and (max-width: 734px) {
  html, body { width: 100%; max-width: 100%; overflow-x: clip; }
  .page-content, .print-document, .print-filter-bar, .calendar-card, .settings-card,
  .settings-form, .settings-content, .month-plan-content { min-width: 0; max-width: 100%; }
  .page-heading, .heading-actions, .month-select-card, .settings-actions,
  .approval-date-form, .managed-edit-form, .monthly-item-form { min-width: 0; }
  .month-picker, .month-picker input, .settings-fields input, .settings-fields textarea,
  .managed-edit-form > input, .monthly-item-form input, .monthly-item-form textarea,
  .approval-date-form input, .print-filter-bar .print-filters,
  .print-filter-bar .print-filters label, .print-filter-bar .print-filters input { width: 100%; min-width: 0; max-width: 100%; }
  .page-heading .heading-actions > *, .settings-actions > *, .approval-date-form > * { min-width: 0; max-width: 100%; }
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .print-filter-bar .print-filter-search { grid-column: 1 / -1; }
  .print-filter-bar .print-filter-date { grid-column: 1; }
  .print-filter-bar .print-filter-submit { grid-column: 2; grid-row: auto; width: 100%; min-height: 44px; align-self: end; }
  .print-filter-bar .print-filters input { height: 44px; font-size: 16px; }
  .print-filter-bar .print-filter-label { white-space: normal; }
  .print-calendar.filter-results .calendar-week { width: 100%; min-width: 0; overflow: hidden; border-radius: 16px; }
  .print-calendar.filter-results .print-content-row,
  .print-calendar.filter-results .print-content-row td { display: block; width: 100%; min-width: 0; }
  .print-calendar.filter-results .print-content-row td { grid-column: auto; height: auto; margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow-wrap: anywhere; }
  .print-calendar.filter-results .print-date-row td { width: 100%; min-width: 0; border-radius: 14px; }
  .print-calendar.filter-results .print-theme-row td { border-radius: 12px; }
  .print-event, .print-event p, .print-event-title { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .print-event { border-radius: 12px; }
}

@media screen and (max-width: 380px) {
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit { grid-column: 1; grid-row: auto; }
  .calendar-card { padding: 11px; }
  .heading-actions { gap: 8px; }
}

@media screen and (max-width: 734px) {
  .calendar-week, .calendar-day, .event-chip { border-radius: 14px !important; }
  .print-calendar .print-content-row td:first-child,
  .print-calendar .print-content-row td:last-child { border-radius: 14px; }
}

/* Weekly themes stay attached to every matching day in filtered results. */
@media screen {
  .print-calendar tbody.calendar-week.has-week-theme {
    border-color: #c9ddf3;
    background: linear-gradient(145deg, #edf5ff 0%, #f8fbff 40%, #fff 100%);
    box-shadow: 0 8px 24px rgba(0, 86, 179, .065);
  }
  .print-calendar .has-week-theme .print-theme-row {
    padding: 10px 13px;
    border-color: #d7e7f8;
    background: linear-gradient(110deg, #e9f3ff, #f4f8fd);
  }
  .print-calendar .has-week-theme .print-theme-row td { border: 0; }
  .print-theme {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: #234b77;
    font-size: 13px;
    line-height: 1.4;
  }
  .print-theme::before {
    content: "ТЕМАТИКА НЕДЕЛИ";
    color: #6381a3;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .09em;
  }
}

@media screen and (max-width: 734px) {
  .dashboard-actions-menu { z-index: 51; }
  .dashboard-actions-menu[open] > .print-toolbar-actions { right: 10px; width: min(330px, calc(100vw - 20px)); }
  .dashboard-actions-menu .print-mobile-menu-links a[aria-current="page"] {
    color: var(--blue);
    background: var(--blue-soft);
  }
  .print-calendar tbody.calendar-week.has-week-theme { padding: 9px; }
  .print-calendar .has-week-theme .print-theme-row { margin-bottom: 9px; padding: 9px 11px; border-radius: 12px; }
  .print-theme { font-size: 12px; }
}

@media print {
  .print-theme::before { content: none; }
}

/* Final overrides: consistent touch targets and visible filter reset. */
@media screen {
  .settings-fields .field input,
  .settings-fields .field textarea { font-size: 14px; line-height: 1.45; }
  .managed-edit-form > input,
  .monthly-item-form input,
  .monthly-item-form textarea,
  .approval-date-form input { font-size: 14px; line-height: 1.45; }
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1.5fr) minmax(180px, .75fr) auto auto; }
  .print-filter-bar .print-filter-reset {
    display: inline-flex; min-height: 42px; align-items: center; justify-content: center;
    padding: 0 14px; border-color: #c9d8e9; color: #40536d; background: #f7f9fc;
    font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap;
  }
  .print-filter-bar .print-filter-reset:hover { border-color: #a9c5e4; color: var(--blue); background: var(--blue-soft); }
}

@media screen and (max-width: 734px) {
  .topbar .print-actions-menu > summary,
  .print-topbar .print-actions-menu > summary { min-height: 48px; gap: 9px; padding: 0 16px; font-size: 14px; }
  .topbar .print-actions-menu > summary svg,
  .print-topbar .print-actions-menu > summary svg { width: 20px; height: 20px; }
  .topbar .print-user-menu > summary { width: 44px; height: 44px; font-size: 17px; }
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px; }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { grid-column: 1; grid-row: auto; width: 100%; }
  .print-filter-bar .print-filter-submit { min-height: 46px; }
  .print-filter-bar .print-filter-reset { min-height: 44px; }
  .settings-fields .field input,
  .settings-fields .field textarea,
  .managed-edit-form > input,
  .monthly-item-form input,
  .monthly-item-form textarea,
  .approval-date-form input { font-size: 16px; }
}

@media screen and (max-width: 380px) {
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { grid-column: 1; grid-row: auto; }
}

/* Last-mile mobile fixes shared by every page. */
@media screen {
  .print-filter-bar .print-filters {
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, .75fr)) auto auto;
  }
  .print-calendar .print-events-list {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
    width: 100%; min-width: 0; overflow: visible;
  }
  .print-calendar .print-events-list > .print-event {
    display: block; width: 100%; min-width: 0; max-width: 100%; height: auto;
    max-height: none; margin: 0; overflow: visible; visibility: visible; opacity: 1;
  }
  .print-actions-menu .print-mobile-menu-links a[aria-current="page"] {
    color: var(--blue); background: var(--blue-soft);
  }
  input[type="date"], input[type="month"], input[type="time"],
  input[type="datetime-local"], input[type="week"] { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
  .month-picker, .approval-date-form, .print-filter-date, .form-grid > label { min-width: 0; }
  .managed-edit-form { align-items: end; }
  .managed-edit-form > textarea {
    display: block; width: 100%; min-width: 0; min-height: 54px; padding: 10px 12px;
    border: 1px solid #d9e1eb; border-radius: 11px; outline: none; color: var(--ink);
    background: #fff; font: inherit; font-size: 14px; line-height: 1.45; resize: vertical; overflow-wrap: anywhere;
  }
  .managed-edit-form > textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 86, 179, .12); }
  .settings-fields .field textarea { min-width: 0; max-width: 100%; min-height: 54px; resize: vertical; overflow-wrap: anywhere; }
  .settings-fields .field input, .settings-fields .field textarea,
  .managed-edit-form > input, .managed-edit-form > textarea,
  .monthly-item-form input, .monthly-item-form textarea { font-size: 14px; line-height: 1.45; }
}

@media screen and (max-width: 734px) {
  .print-calendar.filter-results .calendar-week { overflow: visible; }
  .print-calendar .print-events-list { gap: 8px; }
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .print-filter-bar .print-filter-search,
  .print-filter-bar .print-filter-date,
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { grid-column: 1; grid-row: auto; width: 100%; min-width: 0; }
  .print-filter-bar .print-filter-submit,
  .print-filter-bar .print-filter-reset { min-height: 46px; }
  .topbar, .print-topbar { min-height: 72px; padding: 10px 14px; gap: 8px; }
  .topbar .brand, .print-topbar .brand { min-width: 0; gap: 9px; }
  .topbar .brand-logo, .print-topbar .brand-logo { width: 52px; height: 44px; border-radius: 13px; }
  .topbar .brand strong, .print-topbar .brand strong { font-size: 14px; }
  .topbar .brand small, .print-topbar .brand small { font-size: 11px; }
  .topbar-actions { min-width: 0; gap: 8px; }
  .topbar .print-actions-menu > summary, .print-topbar .print-actions-menu > summary {
    min-width: 96px; min-height: 50px; justify-content: center; gap: 8px; padding: 0 14px;
    border-radius: 16px; font-size: 14px; font-weight: 800;
  }
  .topbar .print-user-menu > summary { width: 46px; height: 46px; font-size: 18px; }
  .print-topbar .print-toolbar-actions .button,
  .dashboard-actions-menu .print-toolbar-actions .button,
  .dashboard-actions-menu .print-mobile-menu-links a { min-height: 48px; font-size: 14px; }
  .month-picker, .month-picker input, .approval-date-form input,
  .print-filter-bar .print-filters input[type="date"], .print-filter-bar .print-filters input[type="time"],
  .form-grid input[type="date"], .form-grid input[type="month"], .form-grid input[type="time"],
  .form-grid input[type="datetime-local"], .form-grid input[type="week"] { width: 100%; min-width: 0; max-width: 100%; min-height: 46px; }
  input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"], input[type="week"] { font-size: 16px; }
  .settings-fields .field input, .settings-fields .field textarea,
  .managed-edit-form > input, .managed-edit-form > textarea,
  .monthly-item-form input, .monthly-item-form textarea { min-width: 0; max-width: 100%; font-size: 16px; }
  .managed-edit-form > textarea, .settings-fields .field textarea { min-height: 58px; }
}

@media screen and (min-width: 735px) and (max-width: 1050px) {
  .print-filter-bar .print-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .print-filter-bar .print-filter-search { grid-column: 1 / -1; }
  .print-filter-bar .print-filter-from { grid-column: 1; grid-row: 2; }
  .print-filter-bar .print-filter-to { grid-column: 2; grid-row: 2; }
  .print-filter-bar .print-filter-submit { grid-column: 3; grid-row: 2; }
  .print-filter-bar .print-filter-reset { grid-column: 1 / -1; grid-row: 3; }
}

@media screen and (max-width: 380px) {
  .topbar, .print-topbar { padding-right: 10px; padding-left: 10px; }
  .topbar .brand, .print-topbar .brand { gap: 7px; }
  .topbar .brand-logo, .print-topbar .brand-logo { width: 48px; height: 42px; }
  .topbar .print-actions-menu > summary, .print-topbar .print-actions-menu > summary { min-width: 88px; padding: 0 10px; }
}

/* Native date controls need device-specific sizing on touch screens (not only viewport breakpoints). */
@media screen and (pointer: coarse) {
  input[type="date"], input[type="month"], input[type="time"],
  input[type="datetime-local"], input[type="week"] {
    width: 100% !important; min-width: 0 !important; max-width: 100% !important;
    inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box;
    height: 46px; min-height: 46px; max-height: 46px; padding: 0 !important; font-size: 16px;
  }
  .print-filter-date, .form-grid > label, .month-picker, .approval-date-form .field {
    display: grid; grid-template-columns: minmax(0, 1fr);
    width: 100%; min-width: 0; max-width: 100%;
  }

  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid > label, .form-grid-field { width: 100%; min-width: 0; max-width: 100%; }
  .event-dialog {
    width: calc(100vw - 16px); max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px); border-radius: 18px;
  }
  .event-dialog form { width: 100%; min-width: 0; max-width: 100%; }
  .dialog-scroll {
    min-width: 0; max-width: 100%; overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; scrollbar-gutter: auto; -ms-overflow-style: none;
  }
  .dialog-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }

  .theme-managed-row { align-items: end; }
  .theme-managed-row .managed-edit-form { display: grid; align-items: end; }
  .theme-managed-row > form:last-child { align-self: end; }
  .theme-create-form { align-items: end; }
}

@media screen and (pointer: coarse) and (max-width: 734px) {
  .settings-content { width: 100%; max-width: 1440px; }
  .settings-content .settings-heading > .button { width: 100%; align-self: stretch; }
  .settings-content .settings-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .settings-content .settings-actions > .button { width: 100%; }
  .theme-managed-row { align-items: stretch; }
  .theme-managed-row .managed-edit-form,
  .theme-create-form { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr); }
  .theme-managed-row .managed-edit-form > .button,
  .theme-create-form > .button { width: 100%; min-height: 44px; }
  .theme-managed-row > form:last-child { display: grid; width: 100%; }
  .theme-managed-row > form:last-child > .button { width: 100%; min-height: 44px; }
  .monthly-item-actions, .monthly-delete-form { width: 100%; }
  .monthly-item-actions > .button, .monthly-delete-form > .button { width: 100%; min-height: 44px; }
}

@media screen {
  .print-event { padding: 12px; }
  .print-time { margin: 3px 0 8px; padding: 5px 9px; border-radius: 9px; }
}

/* Compact textareas on the planning and document settings forms. */
@media screen {
  .settings-content .settings-fields .field textarea,
  .month-plan-content .managed-edit-form > textarea,
  .month-plan-content .monthly-item-form textarea {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 10px 13px;
    line-height: 22px;
    resize: vertical;
    overflow-y: auto;
  }
}

@media screen and (max-width: 734px), screen and (pointer: coarse) {
  .settings-content .settings-fields .field textarea,
  .month-plan-content .managed-edit-form > textarea,
  .month-plan-content .monthly-item-form textarea {
    font-size: 14px;
    line-height: 20px;
  }
}

/* Keep native date controls inside their grid tracks on phones, including iOS Safari. */
@media screen and (max-width: 734px), screen and (pointer: coarse) {
  .page-content,
  .print-filter-bar,
  .print-filter-bar form,
  .print-filter-bar .print-filters,
  .print-filter-date,
  .month-picker,
  .approval-date-form,
  .approval-date-form .field,
  .form-grid,
  .form-grid > label {
    box-sizing: border-box;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="week"] {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    flex: 1 1 0%;
  }

  .week-theme-card .theme-managed-row {
    display: grid !important;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .week-theme-card .theme-managed-row .managed-edit-form,
  .week-theme-card .theme-managed-row > form:last-child {
    display: grid !important;
    width: 100% !important;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .week-theme-card .theme-managed-row .managed-edit-form > .button,
  .week-theme-card .theme-managed-row > form:last-child > .button {
    width: 100% !important;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
  }
}

/* Keep temporal controls inside a wrapper instead of making them direct grid items.
   Leave WebKit's native inline-flex display untouched. */
@media screen {
  .native-date-display { display: none; }
  .native-date-display[hidden] { display: none !important; }
  .native-date-control { display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
  .native-date-control > input[type="date"],
  .native-date-control > input[type="month"],
  .native-date-control > input[type="time"],
  .native-date-control > input[type="datetime-local"],
  .native-date-control > input[type="week"] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    line-height: normal;
  }
  .native-date-control > input::-webkit-datetime-edit,
  .native-date-control > input::-webkit-datetime-edit-fields-wrapper,
  .native-date-control > input::-webkit-datetime-edit-text,
  .native-date-control > input::-webkit-datetime-edit-minute-field,
  .native-date-control > input::-webkit-datetime-edit-hour-field,
  .native-date-control > input::-webkit-datetime-edit-meridiem-field,
  .native-date-control > input::-webkit-datetime-edit-day-field,
  .native-date-control > input::-webkit-datetime-edit-month-field,
  .native-date-control > input::-webkit-datetime-edit-year-field { padding: 0; }
  .native-date-control > input::-webkit-inner-spin-button { height: auto; }
  .native-date-control > input::-webkit-date-and-time-value {
    height: 1.5em;
    line-height: 1.5em;
  }
}

/* On touch phones keep the native picker as the hit target and render its value in a stable field UI. */
@media screen {
  .native-date-control.is-enhanced {
    position: relative;
    width: 100%;
    height: 46px;
    min-height: 46px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #d9e1eb;
    border-radius: 12px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
  }
  .native-date-control.is-enhanced:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, .12);
  }
  .native-date-control.is-enhanced > input[type="date"],
  .native-date-control.is-enhanced > input[type="month"],
  .native-date-control.is-enhanced > input[type="time"],
  .native-date-control.is-enhanced > input[type="datetime-local"],
  .native-date-control.is-enhanced > input[type="week"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: inherit;
    opacity: 0;
    cursor: pointer;
  }
  .native-date-control.is-enhanced > .native-date-display {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    overflow: hidden;
    padding: 0 40px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
  }
  .native-date-control.is-enhanced > .native-date-display.is-placeholder { color: #8a96a8; }
  .native-date-control.is-enhanced::after {
    position: absolute;
    top: 50%;
    right: 13px;
    z-index: 1;
    color: #61748d;
    font-size: 18px;
    line-height: 1;
    content: "▦";
    transform: translateY(-50%);
    pointer-events: none;
  }
  .native-date-control.is-enhanced[data-native-type="time"]::after { content: "◷"; }
  .native-date-control.is-enhanced[data-native-type="datetime-local"]::after { content: "◷"; }
}

/* A little depth and grouping make the shared navigation easier to scan. */
@media screen {
  .topbar,
  .print-topbar {
    border-bottom-color: #d9e5f2;
    background: linear-gradient(180deg, #fff 0%, #f9fbff 100%);
    box-shadow: 0 5px 18px rgba(25, 64, 108, .08);
  }
  .main-nav {
    gap: 4px;
    padding: 4px;
    border: 1px solid #e2eaf4;
    border-radius: 999px;
    background: #f5f8fc;
    box-shadow: inset 0 1px 2px rgba(28, 67, 110, .04);
  }
  .main-nav a { transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
  .main-nav a[aria-current="page"] { background: #e5f0fc; box-shadow: 0 2px 7px rgba(36, 91, 151, .09); }
  .main-nav a:hover { color: var(--blue); background: #edf4fc; }
  .print-actions-menu > summary {
    border-color: #c7d8eb;
    background: linear-gradient(180deg, #fff 0%, #f5f9fe 100%);
    box-shadow: 0 3px 10px rgba(30, 77, 128, .09);
    transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  }
  .print-actions-menu[open] > summary {
    border-color: var(--blue);
    color: #fff;
    background: linear-gradient(135deg, #0867c8 0%, #004d9f 100%);
    box-shadow: 0 6px 16px rgba(0, 86, 179, .24);
  }
  .print-actions-menu[open] > .print-toolbar-actions {
    border-color: #d6e3f1;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    box-shadow: 0 18px 38px rgba(20, 55, 96, .2);
  }
}

/* Desktop preview uses the same clear event cards as the mobile preview. */
@media screen and (min-width: 735px) {
  .print-calendar .print-date-row td { background: #f7faff; }
  .print-calendar .print-content-row td { padding: 10px; }
  .print-calendar .print-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }
  .print-calendar .print-events-list > .print-event {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--ink);
    background: #f8fafd;
    box-shadow: 0 2px 8px rgba(22, 54, 91, .045);
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 12px;
    line-height: 1.45;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
  }
  .print-calendar .print-events-list > .print-event:hover {
    border-color: #c7d9ee;
    background: #f3f8fe;
    box-shadow: 0 5px 13px rgba(22, 54, 91, .08);
    transform: translateY(-1px);
  }
  .print-calendar .print-event + .print-event { margin-top: 0; padding-top: 10px; }
  .print-calendar .print-time {
    display: inline-flex;
    align-items: center;
    margin: 0 0 7px;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--blue);
    background: var(--blue-soft);
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
  }
  .print-calendar .print-time sup { font-size: .72em; font-weight: 800; }
  .print-calendar .print-event-title {
    display: block;
    color: var(--ink);
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 400 !important;
    line-height: 1.4;
  }
  .print-calendar .print-event p {
    margin: 7px 0 0;
    color: #536176;
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 11px;
    line-height: 1.45;
  }
  .print-calendar .print-event p strong { color: #34445c; font-weight: 700 !important; }
  .print-calendar .print-empty-day { color: #8290a4; font-size: 11px; }
}

/* Visually separate the preview controls from the document without affecting print output. */
@media screen {
  .print-topbar {
    position: relative;
    z-index: 20;
    border-bottom-color: #dce7f4;
    box-shadow: 0 4px 16px rgba(31, 87, 150, .09);
  }
  .print-filter-bar {
    position: relative;
    z-index: 10;
    border-bottom-color: #dce7f4;
    background: linear-gradient(180deg, #f4f8fd 0%, #edf4fb 100%);
    box-shadow: 0 9px 22px rgba(31, 87, 150, .10);
  }
}

/* WebKit bug 301648: padding on native date/time inputs makes width: 100% overflow on iOS. */
@media screen and (pointer: coarse) {
  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="week"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
  }
}

@media screen {
  .settings-content .settings-fields .field textarea,
  .month-plan-content .managed-edit-form > textarea,
  .month-plan-content .monthly-item-form textarea {
    height: auto;
    min-height: 44px;
    overflow-y: hidden;
    resize: vertical;
  }
}

/* Rework the themes and document-settings pages as a calm, grouped workspace. */
@media screen {
  .settings-heading {
    position: relative;
    align-items: center;
    min-height: 168px;
    overflow: hidden;
    margin-bottom: 20px;
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid #d9e6f4;
    border-radius: 24px;
    background: radial-gradient(circle at 94% 14%, rgba(0, 86, 179, .09), transparent 30%), linear-gradient(120deg, #fff 0%, #f8fbff 100%);
    box-shadow: 0 12px 32px rgba(24, 62, 105, .07);
  }
  .settings-heading::after {
    position: absolute;
    right: -38px;
    bottom: -114px;
    width: 260px;
    height: 200px;
    border: 1px solid rgba(0, 86, 179, .09);
    border-radius: 50%;
    content: "";
    box-shadow: 0 0 0 24px rgba(0, 86, 179, .025), 0 0 0 48px rgba(0, 86, 179, .02);
    pointer-events: none;
  }
  .settings-heading > div,
  .settings-heading > .button { position: relative; z-index: 1; }
  .settings-heading .eyebrow {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--blue-soft);
    letter-spacing: .09em;
  }
  .settings-heading h1 { max-width: 24ch; font-size: clamp(28px, 3.3vw, 40px); }
  .settings-heading .muted { max-width: 72ch; line-height: 1.6; }
  .settings-heading > .button { flex: 0 0 auto; }
  .settings-form { gap: 18px; }
  .settings-content .settings-card {
    border-color: #dce6f1;
    border-radius: 22px;
    background: linear-gradient(145deg, #fff 0%, #fcfdff 100%);
    box-shadow: 0 10px 28px rgba(24, 62, 105, .055);
  }
  .settings-section-heading {
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #edf1f6;
  }
  .settings-section-heading h2 { font-size: 17px; }
  .settings-section-heading p { max-width: 78ch; line-height: 1.6; }
  .settings-step {
    width: 42px;
    height: 42px;
    border: 1px solid #d7e7f7;
    border-radius: 14px;
    background: linear-gradient(145deg, #edf5ff, #e4effb);
    box-shadow: 0 3px 8px rgba(25, 78, 137, .06);
  }
  .settings-fields .field { gap: 8px; line-height: 1.45; }
  .settings-fields .field input,
  .settings-fields .field textarea,
  .approval-date-form .field input,
  .month-plan-content .managed-edit-form > textarea,
  .month-plan-content .monthly-item-form textarea {
    border-color: #d7e1ed;
    border-radius: 13px;
    background: #fcfdff;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  }
  .settings-fields .field input:focus,
  .settings-fields .field textarea:focus,
  .approval-date-form .field input:focus,
  .month-plan-content .managed-edit-form > textarea:focus,
  .month-plan-content .monthly-item-form textarea:focus { background: #fff; }
  .month-select-card {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    border-color: #d4e4f5 !important;
    background: linear-gradient(120deg, #f8fbff 0%, #fff 70%) !important;
  }
  .month-select-card .month-picker { width: 100%; }
  .month-select-card > .muted {
    margin: 0;
    padding-left: 18px;
    border-left: 2px solid #c5dbf2;
    line-height: 1.6;
  }
  .approval-date-card { background: linear-gradient(135deg, #fff 0%, #f7faff 100%) !important; }
  .week-theme-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border-color: #d6e4f4;
    border-radius: 17px;
    background: linear-gradient(135deg, #f5f9ff 0%, #fbfdff 100%);
    box-shadow: 0 4px 12px rgba(25, 72, 125, .035);
  }
  .week-theme-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #4b91d6, #b3d3f1);
    content: "";
  }
  .week-theme-heading { align-items: center; gap: 9px; margin-bottom: 13px; }
  .week-theme-heading strong {
    padding: 6px 10px;
    border: 1px solid #e2eaf3;
    border-radius: 10px;
    color: #223149;
    background: #fff;
  }
  .week-theme-heading span { padding: 5px 9px; border-radius: 999px; color: #527092; background: #e9f2fc; font-size: 11px; font-weight: 700; }
  .theme-managed-row {
    align-items: center;
    gap: 10px;
    margin-top: 9px;
    padding: 11px;
    border: 1px solid #e1eaf4;
    border-radius: 14px;
    background: rgba(255, 255, 255, .88);
  }
  .theme-managed-row .managed-edit-form { align-items: center; gap: 10px; }
  .theme-create-form {
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 13px;
    border-top: 1px dashed #d8e3ef;
  }
  .month-plan-content > .settings-card { margin-bottom: 16px; }
  .monthly-item-card {
    padding: 17px;
    border-color: #dce6f1;
    border-radius: 17px;
    background: #fbfdff;
  }
  .monthly-item-new { border-style: dashed; border-color: #b9d1eb; background: linear-gradient(135deg, #f1f7ff, #fff); }
  .settings-actions {
    padding: 14px 16px;
    border: 1px solid #dce6f1;
    border-radius: 18px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 8px 22px rgba(24, 62, 105, .06);
  }
}

@media screen and (max-width: 734px) {
  .settings-heading { min-height: 0; gap: 14px; padding: 21px; border-radius: 20px; }
  .settings-heading::after { right: -145px; bottom: -120px; }
  .settings-heading h1 { max-width: 18ch; }
  .settings-heading > .button { width: 100%; }
  .settings-section-heading { align-items: flex-start; gap: 11px; margin-bottom: 16px; padding-bottom: 14px; }
  .settings-step { width: 38px; height: 38px; flex-basis: 38px; }
  .settings-content .settings-card { border-radius: 19px; }
  .month-select-card { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .month-select-card > .muted { padding: 12px 0 0; border-top: 1px solid #e3edf7; border-left: 0; }
  .week-theme-card { padding: 14px 13px 14px 16px; }
  .week-theme-heading { flex-wrap: wrap; }
  .theme-managed-row { padding: 10px; }
  .theme-managed-row .managed-edit-form { gap: 9px; }
  .theme-create-form { padding-top: 12px; }
  .monthly-item-card { padding: 13px; }
  .settings-actions { gap: 9px; padding: 12px; border-radius: 15px; }
}

/* Time conflicts are actionable errors, so keep them above the open event editor. */
@media screen {
  .toast-region {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(14px, env(safe-area-inset-top)) 12px 12px;
    pointer-events: none;
  }
  .floating-toast {
    display: flex;
    width: min(520px, calc(100vw - 24px));
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 14px 15px;
    border: 1px solid #f0c9c5;
    border-radius: 16px;
    color: #7f201a;
    background: #fff9f8;
    box-shadow: 0 16px 42px rgba(64, 27, 24, .22);
    animation: toast-pop-in .2s ease both;
    pointer-events: auto;
  }
  .floating-toast-icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 9px;
    color: #fff;
    background: #c24136;
    font-size: 17px;
    font-weight: 800;
  }
  .floating-toast p { flex: 1; margin: 0; font-size: 13px; font-weight: 650; line-height: 1.45; }
  .floating-toast-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #8c332d;
    background: transparent;
    font-size: 22px;
    line-height: 1;
  }
  .floating-toast-close:hover { background: #fbe9e7; }
}

@keyframes toast-pop-in {
  from { opacity: 0; transform: translateY(-8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .floating-toast { animation: none; }
}

/* Polish the on-screen preview controls while keeping the printable page intact. */
@media screen {
  .print-page .print-filter-bar {
    padding: 14px clamp(16px, 2.2vw, 36px) 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .print-page .print-filter-bar .print-filters {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 14px;
    gap: 12px;
    border: 1px solid #dce6f1;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(24, 62, 105, .045);
  }
  .print-calendar .print-time { align-items: baseline; font-variant-numeric: tabular-nums; }
  .print-calendar .print-time sup {
    position: relative;
    top: -.12em;
    margin-left: 1px;
    font-size: .72em;
    line-height: 0;
    vertical-align: super;
  }
  .print-calendar .print-event-title {
    font-weight: 400 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

@media screen and (min-width: 735px) {
  .print-page .print-topbar { box-shadow: none; }
  .print-page .print-actions-menu[open] > .print-toolbar-actions {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .print-page .print-toolbar-actions > .button,
  .print-page .print-toolbar-actions > .button:hover { box-shadow: none; }
}

@media screen and (max-width: 734px) {
  .print-page .print-filter-bar { padding: 10px 12px 0; }
  .print-page .print-filter-bar .print-filters { padding: 12px; gap: 10px; border-radius: 16px; }
  .print-calendar .print-time { padding: 5px 9px; }
}


/* Keep the preview filters and date controls inside the available viewport width. */
@media screen {
  .print-page .print-filter-bar,
  .print-page .print-filter-bar .print-filters,
  .print-page .print-filter-bar .print-filters > *,
  .print-page .print-filter-date,
  .print-page .print-filter-date .native-date-control {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(180px, 1fr)) auto auto;
    align-items: end;
  }
  .print-page .print-filter-bar .print-filter-search { grid-column: 1; grid-row: 1; }
  .print-page .print-filter-bar .print-filter-from { grid-column: 2; grid-row: 1; }
  .print-page .print-filter-bar .print-filter-to { grid-column: 3; grid-row: 1; }
  .print-page .print-filter-bar .print-filter-submit { grid-column: 4; grid-row: 1; }
  .print-page .print-filter-bar .print-filter-reset { grid-column: 5; grid-row: 1; }
  .print-page .print-filter-date .native-date-control,
  .print-page .print-filter-date input[type="date"] {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    box-sizing: border-box !important;
  }
}

@media screen and (min-width: 735px) and (max-width: 1279px) {
  .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas:
      "search search search"
      "from to submit"
      "reset reset reset";
  }
  .print-page .print-filter-bar .print-filter-search { grid-area: search; }
  .print-page .print-filter-bar .print-filter-from { grid-area: from; }
  .print-page .print-filter-bar .print-filter-to { grid-area: to; }
  .print-page .print-filter-bar .print-filter-submit { grid-area: submit; width: auto; }
  .print-page .print-filter-bar .print-filter-reset { grid-area: reset; justify-self: start; width: auto; }
}

@media screen and (max-width: 734px) {
  .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "search" "from" "to" "submit" "reset";
  }
  .print-page .print-filter-bar .print-filter-search { grid-area: search; }
  .print-page .print-filter-bar .print-filter-from { grid-area: from; }
  .print-page .print-filter-bar .print-filter-to { grid-area: to; }
  .print-page .print-filter-bar .print-filter-submit { grid-area: submit; width: 100%; }
  .print-page .print-filter-bar .print-filter-reset { grid-area: reset; width: 100%; }
  .print-page .print-filter-date input[type="date"] { font-size: 16px; }
}

/* Keep the two date controls paired when the phone still has room for native date text. */
@media screen and (min-width: 380px) and (max-width: 734px) {
  .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "search search"
      "from to"
      "submit submit"
      "reset reset";
  }
  .print-page .print-filter-bar .print-filter-submit,
  .print-page .print-filter-bar .print-filter-reset { width: 100%; }
  .print-page .print-filter-date > span:first-child { overflow-wrap: anywhere; }
  .print-page .print-filter-date input[type="date"] { padding-inline: 6px; }
}

@media screen and (min-width: 735px) and (max-width: 900px) {
  .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "search search"
      "from to"
      "submit submit"
      "reset reset";
  }
  .print-page .print-filter-bar .print-filter-submit,
  .print-page .print-filter-bar .print-filter-reset { width: 100%; }
}

@media screen and (max-width: 379px) {
  .print-page .print-filter-date input[type="date"] { font-size: 15px; padding-inline: 6px; }
}

/* Android's native date/time text proxy needs centered line boxes in every form. */
@media screen and (pointer: coarse) {
  html[data-native-platform="android"] .native-date-control.is-enhanced > .native-date-display {
    align-items: center;
    justify-content: flex-start;
    padding: 0 40px 0 12px;
    line-height: 1.25;
    text-align: left;
  }
  html[data-native-platform="ios"] .native-date-control.is-enhanced > .native-date-display {
    align-items: center;
    justify-content: center;
    padding-top: 1px;
    line-height: 1.25;
  }
}

/* Keep iOS preview dates wide enough for their localized value and calendar icon. */
@media screen and (max-width: 1279px) {
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filters,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filters {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "search" "from" "to" "submit" "reset";
  }
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filter-search,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filter-search { grid-area: search; }
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filter-from,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filter-from { grid-area: from; }
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filter-to,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filter-to { grid-area: to; }
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filter-submit,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filter-submit { grid-area: submit; width: 100%; }
  html[data-native-platform="ios"] .print-page .print-filter-bar .print-filter-reset,
  html[data-native-platform="android"] .print-page .print-filter-bar .print-filter-reset { grid-area: reset; width: 100%; }
  html[data-native-platform="ios"] .print-page .print-filter-date .native-date-control > .native-date-display {
    align-items: center;
    justify-content: flex-start;
    padding: 0 42px 0 14px;
    line-height: 1.25;
    text-align: left;
  }
}

@media screen and (min-width: 1401px) {
  .print-page .print-topbar { justify-content: space-between; }
  .print-page .print-main-nav {
    position: absolute;
    left: 50%;
    margin-left: 0;
    transform: translateX(-50%);
  }
}

/* Calendar hierarchy: clear date numerals, readable time labels, and useful day summaries. */
@media screen {
  .print-page .print-calendar .print-date,
  .print-page .print-calendar .mobile-day-number {
    color: #0758a8;
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
    line-height: 1.15;
  }
  .print-page .print-calendar .print-time {
    align-items: baseline;
    padding: 5px 9px;
    border: 1px solid #d5e7fa;
    border-radius: 9px;
    color: #0758a8;
    background: #edf5fe;
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.25;
  }
  .print-page .print-calendar .print-time sup { font-size: .76em; font-weight: 800; }
  .print-page .print-calendar .print-event-title { color: #1e293b; font-size: 14px; font-weight: 400 !important; line-height: 1.45; }
  .print-page .print-calendar .print-event p { color: #485a72; font-size: 12px; line-height: 1.55; }
  .print-page .print-calendar .print-event p strong { color: #34445c; font-weight: 700 !important; }
  .print-page .print-calendar .print-empty-day {
    margin: 10px 0;
    padding: 9px 10px;
    border: 1px dashed #dbe5f0;
    border-radius: 10px;
    color: #718096;
    background: #f8fafd;
    font-size: 12px;
    text-align: center;
  }
}

@media screen and (max-width: 734px) {
  .print-page .print-calendar .mobile-date { align-items: center; flex-wrap: wrap; }
  .print-page .print-calendar .mobile-day-number { font-size: 18px; }
  .print-page .print-calendar .mobile-weekday { margin-left: auto; }
  .print-page .print-calendar .print-time { font-size: 14px; }
  .print-page .print-calendar .print-event p { font-size: 13px; }
}

