/* Mobile uses the established theme tokens; desktop rules remain in styles.css. */
@media (max-width: 760px) {
  :root {
    --safe-top: max(env(safe-area-inset-top, 0px), var(--native-safe-top, 0px));
    --safe-right: max(env(safe-area-inset-right, 0px), var(--native-safe-right, 0px));
    --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--native-safe-bottom, 0px));
    --safe-left: max(env(safe-area-inset-left, 0px), var(--native-safe-left, 0px));
    --mobile-nav-height: calc(62px + var(--safe-bottom));
  }
  html, body, #root { width: 100%; height: var(--app-height, 100dvh); overflow: hidden; }
  .app-shell { display: block; height: var(--app-height, 100dvh); min-height: 0; }
  .sidebar, .sidebar-backdrop, .mobile-menu-button { display: none; }
  .main-content { height: 100%; min-height: 0; margin-left: 0; padding-bottom: var(--mobile-nav-height); padding-left: var(--safe-left); padding-right: var(--safe-right); }
  .topbar { flex: 0 0 auto; padding: calc(10px + var(--safe-top)) 16px 10px; min-height: calc(64px + var(--safe-top)); }
  .topbar h1 { font-size: 20px; }
  .page-scroll { min-height: 0; overscroll-behavior: contain; padding: 16px 16px 24px; }
  .page-title { font-size: clamp(26px, 7vw, 34px); }
  .page-header { flex-wrap: wrap; gap: 16px; }
  .page-header-copy, .settings-content, .library-subpage { min-width: 0; }
  .module-rail { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .module-card { min-width: 0; min-height: 120px; padding: 18px; }
  .module-card h3 { font-size: 17px; text-align: left; }
  .module-card-foot { font-size: 12px; }
  .bookmark-top { grid-template-columns: minmax(0, 1fr); }
  .bookmark-hero { min-height: 156px; gap: 12px; }
  .bookmark-count-card { min-width: 0; min-height: 88px; flex-direction: row; align-items: center; gap: 12px; padding: 18px; }
  .bookmark-count-card strong { font-size: 34px; }
  .bookmark-count-card span { font-size: 11px; }
  [data-theme="liquid-glass"] .shortcut-card { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 8px 12px; min-height: 124px; padding: 18px; }
  [data-theme="liquid-glass"] .shortcut-card-icon { grid-column: 1; grid-row: 1 / 3; width: 44px; height: 44px; }
  [data-theme="liquid-glass"] .shortcut-card-copy { grid-column: 2 / -1; grid-row: 1; min-width: 0; padding: 0 16px 0 0; }
  [data-theme="liquid-glass"] .shortcut-card-copy strong { font-size: 17px; line-height: 1.5; white-space: nowrap; }
  [data-theme="liquid-glass"] .shortcut-card-copy small { font-size: 11px; line-height: 1.5; }
  [data-theme="liquid-glass"] .shortcut-card-meta { grid-column: 2; grid-row: 2; margin: 0; font-size: 11px; white-space: nowrap; }
  [data-theme="liquid-glass"] .shortcut-card-meta b { font-size: 21px; }
  [data-theme="liquid-glass"] .shortcut-card-enter { display: inline-flex; grid-column: 3; grid-row: 2; margin: 0; font-size: 11px; white-space: nowrap; }
  [data-theme="liquid-glass"] .shortcut-card-index { top: 10px; right: 12px; font-size: 10px; }
  .mobile-nav { position: fixed; display: grid; z-index: 12; bottom: 0; left: 0; right: 0; width: 100%; transform: none; border-radius: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px max(8px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(8px, var(--safe-left)); border: 1px solid var(--line); border-left: 0; border-right: 0; border-bottom: 0; background: var(--surface); box-shadow: 0 -4px 18px color-mix(in srgb, var(--ink) 8%, transparent); }
  .mobile-nav button { min-width: 0; display: grid; place-items: center; gap: 3px; color: var(--muted); background: transparent; border-radius: 12px; min-height: 48px; font-size: 11px; }

  .mobile-nav button span { font-size: 11px; }
  [data-theme="liquid-glass"] .mobile-nav { background: linear-gradient(110deg, color-mix(in srgb, var(--surface) 88%, var(--blue-soft)), color-mix(in srgb, var(--surface) 76%, transparent) 52%, color-mix(in srgb, var(--surface) 90%, var(--blue-soft))); border-color: var(--line-strong); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 10%, transparent), 0 -6px 24px color-mix(in srgb, var(--ink) 8%, transparent); }

  [data-color-mode="night"] {
    --muted-2: #a4afbb;
    --pink-soft: #49313e; --blue-soft: #293952;
    --metric-ink: var(--ink); --metric-muted: var(--muted);
    --tile-ink: var(--ink); --tile-muted: var(--muted);
    --control-ink: var(--ink); --control-bg: var(--surface-soft);
    --control-active-bg: color-mix(in srgb, var(--pink) 25%, var(--surface));
    --api-module-bg: var(--surface); --api-header-bg: var(--surface-soft);
    --api-empty-bg: var(--surface); --api-row-bg: var(--surface-soft);
  }
  [data-color-mode="night"] :is(.module-card, .library-hub-card, .bookmark-hero, .bookmark-count-card) { color: var(--ink); border: 1px solid var(--line); background: linear-gradient(135deg, var(--surface-soft), var(--surface)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%), var(--shadow-soft); }
  [data-color-mode="night"] :is(.module-card, .library-hub-card)::before { background: linear-gradient(120deg, rgb(255 255 255 / 5%), transparent 60%); }
  [data-color-mode="night"] :is(.module-card, .library-hub-card)::after { opacity: .2; }
  [data-color-mode="night"] :is(.module-card-foot, .shortcut-card-copy small, .shortcut-card-index, .shortcut-card-meta, .library-hub-copy p, .bookmark-count-card span) { color: var(--muted); }
  [data-color-mode="night"] :is(.module-card .icon, .shortcut-card-copy strong, .shortcut-card-meta b, .shortcut-card-enter, .bookmark-count-card strong) { color: var(--ink); }
  [data-color-mode="night"] .bookmark-hero :is(h2, strong) { color: var(--ink); }
  [data-color-mode="night"] .bookmark-hero :is(p, span) { color: var(--muted); }
  [data-theme][data-color-mode="night"] .notes-book-info { color: var(--ink); background: color-mix(in srgb, var(--canvas) 92%, var(--book-accent)); border-color: var(--line-strong); box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%); }
  [data-theme][data-color-mode="night"] .notes-book-info :is(button, h3, span) { color: var(--ink); }
  [data-theme][data-color-mode="night"] .notes-book-info i { color: var(--muted); }
  [data-color-mode="night"] :is(.shortcut-card-icon, .library-hub-icon) { color: var(--ink); background: var(--surface-soft); border-color: var(--line); box-shadow: none; }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.shortcut-pink, .hub-pink) { background: linear-gradient(130deg, #49303f, #252d3b); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.shortcut-blue, .hub-blue) { background: linear-gradient(130deg, #2d3d58, #222e3e); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.shortcut-lime, .hub-lime) { background: linear-gradient(130deg, #344438, #24332f); }
  [data-color-mode="night"] .metric-card.available { background: color-mix(in srgb, var(--blue) 18%, var(--canvas)); }
  [data-color-mode="night"] .metric-card .metric-top .label { color: var(--muted); }
  [data-color-mode="night"] :is(.transaction-icon.income, .library-empty-art) { color: #202123; }
  [data-color-mode="night"] .recent-amount.income { color: #b4df83; }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.button-secondary, .button-quiet, .category-button:not(.is-active), .library-back, .icon-button, .segmented, .type-switch, .theme-option:not(.is-active)) { color: var(--ink); background: var(--surface-soft); border-color: var(--line); box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.modal, .style-drawer, .resource-form-panel, .dropdown-menu, .account-menu, .tag-picker-menu, .notes-dialog, .notes-menu-pop, .notes-tool-popover, .login-card) { color: var(--ink); background: #1e2835; border-color: var(--line-strong); box-shadow: var(--shadow); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.panel, .settings-section, .vault-list, .card-library, .bookmark-card, .prompt-card, .style-catalog-card, .style-catalog-banner, .treasure-menu, .topbar) { border-color: var(--line); box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.tag-picker-menu button.is-selected, .dropdown-menu button:hover, .dropdown-menu button.is-selected) { color: var(--ink); background: var(--surface-soft); }
  [data-theme="liquid-glass"][data-color-mode="night"] :is(.search-field, .bookmark-list-row, .bookmark-list-empty, .pagination button, .dropdown-trigger) { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%); }
  [data-theme="liquid-glass"][data-color-mode="night"] .bookmark-list-row:hover { background: var(--surface-soft); }
  [data-color-mode="night"] .category-button.is-active { color: #202123; }
  [data-color-mode="night"][data-theme="liquid-glass"] .category-button:not(.is-active) { background: var(--surface-soft); }
  .treasure-menu { bottom: calc(var(--mobile-nav-height) + 10px); right: max(12px, var(--safe-right)); max-height: 65dvh; overflow: auto; background: var(--surface); color: var(--ink); border-color: var(--line); }
  .quick-add { bottom: calc(var(--mobile-nav-height) + 12px); }
  button, .icon-button, .notes-tool, .notes-menu button { touch-action: manipulation; }
  .icon-button, .notes-tool { min-width: 44px; min-height: 44px; }
  .button, .category-button, .dropdown-option { min-height: 44px; }
  input, textarea, select { font-size: 16px; max-width: 100%; }
  .theme-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-card { min-width: 0; }
  .appearance-mode-row { flex-wrap: wrap; gap: 12px; }
  .appearance-mode-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); background: var(--surface-soft); font: inherit; }
  .appearance-mode-overlay .modal-backdrop { align-items: end; padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) calc(12px + var(--safe-bottom)) max(12px, var(--safe-left)); }
  .appearance-mode-overlay .appearance-mode-sheet { width: 100%; max-width: 440px; padding: 20px; border: 1px solid var(--line-strong); border-radius: 24px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
  .appearance-mode-overlay .appearance-mode-sheet:focus { outline: none; }
  .appearance-mode-overlay .appearance-mode-sheet { overflow-y: auto; }
  .appearance-mode-sheet .modal-comet { display: none; }
  .appearance-mode-sheet .modal-header { margin-bottom: 16px; }
  .appearance-mode-sheet .modal-close { min-width: 44px; min-height: 44px; color: var(--ink); background: var(--surface-soft); }
  .appearance-mode-options { display: grid; gap: 8px; }
  .appearance-mode-options button { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; border: 1px solid transparent; border-radius: 14px; color: var(--ink); background: var(--surface-soft); text-align: left; font: inherit; }
  .appearance-mode-options button span { flex: 1; }
  .appearance-mode-options button[aria-pressed="true"] { border-color: var(--control-accent); background: color-mix(in srgb, var(--control-accent) 15%, var(--surface)); }
  .appearance-mode-options button:active { transform: scale(.98); }
  [data-theme="liquid-glass"] .appearance-mode-overlay .appearance-mode-sheet { background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-soft) 96%, transparent)); backdrop-filter: blur(28px) saturate(135%); -webkit-backdrop-filter: blur(28px) saturate(135%); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 10%, transparent), var(--shadow); }
  [data-theme="liquid-glass"] .appearance-mode-options button { border-color: var(--line); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 5%, transparent); }
  [data-theme="liquid-glass"] .appearance-mode-options button[aria-pressed="true"] { border-color: var(--control-accent); }
  .modal-panel, .modal-card, .notes-dialog, .account-menu, .style-drawer { max-width: calc(100vw - 24px); max-height: calc(var(--app-height, 100dvh) - 24px); overflow-y: auto; overscroll-behavior: contain; }
  .page-scroll.notes-page-scroll:has(.in-book) { padding: 0; }
  .page-scroll.notes-page-scroll:not(:has(.in-book)) { padding: 16px; }
  .page-scroll.notes-page-scroll > .page-enter { width: 100%; min-width: 0; height: 100%; }
  .notes-workspace { min-height: 0; height: 100%; isolation: isolate; }
  [data-theme] .notes-workspace.in-book .notes-split-pane { display: flex; width: 100%; max-width: 100%; flex: 1; min-height: 0; min-width: 0; flex-direction: column; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .notes-workspace.in-book .notes-sidebar { width: 100%; min-width: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  [data-theme] .notes-workspace.in-book .notes-detail { position: relative; inset: auto; transform: none; width: 100%; max-width: 100%; min-width: 0; flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--canvas); }
  .notes-workspace.in-book:not(.level-detail) .notes-detail { display: none; }
  .notes-workspace.in-book.level-detail .notes-sidebar { display: none; }
  .notes-workspace.in-book .notes-sidebar-resizer { display: none; }
  .notes-workspace.in-book.sidebar-collapsed:not(.level-detail) .notes-sidebar { display: flex; }
  .notes-workspace.in-book .notes-list-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .notes-note-list { overflow: auto; flex: 1; }
  .notes-workspace.in-book .notes-note-select { min-height: 56px; }
  .notes-workspace :is(.notes-note-row, .notes-section-row) > .notes-menu { display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; background: transparent; border: 0; box-shadow: none; }
  .notes-workspace :is(.notes-note-row, .notes-section-row) .notes-menu > .notes-tool { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; opacity: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--ink); box-shadow: none; }
  .notes-workspace :is(.notes-note-row, .notes-section-row) .notes-menu > .notes-tool svg { flex: 0 0 18px; width: 18px; height: 18px; }
  .notes-workspace :is(.notes-note-row, .notes-section-row) .notes-menu > .notes-tool:is(:active, [aria-expanded="true"]) { background: var(--note-selected); border-color: var(--control-accent); }
  .notes-workspace.in-book .notes-breadcrumb { flex-shrink: 0; flex-wrap: nowrap; padding-bottom: 10px; gap: 6px; }
  .notes-workspace.in-book .notes-breadcrumb > button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notes-workspace.in-book .notes-breadcrumb > button:first-child { flex-shrink: 0; }
  .notes-workspace.in-book .notes-breadcrumb-end { display: flex; flex: 0 0 auto; margin-left: auto; }
  .notes-workspace.in-book.level-detail .notes-breadcrumb-export { display: none; }
  .notes-workspace.in-book .notes-breadcrumb .notes-mobile-directory { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); }
  .notes-workspace.in-book:not(.level-detail) .notes-mobile-directory { display: none; }
  .notes-workspace.in-book .notes-breadcrumb button { min-height: 36px; font-size: 12px; }
  [data-theme] .notes-workspace.in-book .notes-writing-paper { position: static; transform: none; display: flex; flex-direction: column; width: 100%; max-width: 100%; min-width: 0; min-height: 100%; height: auto; max-height: none; margin: 0; padding: 20px 16px clamp(96px, 25dvh, 240px); border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .notes-writing-paper > div { display: flex; flex: 1; min-width: 0; }
  /* The document grows in the page's scroll area; it is not a focused input box. */
  .notes-workspace.in-book .notes-prose,
  .notes-workspace.in-book .notes-prose:focus,
  .notes-workspace.in-book .notes-prose:focus-visible { flex: 1; height: auto; max-height: none; overflow: visible; border: 0; border-radius: 0; outline: none; box-shadow: none; background: transparent; }
  .notes-workspace.in-book .notes-title-input:focus-visible { outline: none; }
  .notes-workspace.in-book .notes-detail-foot { border-top: 0; }
  .notes-writing-scroll { width: 100%; min-width: 0; overflow-x: hidden; }
  .notes-workspace.in-book .notes-writing-scroll { scrollbar-width: none; }
  .notes-workspace.in-book .notes-writing-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .notes-prose { overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
  .notes-prose pre, .notes-prose .tableWrapper { max-width: 100%; overflow-x: auto; }
  .notes-workspace.in-book .notes-breadcrumb { padding: 8px 12px; }
  [data-theme] .notes-workspace.in-book .notes-sidebar { width: 100%; max-width: 100%; margin: 0; border-radius: 0; box-shadow: none; }
  .notes-prose { font-size: 16px; line-height: 1.8; }
  .notes-title-input { font-size: 26px; }
  .notes-editor-header { flex-wrap: nowrap; }
  .notes-editor-header .notes-editor-toolbar { flex: 1 1 0; flex-basis: 0; overflow-x: auto; }
  .notes-editor-header .notes-tool-group { flex: 0 0 auto; flex-wrap: nowrap; max-width: none; }
  .notes-editor-header .notes-tool { height: 44px; min-height: 44px; min-width: 36px; }
  .notes-editor-header .notes-detail-top { flex: 0 0 auto; width: auto; margin: 0; }
  .notes-editor-header .notes-save-state { display: none; }
  .notes-editor-header .notes-restore-sidebar { min-width: 44px; min-height: 44px; }
  [data-theme] .notes-workspace .notes-editor-header .notes-editor-toolbar { flex: 1 1 0; flex-basis: 0; min-width: 0; }
  [data-theme] .notes-workspace .notes-editor-header .notes-detail-top { display: none; }
  [data-theme] .notes-workspace .notes-editor-header .notes-tool-group { flex: 0 0 auto; flex-wrap: nowrap; max-width: none; }
  [data-theme] .notes-workspace .notes-editor-header .notes-tool { min-height: 44px; height: 44px; }
  .notes-tool-popover { max-height: 55dvh; overflow-y: auto; max-width: calc(100vw - 24px); }
  .notes-tool-popover button { min-height: 42px; }
  .notes-workspace .notes-columns-content { display: flex; flex-direction: column; }
  .notes-workspace .notes-column-view { width: 100% !important; }
  .notes-book-grid, .library-hub-grid { grid-template-columns: minmax(0, 1fr); }
  .keyboard-open .mobile-nav, .keyboard-open .quick-add { display: none; }
  .keyboard-open .main-content { padding-bottom: 0; }
  .keyboard-open .topbar { min-height: calc(50px + var(--safe-top)); padding-top: calc(6px + var(--safe-top)); padding-bottom: 6px; }
  .keyboard-open .eyebrow { display: none; }
  .login-gate { height: var(--app-height, 100dvh); min-height: 0; overflow: auto; padding: calc(20px + var(--safe-top)) max(20px, var(--safe-right)) calc(20px + var(--safe-bottom)) max(20px, var(--safe-left)); }
  .login-card { padding: 24px; }
  .login-card h1 { font-size: 26px; }
  .android-unlock-actions { display: grid; gap: 12px; margin-top: 16px; }
  .android-login-gate .verification-hint { display: block; margin: 14px 0; line-height: 1.6; }
  .android-login-gate .login-pin-form { margin-top: 18px; }
  .pin-fixed-value { padding: 10px 16px; border-radius: 10px; background: var(--surface-soft); font-variant-numeric: tabular-nums; }
  .setting-policy { color: var(--muted); font-size: 12px; }
  .modal-backdrop { padding: calc(12px + var(--safe-top)) max(12px, var(--safe-right)) calc(12px + var(--safe-bottom)) max(12px, var(--safe-left)); }
  .modal { max-height: calc(var(--app-height, 100dvh) - var(--safe-top) - var(--safe-bottom) - 24px); }
  .card-detail-modal { min-height: 0; overflow-y: auto; }
  .card-detail-modal > .modal-header, .card-detail-modal > .card-detail-hero, .card-detail-modal > .card-detail-grid { flex: 0 0 auto; }
  .card-detail-modal > .modal-footer { position: static; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
  .card-detail-modal > .modal-footer .button { width: 100%; min-width: 0; min-height: 44px; white-space: nowrap; padding: 10px 8px; gap: 6px; font-size: 14px; }
  .card-detail-modal > .modal-footer .button-primary { grid-column: 1 / -1; }
  .card-detail-modal .detail-line strong { overflow-wrap: anywhere; min-width: 0; }
  [data-theme] .card-form-modal > form .modal-footer { position: static; padding: 12px 0 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .card-form-modal > form .modal-footer .button { flex: 1; min-height: 44px; border-radius: 12px; }
  :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
  /* Shared mobile materials: Klarna follows its accent; Liquid Glass uses blue/teal. */
  :root {
    --mobile-material-accent: var(--control-accent);
    --mobile-material-secondary: var(--pink-soft);
    --mobile-material-highlight: rgb(255 255 255 / 64%);
    --mobile-material-ink: var(--ink);
    --mobile-material-bg: linear-gradient(135deg, color-mix(in srgb, var(--mobile-material-accent) 22%, transparent), color-mix(in srgb, var(--surface) 68%, transparent) 58%, color-mix(in srgb, var(--mobile-material-secondary) 28%, transparent));
    --mobile-material-border: color-mix(in srgb, var(--mobile-material-accent) 38%, var(--line));
    --mobile-material-shadow: inset 0 1px 0 var(--mobile-material-highlight), 0 5px 14px color-mix(in srgb, var(--mobile-material-accent) 16%, transparent);
  }
  [data-theme="liquid-glass"] { --mobile-material-accent: var(--blue); --mobile-material-secondary: #90cfc9; }
  [data-color-mode="night"] { --mobile-material-highlight: rgb(255 255 255 / 16%); }
  [data-theme] .mobile-nav button { border: 1px solid transparent; }
  [data-theme] .mobile-nav button.is-active,
  [data-theme] .notes-workspace.in-book :is(.notes-section-row.selected, .notes-note-row.selected) {
    color: var(--mobile-material-ink); background: var(--mobile-material-bg); border: 1px solid var(--mobile-material-border);
    box-shadow: var(--mobile-material-shadow); backdrop-filter: blur(18px) saturate(145%); -webkit-backdrop-filter: blur(18px) saturate(145%);
  }
  [data-theme] .mobile-nav button:not(.is-active) { color: var(--muted); background: transparent; border-color: transparent; box-shadow: none; transform: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  [data-theme] .mobile-nav button.is-active { transform: translateY(-2px); }
  [data-theme] .notes-workspace.in-book :is(.notes-section-row.selected, .notes-note-row.selected) { border-radius: 14px; min-width: 0; max-width: 100%; }
  [data-theme] .notes-workspace.in-book :is(.notes-section-row.selected, .notes-note-row.selected) :is(strong, .icon, .notes-note-title) { color: var(--mobile-material-ink); }
  [data-theme] .notes-workspace.in-book :is(.notes-section-row.selected, .notes-note-row.selected) :is(small, time, .notes-note-meta) { color: var(--muted); }
  /* Action wrappers provide layout only. Each button retains its own surface. */
  [data-theme][data-color-mode] :is(.modal-footer, .notes-dialog-actions, .futurism-form-footer, .effect-form-footer) {
    position: static; bottom: auto; margin-bottom: 0; padding: 12px 0 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    display: flex; flex-wrap: wrap; gap: 9px;
  }
  [data-theme][data-color-mode] :is(.modal-footer, .notes-dialog-actions, .futurism-form-footer, .effect-form-footer) > button {
    flex: 1 0 auto; max-width: 100%; min-height: 44px; width: auto; border-radius: 12px; white-space: nowrap; word-break: keep-all; overflow: visible; text-overflow: clip;
  }
  [data-theme] :is(.dropdown-add-option, .dropdown-add-form button) {
    min-height: 44px !important; min-width: 44px; padding: 10px 12px !important; border-radius: 12px !important; border: 1px solid var(--mobile-material-border) !important;
    color: var(--mobile-material-ink) !important; background: var(--mobile-material-bg) !important; box-shadow: var(--mobile-material-shadow);
    backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); white-space: nowrap;
  }
  [data-theme] .dropdown-add-form { gap: 8px; padding: 8px 0 0; }
  [data-theme] .dropdown-add-form input { min-height: 44px; font-size: 16px; border-radius: 12px; }
  [data-theme] :is(.dropdown-add-option, .dropdown-add-form button):hover:not(:disabled) { border-color: var(--mobile-material-accent) !important; }
  [data-theme] :is(.dropdown-add-option, .dropdown-add-form button):active:not(:disabled) { transform: scale(.97); }
  [data-theme] :is(.dropdown-add-option, .dropdown-add-form button):disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
  /* Previous mobile ratio .95: width / (.6 * old height) = .95 / .6. */
  [data-theme] .notes-book-cover { aspect-ratio: calc(.95 / .6); }
  [data-theme] .notes-book-cover.has-image img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
  /* Android expands this sheet beyond the browser breakpoint; preserve the
     pre-existing landscape cover ratio before applying the same .6 factor. */
  @media (min-width: 761px) {
    [data-theme] .notes-book-cover { aspect-ratio: calc(1.38 / .6); }
  }
  .android-login-gate .login-pin-form + .button { margin-top: 12px; width: 100%; }
  .android-login-gate .login-card { max-width: 100%; }
  .android-login-gate .login-pin-form { grid-template-columns: minmax(0, 1fr) auto; }

}
