
.app-shell { min-height: 100vh; --page-gutter: clamp(16px, 2vw, 32px); }
.topbar {
  height: var(--desktop-header-height, 74px);
  padding: 0 var(--page-gutter);
  gap: var(--desktop-header-gap, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.menu-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line, #cfd6e5); border-radius: 10px; background: transparent; color: var(--ink); font-size: 1.45rem; line-height: 1; cursor: pointer; }

.brand { display: inline-flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; text-decoration: none; color: var(--ink); font: inherit; font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; border-radius: 11px; }
.brand:focus-visible { outline: 3px solid rgba(85,118,243,.24); outline-offset: 4px; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--navy); display: flex; gap: 3px; align-items: end; justify-content: center; padding: 7px 6px; }
.brand-mark i { width: 3px; border-radius: 3px; background: white; display: block; }
.brand-mark i:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 10px; opacity: .75; }
.top-actions, .date-nav, .modal-actions { display: flex; align-items: center; gap: var(--desktop-control-gap, 10px); }
.sync-status { width: 112px; flex: 0 0 112px; text-align: right; white-space: nowrap; color: #68728a; font-size: .74rem; font-weight: 750; }
.sync-status.saved { color: #26866d; }
.sync-status.error { color: #c44b43; }
.icon-button, .primary-button, .secondary-button, .danger-button, .today-button, .text-button, .month-title {
  border: 0; cursor: pointer; transition: transform .18s ease, background .18s ease, color .18s ease;
}
.icon-button:hover, .primary-button:hover, .secondary-button:hover, .today-button:hover { transform: translateY(-1px); }
.icon-button { width: 42px; height: 42px; border-radius: 13px; background: #f0f2f7; display: inline-grid; place-items: center; padding: 0; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.small { width: 34px; height: 34px; border-radius: 11px; font-size: 1.5rem; font-weight: 400; }
.icon-button.small .nav-chevron { width: 18px; height: 18px; stroke-width: 2; }
/* Close controls retain the shared square shape even beside long titles/tabs. */
.modal-head > .icon-button, .capture-preview-head > .icon-button { flex-shrink: 0; aspect-ratio: 1; line-height: 1; }
.primary-button { border-radius: 13px; padding: 11px 17px; background: var(--navy); color: white; font-weight: 750; box-shadow: 0 8px 18px rgba(17,26,53,.16); }
.primary-button span { margin-right: 5px; }
.secondary-button, .danger-button { border-radius: 12px; padding: 10px 16px; font-weight: 700; }
.secondary-button { background: #eff1f6; }
.danger-button { background: #fff0ef; color: #c44b43; }

.dashboard { max-width: none; margin: 0; padding: 24px var(--page-gutter) 48px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; }
.card { background: var(--paper); border: 1px solid rgba(225,229,238,.9); border-radius: var(--radius); box-shadow: var(--shadow); }
.calendar-panel { padding: 20px; align-self: start; position: sticky; top: 16px; }

.calendar-panel { display: flex; flex-direction: column; overflow-anchor: none; }
.calendar-panel > .routine-section { margin-top: auto; }
.sidebar-resize-handle { flex: 0 0 17px; margin: 14px -20px -20px; border-radius: 0 0 var(--radius) var(--radius); }

.calendar-panel > * { flex-shrink: 0; }

.calendar-panel > .routine-section { margin-top: 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.calendar-panel #scratchpadPanel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.calendar-panel .scratchpad-sidebar-head { flex-shrink: 0; }
.calendar-panel .scratchpad { flex: 1 1 auto; min-height: 120px; max-height: none; }

.brand-ket { display: inline-flex; align-items: center; white-space: nowrap; gap: 2px; }
.brand-ket .ket-symbol { font-family: "Cambria Math", "STIX Two Math", math, serif; font-size: 1.5em; font-weight: 400; line-height: 1; }
