@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500;1,600&display=swap');

:root {
  color-scheme: light;
  --navy: #123e72;
  --navy-deep: #0b2d56;
  --navy-soft: #eaf0f7;
  --sky: #48a8d7;
  --orange: #f08a45;
  --ink: #203248;
  --muted: #718096;
  --line: #e7e3da;
  --canvas: #f4f3ee;
  --paper: #fffdf8;
  --paper-shadow: 0 24px 58px rgba(29, 46, 67, .12), 0 3px 8px rgba(29, 46, 67, .06);
  --ui: 'DM Sans', 'Segoe UI', Arial, sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; height: 100dvh; margin: 0; }
body { background: var(--canvas); color: var(--ink); font-family: var(--ui); overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
.primary-button:disabled, .secondary-button:disabled { opacity: .6; transform: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(72,168,215,.35); outline-offset: 2px; }
.is-hidden { display: none !important; }

.app-shell { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-columns: 246px minmax(0, 1fr); background: var(--canvas); }
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 27px 16px 17px; color: #d6e1ef; background: linear-gradient(165deg, #123e72 0%, #0b2d56 100%); }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 10px 36px; }
.brand-icon { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 8px 19px rgba(3,18,41,.22); }
.brand-lockup strong { display: block; color: #fff; font-size: 19px; letter-spacing: -.6px; line-height: 1.05; }
.brand-lockup div span { display: block; margin-top: 5px; color: #98b6d2; font-size: 8px; letter-spacing: 1.55px; font-weight: 700; }
.sidebar-label { padding: 0 12px 10px; color: #92acc6; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.sidebar-label-row { display: flex; align-items: center; justify-content: space-between; padding-right: 9px; }
.primary-nav, .collection-list { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 43px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #cadae9; text-align: left; cursor: pointer; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item:hover, .collection-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; box-shadow: inset 3px 0 #f08a45; }
.nav-item span:nth-child(2) { flex: 1; font-size: 13px; font-weight: 600; }
.nav-glyph { display: grid; width: 24px; height: 24px; place-items: center; color: #9ed5ec; font-size: 17px; }
.nav-item kbd { color: #8aa5bf; font-size: 9px; font-weight: 500; opacity: .75; }
.sidebar-separator { height: 1px; margin: 27px 9px 21px; background: rgba(255,255,255,.13); }
.icon-button { display: inline-grid; width: 34px; height: 34px; flex: none; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--navy); font-size: 19px; cursor: pointer; transition: .18s ease; }
.icon-button:hover { border-color: #adc4dc; background: #f2f6fb; transform: translateY(-1px); }
.icon-button.small { width: 27px; height: 27px; border: 0; background: transparent; color: #a7bfd5; font-size: 17px; }
.collection-item { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #c7d5e3; text-align: left; cursor: pointer; }
.collection-swatch { width: 8px; height: 8px; border-radius: 50%; background: #f08a45; box-shadow: 0 0 0 3px rgba(240,138,69,.12); }
.collection-item span:last-child { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-spacer { flex: 1; min-height: 26px; }
.sidebar-footnote { display: flex; align-items: center; gap: 8px; padding: 9px 11px 13px; color: #98b2ca; font-size: 10px; }
.cloud-dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #8cd6ac; box-shadow: 0 0 0 3px rgba(140,214,172,.12); }
.cloud-dot.busy { background: #f3c46e; box-shadow: 0 0 0 3px rgba(243,196,110,.14); }
.cloud-dot.offline { background: #ee897b; box-shadow: 0 0 0 3px rgba(238,137,123,.14); }
.account-chip { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 12px 8px 4px; border: 0; border-top: 1px solid rgba(255,255,255,.13); background: transparent; color: white; text-align: left; cursor: pointer; }
.avatar { display: grid; width: 33px; height: 33px; flex: none; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: #e7a66b; color: #193957; font-size: 12px; font-weight: 700; }
.account-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.account-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { overflow: hidden; color: #a3bad0; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.more-dots { color: #b1c4d7; font-size: 18px; letter-spacing: 2px; }

.main-content { display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 0 38px 26px; overflow: hidden; }
.topbar { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 18px 0; row-gap: 10px; min-height: 123px; flex: none; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e4e2da; }
.page-heading .eyebrow { margin: 0 0 7px; }
.eyebrow { color: #7e8da0; font-size: 9px; font-weight: 700; letter-spacing: 1.55px; }
.page-heading h1 { margin: 0; color: #1d3147; font-family: var(--serif); font-size: 29px; font-weight: 600; letter-spacing: -.45px; }
.topbar-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 11px; }
.search-box { display: flex; width: 236px; height: 39px; align-items: center; gap: 9px; padding: 0 10px 0 12px; border: 1px solid #e0ddd4; border-radius: 8px; background: rgba(255,255,255,.63); color: #8190a0; }
.search-box > span { color: #64809c; font-size: 22px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search-box input::placeholder { color: #9aa6b2; }
.search-box kbd { flex: none; padding: 3px 5px; border: 1px solid #e5e2db; border-radius: 4px; background: #fff; color: #8d99a5; font-size: 9px; }
.primary-button, .secondary-button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 0; border-radius: 8px; background: var(--navy); box-shadow: 0 5px 13px rgba(18,62,114,.16); color: white; font-size: 11px; font-weight: 700; cursor: pointer; transition: .18s ease; }
.primary-button:hover { background: #194f89; box-shadow: 0 7px 16px rgba(18,62,114,.23); transform: translateY(-1px); }
.primary-button > span:first-child { font-size: 17px; font-weight: 400; }
.secondary-button { border: 1px solid #c9d7e5; background: #f5f8fb; box-shadow: none; color: var(--navy); }
.secondary-button:hover { border-color: #8eaccb; background: #edf3f9; }
.update-badge { grid-column: 1 / -1; justify-self: end; max-width: 100%; min-height: 34px; line-height: 1.4; padding: 0 10px; border: 1px solid #f2d4a2; border-radius: 7px; background: #fff5e5; color: #9a6318; font-size: 10px; cursor: pointer; }
.update-badge.downloaded { border-color: #a8d5b5; background: #eef9f0; color: #31734a; }

.view-panel { display: none; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.view-panel.active-view { display: flex; }
.notebook-toolbar { display: flex; flex-wrap: wrap; padding: 10px 0; min-height: 73px; flex: none; align-items: center; justify-content: space-between; gap: 16px; }
.filter-pills { display: flex; align-items: center; gap: 5px; }
.filter-pill { display: inline-flex; min-height: 30px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #7d8794; font-size: 10px; cursor: pointer; }
.filter-pill span:last-child { display: inline-grid; min-width: 17px; height: 17px; place-items: center; border-radius: 6px; background: #ebe9e1; color: #768492; font-size: 9px; }
.filter-pill.active { border-color: #dfe5eb; background: #fff; color: var(--navy); box-shadow: 0 2px 4px rgba(31,50,73,.03); font-weight: 700; }
.filter-pill.active span:last-child { background: #eaf1f8; color: var(--navy); }
.pin-mark { color: #df9852 !important; background: transparent !important; font-size: 13px !important; }
.toolbar-right { display: flex; margin-left: auto; align-items: center; gap: 12px; }
.quiet-button { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #708095; font-size: 10px; cursor: pointer; }
.quiet-button:hover { background: #eae9e3; color: var(--navy); }
#todayButton { padding: 0 10px; border: 1px solid #e2dfd6; background: rgba(255,255,255,.54); color: #51657b; }

.book-stage { position: relative; display: flex; min-height: 0; flex: 1; flex-direction: column; align-items: center; justify-content: safe center; padding: 8px 0 0; overflow-y: auto; perspective: 1600px; }
.book-spine-shadow { position: absolute; top: 47%; left: 50%; z-index: 0; width: 70%; height: 30px; border-radius: 50%; background: rgba(37,52,67,.18); filter: blur(20px); transform: translate(-50%, 205px); }
.book-spread { position: relative; display: grid; width: min(100%, 1060px); height: auto; max-height: 590px; flex: 1 0 320px; min-height: 320px; grid-template-columns: 1fr 1fr; border-radius: 12px 17px 17px 12px; filter: drop-shadow(0 27px 35px rgba(40,47,58,.1)); transform-style: preserve-3d; transition: transform .38s cubic-bezier(.2,.7,.2,1), filter .38s ease; }
.page-edge { position: absolute; z-index: 12; top: 8%; bottom: 8%; width: 33px; padding: 0; border: 0; background: transparent; cursor: grab; touch-action: none; }
.page-edge:active { cursor: grabbing; }
.page-edge:disabled { cursor: default; pointer-events: none; }
.page-edge-left { left: 0; }
.page-edge-right { right: 0; }
.turn-overlay { position: absolute; z-index: 8; inset: 0; pointer-events: none; transform-style: preserve-3d; }
.turn-stationary, .turn-flipper { position: absolute; top: 0; bottom: 0; width: 50%; }
.turn-stationary.left, .turn-flipper.left { left: 0; }
.turn-stationary.right, .turn-flipper.right { right: 0; }
.turn-flipper { z-index: 2; transform-style: preserve-3d; will-change: transform; }
.turn-flipper.next { transform-origin: left center; }
.turn-flipper.previous { transform-origin: right center; }
.turn-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; background: var(--paper); }
.turn-face.back { transform: rotateY(180deg); }
.turn-face .paper-page, .turn-stationary .paper-page { width: 100%; height: 100%; }
.turn-face.front::after { position: absolute; inset: 0; content: ''; background: linear-gradient(90deg, transparent, rgba(44,51,57,.17)); opacity: var(--turn-shadow, 0); pointer-events: none; }
.turn-stationary { transition: opacity .12s ease; }
.paper-page { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 29px 39px 25px; overflow: hidden; background-color: var(--paper); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(113,153,188,.095) 32px); color: #263a50; }
.page-left { border-radius: 11px 0 0 11px; padding-right: 42px; box-shadow: inset 8px 0 #f4efe5; }
.page-right { border-radius: 0 14px 14px 0; padding-left: 43px; box-shadow: inset -8px 0 #f2ede3; }
.page-left:after, .page-right:after { position: absolute; top: 0; bottom: 0; width: 19px; content: ''; pointer-events: none; }
.page-left:after { right: 0; background: linear-gradient(90deg, transparent, rgba(66,57,40,.055)); }
.page-right:after { left: 0; background: linear-gradient(90deg, rgba(66,57,40,.055), transparent); }
.page-corner { position: absolute; top: 0; right: 0; width: 38px; height: 38px; background: linear-gradient(225deg, #f1ede3 0 49%, #fffdf8 51%); box-shadow: -2px 2px 3px rgba(54,53,46,.06); opacity: .6; }
.page-topline { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid #ebe6dc; }
.page-label { color: #91a0ac; font-size: 8px; font-weight: 700; letter-spacing: 1.35px; }
.page-folio { color: #c3b8a6; font-family: var(--serif); font-size: 12px; font-style: italic; }
.page-date-row { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; }
.date-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.page-date { width: 138px; border: 0; background: transparent; color: #8b9aab; font-size: 9px; letter-spacing: .6px; }
.page-title { width: 100%; flex: none; padding: 3px 0 10px; border: 0; outline: 0; background: transparent; color: #223a53; font-family: var(--serif); font-size: clamp(20px, 2.1vw, 26px); font-weight: 600; line-height: 1.3; }
.page-title::placeholder { color: #b7bec5; font-style: italic; }
.page-body { width: 100%; min-height: 0; flex: 1; padding: 4px 0; border: 0; outline: 0; background: transparent; color: #42556b; font-family: var(--ui); font-size: 12px; line-height: 32px; resize: none; }
.page-body::placeholder { color: #b8bdc0; font-family: var(--serif); font-size: 14px; font-style: italic; }
.page-bottomline { display: flex; min-height: 27px; align-items: center; justify-content: space-between; border-top: 1px solid rgba(226,220,207,.8); }
.page-pin, .page-delete { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: #bbc1c4; font-size: 17px; cursor: pointer; }
.page-pin:hover, .page-pin.is-pinned { color: #df9852; }
.page-delete:hover { color: #c65f52; }
.page-save { color: #aab2b7; font-size: 8px; font-weight: 600; letter-spacing: .7px; }
.spine-highlight { position: absolute; top: 0; bottom: 0; left: 50%; z-index: 4; width: 20px; background: linear-gradient(90deg, rgba(43,39,29,.12), rgba(255,255,255,.72) 48%, rgba(43,39,29,.09)); pointer-events: none; transform: translateX(-50%); }
.book-controls { position: relative; display: grid; width: min(100%, 1060px); min-height: 82px; flex: none; grid-template-rows: auto 44px; padding: 6px 0; align-content: center; justify-items: center; row-gap: 4px; color: #85909d; }
.book-control-main { display: flex; flex: none; align-items: center; justify-content: center; gap: 26px; min-height: 36px; }
#previousSpread, #nextSpread { width: 44px; height: 44px; }
.round-control { display: inline-grid; width: 31px; height: 31px; flex: none; place-items: center; border: 1px solid #e1ded6; border-radius: 50%; background: rgba(255,255,255,.72); color: var(--navy); font-size: 15px; cursor: pointer; transition: .17s ease; }
.round-control:hover:not(:disabled) { border-color: #b4c9dc; background: #fff; transform: scale(1.06); }
.round-control:disabled { cursor: default; opacity: .38; }
.spread-counter { display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; font-size: 10px; line-height: 16px; }
.spread-counter strong { color: #415a73; font-weight: 700; }
.empty-state { display: flex; min-height: 0; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-illustration { position: relative; display: grid; width: 90px; height: 90px; place-items: center; border: 1px solid #e7e4dc; border-radius: 26px; background: linear-gradient(140deg, #fffdf8, #ece8dd); box-shadow: 0 13px 26px rgba(51,63,74,.08); color: #f08a45; font-family: var(--serif); font-size: 38px; transform: rotate(-6deg); }
.empty-illustration i { position: absolute; right: 12px; bottom: 10px; width: 28px; height: 28px; border: 5px solid #123e72; border-radius: 50%; }
.empty-state h2 { margin: 25px 0 7px; color: #243c55; font-family: var(--serif); font-size: 25px; }
.empty-state p { margin: 0 0 20px; color: #7d8996; font-size: 12px; }
.search-empty { padding: 60px 0; color: #82909d; text-align: center; font-size: 13px; }

.calendar-view { overflow: auto; }
.calendar-time-strip { display: flex; min-height: 84px; flex: none; align-items: center; gap: 18px; margin: 4px 0 10px; padding: 10px 15px; border: 1px solid #dce6ed; border-radius: 14px; background: radial-gradient(ellipse at 10% 0%, rgba(106,175,207,.17), transparent 48%), linear-gradient(105deg, rgba(255,255,255,.96), rgba(239,245,247,.9)); box-shadow: 0 6px 18px rgba(31,62,86,.045); }
.calendar-time-block { display: grid; min-width: 155px; gap: 2px; }
.calendar-time-block .eyebrow, .calendar-zone-block .eyebrow { margin: 0; color: #8195a5; font-size: 8px; letter-spacing: 1.25px; }
.calendar-time-block strong { color: #173e66; font-family: var(--ui); font-size: 31px; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .025em; line-height: 1.08; }
.calendar-analog-face { display: none; width: 208px; height: 208px; flex: none; filter: drop-shadow(0 7px 10px rgba(20,55,86,.22)); }
.calendar-analog-face canvas { display: block; width: 100%; height: 100%; }
.analog-time-readout { display: none; color: #173e66; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; line-height: 1.25; }
.calendar-time-strip[data-clock-mode="analog"] { gap: 24px; padding: 16px 22px; }
.calendar-time-strip[data-clock-mode="analog"] .analog-time-readout { display: block; margin: 3px 0 8px; }
.calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block strong { white-space: normal; font-size: 13px; }
.calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block span { white-space: normal; line-height: 1.5; }
.calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block small { margin-top: 4px; line-height: 1.5; }
.calendar-zone-block { display: grid; min-width: 0; flex: 1; gap: 3px; }
.calendar-zone-block strong { overflow: hidden; color: #334b63; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.calendar-zone-block span { overflow: hidden; color: #698096; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-zone-block small { color: #8a98a2; font-size: 8px; }
.calendar-clock-actions { display: grid; flex: none; justify-items: end; gap: 6px; }
.clock-mode-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid #d8e2e8; border-radius: 9px; background: rgba(255,255,255,.72); }
.clock-mode-switch button { min-height: 25px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: #72879a; font: inherit; font-size: 9px; font-weight: 650; cursor: pointer; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.clock-mode-switch button[aria-pressed="true"] { background: #173e66; color: #fff; box-shadow: 0 2px 5px rgba(23,62,102,.2); }
.clock-mode-switch button:focus-visible, .clock-refresh-button:focus-visible { outline: 2px solid #71a9cf; outline-offset: 2px; }
.clock-refresh-button { min-height: 24px; padding: 0 5px; font-size: 9px; }
.calendar-time-strip[data-clock-mode="analog"] .calendar-time-block { display: none; }
.calendar-time-strip[data-clock-mode="analog"] .calendar-analog-face { display: block; }
.calendar-toolbar { display: flex; min-height: 76px; flex: none; align-items: center; justify-content: space-between; gap: 18px; }
.calendar-month-controls, .calendar-connect { display: flex; align-items: center; gap: 9px; }
.calendar-month-controls h2 { min-width: 175px; margin: 0 3px; color: #273c52; font-family: var(--serif); font-size: 20px; font-weight: 600; text-align: center; }
.calendar-month-controls .round-control { width: 29px; height: 29px; }
.calendar-connect { gap: 8px; }
.calendar-status { color: #82909d; font-size: 10px; }
.calendar-status.connected { color: #43875c; }
.calendar-layout { display: grid; min-height: 400px; flex: 1; grid-template-columns: minmax(0,1fr) 265px; gap: 17px; padding: 0 0 20px; }
.calendar-card, .agenda-panel { min-width: 0; border: 1px solid #e7e4dc; border-radius: 11px; background: rgba(255,255,255,.72); box-shadow: 0 4px 12px rgba(39,54,69,.025); }
.calendar-card { display: flex; min-height: 0; flex-direction: column; padding: 18px 20px 12px; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.weekday-row { min-height: 32px; align-items: start; border-bottom: 1px solid #eeece6; color: #929da6; font-size: 8px; font-weight: 700; letter-spacing: .7px; text-align: center; }
.calendar-grid { min-height: 0; flex: 1; grid-template-rows: repeat(6, minmax(47px,1fr)); }
.calendar-day { position: relative; display: flex; min-height: 48px; flex-direction: column; align-items: center; gap: 4px; padding: 6px 3px 3px; border: 0; border-right: 1px solid #f0eee9; border-bottom: 1px solid #f0eee9; background: transparent; color: #53667a; cursor: pointer; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:hover { background: #f6f8fa; }
.calendar-day.muted { color: #c1c6c8; }
.calendar-day.today .day-number { color: #fff; background: var(--navy); }
.calendar-day.selected { background: #f1f5f9; box-shadow: inset 0 0 0 1px #d4e1ec; }
.day-number { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; font-size: 10px; }
.calendar-day.today .day-number { font-weight: 700; }
.day-indicators { display: flex; height: 5px; justify-content: center; gap: 3px; }
.day-indicators i { width: 4px; height: 4px; border-radius: 50%; background: #f08a45; }
.day-indicators i.google-dot { background: #4c9e75; }
.calendar-legend { display: flex; min-height: 24px; align-items: end; justify-content: center; gap: 18px; color: #8a969f; font-size: 8px; }
.calendar-legend span { display: flex; align-items: center; gap: 5px; }
.calendar-legend i { width: 6px; height: 6px; border-radius: 50%; }
.legend-note { background: #f08a45; }.legend-google { background: #4c9e75; }
.calendar-legend .device-dot, .day-indicators .device-dot { background: #6791c8; }
.agenda-event.device-event { border-color: #e2eaf4; background: #f5f8fc; }
.agenda-event.device-event:before { background: #6791c8; }
.agenda-panel { display: flex; flex-direction: column; padding: 18px 14px; overflow: auto; }
.agenda-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 13px; border-bottom: 1px solid #eeece6; }
.agenda-panel-heading .eyebrow { margin: 0 0 4px; font-size: 8px; }
.agenda-panel-heading h3 { margin: 0; color: #2b4056; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.day-note-button { margin: 12px 0 8px; padding: 9px; border: 1px dashed #cbd9e5; border-radius: 7px; background: #f4f7fa; color: #3b648a; font-size: 9px; cursor: pointer; }
.day-note-button:hover { border-color: #80a9c9; background: #edf3f8; }
.day-events { display: grid; align-content: start; gap: 8px; padding-top: 4px; }
.agenda-empty { padding: 13px 7px; color: #9aa3aa; font-size: 10px; line-height: 1.55; }
.agenda-event { position: relative; padding: 9px 9px 9px 12px; border: 1px solid #e8eee9; border-radius: 7px; background: #f7faf7; }
.agenda-event:before { position: absolute; top: 9px; bottom: 9px; left: 0; width: 3px; border-radius: 3px; background: #59a278; content: ''; }
.agenda-event.note-event { border-color: #efe7da; background: #fffaf2; }
.agenda-event.note-event:before { background: #e69c58; }
.agenda-event strong { display: block; color: #3d5064; font-size: 10px; line-height: 1.4; }
.agenda-event time { display: block; margin-top: 4px; color: #8b979f; font-size: 9px; }
.agenda-event button { margin: 5px 0 0; padding: 0; border: 0; background: transparent; color: #4e7c9f; font-size: 9px; cursor: pointer; }

.settings-view { align-items: stretch; gap: 14px; padding: 25px 0; overflow: auto; }
.settings-card { display: flex; flex-shrink: 0; min-height: 102px; align-items: center; gap: 18px; padding: 18px 21px; border: 1px solid #e6e3dc; border-radius: 10px; background: rgba(255,255,255,.7); }
.settings-card.spellcheck-card { justify-content: space-between; }
.spellcheck-card > div { min-width: 0; flex: 1; }
.spellcheck-toggle { display: inline-flex; flex: none; align-items: center; gap: 10px; color: #687c8d; font-size: 10px; cursor: pointer; }
.spellcheck-toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.spellcheck-track { position: relative; width: 40px; height: 23px; flex: none; border-radius: 99px; background: #c6cdd1; transition: background .18s ease; }
.spellcheck-track::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(24,45,65,.22); content: ''; transition: transform .18s ease; }
.spellcheck-toggle input:checked + .spellcheck-track { background: #174777; }
.spellcheck-toggle input:checked + .spellcheck-track::after { transform: translateX(17px); }
.spellcheck-toggle input:focus-visible + .spellcheck-track { outline: 3px solid rgba(72,168,215,.4); outline-offset: 3px; }
.settings-card > div:nth-child(2), .settings-card > div:first-child:not(.settings-mark) { min-width: 0; flex: 1; }
.settings-mark { display: grid; width: 47px; height: 47px; flex: none; place-items: center; border-radius: 13px; background: #eaf1f8; color: var(--navy); font-size: 21px; }
.settings-card .eyebrow { margin: 0 0 6px; }
.settings-card h2, .settings-card h3 { margin: 0 0 5px; color: #253b53; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.settings-card p:not(.eyebrow) { max-width: 650px; margin: 5px 0 0; color: #85919b; font-size: 10px; line-height: 1.55; }
.muted { color: #87939c !important; font-size: 10px; }
.settings-card .muted { margin: 2px 0 0; }
.version-label { color: #97a1a8; font-size: 10px; }
.settings-card.drive-card, .settings-card.import-card, .settings-card.about-card { min-height: 99px; }
.drive-card > div, .import-card > div, .about-card > div { flex: 1; }
.drive-card small { max-width: 140px; text-align: right; }
.settings-card code { padding: 2px 4px; border-radius: 3px; background: #f0eee8; color: #526479; }
.device-permissions-card { flex-direction: column; align-items: stretch; }
.settings-card.alarm-sound-card { min-height: 110px; justify-content: space-between; gap: 22px; }
.alarm-sound-copy { min-width: 0; flex: 1; }
.alarm-sound-controls { display: grid; width: min(420px, 48%); flex: none; gap: 6px; }
.alarm-sound-controls > label { color: #53687b; font-size: 9px; font-weight: 600; }
.alarm-sound-controls > div { display: flex; gap: 8px; }
.alarm-sound-controls select { min-width: 0; min-height: 34px; flex: 1; padding: 0 9px; border: 1px solid #e0ddd6; border-radius: 6px; background: #fffefa; color: #334b63; font: inherit; font-size: 10px; }
.alarm-sound-controls small { color: #87939c; font-size: 8px; }
.settings-card.device-permissions-card > div { flex: none; width: 100%; }
.device-permissions-list { display: grid; gap: 0; }
.permission-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #e8e6e0; }
.permission-row strong, .permission-row small { display: block; }
.permission-row strong { color: #334b63; font-size: 11px; }
.permission-row small { margin-top: 3px; color: #82909b; font-size: 9px; line-height: 1.4; }
.permission-row > div { min-width: 0; }
.permission-row > button { min-width: 112px; white-space: normal; line-height: 1.4; padding-block: 8px; }
.permission-row > span { max-width: 180px; overflow-wrap: anywhere; color: #798a97; font-size: 9px; }
.permission-row > span.permission-granted { color: #37865b; }
.location-button { justify-self: start; grid-column: 1 / -1; }

.dashboard-view, .module-view { overflow: auto; padding: 25px 0 28px; }
.dashboard-welcome { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 25px 28px; border: 1px solid #e4e6e2; border-radius: 13px; background: radial-gradient(ellipse at 83% 0%, rgba(72,168,215,.12), transparent 46%), linear-gradient(118deg, rgba(255,255,255,.94), rgba(246,248,246,.78)); box-shadow: 0 8px 25px rgba(34,54,72,.04); }
.dashboard-welcome .eyebrow { margin: 0 0 8px; }
.dashboard-welcome h2, .module-intro h2 { margin: 0; color: #203a54; font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -.4px; }
.dashboard-welcome p:not(.eyebrow), .module-intro p:not(.eyebrow) { margin: 7px 0 0; color: #7c8a96; font-size: 11px; line-height: 1.55; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 15px; }
.summary-card { display: flex; min-height: 120px; flex-direction: column; align-items: flex-start; padding: 17px 18px; border: 1px solid #e6e4dd; border-radius: 11px; background: rgba(255,255,255,.78); color: var(--ink); text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.summary-card:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(40,58,76,.08); }
.summary-card > span { color: #72849a; font-size: 10px; }
.summary-card > strong { margin-top: 5px; color: var(--navy); font-family: var(--serif); font-size: 32px; font-weight: 600; line-height: 1; }
.summary-card small { margin-top: auto; color: #8b98a2; font-size: 9px; }
.summary-warm > strong { color: #d07b3f; }
.dashboard-lower { display: grid; grid-template-columns: minmax(0,1fr) 230px; gap: 14px; margin-top: 15px; }
.module-card { min-width: 0; padding: 19px; border: 1px solid #e6e3dc; border-radius: 11px; background: rgba(255,255,255,.77); box-shadow: 0 5px 15px rgba(39,54,69,.025); }
.module-heading, .module-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.module-heading .eyebrow, .module-list-heading .eyebrow { margin: 0 0 5px; }
.module-heading h3, .module-list-heading h3 { margin: 0; color: #263c52; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-top: 15px; }
.shortcut-grid button { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; align-items: center; gap: 2px 9px; min-height: 60px; padding: 10px; border: 1px solid #ece9e2; border-radius: 8px; background: #fffefa; text-align: left; cursor: pointer; }
.shortcut-grid button:hover { border-color: #c6d6e4; background: #f8fafb; }
.shortcut-grid button > span { grid-row: 1 / span 2; display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: #edf3f8; color: var(--navy); font-size: 16px; }
.shortcut-grid strong { color: #334a60; font-size: 10px; }
.shortcut-grid small { color: #86939e; font-size: 8px; }
.dashboard-date { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.dashboard-date .eyebrow { margin: 0 0 9px; }
.dashboard-date strong { color: var(--navy); font-family: var(--serif); font-size: 21px; font-weight: 600; text-transform: capitalize; }
.dashboard-date span { margin-top: 9px; color: #85919b; font-size: 9px; line-height: 1.55; }
.dashboard-date .quiet-button { margin-top: 10px; padding-left: 0; }
.module-intro { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.module-intro .eyebrow { margin: 0 0 6px; }
.module-intro h2 { font-size: 25px; }
.module-intro p:not(.eyebrow) { margin-top: 5px; }
.reminder-form, .password-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: end; gap: 12px; }
.reminder-form label, .notice-layout label, .password-form label { display: grid; gap: 5px; color: #53667a; font-size: 10px; font-weight: 700; }
.reminder-form input, .reminder-form textarea, .reminder-form select, .notice-layout input, .notice-layout textarea, .notice-layout select, .password-form input { width: 100%; min-height: 38px; padding: 9px 10px; border: 1px solid #e3e1d9; border-radius: 7px; background: #fff; color: #32475b; font-size: 10px; font-weight: 400; }
.reminder-form textarea, .notice-layout textarea { resize: vertical; line-height: 1.55; }
.reminder-form .wide-field { grid-column: span 3; }
.reminder-form > .primary-button { grid-column: 4; min-height: 38px; }
.password-form-actions { display: flex; flex-direction: column; gap: 6px; }
.password-form-actions > button { min-height: 38px; white-space: nowrap; }
.password-edit-hint { color: #6d8291; font-size: 9px; font-weight: 400; }
.module-list-heading { margin: 20px 0 9px; }
.count-badge { display: grid; min-width: 26px; height: 26px; place-items: center; padding: 0 7px; border-radius: 9px; background: #eaf1f8; color: var(--navy); font-size: 10px; font-weight: 700; }
.record-list, .password-list, .template-list { display: grid; gap: 9px; }
.record-card { display: grid; grid-template-columns: 88px minmax(0,1fr) auto; align-items: start; gap: 14px; padding: 15px 17px; border: 1px solid #e7e4dc; border-radius: 10px; background: rgba(255,255,255,.76); }
.record-card.is-complete { opacity: .72; }
.record-status { display: inline-flex; justify-content: center; padding: 5px 8px; border-radius: 99px; background: #edf3f8; color: #436b8f; font-size: 8px; font-weight: 700; }
.record-status.overdue { background: #fff0e8; color: #b96534; }
.record-status.complete { background: #edf7ef; color: #46815a; }
.record-card-main h4 { margin: 0; color: #2d4358; font-size: 12px; }
.record-card-main p { margin: 5px 0 0; color: #6e7e8d; font-size: 10px; }
.record-card-main small { display: block; margin-top: 5px; color: #8b969f; font-size: 9px; }
.record-card-main .record-notes { color: #778692; line-height: 1.5; white-space: pre-wrap; }
.record-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.record-actions button, .password-record-field button { min-height: 27px; padding: 0 8px; border: 1px solid #e0e4e5; border-radius: 6px; background: #fff; color: #546a7f; font-size: 8px; cursor: pointer; }
.record-actions button:hover, .password-record-field button:hover { border-color: #b7cbd9; color: var(--navy); }
.danger-action { border: 0; background: transparent; color: #b46d62; font-size: 9px; cursor: pointer; }
.module-empty { padding: 24px 14px; border: 1px dashed #deded8; border-radius: 9px; color: #89949c; font-size: 10px; text-align: center; }
.module-empty.compact { padding: 14px 10px; }
.notice-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(290px,.9fr); align-items: start; gap: 14px; }
.notice-layout .module-card { display: grid; gap: 12px; }
.notice-composer textarea { min-height: 175px; }
.template-manager > .primary-button { justify-self: start; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.template-divider { height: 1px; margin: 4px 0; background: #ece9e2; }
.template-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid #efede8; }
.template-item strong { color: #334b61; font-size: 10px; }
.template-item p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: #82909c; font-size: 9px; line-height: 1.5; white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.privacy-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #d9e9df; border-radius: 99px; background: #f5faf6; color: #588468; font-size: 9px; white-space: nowrap; }
.privacy-pill i { width: 6px; height: 6px; border-radius: 50%; background: #73bd8c; }
.password-form { grid-template-columns: repeat(3,minmax(0,1fr)) auto; }
.password-form .module-heading { grid-column: 1 / -1; }
.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 38px; }
.password-input-wrap button { position: absolute; top: 0; right: 0; width: 36px; height: 38px; border: 0; background: transparent; color: #8193a2; cursor: pointer; }
.password-record { padding: 15px 17px; border: 1px solid #e6e3dc; border-radius: 10px; background: rgba(255,255,255,.78); }
.password-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #efede8; }
.password-record-heading > div:first-child { min-width: 0; }
.password-record-heading h4 { overflow-wrap: anywhere; }
.password-record-actions { display: flex; align-items: center; flex: none; gap: 7px; }
.password-record-actions button[data-password-action="edit"] { min-height: 32px; padding: 0 11px; border: 1px solid #d9e3e9; border-radius: 6px; background: #f7fafb; color: var(--navy); font-size: 9px; font-weight: 700; cursor: pointer; }
.password-record-actions button[data-password-action="edit"]:hover { background: #ebf3f8; }
.password-record-heading .eyebrow { margin: 0 0 3px; font-size: 8px; }
.password-record-heading h4 { margin: 0; color: #2f465c; font-size: 12px; }
.password-record-field { display: grid; grid-template-columns: 66px minmax(100px,1fr) auto auto; align-items: center; gap: 7px; min-height: 39px; border-bottom: 1px solid #f0eee9; }
.password-record-field:last-child { border-bottom: 0; }
.password-record-field span { color: #83909a; font-size: 9px; }
.password-record-field code { overflow: hidden; color: #43586d; font-family: var(--ui); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.password-record-field button { min-width: 45px; }
.reminder-dot { background: #e39a55; }
.reminder-event { border-color: #f1e3d3; background: #fffbf6; }
.gallery-view { overflow: auto; padding: 23px 0 30px; }
.gallery-welcome { display: grid; grid-template-columns: 62px minmax(0,1fr) auto; align-items: center; gap: 17px; padding: 23px 25px; border: 1px solid #dfe6e8; border-radius: 15px; background: radial-gradient(ellipse at 10% 0%, rgba(99,178,203,.17), transparent 44%), radial-gradient(ellipse at 100% 100%, rgba(240,138,69,.11), transparent 43%), linear-gradient(118deg, rgba(255,255,255,.97), rgba(242,246,245,.88)); box-shadow: 0 10px 27px rgba(35,57,76,.055); }
.gallery-welcome-mark { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(255,255,255,.85); border-radius: 17px; background: linear-gradient(145deg, #164c80, #0b2d56); box-shadow: 0 9px 18px rgba(18,62,114,.2), inset 0 1px rgba(255,255,255,.35); color: #f8bd85; font-size: 28px; }
.gallery-welcome-copy { min-width: 0; }
.gallery-welcome-copy .eyebrow { margin: 0 0 6px; }
.gallery-welcome-copy h2 { margin: 0; color: #203a54; font-family: var(--serif); font-size: clamp(21px, 2vw, 28px); font-weight: 600; letter-spacing: -.35px; }
.gallery-welcome-copy p:not(.eyebrow) { max-width: 680px; margin: 7px 0 0; color: #7c8a96; font-size: 10px; line-height: 1.6; }
.gallery-welcome-actions { display: grid; justify-items: stretch; gap: 8px; }
.gallery-welcome-actions .primary-button, .gallery-welcome-actions .secondary-button { min-height: 37px; white-space: nowrap; }
.gallery-ai-banner { display: flex; min-height: 68px; align-items: center; gap: 13px; margin-top: 13px; padding: 12px 16px; border: 1px solid #e6e2d9; border-radius: 11px; background: linear-gradient(100deg, rgba(255,255,255,.78), rgba(249,247,240,.82)); }
.gallery-ai-spark { display: grid; width: 35px; height: 35px; flex: none; place-items: center; border-radius: 11px; background: #fff0de; color: #d18244; font-size: 18px; }
.gallery-ai-banner > div { min-width: 0; flex: 1; }
.gallery-ai-banner strong { color: #45586a; font-size: 10px; }
.gallery-ai-banner p { margin: 4px 0 0; color: #89939b; font-size: 9px; line-height: 1.45; }
.gallery-ai-soon { flex: none; padding: 5px 8px; border: 1px solid #f0dfca; border-radius: 99px; background: #fffaf3; color: #b37948; font-size: 7px; font-weight: 700; letter-spacing: .8px; }
.gallery-toolbar { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; border-bottom: 1px solid #e4e2da; }
.gallery-filters { display: flex; min-width: 0; flex-wrap: wrap; gap: 4px; }
.gallery-filter { min-height: 31px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #788899; font-size: 9px; cursor: pointer; }
.gallery-filter:hover { background: rgba(255,255,255,.65); color: var(--navy); }
.gallery-filter.active { border-color: #dfe5e9; background: #fff; color: var(--navy); font-weight: 700; box-shadow: 0 2px 8px rgba(31,53,72,.04); }
.gallery-tools { display: flex; align-items: center; gap: 8px; }
.gallery-search { display: flex; width: 190px; min-height: 33px; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid #e3e0d8; border-radius: 8px; background: rgba(255,255,255,.78); color: #66809a; }
.gallery-search span { font-size: 16px; }
.gallery-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #344b61; font-size: 9px; }
.gallery-search input::placeholder { color: #9aa5ad; }
.gallery-tools select { min-height: 33px; max-width: 175px; padding: 0 9px; border: 1px solid #e3e0d8; border-radius: 8px; background: rgba(255,255,255,.78); color: #65798c; font: inherit; font-size: 9px; }
.gallery-summary { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; color: #87939d; font-size: 9px; }
.gallery-sync-status { display: inline-flex; align-items: center; gap: 7px; }
.gallery-sync-status i { width: 6px; height: 6px; border-radius: 50%; background: #78bd8e; box-shadow: 0 0 0 3px rgba(120,189,142,.12); }
.gallery-sync-status.busy i { background: #dfa75b; animation: gallery-pulse 1.1s ease-in-out infinite; }
.gallery-sync-status.error i { background: #d67568; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(175px,1fr)); align-content: start; gap: 13px; padding: 1px 0 24px; }
.gallery-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid #e4e3dc; border-radius: 11px; background: rgba(255,255,255,.85); box-shadow: 0 5px 15px rgba(33,48,64,.045); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.gallery-card:hover { border-color: #d2dce0; box-shadow: 0 11px 23px rgba(31,53,72,.09); transform: translateY(-2px); }
.gallery-card-open { display: grid; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.gallery-card-media { position: relative; display: grid; aspect-ratio: 1.12; overflow: hidden; place-items: center; background: radial-gradient(circle at 25% 20%, rgba(114,170,195,.17), transparent 45%), linear-gradient(145deg, #e9edf0, #e3e4df 60%, #f1e9dc); color: #c18b5c; }
.gallery-card-media:after { position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(16,37,56,.2)); content: ''; opacity: .35; pointer-events: none; }
.gallery-card-placeholder { position: absolute; z-index: 0; font-size: 32px; opacity: .76; }
.gallery-card-media img { position: absolute; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease, transform .35s ease; }
.gallery-card-media.has-thumbnail img { opacity: 1; }
.gallery-card:hover .gallery-card-media img { transform: scale(1.035); }
.gallery-card-media.thumbnail-failed img { display: none; }
.gallery-kind-badge { position: absolute; z-index: 2; bottom: 9px; left: 9px; padding: 4px 6px; border: 1px solid rgba(255,255,255,.42); border-radius: 5px; background: rgba(20,46,69,.66); color: #fff; font-size: 7px; font-weight: 700; letter-spacing: .6px; backdrop-filter: blur(7px); }
.gallery-card-copy { display: grid; gap: 4px; min-width: 0; padding: 10px 11px 12px; }
.gallery-card-copy strong { overflow: hidden; color: #354b60; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.gallery-card-copy small { overflow: hidden; color: #8b969d; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.gallery-favorite { position: absolute; z-index: 3; top: 8px; right: 8px; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid rgba(255,255,255,.62); border-radius: 50%; background: rgba(255,255,255,.83); color: #728295; font-size: 16px; cursor: pointer; backdrop-filter: blur(8px); }
.gallery-favorite.is-favorite { color: #df8a49; }
.gallery-empty { display: grid; min-height: 255px; align-content: center; justify-items: center; padding: 28px; border: 1px dashed #deded8; border-radius: 13px; background: rgba(255,255,255,.36); text-align: center; }
.gallery-empty-icon { display: grid; width: 52px; height: 52px; place-items: center; border: 1px solid #ede3d5; border-radius: 17px; background: #fff8ee; color: #d59056; font-size: 24px; }
.gallery-empty h3 { margin: 15px 0 0; color: #334b61; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.gallery-empty p { max-width: 420px; margin: 7px 0 15px; color: #83909b; font-size: 9px; line-height: 1.6; }
.gallery-viewer { width: min(1150px, calc(100vw - 40px)); max-width: 1150px; max-height: min(840px, calc(100vh - 40px)); padding: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 16px; background: #f8f7f3; box-shadow: 0 28px 90px rgba(12,34,54,.32); color: var(--ink); }
.gallery-viewer::backdrop { background: rgba(10,28,44,.56); backdrop-filter: blur(6px); }
.gallery-viewer-shell { position: relative; display: grid; min-height: min(650px, calc(100vh - 40px)); grid-template-columns: minmax(0,1.55fr) minmax(280px,.65fr); }
.gallery-viewer-close { position: absolute; z-index: 3; top: 12px; right: 12px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(18,43,64,.42); color: #fff; font-size: 21px; cursor: pointer; backdrop-filter: blur(8px); }
.gallery-viewer-media { display: grid; min-width: 0; min-height: 400px; place-items: center; overflow: hidden; background: radial-gradient(ellipse at center, #334a5f, #172f47 70%); }
.gallery-viewer-media img, .gallery-viewer-media video { display: block; max-width: 100%; max-height: min(80vh, 760px); object-fit: contain; }
.gallery-viewer-details { display: flex; min-width: 0; flex-direction: column; gap: 12px; padding: 33px 23px 22px; overflow-y: auto; background: #fffdf8; }
.gallery-viewer-details .eyebrow { margin: 0; }
.gallery-viewer-details h2 { margin: -7px 32px 0 0; overflow-wrap: anywhere; color: #243c55; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.gallery-viewer-meta { margin: -8px 0 2px; color: #87939b; font-size: 9px; }
.gallery-viewer-details label { display: grid; gap: 5px; color: #5d7183; font-size: 9px; font-weight: 700; }
.gallery-viewer-details input, .gallery-viewer-details select { width: 100%; min-height: 36px; padding: 8px 9px; border: 1px solid #e3e1da; border-radius: 7px; background: #fff; color: #344a60; font-size: 10px; font-weight: 400; }
.gallery-viewer-actions { display: grid; gap: 7px; margin-top: 3px; }
.gallery-viewer-actions button { min-height: 34px; justify-content: center; font-size: 9px; }
.gallery-viewer-actions button:disabled { cursor: not-allowed; opacity: .65; }
.danger-button { min-height: 31px; padding: 0 10px; border: 1px solid #f0d9d4; border-radius: 7px; background: #fff9f7; color: #af6256; font-size: 9px; cursor: pointer; }
.danger-button:hover { border-color: #dbb0a8; background: #fff1ed; }
.gallery-privacy-note { display: flex; align-items: flex-start; gap: 7px; margin: auto 0 0; padding-top: 12px; border-top: 1px solid #efede6; color: #8a969d; font-size: 8px; line-height: 1.5; }
.gallery-privacy-note i { width: 6px; height: 6px; flex: none; margin-top: 2px; border-radius: 50%; background: #78bd8e; }
.gallery-loading { display: flex; align-items: center; gap: 6px; color: #e1e9ef; }
.gallery-loading span { width: 6px; height: 6px; border-radius: 50%; background: #e5ad76; animation: gallery-pulse .8s ease-in-out infinite alternate; }
.gallery-loading span:nth-child(2) { animation-delay: .15s; }.gallery-loading span:nth-child(3) { animation-delay: .3s; }
.gallery-loading small { margin-left: 5px; font-size: 9px; }
.gallery-load-error { max-width: 250px; color: #fff; font-size: 11px; line-height: 1.6; text-align: center; }
@keyframes gallery-pulse { to { opacity: .35; transform: scale(.72); } }
.profile-setup { display: grid; gap: 10px; margin-top: 19px; padding-top: 18px; border-top: 1px solid #efede6; }
.profile-setup .eyebrow { margin: 0; }
.profile-setup h2 { margin: -5px 0 0; color: #203a54; font-family: var(--serif); font-size: 23px; font-weight: 600; }
.profile-setup > p:not(.eyebrow):not(.auth-error) { margin: -4px 0 2px; color: #7f8a95; font-size: 10px; line-height: 1.55; }
.profile-setup label { display: grid; gap: 5px; color: #53667a; font-size: 10px; font-weight: 700; }
.profile-setup input, .profile-setup select { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid #e3e1d9; border-radius: 7px; background: #fff; color: #32475b; font-size: 11px; font-weight: 400; }
.profile-setup input[readonly] { background: #f6f5f0; color: #87939c; }
.profile-setup .dialog-submit { margin-top: 2px; }
.app-update-actions { display: flex; flex: none !important; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.app-update-card { flex-wrap: wrap; }
.app-update-card > div:first-child { flex-basis: 300px !important; }
#androidUpdateStatus { color: var(--navy); font-weight: 600; }
.app-update-card[data-state="error"] #androidUpdateStatus { color: #a35a36; }
.app-update-card[data-state="ready"] #androidUpdateStatus { color: #37865b; }
.android-update-notice { position: fixed; z-index: 30; right: 16px; bottom: max(16px,env(safe-area-inset-bottom)); left: 16px; width: min(440px,calc(100% - 32px)); margin: auto; min-height: 48px; padding: 10px 16px; border: 1px solid #a8d5b5; border-radius: 12px; background: #eef9f0; box-shadow: 0 6px 24px #20324826; color: #265f3b; font-size: 12px; font-weight: 600; cursor: pointer; }
#app:not(.is-hidden) ~ .android-update-notice { display: none; }
body:has(.android-update-notice:not(.is-hidden)) .auth-side-note { display: none; }
.mobile-nav { display: none; }
.auth-screen { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(ellipse at 78% 18%, rgba(102,174,213,.16), transparent 35%), linear-gradient(138deg, #f8f6ef 0%, #eeefe9 58%, #e6eef2 100%); }
.auth-decoration { position: absolute; border: 1px solid rgba(18,62,114,.08); border-radius: 50%; pointer-events: none; }
.auth-decoration-one { top: -230px; right: -130px; width: 700px; height: 700px; box-shadow: 0 0 0 44px rgba(18,62,114,.018), 0 0 0 91px rgba(18,62,114,.015); }
.auth-decoration-two { bottom: -300px; left: -210px; width: 620px; height: 620px; box-shadow: 0 0 0 45px rgba(240,138,69,.025), 0 0 0 98px rgba(240,138,69,.02); }
.auth-card { position: relative; z-index: 1; width: min(440px, calc(100% - 38px)); padding: 38px 43px 30px; border: 1px solid rgba(255,255,255,.86); border-radius: 20px; background: rgba(255,255,252,.84); box-shadow: 0 28px 80px rgba(30,53,72,.12), 0 2px 5px rgba(30,53,72,.04); backdrop-filter: blur(16px); animation: enter .55s cubic-bezier(.2,.7,.2,1) both; }
.auth-logo { width: 58px; height: 58px; margin-bottom: 14px; border-radius: 17px; box-shadow: 0 9px 18px rgba(18,62,114,.17); }
.auth-brand { margin-bottom: 31px; color: var(--navy); font-size: 21px; font-weight: 700; letter-spacing: -.5px; }
.auth-brand span { color: #8b9aa8; font-size: 8px; letter-spacing: 1.6px; }
.auth-card .eyebrow { margin: 0 0 11px; }
.auth-card h1 { margin: 0; color: #1e344b; font-family: var(--serif); font-size: 37px; font-weight: 600; letter-spacing: -.8px; line-height: 1.1; }
.auth-card h1 em { color: #427a9e; font-weight: 500; }
.auth-copy { margin: 14px 0 24px; color: #718091; font-size: 12px; line-height: 1.65; }
.google-button { display: flex; width: 100%; height: 47px; align-items: center; gap: 12px; padding: 0 14px; border: 1px solid #dce2e6; border-radius: 8px; background: #fff; box-shadow: 0 2px 5px rgba(34,55,74,.035); color: #33485d; font-size: 11px; font-weight: 700; cursor: pointer; transition: .18s ease; }
.google-button:hover { border-color: #b6c7d3; background: #fcfdfe; box-shadow: 0 6px 15px rgba(34,55,74,.08); transform: translateY(-1px); }
.google-g { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid #eceef0; border-radius: 50%; color: #4285f4; font-size: 12px; font-weight: 700; }
.button-arrow { margin-left: auto; color: #8293a0; font-size: 15px; }
.auth-privacy { margin: 12px 0 0; color: #969fa5; font-size: 9px; text-align: center; }
.auth-error { min-height: 16px; margin: 9px 0 0; color: #bf554e; font-size: 10px; text-align: center; }
.form-dialog #profileError { min-height: 0; margin: -2px 0 0; color: #bf554e; font-size: 11px; line-height: 1.45; text-align: left; }
.auth-footer { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 20px; padding-top: 17px; border-top: 1px solid #efede6; color: #89969e; font-size: 9px; }
.auth-side-note { position: absolute; right: 5.5vw; bottom: 47px; display: flex; align-items: center; gap: 12px; color: #87939c; font-size: 8px; font-weight: 700; letter-spacing: 1.1px; }
.auth-side-note span { color: #d68a4f; font-family: var(--serif); font-size: 11px; }
.auth-side-note i { width: 32px; height: 1px; background: #c9c8c0; }
.pin-card { display: flex; flex-direction: column; gap: 10px; }
.pin-card h1 { font-size: 29px; }
.pin-card .auth-copy { margin: 3px 0 9px; }
.pin-biometric-option { display: flex; align-items: center; gap: 9px; margin: 2px 0; color: #617386; font-size: 10px; font-weight: 600; }
.pin-biometric-option input { width: 16px; height: 16px; accent-color: var(--navy); }
.pin-label { color: #53667a; font-size: 11px; font-weight: 700; }
.pin-input { width: 100%; min-height: 49px; border: 1px solid #d9e1e8; border-radius: 9px; background: #fff; color: #1f405f; font-size: 23px; letter-spacing: .55em; text-align: center; }
.pin-reset { align-self: center; margin-top: 7px; }

.form-dialog { width: min(440px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,.85); border-radius: 16px; background: #fffdf8; box-shadow: 0 28px 90px rgba(19,41,60,.28); color: var(--ink); }
.form-dialog::backdrop { background: rgba(14,34,55,.36); backdrop-filter: blur(4px); }
.form-dialog form { position: relative; display: grid; gap: 12px; padding: 31px 34px 32px; }
.dialog-close { position: absolute; top: 12px; right: 14px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: #f0eee8; color: #788590; font-size: 19px; cursor: pointer; }
.form-dialog .eyebrow { margin: 0; }
.form-dialog h2 { margin: 0; color: #203a54; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.form-dialog form > p:not(.eyebrow) { margin: -4px 0 2px; color: #7f8a95; font-size: 11px; line-height: 1.55; }
.form-dialog label { display: grid; gap: 5px; color: #53667a; font-size: 10px; font-weight: 700; }
.form-dialog input, .form-dialog select, .form-dialog textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #e3e1d9; border-radius: 7px; background: #fff; color: #32475b; font-size: 11px; font-weight: 400; }
.form-dialog input[readonly] { background: #f6f5f0; color: #87939c; }
.form-dialog textarea { resize: vertical; }
.dialog-submit { width: 100%; margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.toast { position: fixed; z-index: 50; bottom: 24px; left: 50%; max-width: min(440px, calc(100% - 32px)); padding: 11px 16px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: #173d64; box-shadow: 0 9px 25px rgba(21,44,64,.25); color: white; font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8e3d38; }
.toast.success { background: #31734a; }

@keyframes enter { from { opacity: 0; transform: translateY(13px) scale(.988); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 215px minmax(0,1fr); }
  .main-content { padding: 0 25px 22px; }
  .search-box { width: 190px; }
  .paper-page { padding: 24px 28px 20px; }
  .page-left { padding-right: 30px; }.page-right { padding-left: 31px; }
  .calendar-layout { grid-template-columns: minmax(0,1fr) 230px; }
}
@media (max-width: 780px), (max-height: 540px) and (pointer: coarse) {
  body { overflow: hidden; }
  .app-shell { display: flex; flex-direction: column; }
  .sidebar { display: none; }
  .main-content { min-height: 0; flex: 1; padding: 0 17px calc(70px + env(safe-area-inset-bottom)); }
  .dashboard-view, .module-view { padding: 14px 0 18px; }
  .dashboard-welcome { min-height: 120px; padding: 17px; }
  .dashboard-welcome h2 { font-size: 22px; }
  .dashboard-welcome p:not(.eyebrow) { max-width: 310px; font-size: 9px; }
  .dashboard-welcome .primary-button { flex: none; }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
  .summary-card { min-height: 96px; padding: 12px; }
  .summary-card > strong { font-size: 27px; }
  .dashboard-lower { grid-template-columns: 1fr; gap: 9px; margin-top: 9px; }
  .module-card { padding: 14px; }
  .shortcut-grid { gap: 6px; margin-top: 10px; }
  .shortcut-grid button { min-height: 56px; padding: 7px; }
  .module-intro { align-items: flex-start; margin-bottom: 12px; }
  .module-intro h2 { font-size: 21px; }
  .module-intro p:not(.eyebrow) { max-width: 340px; font-size: 9px; }
  .reminder-form { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .reminder-form .wide-field { grid-column: span 2; }
  .reminder-form .location-button { grid-column: span 2; }
  .reminder-form > .primary-button { grid-column: span 2; }
  .record-card { grid-template-columns: 1fr auto; gap: 8px; padding: 12px; }
  .record-status { grid-column: 1 / -1; justify-self: start; }
  .record-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .notice-layout { grid-template-columns: 1fr; gap: 9px; }
  .notice-composer textarea { min-height: 130px; }
  .password-form { grid-template-columns: 1fr; gap: 9px; }
  .password-form-actions, .password-form-actions > button { width: 100%; }
  .password-record { padding: 12px; }
  .password-record-field { grid-template-columns: 52px minmax(65px,1fr) auto auto; gap: 5px; }
  .topbar { min-height: 85px; gap: 8px; padding: 12px 0; }
  .page-heading .eyebrow { margin-bottom: 4px; font-size: 8px; }
  .page-heading h1 { font-size: 23px; }
  .topbar-actions { gap: 7px; }
  .search-box { width: 38px; height: 36px; justify-content: center; padding: 0; border: 0; background: transparent; }
  .search-box input, .search-box kbd { display: none; }
  .search-box > span { font-size: 26px; }
  .primary-button { min-height: 36px; padding: 0 10px; font-size: 10px; }
  .primary-button > span:first-child { font-size: 15px; }
  .notebook-toolbar { min-height: 59px; align-items: center; }
  .filter-pills { gap: 2px; }
  .filter-pill { min-height: 28px; gap: 4px; padding: 0 7px; font-size: 9px; }
  .filter-pill span:last-child { min-width: 15px; height: 15px; font-size: 8px; }
  .toolbar-right { gap: 4px; }
  #importButton { width: 36px; min-width: 36px; height: 36px; padding: 0; color: var(--navy); }
  #importButton .import-label { display: none; }
  #importButton .import-icon { font-size: 20px; }
  #todayButton { padding: 0 7px; font-size: 9px; }
  .book-stage { min-height: 0; justify-content: flex-start; padding: 8px 0 0; }
  .book-spine-shadow { display: none; }
  .book-spread { width: min(100%, 530px); height: auto; max-height: 610px; min-height: 300px; flex-basis: 300px; grid-template-columns: minmax(0,1fr); }
  .turn-stationary { display: none; }
  .turn-flipper { width: 100%; }
  .turn-flipper.left, .turn-flipper.right { left: 0; right: 0; }
  .paper-page { display: none; padding: 22px 24px 18px; border-radius: 11px; box-shadow: inset 7px 0 #f4efe5, inset -7px 0 #f2ede3; }
  .paper-page.mobile-active { display: flex; }
  .page-left:after { display: none; }
  .page-right { padding-left: 24px; }
  .spine-highlight { display: none; }
  .page-topline { padding-bottom: 10px; }
  .page-date-row { margin-top: 17px; }
  .page-title { font-size: 23px; }
  .page-body { font-size: 12px; line-height: 31px; }
  .page-bottomline { margin-top: 5px; }
  .book-controls { min-height: 54px; width: 100%; }
  .mobile-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: flex; height: calc(58px + env(safe-area-inset-bottom)); gap: 0; overflow: hidden; padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid #e2dfd7; background: rgba(255,253,248,.94); backdrop-filter: blur(15px); }
  .mobile-nav-item { display: grid; min-width: 0; flex: 1 1 0; align-content: center; justify-items: center; gap: 2px; border: 0; border-radius: 7px; background: transparent; color: #88939b; font-size: 8px; cursor: pointer; }
  .mobile-nav-item span { font-size: 18px; line-height: 20px; }
  .mobile-nav-item.active { color: var(--navy); font-weight: 700; }
  .calendar-toolbar { min-height: 64px; flex-wrap: wrap; gap: 6px; padding: 7px 0; }
  .calendar-time-strip { min-height: 72px; gap: 9px; margin: 2px 0 7px; padding: 7px 8px; }
  .calendar-time-block { min-width: 106px; }
  .calendar-time-block strong { font-size: 24px; }
  .calendar-analog-face { width: 164px; height: 164px; }
  .calendar-time-strip[data-clock-mode="analog"] { display: grid; grid-template-columns: 164px minmax(0,1fr); gap: 12px; padding: 12px; }
  .calendar-time-strip[data-clock-mode="analog"] .calendar-clock-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
  .calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block strong { font-size: 11px; line-height: 1.5; }
  .calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block span { font-size: 9px; overflow-wrap: anywhere; }
  .calendar-time-strip[data-clock-mode="analog"] .calendar-zone-block small { font-size: 8px; }
  .calendar-time-strip[data-clock-mode="analog"] .analog-time-readout { font-size: 21px; }
  .calendar-time-strip[data-clock-mode="analog"] .clock-mode-switch button { min-height: 30px; padding: 0 13px; font-size: 10px; }
  .calendar-clock-actions { gap: 4px; }
  .clock-mode-switch { padding: 2px; }
  .clock-mode-switch button { min-height: 24px; padding: 0 6px; font-size: 8px; }
  .calendar-zone-block strong { font-size: 9px; }
  .calendar-zone-block span, .calendar-zone-block small { font-size: 7px; }
  .calendar-clock-actions .clock-refresh-button { min-height: 21px; padding: 0 2px; font-size: 8px; }
  .clock-refresh-button span { display: none; }
  .calendar-month-controls { gap: 5px; }
  .calendar-month-controls h2 { min-width: 132px; font-size: 18px; }
  .calendar-month-controls .round-control { width: 27px; height: 27px; }
  .calendar-connect { gap: 6px; }
  .calendar-status { display: none; }
  .calendar-connect .secondary-button { min-height: 31px; padding: 0 9px; font-size: 9px; }
  .calendar-layout { min-height: 0; flex: 1; grid-template-columns: 1fr; grid-template-rows: minmax(285px,1fr) minmax(150px,.68fr); gap: 10px; padding-bottom: 8px; }
  .gallery-view { padding: 13px 0 20px; }
  .gallery-welcome { grid-template-columns: 44px minmax(0,1fr); gap: 10px; padding: 14px; }
  .gallery-welcome-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 22px; }
  .gallery-welcome-copy .eyebrow { font-size: 7px; }
  .gallery-welcome-copy h2 { font-size: 19px; }
  .gallery-welcome-copy p:not(.eyebrow) { font-size: 8px; }
  .gallery-welcome-actions { grid-column: 1 / -1; grid-template-columns: minmax(0,1fr); gap: 7px; }
  .gallery-welcome-actions .primary-button, .gallery-welcome-actions .secondary-button { min-height: 34px; padding: 0 7px; font-size: 8px; }
  .gallery-ai-banner { min-height: 58px; gap: 8px; margin-top: 8px; padding: 9px; }
  .gallery-ai-spark { width: 29px; height: 29px; font-size: 15px; }
  .gallery-ai-banner strong { font-size: 8px; }
  .gallery-ai-banner p { font-size: 7px; }
  .gallery-ai-soon { padding: 4px 6px; font-size: 6px; }
  .gallery-toolbar { align-items: stretch; flex-direction: column; gap: 6px; padding: 9px 0 7px; }
  .gallery-filters { flex-wrap: nowrap; overflow-x: auto; }
  .gallery-filter { min-height: 28px; flex: none; padding: 0 9px; font-size: 8px; }
  .gallery-tools { gap: 6px; }
  .gallery-search { width: auto; min-width: 0; flex: 1; min-height: 31px; }
  .gallery-tools select { width: min(46%,160px); min-height: 31px; font-size: 8px; }
  .gallery-summary { min-height: 31px; font-size: 8px; }
  .gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .gallery-card { border-radius: 9px; }
  .gallery-card-media { aspect-ratio: 1.04; }
  .gallery-card-copy { gap: 3px; padding: 8px 8px 9px; }
  .gallery-card-copy strong { font-size: 9px; }
  .gallery-card-copy small { font-size: 7px; }
  .gallery-favorite { top: 6px; right: 6px; width: 26px; height: 26px; font-size: 14px; }
  .gallery-viewer { width: calc(100vw - 20px); max-height: calc(100dvh - 22px); border-radius: 13px; }
  .gallery-viewer-shell { max-height: calc(100dvh - 22px); min-height: 0; grid-template-columns: 1fr; grid-template-rows: minmax(180px, 42dvh) minmax(0,1fr); overflow-y: auto; }
  .gallery-viewer-media { min-height: 180px; }
  .gallery-viewer-media img, .gallery-viewer-media video { max-height: 42dvh; }
  .gallery-viewer-details { gap: 9px; padding: 15px 15px 14px; overflow: visible; }
  .gallery-viewer-details h2 { font-size: 18px; }
  .gallery-privacy-note { margin-top: 1px; }
  .calendar-card { padding: 11px 9px 8px; }
  .weekday-row { min-height: 26px; font-size: 7px; }
  .calendar-grid { grid-template-rows: repeat(6,minmax(34px,1fr)); }
  .calendar-day { min-height: 34px; gap: 1px; padding: 2px; }
  .day-number { width: 21px; height: 21px; font-size: 9px; }
  .calendar-legend { min-height: 20px; flex-wrap: wrap; gap: 4px 10px; font-size: 7px; }
  .agenda-panel { padding: 10px 12px; }
  .agenda-panel-heading { padding-bottom: 7px; }
  .agenda-panel-heading h3 { font-size: 15px; }
  .day-note-button { margin: 7px 0 3px; padding: 7px; }
  .day-events { grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); }
  .agenda-empty { padding: 7px; }
  .settings-view { gap: 9px; padding: 15px 0; }
  .settings-card { min-height: 80px; gap: 10px; padding: 12px; }
  .settings-card.alarm-sound-card { align-items: stretch; flex-direction: column; gap: 10px; }
  .alarm-sound-controls { width: 100%; }
  .alarm-sound-controls select { min-height: 32px; font-size: 9px; }
  .settings-mark { width: 38px; height: 38px; }
  .settings-card h2, .settings-card h3 { font-size: 15px; }
  .settings-card p:not(.eyebrow) { font-size: 9px; }
  .settings-card .secondary-button, .settings-card > .quiet-button { min-height: 31px; padding: 0 8px; font-size: 9px; }
  .settings-card.spellcheck-card { align-items: flex-start; flex-direction: column; }
  .spellcheck-toggle { align-self: flex-end; }
  .permission-row { grid-template-columns: minmax(0,1fr) auto; gap: 5px 8px; }
  .permission-row > span { grid-column: 1; }
  .permission-row > button { grid-column: 2; grid-row: 1 / 3; }
  .drive-card small { display: none; }
  .auth-card { padding: 29px 25px 22px; }
  .auth-card h1 { font-size: 32px; }
  .auth-brand { margin-bottom: 25px; }
  .auth-screen { align-items: start; overflow-y: auto; padding: 22px 0 64px; }
  .profile-setup { margin-top: 14px; padding-top: 14px; }
  .auth-side-note { right: 0; bottom: max(17px, env(safe-area-inset-bottom)); left: 0; justify-content: center; gap: 7px; font-size: 7px; }
  .auth-side-note i { width: 17px; }
}
@media (max-width: 390px) {
  .main-content { padding-right: 11px; padding-left: 11px; }
  .topbar { min-height: 78px; }
  .page-heading h1 { font-size: 20px; }
  .primary-button { gap: 5px; padding: 0 8px; font-size: 9px; }
  .filter-pill { padding: 0 5px; font-size: 8px; }
  .paper-page { padding-right: 17px; padding-left: 19px; }
  .calendar-month-controls h2 { min-width: 119px; font-size: 16px; }
  .calendar-month-controls .quiet-button { padding: 0 4px; font-size: 9px; }
}

@media (max-width: 1050px) and (min-width: 781px) {
  .topbar-actions .search-box { width: 160px; }
  .settings-card.app-update-card .app-update-actions { flex-basis: 100%; justify-content: flex-start; }
}
@media (max-width: 780px), (max-height: 540px) and (pointer: coarse) {
  .primary-button, .secondary-button, .quiet-button { min-height: 44px; line-height: 1.4; padding-block: 8px; }
  .main-content { padding-top: env(safe-area-inset-top); }
  .page-heading { min-width: 0; }
  .page-heading h1 { overflow-wrap: anywhere; }
  .notebook-toolbar { gap: 8px; }
  .notebook-toolbar .quiet-button { min-height: 36px; }
  .book-stage { justify-content: flex-start; }
  .book-controls { min-height: 82px; }
  .calendar-month-controls { flex-wrap: wrap; }
  .calendar-connect { flex-wrap: wrap; min-width: 0; }
  .calendar-toolbar { flex-shrink: 0; }
  .calendar-time-strip { flex-shrink: 0; flex-wrap: wrap; }
  .settings-card:not(.device-permissions-card):not(.alarm-sound-card) { flex-wrap: wrap; }
  .settings-card > button { flex: none; }
  .settings-card p, .settings-card .muted { overflow-wrap: anywhere; }
  .settings-card .secondary-button, .settings-card > .quiet-button, .permission-row > button { min-height: 44px; }
  .permission-row { grid-template-columns: minmax(0,1fr) 116px; gap: 6px 10px; padding: 14px 0; }
  .permission-row > button { width: 100%; min-width: 0; }
  .permission-row > span { max-width: none; }
  .settings-card.app-update-card .app-update-actions { width: 100%; display: grid; grid-template-columns: minmax(0,1fr); }
  .app-update-card > div:first-child { flex-basis: auto !important; }
  .gallery-welcome-actions .primary-button, .gallery-welcome-actions .secondary-button { min-height: 44px; font-size: 11px; white-space: normal; }
  .record-actions { justify-content: flex-start; }
  .record-actions button { min-height: 40px; font-size: 10px; }
  .auth-screen:has(~ .android-update-notice:not(.is-hidden)) { padding-bottom: 90px; }
}
@media (max-width: 359px) {
  .mobile-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); height: calc(108px + env(safe-area-inset-bottom)); }
  .mobile-nav-item { min-height: 48px; }
  .main-content { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
}

.settings-card.web-access-card { border-color: #d7e4ed; background: linear-gradient(110deg, rgba(241,247,251,.9), rgba(255,255,255,.78)); }
.settings-card.web-access-card .settings-mark { color: #4c91b8; }
.settings-card.web-access-card > button { flex: none; white-space: nowrap; }
@media (max-width: 780px), (max-height: 540px) and (pointer: coarse) {
  .settings-card.web-access-card { align-items: flex-start; flex-wrap: wrap; }
  .settings-card.web-access-card > button { width: 100%; }
}

/* Four clear navigation targets per row on compact phones, including larger text settings. */
@media (max-width: 480px) {
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); height: calc(108px + env(safe-area-inset-bottom)); padding-inline: max(4px, env(safe-area-inset-left)) max(4px, env(safe-area-inset-right)); }
  .mobile-nav-item { min-height: 0; font-size: 9px; line-height: 1.15; }
  .mobile-nav-item span { font-size: 18px; }
  .main-content { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  .reminder-form { grid-template-columns: minmax(0, 1fr); }
  .reminder-form .wide-field, .reminder-form .location-button, .reminder-form > .primary-button { grid-column: 1; }
  .reminder-form input, .reminder-form textarea, .reminder-form select { min-width: 0; font-size: 16px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .topbar-actions { max-width: 100%; }
  .topbar-actions .primary-button { white-space: nowrap; }
  .auth-card { width: min(440px, calc(100% - 24px)); padding-right: clamp(16px, 5vw, 25px); padding-left: clamp(16px, 5vw, 25px); }
  .auth-card h1 { font-size: clamp(27px, 8vw, 32px); }
  .toast { bottom: calc(116px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) and (max-height: 620px) {
  .auth-side-note { display: none; }
  .auth-screen { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .book-spread { min-height: 260px; flex-basis: 260px; }
}
@media (max-width: 780px) and (any-pointer: coarse) {
  body:has(input:focus, textarea:focus, select:focus) .mobile-nav { display: none; }
  body:has(input:focus, textarea:focus, select:focus) .main-content { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}
