/* Shared shell: modules have their own row; adding tools never squeezes the title
   or the primary task action. Neutral colors follow the existing theme tokens. */
.page-shell { max-width: 1680px; padding: 24px 28px 40px; }
.page-header { grid-template-columns: minmax(0,1fr) auto; gap: 18px; padding: 18px 22px 12px; border-radius: 16px; background: var(--panel); box-shadow: none; backdrop-filter: none; }
.page-title-group h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.045em; }
.header-context { display: block; font-size: 9px; color: var(--muted); letter-spacing: .08em; }
.page-header .header-actions { width: auto; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.page-header #addTaskButton { min-height: 40px; padding: 0 15px; font-size: 12px; border-radius: 8px; }
.header-menu__trigger { width: 40px; height: 40px; border-radius: 8px; }
.header-menu__panel { width: min(300px,calc(100vw - 32px)); padding: 12px; max-height: calc(100dvh - 110px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; z-index: 50; }
.workspace-menu-label { color: var(--muted); font-size: 9px; letter-spacing: .1em; margin: 4px 8px; }
.workspace-nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.workspace-nav .workspace-tab { display: inline-flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 125px; min-height: 42px; padding: 10px 15px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font: 500 12px/1.4 "DM Sans",system-ui,sans-serif; }
.workspace-nav .workspace-tab:hover { background: var(--surface-hover); color: var(--text); }
.workspace-nav .workspace-tab[aria-current="page"] { background: var(--surface-muted); color: var(--text); border-color: var(--line); }
.workspace-tab b { font-weight: 600; overflow-wrap: anywhere; }
.workspace-tab svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace-nav #studyButton { font-size: 12px; min-width: 125px; padding: 10px 15px; }
.workspace-nav #studyButton b { display: inline; }
.workspace-tab.study-has-active::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text); }
.workspace-nav :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.today-notice { padding: 17px 22px; border-radius: 14px; box-shadow: none; margin: 16px 0; }
.today-notice__head { gap: 10px; }
.today-notice__date { font-weight: 600; }
.today-notice__list { gap: 8px; }
.today-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.panel-shell { border-radius: 14px; box-shadow: none; padding: 22px; min-width: 0; }
.planner-layout { gap: 18px; align-items: start; }
.calendar-head { align-items: center; flex-wrap: wrap; row-gap: 12px; }
.calendar-head .section-title-block { flex: 1; min-width: 140px; }
.calendar-controls { flex: none; flex-wrap: wrap; }
.calendar-controls .secondary-button { min-height: 38px; border-radius: 8px; }
.calendar-helper { max-width: 70ch; font-size: 11px; line-height: 1.6; margin-bottom: 16px; }
.calendar-frame { overflow: hidden; border-radius: 10px; }
.task-groups-head { flex-wrap: wrap; gap: 12px; }
.task-groups-head > div:first-child { flex: 1; min-width: 140px; }
.task-group__header, .folder-row, .task-card__meta { min-width: 0; }
.task-group__title, .task-group h4, .task-card__title, .unscheduled-card__name { overflow-wrap: anywhere; }
.task-group, .task-group__list { min-width: 0; }
.task-group__empty { line-height: 1.6; padding: 20px 12px; }
.task-groups-nav { display: none; }
.unscheduled-list { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0,1fr); overflow-x: hidden; overflow-y: auto; max-height: 74dvh; scroll-snap-type: none; cursor: auto; gap: 9px; padding: 0; }
.unscheduled-list .task-group { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 0; height: auto; flex: none; box-shadow: none; }
.task-group__summary { cursor: pointer; min-height: 44px; padding: 10px 12px; list-style: none; font-weight: 600; }
.task-group__summary::-webkit-details-marker { display: none; }
.task-group__summary::before { content: "›"; display: block; flex: none; font-size: 19px; line-height: 1; color: var(--muted); transform: rotate(0); }
.task-group[open] > .task-group__summary::before { transform: rotate(90deg); }
.task-group__folder { flex: 1; overflow-wrap: anywhere; font-size: 11px; }
.task-group__folder::before { display: none; }
.task-group__summary-actions { flex: none; }
.task-group__delete { min-width: 30px; width: 30px; height: 30px; }
.task-group__body { display: grid; height: auto; max-height: none; grid-template-rows: minmax(0,1fr) auto; padding: 0 10px 10px; }
.task-group__items { max-height: 360px; overflow-y: auto; overflow-x: hidden; padding: 1px; }
.task-group--composer .task-group__summary::before { display: none; }
.task-group--composer .task-group__body { padding: 0 12px 12px; }
.mobile-selected-day-head { flex-wrap: wrap; row-gap: 10px; }
.mobile-selected-day-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mobile-selected-day-panel { border-radius: 12px; }
.modal-card, .journal-redesign-panel, .docs-layout, .docs-sidebar, .docs-main { min-width: 0; }
.modal-card { max-height: calc(100dvh - 32px); overflow: auto; }
.journal-redesign-panel { max-height: calc(100dvh - 24px); }
.journal-drawer:not(.hidden) .journal-redesign-panel { inset: 14px 0; width: min(1100px,calc(100% - 28px)); max-height: calc(100dvh - 28px); margin-inline: auto; transform: none; animation: workspace-panel-in .15s ease; }
@keyframes workspace-panel-in { from { opacity: 0; } to { opacity: 1; } }
@media(min-width:1280px) { .planner-layout { grid-template-columns: minmax(0,1fr) minmax(320px,350px); } }
@media(max-width:980px) {
  .page-shell { padding: 14px 16px 32px; }
  .page-header { padding: 16px 18px 10px; gap: 13px; }
  .planner-layout { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .panel-shell { padding: 18px; }
  .today-notice { padding: 16px 18px; }
}
@media(max-width:600px) {
  .page-shell { padding: max(10px,env(safe-area-inset-top)) 10px max(24px,env(safe-area-inset-bottom)); }
  .page-header { grid-template-columns: minmax(0,1fr) auto; gap: 12px 8px; padding: 14px 12px 9px; border-radius: 13px; }
  .page-header .page-title-group h1 { font-size: 20px; }
  .header-context { display: none; }
  .page-header .header-actions { width: auto; gap: 5px; }
  .page-header #addTaskButton { min-width: 0; min-height: 38px; padding: 0 10px; font-size: 11px; }
  .header-menu__trigger { width: 36px; height: 38px; }
  .workspace-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding-top: 9px; }
  .workspace-nav .workspace-tab, .workspace-nav #studyButton { flex-direction: column; gap: 4px; min-width: 0; min-height: 57px; padding: 7px 2px; font-size: 10px; text-align: center; justify-content: center; position: relative; }
  .workspace-tab svg { width: 17px; height: 17px; }
  .workspace-tab.study-has-active::after { position: absolute; top: 9px; right: 12px; }
  .today-notice { border-radius: 12px; padding: 14px; margin: 12px 0; }
  .today-notice__head { gap: 7px; align-items: center; }
  .today-notice__label { font-size: 9px; }
  .today-notice__journal { max-width: 110px; font-size: 11px; min-height: 34px; }
  .today-notice__list { padding-bottom: 0; }
  .panel-shell { padding: 14px; border-radius: 12px; }
  .calendar-head .section-title-block { min-width: 0; }
  .calendar-head h2 { font-size: 19px; }
  .calendar-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; gap: 6px; }
  .calendar-controls .secondary-button { min-width: 0; padding: 0 5px; font-size: 11px; }
  .calendar-weekdays span { font-size: 9px; padding: 9px 2px; }
  .task-groups-card { padding: 12px; }
  .task-groups-head { gap: 8px; }
  .task-groups-head h3 { font-size: 16px; }
  .task-groups-head .section-head p { font-size: 11px; }
  .mobile-selected-day-actions .secondary-button { min-height: 36px; }
  .modal-card { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 18px 14px; }
  .modal-actions { flex-wrap: wrap; gap: 8px; }
  .modal-actions > button { flex: 1; min-width: 85px; min-height: 42px; }
  .journal-redesign-header h2 { font-size: 32px; }
  .journal-drawer:not(.hidden) .journal-redesign-panel { inset: 10px 0; width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
}
@media(max-width:360px) {
  .page-header .page-title-group h1 { font-size: 18px; }
  .page-header #addTaskButton { padding: 0 8px; font-size: 10px; }
  .workspace-nav .workspace-tab, .workspace-nav #studyButton { font-size: 9px; }
}
@media(max-height:520px) and (orientation:landscape) {
  .page-header { position: relative; top: auto; }
  .header-menu__panel { max-height: calc(100dvh - 80px); }
  .modal-card, .journal-redesign-panel { max-height: calc(100dvh - 16px); }
}

/* Today keeps the workspace navigation and four short, actionable lists. */
#todayHome[hidden], #calendarScreen[hidden], #homeFeedback[hidden] { display: none; }
#addTaskButton[hidden] { display: none !important; }
.page-shell:has(#todayHome:not([hidden])) .header-context { display: none; }
.today-home { width: min(100%, 1080px); margin: 0 auto; padding: 42px 12px 32px; color: var(--text); }
.home-intro, .home-card > header, .quick-capture header, .quick-capture footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-intro { margin-bottom: 23px; }
.home-intro time { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.home-intro h2 { margin: 5px 0 0; font-size: clamp(34px, 5vw, 48px); line-height: 1.05; letter-spacing: -.06em; }
#quickCaptureButton { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 9px; }
#quickCaptureButton kbd { font: inherit; font-size: 10px; opacity: .72; white-space: nowrap; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.home-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.home-card > header { margin-bottom: 12px; }
.home-card h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.03em; }
.home-muted { color: var(--muted); font-size: 12px; margin: 0; }
.home-link, .home-row-link, .home-check { font: inherit; color: var(--text); background: transparent; cursor: pointer; }
.home-link { border: 0; border-radius: 6px; padding: 6px; min-height: 34px; font-size: 11px; white-space: nowrap; color: var(--muted); }
.home-link:hover, .home-row-link:hover, .home-check:hover { background: var(--surface-hover); color: var(--text); }
.home-list { display: grid; gap: 0; }
.home-list > p { padding: 8px 0; }
.home-row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; gap: 8px; align-items: center; border: 0; border-radius: 6px; padding: 7px 6px; min-height: 40px; text-align: left; }
.home-row-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.home-row-link small { white-space: nowrap; color: var(--muted); font-size: 11px; }
.home-list > :not(:first-child) { border-top: 1px solid var(--line-soft); }
.home-task { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; }
.home-check { width: 28px; height: 36px; border: 0; border-radius: 6px; display: grid; place-items: center; }
.home-check::after { content: ""; width: 13px; height: 13px; border: 1px solid var(--muted); border-radius: 50%; }
.home-check:hover::after { background: var(--text); border-color: var(--text); }
.home-metric { display: block; margin: 10px 0 3px; font-size: clamp(29px, 5vw, 39px); font-variant-numeric: tabular-nums; font-weight: 550; letter-spacing: -.05em; }
.home-feedback { position: fixed; z-index: 125; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 28px); padding: 11px 15px; color: var(--panel); background: var(--text); border-radius: 8px; font-size: 12px; }
.quick-capture { width: min(430px, calc(100vw - 28px)); max-height: calc(100dvh - 24px); padding: 19px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--panel); }
.quick-capture::backdrop { background: #0006; }
.quick-capture form { display: grid; gap: 11px; }
.quick-capture h2 { margin: 0; font-size: 18px; }
.quick-capture label, #quickStatus { font-size: 12px; color: var(--muted); }
.quick-capture select, .quick-capture input { width: 100%; padding: 9px 11px; min-height: 42px; font-size: 16px; }
.quick-capture footer .primary-button { min-height: 40px; flex: none; }
.home-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media(max-width: 680px) {
  .today-home { padding: 24px 2px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .home-intro { margin-bottom: 16px; }
  .home-card { padding: 13px 15px; border-radius: 12px; }
  .home-card > header { margin-bottom: 6px; }
  .home-metric { margin-top: 3px; }
  #quickCaptureButton kbd { display: none; }
}
@media(max-width: 600px) {
  .workspace-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
