:root {
  color-scheme: light;
  --canvas: #fdfbf8;
  --surface: #ffffff;
  --surface-muted: #faf8f4;
  --surface-tint: #f6f1e9;
  --text: #292522;
  --text-soft: #736b65;
  --text-faint: #9b928b;
  --border: #e5ddd1;
  --border-strong: #d2c6b7;
  --action: #d66eab;
  --action-hover: #bd5794;
  --action-soft: #d66eab;
  --on-action: #ffffff;
  --on-soft: #ffffff;
  --focus: #356c83;
  --success: #4d7c66;
  --warning: #a36d2e;
  --error: #a84545;
  --rose: #e790aa;
  --lavender: #a996dc;
  --sage: #86bd98;
  --sky: #79b8dc;
  --peach: #e8a074;
  --shadow-soft: 0 16px 45px rgba(68, 53, 44, 0.09);
  --shadow-paper: 0 20px 50px rgba(55, 45, 39, 0.13), 0 2px 8px rgba(55, 45, 39, 0.05);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --header-height: 64px;
  --footer-height: 30px;
  --sidebar-width: 312px;
  --motion-fast: 160ms ease;
  font-family: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="orchid"] { --action: #d66eab; --action-hover: #bd5794; --action-soft: #d66eab; --on-action: #ffffff; --on-soft: #ffffff; --focus: #a55083; }
html[data-theme="aqua"] { --action: #72c9bf; --action-hover: #58afa5; --action-soft: #72c9bf; --on-action: #ffffff; --on-soft: #ffffff; --focus: #438f87; }
html[data-theme="leaf"] { --action: #aed688; --action-hover: #94bd6e; --action-soft: #aed688; --on-action: #ffffff; --on-soft: #ffffff; --focus: #759d54; }
html[data-theme="coral"] { --action: #f69173; --action-hover: #dc7659; --action-soft: #f69173; --on-action: #ffffff; --on-soft: #ffffff; --focus: #c7664b; }
html[data-theme="amber"] { --action: #fcb247; --action-hover: #df952d; --action-soft: #fcb247; --on-action: #ffffff; --on-soft: #ffffff; --focus: #c18125; }
html[data-theme="pastel-rose"] { --action: #ff9aa2; --action-hover: #e67f88; --action-soft: #ff9aa2; --on-action: #171412; --on-soft: #171412; --focus: #c86d75; }
html[data-theme="blush"] { --action: #ffb7b2; --action-hover: #e49a95; --action-soft: #ffb7b2; --on-action: #171412; --on-soft: #171412; --focus: #c9827d; }
html[data-theme="peach"] { --action: #ffdac1; --action-hover: #e3bda4; --action-soft: #ffdac1; --on-action: #171412; --on-soft: #171412; --focus: #c89e82; }
html[data-theme="mint"] { --action: #b5ead7; --action-hover: #98cfbb; --action-soft: #b5ead7; --on-action: #171412; --on-soft: #171412; --focus: #78ae9b; }
html[data-theme="periwinkle"] { --action: #c7ceea; --action-hover: #aab2d0; --action-soft: #c7ceea; --on-action: #171412; --on-soft: #171412; --focus: #8993b5; }

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  margin: 0;
}

body {
  color: var(--text);
  background: var(--canvas);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

strong { font-weight: 600; }

button,
input,
select,
textarea {
  font: inherit;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 78%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--text);
  transform: translateY(-160%);
  transition: transform var(--motion-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  z-index: 20;
  display: grid;
  grid-template-columns: 220px minmax(230px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand,
.brand-copy,
.calendar-context,
.header-actions,
.preview-meta,
.category-legend,
.legal-footer {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--action) 18%, transparent);
  border-radius: 12px;
  color: var(--on-soft);
  background: var(--action-soft);
}

.brand-mark svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.brand-copy {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong,
.calendar-switcher strong {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  letter-spacing: -0.015em;
}

.brand-copy span,
.calendar-switcher small,
.save-status,
.field-hint,
.month-control small,
.control-copy span,
.section-description {
  color: var(--text-soft);
}

.brand-copy span {
  margin-top: 3px;
  font-size: 11px;
}

.calendar-context {
  justify-content: center;
  justify-self: end;
  gap: 12px;
  min-width: 0;
}

.calendar-switcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: fit-content;
  min-width: 0;
  max-width: 360px;
  height: 44px;
  padding: 5px 38px 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-align: center;
  background: var(--surface);
}

.calendar-switcher > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.calendar-switcher small {
  font-size: 10px;
}

.calendar-switcher svg,
.button svg,
.icon-button svg,
.section-tab svg,
.mobile-tabbar svg,
.notice-card svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.calendar-switcher svg {
  position: absolute;
  right: 14px;
  width: 18px;
}

.save-status {
  gap: 6px;
  flex: 0 0 auto;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 15%, transparent);
}

.save-status[data-state="saved"] .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 15%, transparent);
}

.save-status[data-state="saving"] .status-dot {
  background: var(--warning);
}

.save-status[data-state="failed"] .status-dot,
.save-status[data-state="unavailable"] .status-dot {
  background: var(--error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 15%, transparent);
}

.storage-banner {
  position: fixed;
  z-index: 90;
  top: calc(var(--header-height) + 8px);
  left: 50%;
  display: flex;
  width: min(92vw, 720px);
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--border));
  border-radius: 14px;
  color: #5b4327;
  background: #fff8ed;
  box-shadow: var(--shadow-soft);
  transform: translateX(-50%);
  font-size: 11px;
}

.storage-banner[hidden] {
  display: none;
}

.storage-banner > div {
  display: flex;
  gap: 6px;
}

.storage-banner button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

html[data-readonly="true"] .day-cell[tabindex="0"] {
  cursor: default;
}

.header-actions {
  justify-content: flex-end;
  gap: 8px;
}

.view-switcher {
  display: grid;
  grid-template-columns: repeat(3, auto);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
}

.view-switcher button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  color: var(--text-soft);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.view-switcher button.is-selected {
  color: var(--on-soft);
  background: var(--action-soft);
}

.language-picker {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface);
  font-size: 10px;
  font-weight: 650;
}

.language-picker span + span {
  padding-left: 4px;
  border-left: 1px solid var(--border);
}

.language-picker span.is-active {
  color: var(--action);
  font-weight: 800;
}

.language-picker:focus-visible {
  border-color: var(--action);
}

.sidebar-data-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.sidebar-data-actions .button {
  min-height: 34px;
  padding-inline: 8px;
  font-size: 11px;
}

.sidebar-data-actions .button svg { width: 15px; }

.header-theme-picker {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin: 0 14px 0 0;
  background: var(--surface);
}

.header-theme-picker label {
  position: relative;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}

.header-theme-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.header-theme-picker .swatch {
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-strong);
}

.header-theme-picker input:checked + .swatch {
  box-shadow: 0 0 0 2px var(--action);
}

.header-theme-picker input:focus-visible + .swatch {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, white);
  outline-offset: 3px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}

.button {
  min-height: 40px;
  gap: 7px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.button svg {
  width: 17px;
}

.button-primary {
  color: var(--on-action);
  background: var(--action);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--action) 22%, transparent);
}

.button-primary:not(:disabled):hover {
  background: var(--action-hover);
  transform: translateY(-1px);
}

.button-secondary {
  border-color: color-mix(in srgb, var(--action) 24%, var(--border));
  color: var(--on-soft);
  background: var(--action-soft);
}

.button-secondary:not(:disabled):hover {
  border-color: var(--action);
  background: var(--action-soft);
}

.button-danger {
  color: var(--on-action);
  background: var(--action);
}

.button-wide {
  width: 100%;
  color: var(--on-soft);
  background: var(--action-soft);
}

.icon-button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-color: color-mix(in srgb, var(--action) 22%, var(--border));
  border-radius: 50%;
  color: var(--on-soft);
  background: var(--action-soft);
}

.icon-button svg {
  width: 18px;
}

.icon-button:not(:disabled):hover {
  border-color: var(--action);
  background: var(--action-soft);
}

.mobile-action,
.sidebar-close,
.mobile-tabbar,
.mobile-actions-panel,
.panel-scrim {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 12;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 16px 7px;
}

.sidebar-heading h1,
.control-section h2,
.preview-toolbar h2 {
  margin: 2px 0 0;
  letter-spacing: -0.025em;
}

.sidebar-heading h1 {
  max-width: 230px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.12;
}

.eyebrow,
.calendar-kicker {
  color: var(--action);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 0 12px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

.section-tab {
  display: flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
  padding: 5px 2px;
  border: 0;
  border-radius: 10px;
  color: var(--text-soft);
  background: transparent;
  font-size: 10px;
  font-weight: 600;
}

.section-tab svg {
  width: 18px;
}

.section-tab.is-active {
  color: var(--on-soft);
  background: var(--action-soft);
  box-shadow: 0 3px 10px rgba(60, 45, 36, 0.07);
}

.sidebar-content {
  min-height: 0;
  flex: 1;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.control-section {
  padding: 10px 16px 12px;
}

.control-section[hidden] {
  display: none;
}

.control-section h2 {
  font-size: 16px;
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.field-group {
  display: flex;
  margin-bottom: 7px;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
}

.field-group input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-muted);
}

.field-hint {
  font-size: 10px;
}

.month-control {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.month-control > div {
  display: flex;
  align-items: center;
  flex-direction: column;
  line-height: 1.3;
}

.month-control small {
  font-size: 10px;
}

.control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.control-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.control-copy strong {
  font-size: 12px;
}

.control-copy span {
  font-size: 10px;
}

.switch {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(42, 34, 29, 0.2);
}

.switch.is-on {
  background: var(--action);
}

.switch.is-on span {
  left: 20px;
}

.notice-card {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--warning) 20%, var(--border));
  border-radius: var(--radius-md);
  color: color-mix(in srgb, var(--warning) 75%, var(--text));
  background: color-mix(in srgb, var(--warning) 7%, white);
}

.notice-card svg {
  flex: 0 0 18px;
  width: 18px;
}

.notice-card p {
  margin: 0;
  font-size: 10px;
}

.section-description {
  margin: 4px 0 8px;
  font-size: 11px;
}

.manage-categories-button {
  margin-top: 6px;
}

.event-summary {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.event-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 11px;
}

.event-summary-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-summary-empty {
  color: var(--text-soft);
  font-size: 11px;
}

.swatch-row {
  display: flex;
  gap: 10px;
}

.control-label {
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.color-grid label { color: var(--text-soft); font-size: 10px; }
.color-grid input { display: block; width: 100%; min-height: 38px; margin-top: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.control-label { display: block; margin-top: 11px; }

#month-notes {
  min-height: 64px;
  max-height: 72px;
  resize: vertical;
}

input[type="range"] {
  --range-progress: 0%;
  height: 6px;
  min-height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(to right, var(--action) 0 var(--range-progress), var(--border-strong) var(--range-progress) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid white;
  border-radius: 50%;
  appearance: none;
  background: var(--action);
  box-shadow: 0 0 0 1px var(--border-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--action);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.data-tools-dialog .dialog-card { width: min(760px, calc(100vw - 32px)); }
.data-tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.data-tool-card { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-muted); }
.data-tool-card h3, .data-tool-card p { margin: 0; }
.data-tool-card h3 { font-size: 14px; }
.data-tool-card p { color: var(--text-soft); font-size: 11px; }
.data-tool-card .button { width: 100%; }
.data-tool-card input[type="text"] { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.data-tool-danger { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--error) 28%, var(--border)); background: color-mix(in srgb, var(--error) 5%, var(--surface)); }
.data-tools-status { min-height: 42px; padding: 10px 18px 16px; margin: 0; color: var(--text-soft); font-size: 11px; }
.data-tools-status.is-error { color: var(--error); font-weight: 700; }

.output-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.output-summary strong { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 400; }
.output-summary span { color: var(--text-soft); font-size: 11px; font-weight: 750; }

.print-pages { display: none; }
.output-dialog-body { display: grid; gap: 12px; }
.output-options { display: grid; gap: 7px; padding: 0; border: 0; margin: 0; }
.output-options legend { margin-bottom: 5px; color: var(--text-soft); font-size: 11px; font-weight: 600; }
.output-option { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(130px, 0.7fr); align-items: center; gap: 8px; min-height: 42px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-muted); }
.output-option input { width: 17px; height: 17px; accent-color: var(--action); }
.output-option select { min-height: 36px; }

.pwa-help-content { display: grid; gap: 12px; }
.pwa-help-content h3, .pwa-help-content ol, .pwa-help-content p { margin: 0; }
.pwa-help-content ol { display: grid; gap: 8px; padding-left: 22px; color: var(--text-soft); font-size: 12px; }
.pwa-status { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--success) 28%, var(--border)); border-radius: 12px; color: #365f4c; background: #f1f8f3; font-size: 11px; font-weight: 700; }
.update-banner { position: fixed; z-index: 110; right: 18px; bottom: calc(var(--footer-height) + 18px); display: flex; width: min(92vw, 520px); min-height: 52px; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 11px; }
.update-banner[hidden] { display: none; }
.update-banner span { flex: 1; }
.update-banner button { min-height: 36px; padding: 0 11px; border: 1px solid color-mix(in srgb, var(--action) 28%, var(--border)); border-radius: 999px; color: var(--on-soft); background: var(--action-soft); font-size: 10px; font-weight: 800; }
.update-banner button:first-of-type { border-color: transparent; color: white; background: var(--action); }

.swatch {
  width: 36px;
  height: 36px;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border), 0 3px 8px rgba(50, 40, 34, 0.08);
}

.swatch-orchid { background: #d66eab; }
.swatch-aqua { background: #72c9bf; }
.swatch-leaf { background: #aed688; }
.swatch-coral { background: #f69173; }
.swatch-amber { background: #fcb247; }
.swatch-pastel-rose { background: #ff9aa2; }
.swatch-blush { background: #ffb7b2; }
.swatch-peach-new { background: #ffdac1; }
.swatch-mint { background: #b5ead7; }
.swatch-periwinkle { background: #c7ceea; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-muted);
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
}

.segmented .is-selected {
  color: var(--on-soft);
  background: var(--action-soft);
  box-shadow: 0 2px 8px rgba(50, 40, 34, 0.08);
}

.preview-workspace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  background: var(--canvas);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 18px 2px;
}

.preview-toolbar h2 {
  font-size: 17px;
}

.preview-meta {
  gap: 5px;
}

.preview-meta span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: color-mix(in srgb, white 78%, transparent);
  font-size: 9px;
  font-weight: 750;
}

.canvas-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 6px 14px 10px;
  overflow: hidden;
}

.calendar-page {
  --page-ratio: 1.414;
  --document-heading: Georgia, "Times New Roman", serif;
  --document-body: Arial, Helvetica, sans-serif;
  --document-accent: #8b5f58;
  --document-text: #292522;
  --document-background: #ffffff;
  display: grid;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--page-ratio) / 1;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: clamp(14px, 2.3vw, 28px);
  border: 1px solid rgba(128, 108, 94, 0.13);
  border-radius: clamp(15px, 2vw, 22px);
  color: var(--document-text);
  background: var(--document-background);
  font-family: var(--document-body);
  box-shadow: var(--shadow-paper);
  container-type: size;
  overflow: hidden;
}

.calendar-page[hidden] { display: none; }
.week-page { --page-ratio: 1.414; grid-template-rows: auto minmax(0, 1fr) auto; }
.daily-page { --page-ratio: 0.707; grid-template-rows: auto minmax(0, 1fr); }

.week-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-top: 1.5cqh;
  border: 1px solid color-mix(in srgb, var(--document-accent) 25%, #ddd);
}

.week-day {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.8cqh;
  padding: 1cqh 0.7cqw;
  border-right: 1px solid color-mix(in srgb, var(--document-accent) 22%, #ddd);
  overflow: hidden;
}

.week-day:last-child { border-right: 0; }
.week-day.is-today { background: color-mix(in srgb, var(--document-accent) 8%, white); }
.week-day-header { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding-bottom: 0.8cqh; border-bottom: 1px solid color-mix(in srgb, var(--document-accent) 18%, #ddd); }
.week-day-header strong { color: var(--document-accent); font-family: var(--document-heading); font-size: clamp(10px, 2.5cqh, 17px); font-weight: 500; }
.week-day-header span { font-size: clamp(6px, 1.3cqh, 9px); font-weight: 800; text-transform: uppercase; }
.week-events { display: grid; align-content: start; gap: 0.7cqh; }
.week-event { padding: 0.6cqh 0.6cqw; border-radius: 6px; font-size: clamp(5px, 1.25cqh, 8px); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.week-empty { color: #978f89; font-size: clamp(6px, 1.3cqh, 9px); }

.week-notes-area {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1cqw;
  padding-top: 1.2cqh;
  color: var(--document-accent);
  font-family: var(--document-heading);
  font-size: clamp(9px, 2cqh, 13px);
}

.week-notes-area textarea {
  min-height: 5.8cqh;
  padding: 0 0.5cqw;
  border: 0;
  border-radius: 0;
  color: var(--document-text);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 1.6cqh, color-mix(in srgb, var(--document-accent) 28%, transparent) 1.7cqh);
  font-family: var(--document-body);
  font-size: clamp(7px, 1.5cqh, 10px);
  line-height: 1.7cqh;
  resize: none;
}

.daily-header { align-items: center; }
.daily-date { color: var(--document-accent); font-family: var(--document-heading); font-size: clamp(10px, 2.3cqh, 16px); }
.daily-layout { display: grid; min-height: 0; grid-template-columns: 0.9fr 1.1fr; gap: 4cqw; padding-top: 2cqh; }
.daily-schedule { display: grid; min-height: 0; grid-template-rows: repeat(13, minmax(0, 1fr)); gap: 0.45cqh; }
.daily-hour { display: grid; min-height: 0; grid-template-columns: 4.5cqw minmax(0, 1fr); align-items: center; gap: 1cqw; }
.daily-hour label { font-family: var(--document-heading); font-size: clamp(7px, 1.5cqh, 10px); }
.daily-hour input { width: 100%; height: 100%; min-height: 0; padding: 0 0.8cqw; border: 0; border-radius: 0; color: var(--document-text); background: color-mix(in srgb, var(--document-accent) 8%, #f2f2f2); font-family: var(--document-body); font-size: clamp(7px, 1.45cqh, 10px); }
.daily-writing { display: grid; min-height: 0; grid-template-rows: minmax(0, 1fr) 30%; gap: 3cqh; }
.daily-writing label { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: 0.8cqh; color: var(--document-accent); font-family: var(--document-heading); font-size: clamp(9px, 2cqh, 14px); letter-spacing: 0.06em; text-align: center; text-transform: uppercase; }
.daily-writing textarea { width: 100%; min-height: 0; padding: 0.5cqh 0.8cqw; color: var(--document-text); font-family: var(--document-body); font-size: clamp(7px, 1.45cqh, 10px); resize: none; }
.daily-task-list textarea { border: 0; border-radius: 0; background: repeating-linear-gradient(to bottom, transparent 0, transparent 2.05cqh, color-mix(in srgb, var(--document-accent) 40%, transparent) 2.15cqh); line-height: 2.15cqh; }
.daily-notes-box textarea { border: 1px solid color-mix(in srgb, var(--document-accent) 48%, #777); border-radius: 0; background: white; }
.print-field-value { display: flex; align-items: center; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.daily-hour .print-field-value { width: 100%; height: 100%; padding: 0 0.8cqw; background: color-mix(in srgb, var(--document-accent) 8%, #f2f2f2); font-size: clamp(7px, 1.45cqh, 10px); }
.week-notes-area .print-field-value { min-height: 5.8cqh; background: repeating-linear-gradient(to bottom, transparent 0, transparent 1.6cqh, color-mix(in srgb, var(--document-accent) 28%, transparent) 1.7cqh); font-family: var(--document-body); font-size: clamp(7px, 1.5cqh, 10px); line-height: 1.7cqh; }
.daily-writing .print-field-value { min-height: 0; padding: 0.5cqh 0.8cqw; color: var(--document-text); font-family: var(--document-body); font-size: clamp(7px, 1.45cqh, 10px); text-align: left; text-transform: none; }
.daily-task-list .print-field-value { background: repeating-linear-gradient(to bottom, transparent 0, transparent 2.05cqh, color-mix(in srgb, var(--document-accent) 40%, transparent) 2.15cqh); line-height: 2.15cqh; }
.daily-notes-box .print-field-value { border: 1px solid color-mix(in srgb, var(--document-accent) 48%, #777); }

.calendar-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 1.2cqh;
  border-bottom: 1px solid #eadfd8;
}

.calendar-header h2 {
  margin: 0.3cqh 0 0;
  color: var(--document-accent);
  font-family: var(--document-heading);
  font-size: clamp(25px, 7cqh, 50px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.calendar-kicker {
  font-size: clamp(7px, 1.6cqh, 11px);
}

.calendar-year {
  color: var(--document-accent);
  font-family: var(--document-heading);
  font-size: clamp(22px, 5cqh, 38px);
  line-height: 1;
}

.calendar-branding { display: flex; align-items: center; gap: 1.5cqw; }

.category-legend {
  justify-content: flex-end;
  gap: clamp(8px, 2.5cqw, 22px);
  min-height: clamp(18px, 5cqh, 32px);
  color: var(--text-soft);
  font-size: clamp(6px, 1.6cqh, 10px);
}

.category-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-sage { background: #9fbea7; }
.dot-rose { background: #dcaaba; }
.dot-sky { background: #a9c9dc; }

.calendar-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto minmax(0, 1fr);
  border-top: 1px solid #ded5cf;
  border-left: 1px solid #ded5cf;
}

.calendar-page[data-grid-style="SOFT"] .calendar-grid,
.calendar-page[data-grid-style="SOFT"] .day-cell,
.calendar-page[data-grid-style="SOFT"] .weekday { border-color: color-mix(in srgb, var(--document-accent) 18%, white); }
.calendar-page[data-grid-style="BOLD"] .calendar-grid,
.calendar-page[data-grid-style="BOLD"] .day-cell,
.calendar-page[data-grid-style="BOLD"] .weekday { border-color: color-mix(in srgb, var(--document-accent) 48%, #777); border-width: 1.5px; }
.week-number { position: absolute; top: 0.5cqh; left: 0.5cqw; color: var(--document-accent); font-size: clamp(5px, 1.2cqh, 8px); font-weight: 800; }
.calendar-grid.has-week-numbers .day-number { margin-left: 1.8cqw; }

.weekday {
  padding: clamp(3px, 1cqh, 7px);
  border-right: 1px solid #ded5cf;
  border-bottom: 1px solid #ded5cf;
  color: #756c66;
  background: #faf7f5;
  font-size: clamp(6px, 1.55cqh, 10px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.weekday.weekend {
  background: #f8f2ef;
}

.calendar-days {
  display: grid;
  min-height: 0;
  grid-column: 1 / -1;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
}

.day-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: clamp(3px, 1cqh, 7px);
  border-right: 1px solid #ded5cf;
  border-bottom: 1px solid #ded5cf;
  background: white;
  overflow: hidden;
}

.day-cell.is-current {
  outline: 2px solid color-mix(in srgb, var(--action) 35%, transparent);
  outline-offset: -2px;
}

.day-cell[tabindex="0"] {
  cursor: pointer;
}

.day-cell[tabindex="0"]:focus-visible {
  z-index: 2;
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.day-cell[data-weekend="true"] {
  background: #fffbf9;
}

.day-cell.is-outside {
  color: #c4bbb5;
  background: #fbf9f7;
}

.day-number {
  display: block;
  margin-bottom: clamp(1px, 0.6cqh, 4px);
  font-size: clamp(7px, 2cqh, 12px);
  font-weight: 750;
}

.event-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: clamp(2px, 0.65cqh, 4px) clamp(3px, 0.8cqw, 6px);
  border-radius: 999px;
  font-size: clamp(5px, 1.45cqh, 9px);
  font-weight: 700;
  line-height: 1.15;
}

button.event-card {
  width: 100%;
  border: 0;
  text-align: left;
}

button.event-card:hover {
  filter: saturate(1.08) brightness(0.98);
}

.event-card > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-school { color: #3f5f49; background: #e7f0e9; }
.event-personal { color: #754c59; background: #f5e6eb; }
.event-planning { color: #42657a; background: #e5f0f6; }

.event-dot {
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.event-dot-school { background: #7ba187; }
.event-dot-personal { background: #c7889e; }
.event-dot-planning { background: #7aaac2; }

.calendar-notes {
  display: block;
  align-items: end;
  gap: 2cqw;
  padding-top: 1.2cqh;
}

.calendar-notes > div:first-child {
  display: flex;
  flex-direction: column;
}

.calendar-notes span {
  color: var(--text-soft);
  font-size: clamp(6px, 1.4cqh, 9px);
}

.calendar-notes strong {
  max-width: 55cqw;
  overflow: hidden;
  font-family: var(--document-heading);
  font-size: clamp(8px, 2cqh, 13px);
  font-weight: 400;
}

.legal-footer {
  z-index: 25;
  justify-content: center;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  background: var(--surface);
  font-size: 10px;
  text-align: center;
}

.legal-footer a {
  margin: 0 3px;
  color: var(--action);
  font-weight: 600;
}

.app-dialog {
  width: min(92vw, 560px);
  max-height: min(88dvh, 760px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--text);
  background: transparent;
  box-shadow: var(--shadow-soft);
  overflow: visible;
}

.app-dialog.dialog-wide {
  width: min(92vw, 680px);
}

.app-dialog::backdrop {
  background: rgba(39, 31, 27, 0.48);
  backdrop-filter: blur(3px);
}

.dialog-card {
  display: flex;
  max-height: min(88dvh, 760px);
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  overflow: hidden;
}

.dialog-card-wide {
  width: min(92vw, 680px);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  background: var(--surface);
}

.dialog-header {
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
}

.dialog-body,
.calendar-list,
.category-editor-list {
  min-height: 0;
  padding: 12px 15px;
  overflow-y: auto;
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.dialog-actions-split {
  justify-content: space-between;
}

.dialog-actions-split > div {
  display: flex;
  gap: 8px;
}

#event-dialog {
  width: min(92vw, 700px);
  max-height: calc(100dvh - 24px);
}

#event-dialog .dialog-card-event {
  max-height: calc(100dvh - 24px);
}

#event-dialog .dialog-header,
#event-dialog .dialog-actions {
  padding: 8px 14px;
}

#event-dialog .dialog-header h2 { font-size: 20px; }

#event-dialog .event-form-grid {
  padding: 7px 14px;
  overflow-y: hidden;
}

#event-dialog .event-form-grid .field-group {
  margin-bottom: 2px;
}

#event-dialog .dialog-body input,
#event-dialog .dialog-body select {
  min-height: 34px;
  padding-block: 4px;
}

#event-dialog .dialog-body textarea {
  min-height: 42px;
  max-height: 52px;
  resize: none;
}

#event-dialog .field-error:empty { display: none; }
#event-dialog .check-field { min-height: 34px; margin-bottom: 2px; }
#event-dialog .button { min-height: 36px; }

.event-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.event-form-grid .field-group {
  gap: 2px;
  margin-bottom: 5px;
}

.field-span {
  grid-column: 1 / -1;
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea,
.category-editor-row input[type="text"] {
  width: 100%;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: white;
}

.dialog-body textarea {
  min-height: 54px;
  resize: vertical;
}

.check-field {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 9px;
  align-self: end;
  margin-bottom: 5px;
  font-weight: 600;
}

.check-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--action);
}

.field-error {
  min-height: 14px;
  color: var(--error);
  font-size: 10px;
}

.calendar-list {
  display: grid;
  gap: 10px;
}

.calendar-list-empty {
  padding: 28px 10px;
  color: var(--text-soft);
  text-align: center;
}

.calendar-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.calendar-list-row.is-active {
  border-color: color-mix(in srgb, var(--action) 40%, var(--border));
  background: color-mix(in srgb, var(--action-soft) 48%, white);
}

.calendar-list-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.calendar-list-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-list-copy span {
  color: var(--text-soft);
  font-size: 11px;
}

.calendar-list-actions {
  display: flex;
  gap: 6px;
}

.calendar-list-actions button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--action) 28%, var(--border));
  border-radius: 999px;
  color: var(--on-soft);
  background: var(--action-soft);
  font-size: 10px;
  font-weight: 750;
}

.category-editor-list {
  display: grid;
  gap: 4px;
}

.category-editor-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 2px;
}

.category-editor-row input[type="color"] {
  width: 32px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

#categories-dialog { width: min(92vw, 520px); }
#categories-dialog .dialog-card { width: min(92vw, 520px); max-height: calc(100dvh - 24px); }
#categories-dialog .category-editor-list { padding: 8px 14px; overflow-y: hidden; }
#categories-dialog .dialog-header,
#categories-dialog .dialog-actions { padding-block: 8px; }
#categories-dialog .category-editor-row input[type="text"] { min-height: 32px; padding-block: 4px; }

.category-editor-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

body:has(dialog[open]) {
  overflow: hidden;
}

@media (max-width: 1180px) {
  .pwa-help-button { display: none; }
  :root {
    --sidebar-width: 286px;
  }

  .topbar {
    grid-template-columns: minmax(190px, 0.8fr) minmax(220px, 1fr) auto;
    gap: 10px;
    padding-inline: 14px;
  }

  .brand-copy span,
  .save-status,
  .desktop-action {
    display: none;
  }

  .calendar-switcher {
    min-width: 210px;
  }

  .view-switcher button { padding-inline: 7px; }
}

@media (max-width: 1023px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.8fr) auto;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(360px, calc(100vw - 48px));
    border-right: 1px solid var(--border);
    border-radius: 0 22px 22px 0;
    box-shadow: var(--shadow-soft);
    transform: translateX(-105%);
    transition: transform var(--motion-fast);
  }

  .sidebar-content { overflow-y: auto; }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close,
  .panel-scrim {
    display: flex;
  }

  .panel-scrim {
    position: fixed;
    z-index: 50;
    inset: 0;
    border: 0;
    background: rgba(39, 31, 27, 0.35);
    opacity: 0;
    transition: opacity var(--motion-fast);
  }

  .panel-scrim.is-visible {
    opacity: 1;
  }

  .preview-workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .canvas-stage {
    padding: 12px 18px 20px;
  }

  .calendar-page {
    width: auto;
    height: 100%;
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 58px;
    --footer-height: 42px;
    --tabbar-height: 70px;
  }

  .app-shell {
    grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height) var(--tabbar-height);
  }

  .data-tools-dialog .dialog-card { width: 100%; }
  .data-tools-grid { grid-template-columns: 1fr; }
  .data-tool-danger { grid-column: auto; }
  .update-banner { right: 10px; bottom: calc(var(--footer-height) + var(--tabbar-height) + 10px); left: 10px; width: auto; flex-wrap: wrap; }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
  }

  .brand-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .calendar-context,
  .button-primary {
    display: none;
  }

  .view-switcher button { min-width: 28px; padding-inline: 5px; font-size: 0; }
  .view-switcher button::after { font-size: 10px; }
  .view-switcher button[data-planner-view="MONTH"]::after { content: "M"; }
  .view-switcher button[data-planner-view="WEEK"]::after { content: "W"; }
  .view-switcher button[data-planner-view="DAY"]::after { content: "D"; }

  .mobile-action {
    display: inline-flex;
  }

  .preview-workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .preview-toolbar {
    padding: 7px 14px 2px;
  }

  .preview-meta span:nth-child(2),
  .preview-meta span:nth-child(3) {
    display: none;
  }

  .canvas-stage {
    align-items: start;
    padding: 8px 12px 12px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .calendar-page {
    width: max(100%, 620px);
    height: auto;
    max-height: none;
    aspect-ratio: var(--page-ratio) / 1;
    transform-origin: top left;
  }

  .legal-footer {
    padding: 3px 14px;
    font-size: 8.5px;
    line-height: 1.25;
  }

  .mobile-tabbar {
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: var(--surface);
  }

  .mobile-tabbar button {
    display: flex;
    min-width: 0;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-direction: column;
    border: 0;
    border-radius: 12px;
    color: var(--text-soft);
    background: transparent;
    font-size: 9px;
    font-weight: 750;
  }

  .mobile-tabbar button.is-active {
    color: var(--on-soft);
    background: var(--action-soft);
  }

  .mobile-tabbar svg {
    width: 20px;
  }

  .mobile-actions-panel {
    position: fixed;
    z-index: 70;
    top: 52px;
    right: 10px;
    display: grid;
    width: 180px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  .mobile-actions-panel[hidden] {
    display: none;
  }

  .mobile-actions-panel button {
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    text-align: left;
    color: var(--on-soft);
    background: var(--action-soft);
  }

  body.has-panel-open {
    overflow: hidden;
  }

  .app-dialog,
  .dialog-card,
  .dialog-card-wide {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100dvh - 16px);
  }

  .event-form-grid {
    grid-template-columns: 1fr;
  }

  .field-span {
    grid-column: auto;
  }

  .dialog-actions-split {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions-split > div {
    justify-content: flex-end;
  }

  .category-editor-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .category-editor-row label { font-size: 9px; }

  .calendar-list-row {
    grid-template-columns: 1fr;
  }

  .calendar-list-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 389px) {
  .brand-copy strong {
    max-width: 180px;
  }

  .preview-toolbar h2 {
    font-size: 14px;
  }

  .canvas-stage {
    padding-inline: 8px;
  }
}

@media (max-height: 699px) and (min-width: 1024px) {
  .app-shell {
    grid-template-rows: 58px minmax(0, 1fr) 28px;
  }

  .preview-workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .sidebar-heading {
    padding-block: 13px 10px;
  }

  .section-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .section-tab {
    min-height: 44px;
  }

  .control-section {
    padding-top: 14px;
  }

  .calendar-page {
    width: min(100%, calc((100dvh - 58px - 28px - 78px) * 1.414));
  }
}

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

@media print {
  html,
  body {
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    background: white;
    overflow: visible;
  }

  .app-shell,
  dialog,
  .storage-banner,
  .panel-scrim,
  .update-banner {
    display: none !important;
  }

  .print-pages {
    display: block;
    width: var(--print-page-width);
    height: auto;
    background: white;
  }

  .print-page {
    width: var(--print-page-width);
    height: var(--print-page-height);
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    padding: 8mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    break-inside: avoid;
    page-break-after: always;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
