/* v3.2.6-local shared app shell and companion workspace prototype */
.app-topbar {
    position: sticky;
    top: 10px;
    z-index: 70;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 10px;
    border: 1px solid rgba(159,178,177,.36);
    border-radius: 20px;
    background: rgba(var(--card-rgb), .88);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.proof-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.proof-layout:has(.library-branch-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1.65fr) minmax(420px, .85fr);
}
.proof-list-card { min-width: 0; }
.proof-filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(190px, .85fr) minmax(150px, .6fr);
    gap: 10px;
    margin: 18px 0 12px;
}
.proof-filter-bar label { display: grid; gap: 6px; }
.proof-search { grid-column: span 2; }
.proof-path-filter { grid-column: 3; }
.proof-date-range {
    grid-column: span 2;
    display: grid;
    gap: 6px;
    min-width: 0;
}
.proof-filter-label { color: var(--text); }
.proof-date-range-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.proof-date-range-fields label {
    position: relative;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-left: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--muted);
    font-size: 12px;
    font-weight: var(--weight-semibold);
}
.proof-date-range-fields .date-picker-trigger {
    min-height: 42px;
    border: 0;
    border-radius: 0 11px 11px 0;
    background: transparent;
    padding-left: 0;
}
.proof-date-range-fields label:first-child .date-picker-popover { left: 0; right: auto; }
.proof-date-range-fields label:last-child .date-picker-popover { right: 0; left: auto; }
.proof-sort-filter { grid-column: 3; }
.proof-filter-bar .minty-select,
.proof-filter-bar .minty-date-field { min-width: 0; }
.proof-library-list { display: grid; gap: 10px; }
.proof-library-list.empty { padding: 24px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.proof-library-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: var(--card);
}
.proof-library-card[data-proof-open] { cursor: pointer; }
.proof-library-card[data-proof-open]:hover,
.proof-library-card[data-proof-open]:focus-visible,
.proof-library-card.inspector-active {
    border-color: rgba(var(--accent-rgb), .62);
    background: rgba(var(--accent-rgb), .08);
    outline: none;
}
.proof-library-main { min-width: 0; }
.proof-library-title { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.proof-library-title time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.proof-library-card p { margin: 8px 0; color: var(--text-soft); overflow-wrap: anywhere; }
.proof-library-card p a,
.proof-context { color: var(--accent); }
.proof-context { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.proof-library-actions { display: flex; gap: 8px; align-items: flex-start; }
.proof-library-actions .ghost-button { min-height: 38px; padding: 7px 10px; }
.proof-storage-track {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--line);
}
.proof-storage-track i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .2s ease;
}
.proof-storage-track i.has-usage { min-width: 2px; }
.proof-attachment-list {
    display: grid;
    gap: 7px;
    margin: 10px 0;
}
.proof-attachment-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card-soft);
}
.proof-attachment-preview,
.proof-attachment-filetype {
    display: grid;
    width: 44px;
    height: 38px;
    place-items: center;
    overflow: hidden;
    border-radius: 5px;
    background: var(--card);
}
.proof-attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.proof-attachment-filetype {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.proof-attachment-name {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}
.proof-attachment-name strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proof-attachment-name small { color: var(--muted); font-size: 11px; }
.proof-attachment-remove {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--red);
    cursor: pointer;
}
.proof-attachment-add {
    position: relative;
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.proof-attachment-add input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.proof-attachment-add:focus-within,
.proof-attachment-add:hover { border-color: var(--accent); color: var(--accent); }
.branch-attachments { display: grid; gap: 7px; margin: 2px 0; }
.branch-attachments small { color: var(--muted); font-size: 12px; }

.image-attachment-viewer { padding: 10px; }
.image-attachment-viewer-card {
    display: grid;
    grid-template-rows: auto auto auto;
    width: min(1100px, 100%);
    height: auto;
    max-height: min(92dvh, 900px);
    min-height: 0;
    gap: 14px;
    overflow: hidden;
}
.image-attachment-viewer-header { min-width: 0; }
.image-attachment-viewer-header > div { min-width: 0; }
.image-attachment-viewer-header h2 {
    overflow: hidden;
    font-size: clamp(18px, 2vw, 24px);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.image-attachment-viewer-stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    max-height: calc(92dvh - 150px);
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: #071115;
}
.image-attachment-viewer-stage img {
    display: block;
    grid-column: 1;
    grid-row: 1;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(92dvh - 150px);
    min-height: 0;
    justify-self: center;
    object-fit: contain;
}
.image-attachment-viewer-nav {
    position: absolute;
    top: 50%;
    z-index: 1;
    display: grid;
    width: 40px;
    height: 48px;
    place-items: center;
    transform: translateY(-50%);
    padding: 0;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 12px;
    background: rgba(6,17,21,.78);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.image-attachment-viewer-nav.previous { left: 10px; }
.image-attachment-viewer-nav.next { right: 10px; }
.image-attachment-viewer-nav:hover,
.image-attachment-viewer-nav:focus-visible { border-color: var(--accent); color: var(--accent); }
.image-attachment-viewer-footer { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; }
.image-attachment-viewer-footer span { color: var(--muted); font-size: 13px; }
.image-attachment-viewer-footer .ghost-button { min-height: 40px; text-decoration: none; }

@media (max-width: 720px) {
    .image-attachment-viewer-card { max-height: calc(100dvh - 20px); padding: 12px; border-radius: 16px; }
    .image-attachment-viewer-stage,
    .image-attachment-viewer-stage img { max-height: calc(100dvh - 180px); }
    .image-attachment-viewer-nav.previous { left: 8px; }
    .image-attachment-viewer-nav.next { right: 8px; }
    .image-attachment-viewer-footer .ghost-button { width: auto; }
}

/* Drawer hierarchy: details stay visible; one frequent Branch Tool opens at a time. */
.branch-tools { display: grid; gap: 9px; margin: var(--detail-gap) 0 0; padding: var(--detail-padding); border: 1px solid var(--line); border-radius: var(--detail-radius); background: var(--detail-surface); }
.branch-tools-heading .eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.branch-tool-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.branch-tool-tabs button { min-height: 40px; padding: 6px 7px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; }
.branch-tool-tabs button small { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px; color: var(--muted); font-size: 11px; line-height: 1; background: rgba(var(--accent-rgb), .08); }
.branch-tool-tabs button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.branch-tool-tabs button.active small { color: inherit; }
.branch-tool-panel[hidden] { display: none !important; }
.branch-tool-panel { margin-top: 0; }
.branch-tool-panel > summary { display: none; }
.branch-tools:has(~ .branch-tool-panel[open]) { margin-bottom: -12px; border-color: var(--accent); border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.branch-tool-panel[open] {
  margin-top: 0;
  padding: var(--detail-padding);
  border-color: var(--accent);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  background: var(--detail-surface-open);
}
.branch-tool-panel[open] > :not(.drawer-section-heading) { margin-right: 0; margin-left: 0; }
.branch-tool-panel > .note-items-section,
.branch-tool-panel > .branch-reminders-section { margin-top: 0; padding-top: 0; border-top: 0; }
.branch-tool-primary-action { width: 100%; justify-content: center; }
.add-branch-note-row .branch-tool-primary-action,
.add-note-item-row .branch-tool-primary-action { grid-column: 1 / -1; }
.branch-additional-options {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--detail-radius);
  background: var(--detail-surface);
}
.branch-additional-options-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: var(--detail-padding);
  cursor: pointer;
  list-style: none;
}
.branch-additional-options-heading::-webkit-details-marker { display: none; }
.branch-additional-options-heading::after {
  content: "";
  width: 8px;
  height: 8px;
  justify-self: end;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease, border-color .16s ease;
}
.branch-additional-options[open] > .branch-additional-options-heading {
  border-bottom: 1px solid var(--line);
  background: var(--detail-surface-open);
}
.branch-additional-options[open] > .branch-additional-options-heading::after {
  transform: rotate(225deg) translate(-2px, -2px);
  border-color: var(--accent);
}
.branch-additional-options-heading strong { display: block; color: var(--text); font-size: 14px; }
.branch-additional-options-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; }
.branch-additional-options-body { display: grid; gap: var(--detail-gap); padding: var(--detail-padding); }
@media (max-width: 720px) {
  .branch-tool-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .proof-layout,
    .proof-layout:has(.library-branch-panel:not([hidden])) { grid-template-columns: 1fr; }
    .proof-layout .library-branch-panel { position: static; height: min(78vh, 900px); min-height: 560px; }
}
@media (max-width: 760px) {
    .proof-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .proof-search { grid-column: 1 / -1; }
    .proof-path-filter,
    .proof-sort-filter { grid-column: auto; }
    .proof-date-range { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .proof-filter-bar,
    .proof-date-range-fields { grid-template-columns: 1fr; }
    .proof-search { grid-column: auto; }
    .proof-path-filter,
    .proof-date-range,
    .proof-sort-filter { grid-column: auto; }
    .proof-date-range-fields label { grid-template-columns: 42px minmax(0, 1fr); }
    .proof-date-range-fields label:first-child .date-picker-popover,
    .proof-date-range-fields label:last-child .date-picker-popover {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    .proof-library-card { grid-template-columns: 1fr; }
    .proof-library-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
    .proof-library-actions .ghost-button { justify-content: center; }
}
.app-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}
.app-brand-mark {
    width: 36px;
    height: 36px;
    display: block;
    flex: 0 0 36px;
    padding: 3px;
    object-fit: contain;
    border-radius: 11px;
    background: var(--accent-soft);
    border: 1px solid rgba(var(--accent-rgb),.18);
}
.app-topbar-brand strong,
.app-topbar-brand small { display: block; line-height: 1.1; }
.app-topbar-brand strong { font-size: 15px; letter-spacing: var(--tracking-subheading); }
.app-topbar-brand small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.app-primary-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}
.app-nav-link,
.app-topbar-icon {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}
.app-nav-link:hover,
.app-topbar-icon:hover {
    color: var(--text);
    border-color: var(--line);
    background: var(--card-soft);
}
.app-nav-link.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),.20);
    background: var(--accent-soft);
}
.app-nav-link small {
    padding: 2px 5px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(var(--card-rgb), .7);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
}
.app-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}
.app-topbar-logout-form .app-topbar-icon { width: 100%; cursor: pointer; }
.module-shell { max-width: var(--app-shell-max); }
.module-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid rgba(159,178,177,.36);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(var(--card-rgb), .92), rgba(var(--card-soft-rgb), .88));
    box-shadow: var(--shadow-soft);
}
.module-hero h1 { margin-bottom: 10px; }
.module-hero p { max-width: 780px; margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.module-card-kicker {
    display: inline-flex;
    width: max-content;
    align-items: center;
    border-radius: 999px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(var(--accent-rgb),.18);
    font-size: 12px;
    font-weight: var(--weight-semibold);
}
.module-card-kicker { padding: 5px 9px; margin-bottom: 14px; }
.module-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.module-card {
    min-height: 190px;
    padding: 22px;
    border: 1px solid rgba(159,178,177,.36);
    border-radius: 22px;
    background: rgba(var(--card-rgb), .86);
    box-shadow: var(--shadow-soft);
}
.module-card-wide { grid-column: 1 / -1; min-height: 0; }
.module-card h2 { margin-bottom: 10px; font-size: 20px; }
.module-card p { margin-bottom: 0; color: var(--muted); line-height: 1.6; }
.welcome-private-note {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}
html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .module-hero,
html[data-theme="dark"] .module-card {
    border-color: rgba(96,119,122,.45);
}
/* The top bar is Guest Mode's only header (guest-runtime.css owns its layout);
   these rules must never reach the signed-in sidebar navigation (UI-19). */
@media (max-width: 1120px) {
    .app-topbar {
        grid-template-columns: auto auto;
        justify-content: space-between;
    }
    .app-topbar-icon {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
@media (max-width: 720px) {
    .app-topbar {
        top: 6px;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 14px;
    }
    .app-topbar-brand small { display: none; }
    .app-nav-link,
    .app-topbar-icon { min-height: 44px; }
    .app-topbar-icon { padding-inline: 7px; }
    .module-hero { flex-direction: column; }
    .module-layout { grid-template-columns: 1fr; }
    .module-card-wide { grid-column: auto; }
}

/* Signed-in workspace sidebar. Guest Mode intentionally keeps its lightweight top bar. */
.app-sidebar-mobile-trigger,
.app-sidebar-backdrop { display: none; }
.app-shell:has(.app-sidebar) {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    gap: 0 18px;
    align-items: start;
}
.app-shell:has(.app-sidebar) > .app-shell-content {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}
.app-shell-content > * { min-width: 0; }
.app-shell:has(.app-sidebar).module-shell { max-width: var(--app-shell-max); }
.app-shell:has(.app-sidebar).profile-shell { max-width: var(--app-shell-max); }
.app-sidebar {
    position: sticky;
    top: 14px;
    grid-column: 1;
    grid-row: 1;
    display: flex;
    min-width: 0;
    min-height: calc(100vh - 28px);
    max-height: calc(100vh - 28px);
    flex-direction: column;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid rgba(159,178,177,.36);
    border-radius: 20px;
    background: rgba(var(--card-rgb), .9);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    transition: width .18s ease, transform .18s ease, padding .18s ease;
}
.app-sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 2px 14px;
    border-bottom: 1px solid var(--line);
}
.app-sidebar .app-topbar-brand { min-width: 0; }
.app-sidebar .app-topbar-brand > span { min-width: 0; }
.app-sidebar-collapse,
.app-sidebar-close {
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card-soft);
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
}
.app-sidebar-collapse:hover,
.app-sidebar-close:hover { color: var(--text); border-color: rgba(var(--accent-rgb), .45); }
.app-sidebar-close { display: none; }
.app-sidebar .app-primary-nav {
    display: grid;
    justify-content: stretch;
    gap: 16px;
    padding: 16px 0;
}
.app-nav-group { display: grid; gap: 3px; }
.app-nav-group-label {
    margin: 0 0 4px;
    padding: 0 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}
.app-sidebar .app-nav-link {
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    padding: 8px 10px;
    border-color: transparent;
    border-radius: 10px;
    color: var(--text-soft);
}
.app-sidebar .app-nav-link:hover { border-color: var(--line); color: var(--text); }
.app-sidebar .app-nav-link.active {
    border-color: rgba(var(--accent-rgb), .28);
    background: var(--accent-soft);
    color: var(--accent);
}
.app-nav-link-symbol {
    display: inline-grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card-soft);
    color: currentColor;
    font-size: 15px;
    font-weight: var(--weight-bold);
    line-height: 1;
}
.app-nav-link.active .app-nav-link-symbol { border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .14); }
.app-nav-link-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .app-nav-link small { margin-left: auto; }
.app-sidebar-footer {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.app-sidebar-profile,
.app-sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: var(--weight-semibold);
}
.app-sidebar-profile:hover,
.app-sidebar-footer-link:hover,
.app-sidebar-profile.active,
.app-sidebar-footer-link.active { border-color: var(--line); background: var(--card-soft); color: var(--text); }
.app-sidebar-profile-avatar {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
}
.app-sidebar-profile-copy { display: grid; min-width: 0; gap: 1px; }
.app-sidebar-profile-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sidebar-profile-copy small { color: var(--muted); font-size: 11px; font-weight: var(--weight-regular); }
.app-sidebar-footer-link > span:first-child {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
}
.app-topbar-logout-form { margin: 0; }
.app-topbar-logout-form .app-sidebar-footer-link { width: 100%; border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; }
.app-topbar-logout-form .app-sidebar-footer-link:hover { border-color: rgba(217,83,79,.28); background: var(--card-soft); }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) { grid-template-columns: 68px minmax(0, 1fr); }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar { padding-inline: 9px; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-heading { flex-direction: column; justify-content: center; gap: 8px; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-topbar-brand,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-profile,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-footer-link { justify-content: center; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-brand-copy,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-nav-group-label,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-nav-link-label,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-nav-link small,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-profile-copy,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-footer-label { display: none; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-collapse { position: static; width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; background: var(--card-soft); color: var(--text); font-size: 22px; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar .app-primary-nav { gap: 12px; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-nav-group { gap: 4px; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar .app-primary-nav,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-footer { overflow: hidden; }
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar .app-nav-link,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-profile,
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-sidebar-footer-link {
    width: 40px;
    min-width: 40px;
    justify-content: center;
    margin-inline: auto;
    padding-inline: 6px;
}
:is(.app-shell.app-sidebar-collapsed, html.app-sidebar-precollapsed .app-shell) .app-nav-link-symbol { width: 24px; height: 24px; flex-basis: 24px; }

@media (max-width: 1100px) {
    .app-shell:has(.app-sidebar),
    .app-shell.app-sidebar-collapsed { display: block; width: min(100% - 18px, var(--app-shell-max)); padding-top: 0; }
    .app-shell:has(.app-sidebar).module-shell,
    .app-shell:has(.app-sidebar).profile-shell { max-width: var(--app-shell-max); }
    .app-sidebar-mobile-trigger {
        position: absolute;
        z-index: 82;
        top: 12px;
        right: 12px;
        display: inline-grid;
        width: 40px;
        height: 40px;
        min-height: 40px;
        place-items: center;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 1px solid rgba(var(--accent-rgb), .28);
        border-radius: 10px;
        background: rgba(var(--card-rgb), .94);
        box-shadow: var(--shadow-soft);
        color: var(--text);
        font-size: 18px;
        font-weight: var(--weight-semibold);
        backdrop-filter: blur(14px);
    }
    .app-mobile-nav-host {
        position: relative;
        padding-right: 66px;
    }
    .app-sidebar {
        position: fixed;
        z-index: 84;
        top: 10px;
        bottom: 10px;
        left: 10px;
        width: min(320px, calc(100vw - 48px));
        min-height: 0;
        max-height: none;
        transform: translateX(calc(-100% - 24px));
        transition: transform .2s ease;
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-sidebar-close { display: inline-grid; }
    .app-sidebar-collapse { display: none; }
    .app-sidebar-backdrop {
        position: fixed;
        z-index: 83;
        inset: 0;
        width: 100vw;
        height: 100vh;
        padding: 0;
        border: 0;
        background: rgba(2, 12, 15, .56);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    html.app-nav-open { overflow: hidden; }
    html.app-nav-open .app-sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .app-shell.app-sidebar-collapsed .app-sidebar { padding: 12px; }
    .app-shell.app-sidebar-collapsed .app-sidebar { width: min(340px, calc(100vw - 24px)); }
    .app-shell.app-sidebar-collapsed .app-sidebar-heading { flex-direction: row; justify-content: space-between; gap: 8px; }
    .app-shell.app-sidebar-collapsed .app-topbar-brand,
    .app-shell.app-sidebar-collapsed .app-sidebar-profile,
    .app-shell.app-sidebar-collapsed .app-sidebar-footer-link,
    .app-shell.app-sidebar-collapsed .app-sidebar .app-nav-link { justify-content: flex-start; padding-inline: 10px; }
    .app-shell.app-sidebar-collapsed .app-sidebar-brand-copy,
    .app-shell.app-sidebar-collapsed .app-nav-group-label,
    .app-shell.app-sidebar-collapsed .app-nav-link-label,
    .app-shell.app-sidebar-collapsed .app-sidebar-profile-copy,
    .app-shell.app-sidebar-collapsed .app-sidebar-footer-label { display: initial; }
    .app-shell.app-sidebar-collapsed .app-nav-link small { display: inline-flex; }
    .app-sidebar .app-primary-nav,
    .app-shell.app-sidebar-collapsed .app-sidebar .app-primary-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        overflow: visible;
    }
    .app-sidebar .app-nav-group,
    .app-shell.app-sidebar-collapsed .app-sidebar .app-nav-group {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
    }
    .app-shell.app-sidebar-collapsed .app-sidebar .app-nav-link,
    .app-shell.app-sidebar-collapsed .app-sidebar .app-sidebar-profile,
    .app-shell.app-sidebar-collapsed .app-sidebar .app-sidebar-footer-link {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
        margin: 0;
        padding-inline: 10px;
    }
    .app-shell.app-sidebar-collapsed .app-sidebar .app-nav-link-symbol {
        width: 26px;
        height: 26px;
        flex-basis: 26px;
    }
}
@media (max-width: 720px) {
    .app-shell:has(.app-sidebar),
    .app-shell.app-sidebar-collapsed { width: 100%; padding: 6px 6px 24px; }
    .app-sidebar-mobile-trigger { top: 10px; right: 10px; width: 38px; height: 38px; min-height: 38px; }
    .app-mobile-nav-host { padding-right: 58px; }
}

/* v3.2.6-local reminders foundation */
.branch-reminders-section {
    margin: 2px 0 12px;
}
.small-action-link {
    color: var(--accent);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    text-decoration: none;
    white-space: nowrap;
}
.small-action-link:hover { text-decoration: underline; }

/* v4.3 branch-private details */
.private-branch-section { display: grid; gap: 12px; }
.private-branch-form { display: grid; gap: 10px; }
.private-branch-form label { display: grid; gap: 6px; color: var(--text); font-size: 13px; font-weight: var(--weight-semibold); }
.private-branch-form input,
.private-branch-form textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 11px;
    background: var(--card);
    color: var(--text);
}
.private-branch-form textarea { min-height: 112px; resize: vertical; }
.private-branch-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.private-branch-toolbar small { color: var(--muted); }
.private-branch-list { display: grid; gap: 8px; }
.private-branch-list.empty {
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
}
.private-branch-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
    border-left: 3px solid var(--blue);
    border-radius: 12px;
    background: rgba(var(--card-rgb), .66);
}
.private-branch-entry strong { overflow-wrap: anywhere; }
.private-branch-entry p { margin: 6px 0; color: var(--text-soft); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.private-branch-entry small { color: var(--muted); font-size: 11px; }
.private-branch-entry-actions { display: flex; align-items: flex-start; gap: 7px; }
.private-branch-entry-actions .text-button { min-height: 30px; padding: 5px 6px; }
@media (max-width: 560px) {
    .private-branch-entry { grid-template-columns: 1fr; }
    .private-branch-entry-actions { justify-content: flex-end; }
}
.reminder-form input,
.reminder-form textarea,
.reminder-form select {
    font: inherit;
    font-weight: var(--weight-regular);
}
.reminder-filter-tabs {
    flex-wrap: wrap;
}
.reminder-filter-tabs button {
    padding: 7px 12px;
}
.reminder-filter-tabs button.active {
    border-color: rgba(var(--accent-rgb),.28);
}
.reminder-list.empty {
    text-align: center;
}
.reminder-list.empty.error { color: var(--error-text); text-align: left; }
.reminder-card.priority-high,
.reminder-card.priority-critical { border-left: 4px solid var(--accent); }
.reminder-card.reminder-overdue { border-left: 4px solid #d92d20; }
.reminder-card-title-row span {
    background: var(--card);
}
.reminder-card p { white-space: pre-wrap; }
@media (max-width: 980px) {
    .reminders-list-card { order: 1; }
}
@media (max-width: 720px) {
    .reminders-list-header { flex-direction: column; }
    .reminder-card-actions .ghost-button { flex: 1 1 auto; }
}
html[data-theme="dark"] .branch-reminder-delete { color: #ff8f89; }

/* v3.2.6-local reminder polish and shared date-time picker */
.drawer-section-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.drawer-section-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.branch-reminders-section {
    border: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
}
.branch-reminder-list { display: grid; gap: 8px; margin: 0 0 12px; }
.branch-reminder-list.empty {
    margin-bottom: 12px;
    padding: 12px 13px;
    border: 1px dashed rgba(159,178,177,.42);
    border-radius: 13px;
    color: var(--muted);
    font-size: 13px;
    background: rgba(var(--card-rgb), .35);
}
.branch-reminder-card {
    display: grid;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(var(--card-rgb), .58);
}
.branch-reminder-card.done {
    background: rgba(var(--card-soft-rgb), .7);
    border-color: var(--line);
}
.branch-reminder-card strong { display: block; margin-bottom: 3px; font-size: 13px; font-weight: var(--weight-bold); }
.branch-reminder-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.branch-reminder-card.done strong { color: var(--muted); text-decoration: line-through; }
.branch-reminder-action,
.branch-reminder-delete {
    min-height: 32px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(var(--card-rgb), .7);
    padding: 6px 9px;
    font-size: 12px;
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.branch-reminder-action { color: var(--accent); }
.branch-reminder-delete { color: var(--muted); }
.branch-reminder-delete:hover { color: var(--red); border-color: rgba(220,38,38,.28); }
.reminder-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-medium);
}

.minty-datetime-field,
.minty-date-field { position: relative; width: 100%; }
.minty-datetime-trigger,
.minty-date-trigger { min-width: 0; }
.minty-datetime-popover { width: min(340px, calc(100vw - 42px)); }
.minty-time-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.minty-time-row label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: var(--weight-medium);
}
.minty-time-row select {
    min-height: 40px;
    border-radius: 11px;
    background: var(--card);
}
.date-picker-popover .text-button + .text-button { margin-left: 8px; }

.reminders-shell { max-width: var(--app-shell-max); }

/* v3.2.9 list pagination controls */
.module-list-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--card-rgb), .42);
}
.module-page-size {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-semibold);
}
.module-page-size select {
    min-width: 86px;
}
.module-page-arrows {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.module-page-arrows span {
    min-width: 70px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-semibold);
}
.module-page-arrows button {
    width: 40px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-weight: var(--weight-bold);
    cursor: pointer;
}
.module-page-arrows button:disabled {
    opacity: .42;
    cursor: not-allowed;
}
@media (max-width: 640px) {
    .module-list-controls { flex-direction: column; }
}

.reminders-layout {
    display: grid;
    gap: 16px;
    align-items: start;
}
.reminders-list-card { min-height: 520px; }
.module-card-copy { margin: -2px 0 16px !important; }
.reminder-form {
    display: grid;
    gap: 13px;
    margin-top: 18px;
}
.reminder-form input,
.reminder-form textarea,
.reminder-form select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--card);
    color: var(--text);
}
.reminder-form textarea { min-height: 104px; resize: vertical; }
.reminder-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reminder-actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.reminders-list-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.workspace-filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 290px) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 12px;
}
.workspace-filter-bar .todo-filter-tabs,
.workspace-filter-bar .reminder-filter-tabs,
.workspace-filter-bar .notes-search-row { margin-bottom: 0; }
.workspace-path-filter {
    display: grid;
    min-width: 0;
    gap: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: var(--weight-semibold);
}
.workspace-path-filter select { width: 100%; }
.workspace-focus-filter {
    position: relative;
    min-height: 46px;
    align-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    white-space: nowrap;
}
.workspace-filter-tooltip {
    position: absolute;
    z-index: 30;
    right: 0;
    top: calc(100% + 8px);
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    font-size: 12px;
    font-weight: var(--weight-regular);
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity .14s ease, transform .14s ease;
    pointer-events: none;
}
.workspace-focus-filter:hover .workspace-filter-tooltip,
.workspace-focus-filter:focus-visible .workspace-filter-tooltip {
    opacity: 1;
    transform: translateY(0);
}
.workspace-filter-check {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border: 2px solid var(--muted);
    border-radius: 6px;
}
.workspace-focus-filter.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .14);
    color: var(--accent);
}
.workspace-focus-filter.active .workspace-filter-check {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: inset 0 0 0 4px var(--card);
}
.reminder-filter-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--card-soft-rgb), .72);
}
.reminder-filter-tabs button {
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.reminder-filter-tabs button.active {
    background: rgba(var(--card-rgb), .92);
    color: var(--accent);
    box-shadow: 0 6px 14px rgba(31,41,51,.08);
}
.reminder-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.reminder-list { display: grid; gap: 10px; }
.reminder-list.empty {
    padding: 18px;
    border: 1px dashed rgba(159,178,177,.42);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(var(--card-rgb), .45);
}
.reminder-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(var(--card-rgb), .62);
}
.reminder-card-main { min-width: 0; }
.reminder-card-title-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.reminder-card-title-row strong { font-size: 15px; }
.reminder-card-title-row span {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    text-transform: capitalize;
}
.reminder-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.reminder-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.reminder-meta span,
.reminder-meta a {
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(var(--card-soft-rgb), .65);
    color: var(--muted);
    text-decoration: none;
}
.reminder-meta a { color: var(--accent); }
.reminder-card-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.reminder-card-actions .ghost-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.reminder-card.reminder-done { opacity: .7; }
.reminder-card.reminder-done .reminder-card-title-row strong { text-decoration: line-through; color: var(--muted); }
@media (max-width: 640px) {
    .reminder-form-grid,
    .reminder-filter-tabs,
    .reminder-stats { grid-template-columns: 1fr; }
    .reminders-list-header,
    .drawer-section-intro,
    .reminder-card { grid-template-columns: 1fr; display: grid; }
    .reminder-card-actions { justify-content: stretch; }
    .reminder-card-actions .ghost-button { flex: 1 1 auto; }
    .workspace-filter-bar { grid-template-columns: 1fr; }
}

/* v3.2.6-local reminder repeats */
.reminder-repeat-panel {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--card-soft-rgb), .54);
}
.reminder-repeat-every {
    display: grid;
    grid-template-columns: minmax(82px, .45fr) minmax(0, 1fr);
    gap: 8px;
}
.reminder-repeat-every input,
.reminder-repeat-every select { min-width: 0; }
.reminder-meta .repeat-pill,
.branch-reminder-card .repeat-pill {
    border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
    background: color-mix(in srgb, var(--amber-soft) 55%, var(--card));
    color: var(--text);
}
html[data-theme="dark"] .reminder-meta .repeat-pill,
html[data-theme="dark"] .branch-reminder-card .repeat-pill {
    background: color-mix(in srgb, var(--amber-soft) 42%, var(--card));
}

/* v3.2.6-local consistent selectors and Minty Path dialog prompts */
.minty-native-select {
    display: none !important;
}
.minty-select {
    position: relative;
    width: 100%;
    min-width: 0;
}
.minty-select-button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--input-bg);
    color: var(--text);
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.minty-select-button:hover {
    border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
    background: var(--surface-hover);
}
.minty-select.open .minty-select-button,
.minty-select-button:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.minty-select-button:disabled {
    cursor: not-allowed;
    opacity: .62;
}
.minty-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.minty-select-arrow {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    transition: transform .16s ease, color .16s ease;
}
.minty-select.open .minty-select-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}
/* Every menu floats while open: app-shell.js positionMenu() sets its fixed
   position, width, and maximum height from the trigger (UI-01). */
.minty-select-menu {
    overflow: auto;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 56%, var(--line));
    border-radius: 14px;
    background: rgba(var(--card-rgb), .98);
    box-shadow: 0 18px 44px rgba(0,0,0,.24), var(--shadow-soft);
    backdrop-filter: blur(16px);
}
.minty-select-menu[hidden] { display: none !important; }
.minty-select-menu-floating {
    position: fixed;
    right: auto;
    z-index: var(--z-select-menu);
}
.minty-select-search {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 100%;
    min-height: 38px;
    margin: 0 0 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--input-bg);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.minty-select-search:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}
.minty-select-search[hidden] { display: none !important; }
.minty-select-empty {
    padding: 14px 10px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.minty-select-empty[hidden],
.minty-select-option[hidden],
.minty-select-group[hidden] { display: none !important; }
.minty-select-group + .minty-select-group {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}
.minty-select-group-label {
    padding: 7px 10px 5px;
    color: var(--accent);
    font-size: 11px;
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}
.minty-select-option {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-weight: var(--weight-medium);
}
.minty-select-option:hover,
.minty-select-option:focus {
    outline: none;
    background: var(--surface-hover);
    color: var(--text);
}
.minty-select-option[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: var(--weight-bold);
}
.minty-select-option[aria-selected="true"]::after {
    content: "✓";
    font-size: 12px;
    color: var(--accent);
}
.minty-select-option:disabled {
    color: var(--muted);
    opacity: .52;
    cursor: not-allowed;
}
.reminder-form .minty-select-button,
.minty-time-row .minty-select-button {
    min-height: 44px;
}

.minty-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-dialog);
    display: grid;
    place-items: center;
    padding: 18px;
    background: var(--overlay);
    backdrop-filter: blur(10px);
}
.minty-dialog-card {
    width: min(100%, 520px);
    position: relative;
    border: 1px solid color-mix(in srgb, var(--line-strong) 50%, var(--line));
    border-radius: 22px;
    background: rgba(var(--card-rgb), .98);
    box-shadow: 0 28px 72px rgba(0,0,0,.32), var(--shadow);
    padding: 24px;
}
.minty-dialog-card h2 {
    margin: 0 0 10px;
    font-size: clamp(22px, 4vw, 30px);
}
.minty-dialog-message {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.55;
}
.minty-dialog-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 16px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card-soft);
}
.minty-dialog-mode .ghost-button {
    min-height: 42px;
    border-color: transparent;
}
.minty-dialog-mode .ghost-button.active {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: var(--accent-soft);
    color: var(--accent);
}
.minty-dialog-note {
    margin: 12px 0 0;
    padding-left: 12px;
    border-left: 3px solid var(--line-strong);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.minty-dialog-count.is-error {
    border-left-color: var(--red);
    color: var(--red);
}
.minty-dialog-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card-soft);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
}
.minty-dialog-close:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    color: var(--accent);
}
.minty-dialog-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-medium);
}
.minty-dialog-field input,
.minty-dialog-field textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--input-bg);
    color: var(--text);
    padding: 12px 13px;
    outline: none;
}
.minty-dialog-field textarea { resize: vertical; }
.minty-dialog-field input:focus,
.minty-dialog-field textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}
.minty-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.minty-dialog-card.shake {
    animation: mintyShake .22s ease-in-out;
}
@keyframes mintyShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@media (max-width: 560px) {
    .minty-dialog-card {
        padding: 20px;
        border-radius: 18px;
    }
    .minty-dialog-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* v3.2.6-local Arrange menu + Inbox foundation */
.visual-more-menu {
    min-width: 124px;
}
.visual-more-menu > summary.ghost-button {
    width: 100%;
    min-height: 42px;
    justify-content: space-between;
    border-color: var(--line);
    background: var(--input-bg);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.visual-more-menu > summary.ghost-button::after {
    content: "▾";
    margin-left: 10px;
    color: var(--muted);
    font-size: 13px;
    transition: transform .16s ease, color .16s ease;
}
.visual-more-menu[open] > summary.ghost-button {
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}
.visual-more-menu[open] > summary.ghost-button::after {
    transform: rotate(180deg);
    color: var(--accent);
}
.visual-more-popover {
    min-width: 230px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 56%, var(--line));
    border-radius: 14px;
    background: rgba(var(--card-rgb), .98);
    box-shadow: 0 18px 44px rgba(0,0,0,.24), var(--shadow-soft);
    backdrop-filter: blur(16px);
}
.visual-arrange-context {
    margin: 2px 4px 6px;
    padding: 8px 9px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.visual-more-popover .ghost-button {
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    padding: 8px 10px;
    font-weight: var(--weight-medium);
}
.visual-more-popover .ghost-button:hover,
.visual-more-popover .ghost-button:focus {
    background: var(--surface-hover);
    outline: none;
}
.visual-more-popover .ghost-button:disabled {
    color: var(--muted);
    opacity: .52;
}

/* v4.12 Plan View command bar */
.visual-controls-primary,
.visual-controls-secondary {
    align-items: center;
    flex-wrap: wrap;
}
.visual-controls .visual-tools-toggle {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
    font-size: 16px;
    letter-spacing: 0;
}
.visual-controls .visual-tools-toggle.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .35);
    background: var(--accent-soft);
}

@media (max-width: 720px) {
    .visual-controls-primary,
    .visual-controls-secondary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-secondary {
        align-items: stretch;
    }
    .visual-controls .visual-tools-toggle {
        width: auto;
        min-width: 0;
    }
    .visual-controls-secondary .visual-more-popover {
        right: 0;
        left: auto;
    }
    .visual-controls-secondary .visual-zoom-readout {
        min-width: 0;
        width: 100%;
        padding-inline: 6px;
        gap: 0;
    }
    .visual-controls-secondary .visual-zoom-readout span {
        display: none;
    }
    .visual-controls-secondary .ghost-button[data-visual-action="zoom-out"],
    .visual-controls-secondary .ghost-button[data-visual-action="zoom-in"] {
        display: inline-flex;
        width: auto;
        min-height: 44px;
        padding: 4px;
        font-size: 22px;
    }
}

/* v4.41.4 mobile-first Plan command hierarchy */
.visual-controls-primary > .ghost-button,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button {
    max-width: none;
}
.visual-controls-primary > .ghost-button:not(.visual-tools-toggle),
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button:not(.visual-tools-toggle),
.visual-controls-primary > .visual-tools-toggle,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-tools-toggle {
    flex: none;
    min-width: 0;
    max-width: none;
}
.visual-controls-primary .visual-zoom-mode-toggle {
    display: inline-flex;
}
.visual-controls-secondary,
.visual-shell.visual-fullscreen-fallback .visual-controls-secondary {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    overscroll-behavior: contain;
}
.visual-controls-secondary .visual-more-menu {
    width: 100%;
    min-width: 0;
}
.visual-controls-secondary .visual-more-popover {
    position: static;
    width: 100%;
    min-width: 0;
    margin-top: 5px;
    box-shadow: none;
}
.visual-controls-secondary .visual-arrange-panel {
    display: block !important;
    width: 100%;
    min-width: 0;
}
.visual-controls-secondary .visual-arrange-panel > summary {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    border-color: var(--line-strong);
    background: color-mix(in srgb, var(--card-soft) 82%, transparent);
}
.visual-controls-secondary .visual-arrange-panel[open] > summary {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .42);
    background: var(--accent-soft);
}
.visual-controls-secondary .visual-arrange-panel > .visual-arrange-popover {
    position: static !important;
    display: grid;
    gap: 12px;
    width: 100% !important;
    min-width: 0;
    margin: 7px 0 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--card-soft) 88%, var(--card));
    box-shadow: none;
}
.visual-arrange-intro {
    display: grid;
    gap: 3px;
}
.visual-arrange-intro strong {
    color: var(--text);
    font-size: 13px;
}
.visual-arrange-intro .visual-arrange-context {
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--muted);
    font-size: 12px;
}
.visual-arrange-group {
    display: grid;
    gap: 7px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
}
.visual-arrange-group h4,
.visual-arrange-group h5 {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}
.visual-arrange-group h5 {
    margin-top: 3px;
    font-size: 11px;
}
/* Arrange actions are rows like the rest of the tray: full width, left
   aligned, same height, border, fill, and weight. Short option sets (sort
   order, alignment) sit in equal columns with centred labels. */
.visual-arrange-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}
.visual-controls .visual-arrange-grid .ghost-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    justify-content: flex-start;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--card-soft);
    color: var(--text);
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}
.visual-controls .visual-arrange-grid .ghost-button:hover,
.visual-controls .visual-arrange-grid .ghost-button:focus-visible {
    border-color: rgba(var(--accent-rgb), .42);
    background: var(--accent-soft);
}
.visual-arrange-sort-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.visual-arrange-align-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.visual-controls .visual-arrange-sort-grid .ghost-button,
.visual-controls .visual-arrange-align-grid .ghost-button {
    justify-content: center;
    text-align: center;
}
.visual-arrange-note {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}
@media (min-width: 721px) {
    .visual-controls-primary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary {
        flex-wrap: wrap;
    }
    .visual-controls-primary > .ghost-button,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button {
        max-width: none;
    }
    .visual-context-controls {
        flex-wrap: wrap;
        margin-top: 8px;
    }
    .visual-context-controls .visual-tools-toggle {
        display: none;
    }
}

@media (min-width: 1100px) {
    .visual-controls-primary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary {
        flex-wrap: nowrap;
    }
    .visual-controls-primary .visual-tools-toggle,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary .visual-tools-toggle {
        margin-left: 0;
    }
}

@media (min-width: 1280px) {
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary {
        justify-content: center;
    }
}

/* Layered Plan canvas: camera HUD, action dock, and selection context. */
.visual-shell {
    position: relative;
    display: block;
    isolation: isolate;
}
.visual-shell .visual-viewport,
.visual-shell.visual-fullscreen-fallback .visual-viewport {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
}
.visual-camera-hud {
    position: absolute;
    top: 10px;
    z-index: 45;
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgba(var(--card-rgb), .94);
    box-shadow: 0 12px 30px rgba(0,0,0,.18), var(--shadow-soft);
    backdrop-filter: blur(16px);
}
/* The camera controls sit at the top right until the user moves them
   (bindFreeDock then sets an inline position). */
.visual-camera-hud,
.visual-camera-restore {
    right: 10px;
}
.visual-camera-hud[hidden],
.visual-pod-restore[hidden] {
    display: none !important;
}
.visual-camera-hud .ghost-button,
.visual-camera-hud .visual-zoom-readout {
    min-width: 0;
    min-height: 40px;
    border-radius: 9px;
}
.visual-camera-hud .ghost-button {
    padding: 7px 10px;
    white-space: nowrap;
}
.visual-camera-hud .visual-camera-step {
    width: 40px;
    padding-inline: 0;
    font-size: 18px;
}
.visual-camera-hud .visual-zoom-readout {
    min-width: 78px;
    padding-inline: 9px;
    background: color-mix(in srgb, var(--card-soft) 84%, transparent);
}
.visual-camera-hud .visual-zoom-readout span {
    display: none;
}
.visual-camera-hud .visual-zoom-mode-toggle.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .36);
    background: var(--accent-soft);
}
.visual-camera-hud .visual-zoom-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.visual-pod-handle,
.visual-pod-hide {
    flex: 0 0 38px;
    width: 38px !important;
    min-width: 38px !important;
    padding-inline: 0 !important;
    color: var(--accent);
    touch-action: none;
}
.visual-pod-handle {
    cursor: pointer;
}
.visual-pod-handle.is-unlocked {
    cursor: grab;
    color: var(--text);
    border-color: rgba(var(--accent-rgb), .55);
    background: var(--accent-soft);
}
.visual-pod-handle.is-locked {
    color: var(--muted);
}
.visual-pod-icon {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.visual-pod-cluster {
    display: inline-flex;
    align-items: stretch;
    gap: 3px;
    padding-right: 5px;
    margin-right: 1px;
    border-right: 1px solid var(--line);
}
.visual-pod-cluster > .ghost-button {
    flex: 0 0 36px;
    width: 36px !important;
    min-width: 36px !important;
    min-height: 42px;
    padding-inline: 0 !important;
}
.visual-pod-handle.is-dragging {
    cursor: grabbing;
    color: var(--text);
    border-color: rgba(var(--accent-rgb), .55);
    background: var(--accent-soft);
}
/* The dashed "can be moved" outline wraps the visible bar. An action dock's
   own box spans the canvas width while it sits in its default row. */
.visual-camera-hud.is-position-unlocked,
:is(.visual-controls, .atlas-controls).is-position-unlocked :is(.visual-controls-primary, .atlas-controls-primary, .visual-context-controls) {
    outline: 1px dashed rgba(var(--accent-rgb), .42);
    outline-offset: 3px;
}
:is(.visual-camera-hud, .visual-controls, .atlas-controls)[data-pod-free-position="true"] {
    position: absolute !important;
    margin: 0 !important;
}
:is(.visual-controls, .atlas-controls)[data-pod-free-position="true"] {
    width: fit-content;
    max-width: calc(100% - 16px);
}
@media (min-width: 721px) {
    :is(.visual-controls, .atlas-controls)[data-popover-vertical] > :is(.visual-controls-secondary, .atlas-controls-secondary) {
        right: auto !important;
        left: var(--dock-popover-left, 0px) !important;
        max-height: min(var(--dock-popover-max-height, 68vh), 640px);
        transform: none !important;
    }
    :is(.visual-controls, .atlas-controls)[data-popover-vertical="below"] > :is(.visual-controls-secondary, .atlas-controls-secondary) {
        top: calc(100% + 8px) !important;
        bottom: auto !important;
    }
    :is(.visual-controls, .atlas-controls)[data-popover-vertical="above"] > :is(.visual-controls-secondary, .atlas-controls-secondary) {
        top: auto !important;
        bottom: calc(100% + 8px) !important;
    }
}
.visual-pod-restore {
    position: absolute;
    z-index: 51;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 88px;
    min-height: 42px;
    padding: 9px 13px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .42);
    background: rgba(var(--card-rgb), .96);
    box-shadow: 0 12px 28px rgba(0,0,0,.22), var(--shadow-soft);
    backdrop-filter: blur(16px);
}
.visual-pod-restore .visual-pod-icon {
    width: 17px;
    height: 17px;
}
.visual-camera-restore {
    top: 10px;
}
.visual-controls,
.visual-shell.visual-fullscreen-fallback .visual-controls {
    position: absolute;
    inset: auto 10px 10px;
    z-index: 50;
    display: block;
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
}
.visual-controls-primary,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary,
.visual-context-controls {
    margin-inline: auto;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: rgba(var(--card-rgb), .96);
    box-shadow: 0 16px 36px rgba(0,0,0,.22), var(--shadow-soft);
    backdrop-filter: blur(18px);
    pointer-events: auto;
}
.visual-controls-primary,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary {
    grid-template-columns: 38px repeat(5, minmax(88px, 1fr)) 38px;
}
.visual-controls-primary > .ghost-button,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button,
.visual-context-controls .ghost-button {
    min-height: 42px;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
}
.visual-context-relationship-menu {
    position: relative;
    min-width: 0;
}
.visual-context-relationship-menu > summary {
    position: relative;
    width: 100%;
    min-height: 42px;
    padding: 7px 8px;
    justify-content: center;
    border-radius: 9px;
}
.visual-context-relationship-menu > summary::-webkit-details-marker {
    display: none;
}
.visual-context-relationship-menu[open] > summary {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .42);
    background: var(--accent-soft);
}
.visual-context-relationship-menu > .visual-relationship-manager-popover {
    top: auto;
    right: 0;
    bottom: calc(100% + 8px);
    left: auto;
    width: min(390px, calc(100vw - 36px));
}
.visual-controls .visual-context-controls .visual-tools-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.visual-controls-secondary,
.visual-shell.visual-fullscreen-fallback .visual-controls-secondary {
    position: absolute;
    inset: auto 0 calc(100% + 8px) auto;
    z-index: 55;
    display: grid;
    max-height: min(68vh, 640px);
    border: 1px solid var(--line-strong);
    background: rgba(var(--card-rgb), .985);
    box-shadow: 0 20px 48px rgba(0,0,0,.3), var(--shadow-soft);
    backdrop-filter: blur(18px);
    overflow-y: auto;
    pointer-events: auto;
}
.visual-controls-secondary[hidden] {
    display: none !important;
}
/* A tray opens centred above the dock; on phones it spans the dock instead,
   embedded or full canvas (below). */
.visual-shell .visual-controls .visual-controls-secondary {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 720px) {
    .visual-camera-hud {
        top: 8px;
        right: 8px;
        left: 8px;
        transform: none;
        display: grid;
        grid-template-columns: 36px 36px 36px minmax(48px, 1fr) 36px 46px 36px;
        gap: 3px;
        padding: 4px;
        border-radius: 12px;
    }
    .visual-camera-hud .visual-pod-cluster { width: 100%; }
    .visual-camera-hud .visual-pod-cluster .visual-pod-hide {
        width: 100%;
        min-width: 0;
    }
    .visual-camera-hud .ghost-button,
    .visual-camera-hud .visual-zoom-readout {
        min-height: 44px;
        padding-inline: 4px;
        font-size: 11px;
    }
    .visual-camera-hud .visual-camera-step {
        width: 100%;
        font-size: 20px;
    }
    .visual-controls,
    .visual-shell.visual-fullscreen-fallback .visual-controls {
        inset: auto 6px max(6px, env(safe-area-inset-bottom));
    }
    .visual-controls-primary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary,
    .visual-context-controls {
        border-radius: 12px;
    }
    .visual-controls-primary > .ghost-button,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button,
    .visual-context-controls .ghost-button {
        padding: 6px 3px;
        font-size: 11px;
        white-space: normal;
    }
    .visual-pod-handle {
        display: none !important;
    }
    .visual-pod-hide {
        width: 36px !important;
        min-width: 36px !important;
    }
    .visual-controls-secondary,
    .visual-shell .visual-controls .visual-controls-secondary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-secondary {
        right: 0;
        left: 0;
        transform: none;
        max-height: min(62vh, 560px);
    }
    /* Tray rows, the Arrange layout row, and Arrange actions share one phone
       size: 44 px touch targets, 8 px corners, 11 px labels. */
    .visual-controls .visual-command-menu > .ghost-button,
    .visual-controls .visual-command-menu > .visual-more-menu > summary,
    .visual-controls .visual-arrange-grid .ghost-button {
        min-height: 44px;
        border-radius: 8px;
        font-size: 11px;
    }
    .visual-context-relationship-menu > summary {
        min-height: 44px;
        padding: 6px 3px;
    }
    .visual-context-relationship-menu > .visual-relationship-manager-popover {
        position: fixed;
        right: 12px;
        bottom: calc(126px + env(safe-area-inset-bottom));
        left: 12px;
        width: auto;
        max-height: min(56vh, 440px);
    }
    .visual-shell.visual-fullscreen-fallback .visual-side-panel {
        top: var(--visual-mobile-panel-top, 68px);
    }
    .visual-camera-restore {
        top: 8px;
        right: 8px !important;
        left: auto !important;
        transform: none !important;
    }
}

@media (max-width: 380px) {
    .visual-camera-hud .ghost-button,
    .visual-camera-hud .visual-zoom-readout,
    .visual-controls-primary > .ghost-button,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button,
    .visual-context-controls .ghost-button {
        font-size: 11px;
    }
}

/* v4.41.4: stable global dock with a separate contextual action strip. */
.visual-controls-primary,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary {
    position: relative;
    display: flex;
    align-items: stretch;
    width: fit-content;
    max-width: min(100%, 620px);
    gap: 5px;
    padding: 6px;
}
.visual-controls-primary > .ghost-button,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 88px;
}
.visual-controls-primary > .visual-pod-handle,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-pod-handle,
.visual-controls-primary > .visual-icon-command,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-icon-command,
.visual-controls-primary > .visual-tools-toggle,
.visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-tools-toggle {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
}
.visual-icon-command,
.visual-context-more,
.visual-camera-find,
.visual-camera-fullscreen {
    font-size: 18px !important;
    line-height: 1;
}
.visual-context-controls {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 8px;
}
.visual-context-controls.is-targeting {
    grid-template-columns: minmax(220px, 1fr) 42px;
}
.visual-context-actions > .ghost-button,
.visual-context-actions > .visual-more-menu > summary {
    width: auto;
    min-width: 84px;
    min-height: 42px;
    padding: 7px 11px;
}
.visual-context-actions > .visual-context-more,
.visual-context-actions > .visual-context-close {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
    font-size: 18px;
}
.visual-context-close {
    color: var(--muted);
}
.visual-focus-action.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .42);
    background: var(--accent-soft);
}
.visual-context-relationship-menu > .visual-relationship-manager-popover {
    padding: 8px;
}
.visual-relationship-manager-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 9px;
    border-bottom: 1px solid var(--line);
}
.visual-relationship-manager-head > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.visual-relationship-manager-head strong {
    color: var(--text);
    font-size: 13px;
}
.visual-relationship-manager-head span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.visual-relationship-manager-head > .ghost-button {
    width: auto;
    min-width: 72px;
    min-height: 36px;
    padding: 6px 10px;
    justify-content: center;
    border-color: rgba(var(--accent-rgb), .34);
    background: var(--accent-soft);
    color: var(--accent);
}
.visual-relationship-manager-list {
    display: grid;
    gap: 6px;
    padding-top: 8px;
}
.visual-relationship-manager-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card-soft);
}
.visual-relationship-manager-item:last-child {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.visual-relationship-manager-branch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    min-height: 38px;
    padding: 5px 7px;
    border: 1px solid transparent;
    border-radius: 8px;
}
.visual-relationship-manager-branch:hover,
.visual-relationship-manager-branch:focus-visible {
    border-color: rgba(var(--accent-rgb), .3);
    background: var(--accent-soft);
}
.visual-relationship-manager-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.visual-relationship-manager-copy strong,
.visual-relationship-manager-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.visual-relationship-manager-copy small {
    color: var(--muted);
    font-size: 11px;
}
.visual-relationship-manager-open {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
}
.visual-relationship-manager-actions {
    display: flex;
    gap: 4px;
}
.visual-relationship-manager-actions .ghost-button {
    width: auto;
    min-width: 0;
    min-height: 34px;
    padding: 5px 8px;
    justify-content: center;
    border-color: var(--line-strong);
    background: rgba(var(--card-rgb), .72);
    font-size: 11px;
}
.visual-relationship-manager-actions .danger-link {
    color: var(--danger, #b42318);
}
.visual-relationship-manager-empty {
    padding: 12px 8px;
    text-align: center;
}
.visual-controls-secondary,
.visual-shell.visual-fullscreen-fallback .visual-controls-secondary {
    width: min(320px, calc(100vw - 36px));
    padding: 7px;
    border-radius: 13px;
}
.visual-branch-tools,
.visual-shell.visual-fullscreen-fallback .visual-branch-tools {
    width: min(340px, calc(100vw - 36px));
}
.visual-command-menu {
    display: grid;
    gap: 3px;
}
.visual-command-menu > .ghost-button,
.visual-command-menu > .visual-more-menu > summary {
    justify-content: flex-start;
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border-color: transparent;
    background: transparent;
    text-align: left;
}
.visual-command-menu > .ghost-button:hover,
.visual-command-menu > .ghost-button:focus-visible,
.visual-command-menu > .visual-more-menu > summary:hover,
.visual-command-menu > .visual-more-menu > summary:focus-visible {
    border-color: var(--line-strong);
    background: var(--card-soft);
}
.visual-shell.relationships-on .visual-command-menu > .visual-relationships-toggle,
.visual-command-menu > .visual-relationships-toggle.active {
    border-color: transparent;
    background: transparent;
    color: var(--text);
    font-weight: inherit;
}
.visual-shell.relationships-on .visual-command-menu > .visual-relationships-toggle:hover,
.visual-shell.relationships-on .visual-command-menu > .visual-relationships-toggle:focus-visible,
.visual-command-menu > .visual-relationships-toggle.active:hover,
.visual-command-menu > .visual-relationships-toggle.active:focus-visible {
    border-color: var(--line-strong);
    background: var(--card-soft);
}
.visual-command-menu > .visual-more-menu {
    width: 100%;
}
.visual-command-menu > .visual-more-menu > summary {
    border: 1px solid transparent;
}
.visual-controls .visual-branch-tools .visual-command-menu {
    gap: 6px;
}
.visual-controls .visual-branch-tools .visual-command-menu > .ghost-button,
.visual-controls .visual-branch-tools .visual-command-menu > .visual-more-menu > summary,
.visual-controls .visual-branch-tools .visual-command-menu > .visual-disconnect-button:not(:disabled),
.visual-controls .visual-branch-tools .visual-command-menu > .visual-bulk-connect:not(:disabled) {
    border-color: var(--line-strong);
    background: var(--card-soft);
    color: var(--text);
}
.visual-camera-hud {
    overflow: visible;
}

@media (max-width: 720px) {
    .visual-camera-hud:has(.visual-camera-find) {
        grid-template-columns: 36px 36px 36px minmax(48px, 1fr) 36px 46px 36px 36px;
    }
    .visual-controls-primary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary {
        max-width: none;
        gap: 3px;
        padding: 4px;
    }
    .visual-controls-primary > .ghost-button,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button,
    .visual-controls-primary > .visual-icon-command,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-icon-command,
    .visual-controls-primary > .visual-tools-toggle,
    .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .visual-tools-toggle {
        width: 100%;
        min-width: 0;
    }
    .visual-context-controls,
    .visual-context-controls.is-targeting {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
        margin-bottom: 5px;
    }
    .visual-context-controls.is-bulk .visual-context-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .visual-context-actions > .ghost-button,
    .visual-context-actions > .visual-more-menu,
    .visual-context-actions > .visual-more-menu > summary,
    .visual-context-actions > .visual-context-more,
    .visual-context-actions > .visual-context-close {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 6px 3px;
        font-size: 11px;
    }
    .visual-context-controls.is-targeting .visual-context-close {
        font-size: 18px;
    }
    .visual-pod-cluster {
        width: 100%;
        min-width: 0;
        padding-right: 3px;
    }
    .visual-pod-cluster > .ghost-button {
        flex: 1 1 0;
        width: auto !important;
        min-width: 0 !important;
        min-height: 44px;
    }
    .visual-controls-secondary,
    .visual-shell.visual-fullscreen-fallback .visual-controls-secondary,
    .visual-branch-tools,
    .visual-shell.visual-fullscreen-fallback .visual-branch-tools {
        width: auto;
    }
}

@media (max-width: 380px) {
    .visual-camera-hud:has(.visual-camera-find) {
        grid-template-columns: 32px 32px 32px minmax(42px, 1fr) 32px 42px 32px 32px;
    }
}

.inbox-shell { max-width: var(--app-shell-max); }
.inbox-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
    gap: 16px;
    align-items: start;
}
.inbox-layout:has(.inbox-branch-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1.35fr) minmax(420px, .65fr);
}
.inbox-list-card { min-height: 520px; }
.inbox-composer-card { position: sticky; top: 92px; }
.inbox-detail-card[hidden] { display: none; }
.inbox-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.inbox-form {
    display: grid;
    gap: 13px;
    margin-top: 18px;
}
.inbox-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-medium);
}
.inbox-form input,
.inbox-form textarea,
.inbox-form select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--card);
    color: var(--text);
}
.inbox-form textarea { min-height: 122px; resize: vertical; }
.inbox-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inbox-actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inbox-filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--card-soft-rgb), .72);
}
.inbox-filter-tabs button {
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.inbox-filter-tabs button.active {
    background: rgba(var(--card-rgb), .92);
    color: var(--accent);
    box-shadow: 0 6px 14px rgba(31,41,51,.08);
}
.inbox-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.inbox-list { display: grid; gap: 10px; }
.inbox-list.empty {
    padding: 18px;
    border: 1px dashed rgba(159,178,177,.42);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(var(--card-rgb), .45);
}
.inbox-list.empty.error { color: var(--error-text); }
.inbox-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
    border-radius: 14px;
    background: color-mix(in srgb, var(--accent) 8%, var(--card));
}
.inbox-bulk-bar[hidden] { display: none; }
.inbox-select-page { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.inbox-select-page input,
.inbox-select-control input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.inbox-bulk-bar > strong { white-space: nowrap; font-size: 13px; }
.inbox-bulk-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.inbox-bulk-actions .ghost-button,
.inbox-bulk-actions .primary-button { width: auto; min-height: 34px; padding: 7px 10px; font-size: 12px; }
.inbox-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 16px;
    background: rgba(var(--card-rgb), .62);
}
.inbox-card.inbox-archived { opacity: .72; }
.inbox-select-control { display: grid; place-items: center; align-self: start; min-width: 24px; min-height: 34px; cursor: pointer; }
.inbox-select-spacer { width: 24px; }
.inbox-card-main { min-width: 0; }
.inbox-card-title-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.inbox-card-title-row strong { font-size: 15px; }
.inbox-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.inbox-card-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.inbox-card-actions .ghost-button,
.inbox-card-actions .primary-button { min-height: 34px; padding: 7px 10px; font-size: 12px; width: auto; }
.inbox-card[data-inbox-open] { cursor: pointer; }
.inbox-card[data-inbox-open]:hover,
.inbox-card[data-inbox-open]:focus-visible,
.inbox-card.selected { border-color: rgba(var(--accent-rgb), .62); background: rgba(var(--accent-rgb), .08); outline: none; }
.inbox-card.batch-selected { border-color: color-mix(in srgb, var(--accent) 68%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.inbox-place-dialog { width: min(620px, calc(100vw - 28px)); }
.inbox-place-form { padding: 16px; }
.inbox-place-form > label { display: grid; gap: 7px; color: var(--text); font-size: 13px; font-weight: var(--weight-semibold); }
.profile-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.profile-dialog-heading h2 { margin: 2px 0 0; font-size: 20px; }
.profile-dialog-heading .eyebrow { margin: 0; }
.inbox-placement-modes { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.inbox-placement-modes legend { margin-bottom: 7px; color: var(--text); font-size: 13px; font-weight: var(--weight-semibold); }
.inbox-placement-modes > label {
    display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 11px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--card-soft); cursor: pointer;
}
.inbox-placement-modes input { margin-top: 3px; accent-color: var(--accent); }
.inbox-placement-modes span { display: grid; gap: 2px; }
.inbox-placement-modes small { color: var(--muted); font-weight: var(--weight-regular); }
.inbox-hero-actions { display: flex; align-items: center; gap: 8px; }

@media (max-width: 980px) {
    .inbox-layout,
    .inbox-layout:has(.inbox-branch-panel:not([hidden])) { grid-template-columns: 1fr; }
    .inbox-composer-card { position: static; }
}
@media (max-width: 640px) {
    .inbox-form-grid,
    .inbox-filter-tabs,
    .inbox-stats,
    .inbox-card { grid-template-columns: 1fr; }
    .inbox-card-actions { justify-content: stretch; }
    .inbox-card-actions .ghost-button { flex: 1 1 auto; }
    .inbox-bulk-bar { align-items: stretch; flex-direction: column; }
    .inbox-bulk-actions { display: grid; grid-template-columns: 1fr 1fr; margin-left: 0; }
    .inbox-bulk-actions .ghost-button,
    .inbox-bulk-actions .primary-button { width: 100%; }
    .inbox-card { grid-template-columns: auto minmax(0, 1fr); }
    .inbox-card-actions { grid-column: 1 / -1; }
    .inbox-hero { align-items: stretch; }
    .inbox-hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .inbox-hero-actions .ghost-button, .inbox-hero-actions .primary-button { width: 100%; }
}


/* v3.2.6-local All Todos module */
.todos-shell { max-width: var(--app-shell-max); }
.todos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.todos-layout:has(.library-branch-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1.35fr) minmax(420px, .65fr);
}
.todos-list-card { min-height: 520px; }
.todos-list-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.todo-filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--card-soft-rgb), .72);
}
.todo-filter-tabs button {
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.todo-filter-tabs button.active {
    background: rgba(var(--card-rgb), .92);
    color: var(--accent);
    box-shadow: 0 6px 14px rgba(31,41,51,.08);
}
.todo-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.todo-list { display: grid; gap: 10px; }
.todo-list.empty {
    padding: 18px;
    border: 1px dashed rgba(159,178,177,.42);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(var(--card-rgb), .45);
}
.todo-list.empty.error { color: var(--error-text); }
.todo-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(var(--card-rgb), .62);
}
.todo-card.todo-open { border-left: 4px solid var(--accent); }
.todo-card.todo-done { opacity: .72; }
.todo-card.todo-done .todo-card-title-row strong { color: var(--muted); text-decoration: line-through; }
.todo-card-main { min-width: 0; }
.todo-card-title-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.todo-card-title-row strong { font-size: 15px; line-height: 1.35; }
.todo-card-title-row span {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: var(--weight-semibold);
}
.todo-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.todo-meta span,
.todo-meta a {
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(var(--card-soft-rgb), .65);
    color: var(--muted);
    text-decoration: none;
}
.todo-meta a { color: var(--accent); }
.todo-card-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.todo-card-actions .ghost-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.todo-card[data-todo-open] { cursor: pointer; }
.todo-card[data-todo-open]:hover,
.todo-card[data-todo-open]:focus-visible,
.todo-card.inspector-active {
    border-color: rgba(var(--accent-rgb), .62);
    background: rgba(var(--accent-rgb), .08);
    outline: none;
}

@media (max-width: 980px) {
    .todos-layout,
    .todos-layout:has(.library-branch-panel:not([hidden])) { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .todo-filter-tabs,
    .todo-stats,
    .todo-card { grid-template-columns: 1fr; }
    .todo-card-actions { justify-content: stretch; }
    .todo-card-actions .ghost-button { flex: 1 1 auto; }
}

/* All Notes module */
.notes-shell { max-width: var(--app-shell-max); }
.notes-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.notes-layout:has(.library-branch-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1.35fr) minmax(420px, .65fr);
}
.notes-list-card { min-height: 520px; }
.notes-search-row input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--card);
    color: var(--text);
}
.note-actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notes-list-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.notes-search-row {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--text);
    font-size: 13px;
    font-weight: var(--weight-semibold);
}
.note-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.note-list { display: grid; gap: 10px; }
.note-list.empty {
    padding: 18px;
    border: 1px dashed rgba(159,178,177,.42);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(var(--card-rgb), .45);
}
.note-list.empty.error { color: var(--error-text); }
.note-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 16px;
    background: rgba(var(--card-rgb), .62);
}
.note-card-main { min-width: 0; }
.note-card-title-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.note-card-title-row strong { font-size: 15px; line-height: 1.35; }
.note-card-title-row span {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: var(--weight-semibold);
}
.note-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.note-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.note-meta span,
.note-meta a {
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(var(--card-soft-rgb), .65);
    color: var(--muted);
    text-decoration: none;
}
.note-meta a { color: var(--accent); }
.note-card-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.note-card-actions .ghost-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.note-card[data-note-open] { cursor: pointer; }
.note-card[data-note-open]:hover,
.note-card[data-note-open]:focus-visible,
.note-card.inspector-active {
    border-color: rgba(var(--accent-rgb), .62);
    background: rgba(var(--accent-rgb), .08);
    outline: none;
}
.library-branch-panel {
    position: sticky;
    top: 92px;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow-soft);
}
.library-branch-panel[hidden] { display: none; }
.library-branch-panel.is-loading { visibility: hidden; }
.library-branch-frame {
    display: block;
    width: 100%;
    height: 1px;
    border: 0;
    background: var(--card);
    visibility: hidden;
}
.library-branch-frame.is-size-ready { visibility: visible; }

.drawer-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.branch-note-card.targeted,
.branch-proof-card.targeted,
.note-item-row.targeted,
.branch-reminder-card.targeted {
    border-color: rgba(var(--accent-rgb), .72);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .14);
}

/* Reminders use the same branch-owned library composition as Notes, Todos,
   and Evidence. The compatibility dialog only appears for older reminders
   that do not yet belong to a branch. */
.reminders-layout {
    grid-template-columns: minmax(0, 1fr);
}
.reminders-layout:has(.library-branch-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1.35fr) minmax(420px, .65fr);
}
.reminder-card[data-reminder-open] { cursor: pointer; }
.reminder-card[data-reminder-open]:hover,
.reminder-card[data-reminder-open]:focus-visible,
.reminder-card.inspector-active {
    border-color: rgba(var(--accent-rgb), .62);
    background: rgba(var(--accent-rgb), .08);
    outline: none;
}
.reminder-editor-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: min(900px, calc(100vh - 32px));
    overflow-y: auto;
}
.reminder-editor-form { margin-top: 0; }
.reminder-editor-form .reminder-repeat-panel { padding: 12px; }
.branch-reminder-card { grid-template-columns: minmax(0, 1fr) auto auto auto; }

@media (max-width: 980px) {
    .reminders-layout,
    .reminders-layout:has(.library-branch-panel:not([hidden])) { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .branch-reminder-card { grid-template-columns: 1fr; align-items: stretch; }
    .reminder-editor-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
}

/* Branch Details can be mounted inside a library without rendering a second
   copy of its controls. The embedded workspace keeps the real drawer and its
   existing behavior while removing map-only chrome around it. */
body.branch-embed { min-width: 0; overflow: visible; background: var(--card); }
body.branch-embed .app-skip-link,
body.branch-embed .app-sidebar-mobile-trigger,
body.branch-embed .app-sidebar-backdrop,
body.branch-embed .app-sidebar,
body.branch-embed #headerPanel,
body.branch-embed .account-verification-notice,
body.branch-embed .layout > .map-panel { display: none !important; }
body.branch-embed .app-shell:has(.app-sidebar) {
    display: block;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 0;
}
body.branch-embed .app-shell:has(.app-sidebar) > .app-shell-content {
    display: block;
    width: 100%;
    min-height: 0;
}
body.branch-embed .layout {
    display: block !important;
    width: 100%;
    min-height: 0;
    margin: 0;
}
body.branch-embed .drawer {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body.branch-embed .drawer .icon-button#closeDrawer { display: inline-grid !important; }
body.branch-embed .drawer-empty { visibility: hidden; }
body.branch-embed .branch-embed-open-map { min-height: 36px; padding: 7px 10px; font-size: 12px; }
body.inbox-draft-embed .focus-action-toggle,
body.inbox-draft-embed #branchAdditionalOptions { display: none !important; }

@media (max-width: 980px) {
    .notes-layout,
    .notes-layout:has(.library-branch-panel:not([hidden])) { grid-template-columns: 1fr; }
    .library-branch-panel { position: static; height: auto; min-height: 0; }
}
@media (max-width: 640px) {
    .note-stats,
    .note-card { grid-template-columns: 1fr; }
    .note-card-actions { justify-content: stretch; }
    .note-card-actions .ghost-button { flex: 1 1 auto; }
    .library-branch-panel { height: auto; min-height: 0; border-radius: 14px; }
}

/* Admin visibility and health checks */
.compact-data-list { display: grid; gap: 8px; }
.compact-data-list a,
.compact-data-list > div {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
  color: var(--text);
  text-decoration: none;
}
.compact-data-list a:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--card); }
.compact-data-list strong { font-size: 13px; line-height: 1.35; }
.compact-data-list span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.health-summary-grid .status-word { font-size: 31px; letter-spacing: var(--tracking-display); }
.health-panel { overflow: hidden; }
.health-check-list { display: grid; gap: 8px; }
.health-check {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.health-check > span {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.health-check strong { display: block; margin-bottom: 4px; font-size: 14px; }
.health-check p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.health-check.ok > span { color: var(--green); border-color: rgba(22,163,74,.25); background: var(--green-soft); }
.health-check.warn > span { color: #a16207; border-color: rgba(161,98,7,.25); background: #fff8df; }
.health-check.bad > span { color: var(--red); border-color: rgba(217,83,79,.25); background: var(--red-soft); }
.health-check.info > span { color: var(--muted); }
html[data-theme="dark"] .health-check.warn > span { background: rgba(250,204,21,.12); color: #facc15; }
@media (max-width: 900px) {
  .health-check { grid-template-columns: 1fr; }
  .health-check > span { justify-self: start; padding-inline: 10px; }
}

/* Profile and admin backup polish */
.profile-preference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.profile-preference-grid label { margin: 0; }
.profile-preference-grid select { min-height: 44px; }
.profile-preference-grid .minty-select-button { min-height: 44px; }
.profile-preference-grid .profile-checkbox-preference {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
  color: var(--text);
  cursor: pointer;
}
.profile-checkbox-preference input { flex: 0 0 auto; accent-color: var(--accent); }
.profile-checkbox-preference strong,
.profile-checkbox-preference small { display: block; }
.profile-checkbox-preference small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.profile-preference-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.system-backup-list article {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
}
.system-backup-list article form { margin: 4px 0 0; }
.system-backup-list small { color: var(--muted); }
.profile-storage-usage {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 210px);
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
}
.profile-storage-usage > div:first-child { display: grid; gap: 3px; }
.profile-storage-usage small { color: var(--muted); }
.storage-footprint { grid-template-columns: 1fr; align-items: start; }
.storage-footprint-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 0; }
.storage-footprint-list div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.storage-footprint-list dt { color: var(--muted); }
.storage-footprint-list dd { margin: 0; font-weight: 700; text-align: right; }

/* Profile settings workspace */
/* Inherit the shared .app-shell width rather than setting a narrower one, so
   Profile lines up with Growth Paths and the module pages. */
html:has(.profile-shell) {
  scrollbar-gutter: stable;
}
@supports not (scrollbar-gutter: stable) {
  html:has(.profile-shell) { overflow-y: scroll; }
}
.profile-layout {
  display: grid;
  align-items: start;
}
.profile-column { display: contents; }
.profile-group-heading .eyebrow { margin: 0 0 2px; }
.profile-group-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}
.profile-group-account { order: 1; }
.profile-group-workspace { order: 4; }
.profile-preferences-card { order: 5; }
.appearance-card { order: 6; }
.motion-preference-card { order: 7; margin-top: 0; }
.profile-group-connections { order: 8; }
.ai-provider-card { order: 9; scroll-margin-top: 170px; }
.profile-group-data { order: 13; }
.profile-group-support { order: 15; }
.profile-support-card { order: 16; }
.profile-card,
.profile-danger-card {
  min-width: 0;
  padding: 15px;
  border-radius: 12px;
  box-shadow: none;
  scroll-margin-top: 76px;
}
.profile-card > .eyebrow { display: none; }
.profile-card h2 { margin-top: 0; font-size: 18px; }
.profile-card .section-intro { margin-bottom: 16px; font-size: 13px; }
.profile-settings-status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.profile-settings-body {
  border-top: 1px solid var(--line);
}
.profile-settings-body > .section-intro:first-child { margin-top: 0; }
.profile-security-section .profile-action-stack { align-items: center; }
.profile-security-section .profile-action-stack button { width: auto; }
.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.profile-form-grid label { margin: 0; }
.profile-field-password {
  grid-column: 1 / -1;
  max-width: 520px;
}
.profile-field-password small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-regular);
}
.profile-form-actions {
  display: flex;
  justify-content: flex-start;
}
.profile-form-actions .primary-button {
  width: auto;
  min-width: 160px;
}
.profile-subsection-heading { margin-bottom: 12px; }
.profile-subsection-heading h3 { margin: 0; font-size: 15px; }
.profile-subsection-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.profile-support-form {
  grid-template-columns: minmax(180px, .34fr) minmax(0, 1fr);
  gap: 12px 14px;
}
.profile-support-form .profile-support-message,
.profile-support-form > .primary-button { grid-column: 1 / -1; }
.profile-support-message textarea { min-height: 140px; }
.profile-support-form > .primary-button {
  width: auto;
  min-width: 160px;
  justify-self: start;
}
.profile-connection-status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.profile-ai-heading { display: flex; align-items: start; gap: 16px; }
.profile-ai-heading .section-intro { margin-bottom: 0; }
.profile-ai-connection-list { display: grid; gap: 8px; }
.profile-ai-connection-list.empty { padding: 13px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
.profile-ai-connection-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-soft); }
.profile-ai-connection-row > div:first-child { min-width: 0; display: grid; gap: 3px; }
.profile-ai-connection-row small { overflow-wrap: anywhere; color: var(--muted); }
.profile-ai-connection-row > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-ai-connection-form { max-width: 680px; border-top: 1px solid var(--line); }
.profile-ai-connection-form label small { color: var(--muted); font-weight: var(--weight-regular); }
.profile-connection-body {
  border-top: 1px solid var(--line);
}
.profile-connection-body > h2 { margin-top: 0; }
.motion-preference-card .section-intro { margin: 0; }
.motion-preference-card .motion-save-status { text-align: left; margin: 0; }
.zoom-speed-form .appearance-subsection { margin-top: 6px; }
.zoom-speed-form .profile-preference-grid { margin-top: 4px; }
.zoom-speed-form .primary-button { margin-top: 16px; }
.zoom-speed-form .profile-preference-hint { margin-top: 10px; }
.profile-danger-card {
  border-radius: 12px;
  scroll-margin-top: 76px;
}
@media (max-width: 640px) {
  .profile-preference-grid { grid-template-columns: 1fr; }
  .profile-group-heading { flex-direction: column; }
  .profile-group-heading > p { text-align: left; }
  .profile-card { padding: 15px; }
  .profile-settings-status { order: 4; }
  .profile-form-grid,
  .profile-support-form { grid-template-columns: 1fr; }
  .profile-field-password,
  .profile-support-form .profile-support-message,
  .profile-support-form > .primary-button { grid-column: 1; max-width: none; }
  .profile-form-actions .primary-button,
  .profile-support-form > .primary-button { width: 100%; }
  .profile-connection-status { order: 4; }
  .profile-ai-heading, .profile-ai-connection-row { align-items: stretch; flex-direction: column; }
  .profile-ai-heading .ghost-button { width: 100%; }
  .motion-preference-card .motion-save-status { text-align: left; }
  .profile-storage-usage { grid-template-columns: 1fr; }
  .storage-footprint-list { grid-template-columns: 1fr; }
}

/* Static, content-sized Profile dashboard */
.profile-layout {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}
.ai-provider-card { grid-column: span 8; }
/* Profile section ids are scoped to Profile: Help also has a #chrome-extension
   section, which these rules used to pull out of its grid. */
.profile-layout #chrome-extension { order: 10; grid-column: span 4; }
.inbound-email-card { order: 11; grid-column: span 6; }
.profile-layout #calendar-feed { order: 12; grid-column: span 6; }
.profile-support-card { grid-column: 3 / 11; }
.profile-settings-card,
.profile-connection-card {
  align-self: start;
  padding: 0;
  overflow: hidden;
}
.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent-soft) 32%, var(--card));
}
.profile-panel-header > span:first-child { min-width: 0; }
.profile-panel-header strong,
.profile-panel-header small { display: block; }
.profile-panel-header strong { color: var(--text); font-size: 15px; }
.profile-panel-header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.profile-control-block .appearance-subsection {
  margin: 0;
  padding: 0;
  border: 0;
}
.profile-control-block .primary-button { margin-top: 12px; }
.profile-control-block .profile-preference-hint { margin: 8px 0 0; }
.profile-motion-block .motion-save-status { margin-top: 8px; }
.profile-support-form { max-width: 960px; }
@media (max-width: 1180px) {
  .profile-layout { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .profile-group-heading,
  .profile-preferences-card,
  .appearance-card,
  .motion-preference-card,
  .ai-provider-card,
  .inbound-email-card,
  .profile-layout #chrome-extension,
  .profile-layout #calendar-feed,
  .profile-support-card { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-panel-header { align-items: flex-start; flex-wrap: wrap; }
  .profile-settings-status,
  .profile-connection-status { margin-left: 0; }
}

/* Unified Profile control center */
.profile-shell { max-width: 1520px; }
.profile-layout-overview {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px 12px;
}
.profile-layout-overview .profile-group-account { order: 1; }
.profile-layout-overview .profile-account-sections { order: 2; }
.profile-layout-overview .profile-group-workspace { order: 3; }
.profile-layout-overview .profile-preferences-card { order: 4; }
.profile-layout-overview .appearance-card { order: 5; }
.profile-layout-overview .motion-preference-card { order: 6; }
.profile-layout-overview .profile-group-connections { order: 7; }
.profile-layout-overview .profile-connections-grid { order: 8; }
.profile-layout-overview .profile-group-data { order: 12; }
.profile-layout-overview .profile-data-grid { order: 13; }
.profile-layout-overview .profile-group-support { order: 14; }
.profile-layout-overview .profile-support-grid { order: 15; }
.profile-group-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 48px;
  margin: 4px 0 0;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.profile-group-account { margin-top: 0; border-top: 0; }
.profile-group-heading > div { min-width: 0; }
.profile-group-heading h2 { margin: 0; font-size: 16px; line-height: 1.2; }
.profile-group-heading > div > p {
  max-width: none;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}
.profile-heading-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--card));
  color: var(--accent);
}
.profile-heading-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-account-sections {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.profile-account-section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
}
.profile-account-section .profile-subsection-heading { margin-bottom: 10px; }
.profile-account-section .profile-subsection-heading p { margin-top: 2px; }
.profile-account-section .security-list {
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 0 0 9px;
}
.profile-account-section .security-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}
.profile-account-section .security-list dt { color: var(--muted); font-size: 12px; }
.profile-account-section .security-list dd { font-size: 13px; }
.profile-account-form .profile-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }
.profile-account-form .profile-field-password { grid-column: 1 / -1; max-width: 420px; }
.profile-account-form .primary-button { min-height: 38px; padding-block: 7px; }
.profile-action-row {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-soft);
  color: var(--text);
  text-align: left;
}
.profile-action-row:hover { border-color: color-mix(in srgb, var(--accent) 52%, var(--line)); }
.profile-action-row strong { flex: 1; }
.profile-action-row > span:last-child { margin-left: auto; color: var(--muted); }
.profile-security-section .profile-action-stack button { min-height: 36px; padding: 7px 10px; }

.profile-preferences-card,
.appearance-card,
.motion-preference-card { grid-column: span 4; }
.profile-panel-header { min-height: 50px; padding: 10px 12px; }
.profile-settings-body,
.profile-connection-body { padding: 12px; }
.profile-layout-overview #profile-workspace .profile-preference-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.profile-layout-overview #profile-workspace .profile-checkbox-preference {
  grid-column: 1 / -1;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: default;
}
.profile-checkbox-preference label { display: flex; align-items: center; gap: 9px; margin: 0; cursor: pointer; }
.profile-checkbox-preference input { width: 18px; height: 18px; margin: 0; }
.profile-checkbox-preference strong { font-size: 12px; }
.profile-settings-status,
.profile-connection-status { padding: 3px 7px; font-size: 11px; }
.theme-choice-grid { gap: 7px; }
.theme-choice { gap: 5px; padding: 8px; border-radius: 10px; }
.theme-choice small { display: none; }
.theme-preview { height: 36px; padding: 6px; border-radius: 7px; }
.appearance-subsection { gap: 9px; padding-top: 12px; }
.accent-choice-grid { gap: 6px; }
.accent-choice { min-height: 36px; padding: 6px; border-radius: 9px; }
.accent-swatch { width: 16px; height: 16px; flex-basis: 16px; }
.custom-accent-control { display: none; }
.theme-preference-form:has([data-custom-accent]:checked) .custom-accent-control { display: grid; }
.theme-save-status { margin-top: 2px; }
.profile-motion-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
}
.profile-control-block {
  min-width: 0;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.profile-control-block:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-motion-block { padding-top: 0; }
.profile-setting-row,
.profile-setting-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.profile-setting-row > span,
.profile-setting-title { color: var(--text); }
.profile-setting-row > span { display: inline-flex; align-items: center; gap: 7px; }
.profile-setting-title h3 { margin: 0; font-size: 13px; }
.profile-info-button {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-bold);
  line-height: 1;
}
.profile-info-button:hover,
.profile-info-button:focus-visible,
.profile-info-button[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.profile-switch { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.profile-switch input { position: absolute; opacity: 0; pointer-events: none; }
.profile-switch i {
  width: 36px;
  height: 20px;
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card-soft);
  transition: background .15s ease, border-color .15s ease;
}
.profile-switch i::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}
.profile-switch input:checked + i { border-color: var(--accent); background: var(--accent-soft); }
.profile-switch input:checked + i::after { transform: translateX(16px); background: var(--accent); }
.motion-save-status { margin: 5px 0 0; font-size: 11px; }
.profile-control-block .profile-preference-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.profile-control-block .profile-preference-grid select,
.profile-control-block .profile-preference-grid .minty-select-button { min-height: 38px; }
.profile-layout-overview .profile-card:has(.minty-select.open) {
  position: relative;
  z-index: 40;
  overflow: visible;
}

.profile-connections-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}
.profile-connection-stack { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; }
.profile-connections-grid .profile-connection-card {
  grid-column: auto;
  min-width: 0;
  width: 100%;
}
.profile-connection-stack > .profile-connection-card { grid-column: 1; }
.profile-connection-stack #chrome-extension { grid-column: 1; }
.profile-connections-grid #calendar-feed { grid-column: auto; }
.profile-connection-card .profile-panel-header { align-items: flex-start; }
.profile-connection-card .profile-panel-header small { display: none; }
.profile-connection-body > h2,
.profile-connection-body > .section-intro:first-of-type { display: none; }
.profile-ai-heading > div { display: none; }
.profile-ai-heading { justify-content: flex-end; }
.profile-ai-connection-list { margin: 0 0 9px; }
.profile-ai-connection-row { padding: 9px; }
.profile-ai-connection-form { margin-top: 10px; padding-top: 10px; }
.profile-connection-body > .profile-preference-hint { margin: 9px 0; font-size: 11px; }
.profile-connection-card .profile-action-row { margin-top: 9px; margin-bottom: 0; }
.profile-connection-card form > .primary-button,
.profile-connection-card form > .ghost-button {
  width: auto;
  justify-self: start;
}
.profile-extension-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.profile-extension-actions .primary-button,
.profile-extension-actions .ghost-button {
  min-height: 40px;
}
.inbound-email-card .notice { margin: 0 0 10px; padding: 9px; font-size: 11px; }
.inbound-address-form,
.inbound-sender-form,
.calendar-create-form { grid-template-columns: 1fr; gap: 7px; }
.inbound-sender-section { margin-top: 12px; padding-top: 11px; }
.inbound-sender-row { padding: 8px; }
.calendar-create-form { margin: 0 0 10px; }
.calendar-feed-item { gap: 7px; padding: 9px; border-radius: 9px; }
.calendar-feed-heading { gap: 7px; }
.calendar-feed-options { gap: 7px 10px; }

.profile-data-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}
.profile-data-grid .profile-card { padding: 13px; }
.profile-storage-usage { display: grid; gap: 9px; }
.profile-storage-usage .storage-footprint-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.profile-storage-usage .storage-footprint-list div { align-items: flex-start; flex-direction: column; gap: 2px; }
.profile-storage-usage .storage-footprint-list dd { text-align: left; }
.profile-data-download { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-data-download small { max-width: 560px; }
.profile-data-download .primary-button,
.profile-data-download .ghost-button { min-height: 38px; flex: 0 0 auto; }
.profile-restore-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
  gap: 16px;
}
.profile-restore-card strong,
.profile-restore-card small,
.profile-support-card strong,
.profile-support-card small { display: block; }
.profile-restore-card small,
.profile-support-card small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.profile-restore-card .profile-data-caveat { margin-top: 9px; max-width: 580px; }
.profile-backup-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.profile-backup-actions > * { min-height: 38px; }
.profile-support-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}
.profile-support-card,
.profile-support-grid .profile-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 13px;
}
.profile-support-card .primary-button { min-height: 36px; flex: 0 0 auto; }
.profile-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 11px 13px;
}
.profile-support-grid .profile-support-card,
.profile-support-grid .profile-danger-card {
  grid-column: auto;
  width: 100%;
  min-height: 72px;
  margin-top: 0;
}
.profile-support-grid .profile-support-card { order: 1; }
.profile-support-grid .profile-danger-card { order: 2; }
.profile-danger-card h2 { margin: 0 0 2px; font-size: 14px; color: var(--red); }
.profile-danger-card p { font-size: 11px; }
.profile-danger-card .danger-button { min-height: 36px; flex: 0 0 auto; }

.profile-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: 100%;
  max-height: min(86vh, 780px);
  padding: 0;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .42);
}
.profile-dialog::backdrop { background: rgba(2, 9, 12, .72); backdrop-filter: blur(5px); }
.profile-dialog:has(.profile-dialog-card-wide) { width: min(760px, calc(100vw - 28px)); }
.profile-dialog:has(.profile-dialog-card-attachments) { width: min(1040px, calc(100vw - 28px)); }
.profile-dialog-card { max-height: min(86vh, 780px); overflow: auto; padding: 16px; }
.profile-dialog-card-wide { width: 100%; }
.profile-dialog-card-attachments { width: 100%; overflow: hidden; }
.profile-dialog-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: -2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.profile-dialog-card > header h2 { margin: 0; font-size: 18px; }
.profile-dialog-card > header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.profile-dialog-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.profile-dialog-form { display: grid; gap: 11px; }
.profile-restore-impact { display: grid; gap: 4px; margin: 0; padding-left: 20px; color: var(--text); font-size: 13px; line-height: 1.45; }
.profile-dialog-form label { margin: 0; }
.profile-dialog-form > .profile-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 3px;
}
.profile-dialog-actions > button,
.profile-dialog-actions > a { width: auto; min-width: 0; }
.profile-dialog-danger { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.profile-restore-form textarea { min-height: 150px; }
.profile-dialog .profile-support-form { max-width: none; grid-template-columns: minmax(150px, .35fr) 1fr; }
.profile-attachment-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(190px, .55fr) minmax(160px, .4fr);
  gap: 10px;
  margin-bottom: 12px;
}
.profile-attachment-toolbar label { margin: 0; }
.profile-attachment-summary,
.profile-attachment-footer,
.profile-attachment-selection,
.profile-attachment-pagination {
  display: flex;
  align-items: center;
  gap: 9px;
}
.profile-attachment-summary { justify-content: space-between; min-height: 31px; padding: 0 2px 9px; color: var(--muted); font-size: 12px; }
.profile-attachment-summary .checkbox-row { margin: 0; color: var(--text); }
.profile-attachment-list {
  min-height: 190px;
  max-height: min(46vh, 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
}
.profile-attachment-list[aria-busy="true"] { opacity: .7; }
.profile-attachment-row {
  display: grid;
  grid-template-columns: 24px 42px minmax(0, 1fr) 100px auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}
.profile-attachment-row:last-child { border-bottom: 0; }
.profile-attachment-row:hover { background: color-mix(in srgb, var(--accent) 4%, var(--card-soft)); }
.profile-attachment-check { display: grid; place-items: center; margin: 0; }
.profile-attachment-type {
  display: grid;
  place-items: center;
  width: 42px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
}
.profile-attachment-file,
.profile-attachment-meta { display: grid; min-width: 0; gap: 2px; }
.profile-attachment-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-attachment-file small,
.profile-attachment-meta small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-attachment-meta { text-align: right; }
.profile-attachment-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.profile-attachment-row-actions .compact-button { min-height: 32px; }
.profile-attachment-footer { justify-content: space-between; min-height: 48px; padding-top: 10px; }
.profile-attachment-pagination span,
.profile-attachment-selection span { color: var(--muted); font-size: 12px; }
.profile-attachment-warning { margin: 1px 0 0; text-align: right; }
.profile-attachment-empty { display: grid; place-items: center; align-content: center; gap: 5px; min-height: 188px; padding: 24px; color: var(--muted); text-align: center; }
.profile-attachment-empty strong { color: var(--text); }
.profile-tooltip {
  position: fixed;
  z-index: 10020;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.profile-tooltip[hidden] { display: none; }

@media (max-width: 1240px) {
  .profile-preferences-card,
  .appearance-card { grid-column: span 6; }
  .motion-preference-card { grid-column: 1 / -1; }
  .profile-motion-body { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .profile-control-block { padding: 0 12px 0 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .profile-control-block:last-child { padding-right: 0; border-right: 0; }
  .profile-connections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-connections-grid #calendar-feed { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .profile-layout-overview { grid-template-columns: 1fr; }
  .profile-account-sections,
  .profile-preferences-card,
  .appearance-card,
  .motion-preference-card,
  .profile-connections-grid,
  .profile-data-grid,
  .profile-support-grid { grid-column: 1; }
  .profile-account-sections,
  .profile-connections-grid,
  .profile-data-grid,
  .profile-support-grid,
  .profile-motion-body { grid-template-columns: 1fr; }
  .profile-connections-grid #calendar-feed { grid-column: 1; }
  .profile-control-block { padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-account-form .profile-form-grid { grid-template-columns: 1fr; }
  .profile-account-form .profile-field-password { grid-column: 1; }
  .profile-storage-usage .storage-footprint-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-data-download,
  .profile-restore-card,
  .profile-support-card,
  .profile-support-grid .profile-danger-card { align-items: stretch; flex-direction: column; }
  .profile-data-download .primary-button,
  .profile-backup-actions,
  .profile-support-card .primary-button,
  .profile-support-grid .profile-danger-card .danger-button { width: auto; align-self: flex-start; }
  .profile-attachment-toolbar { grid-template-columns: 1fr; }
  .profile-attachment-row { grid-template-columns: 24px 38px minmax(0, 1fr); }
  .profile-attachment-type { width: 38px; }
  .profile-attachment-meta { grid-column: 3; text-align: left; }
  .profile-attachment-row-actions { grid-column: 3; justify-content: flex-start; }
  .profile-attachment-footer { align-items: stretch; flex-direction: column; }
  .profile-attachment-selection { justify-content: space-between; }
  .profile-dialog .profile-support-form { grid-template-columns: 1fr; }
  .profile-dialog .profile-support-form > * { grid-column: 1; }
}

/* Mobile workspace focus */
.mobile-workspace-filter { display: none; }
@media (max-width: 640px) {
  .module-shell { gap: 12px; }
  .module-hero {
    min-height: 58px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding: 10px 12px;
    border-radius: 15px;
    background: rgba(var(--card-rgb), .72);
    box-shadow: none;
  }
  .module-hero.app-mobile-nav-host {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    padding-right: 12px;
  }
  .module-hero.app-mobile-nav-host > :first-child {
    grid-column: 1;
    grid-row: 1;
  }
  .module-hero.app-mobile-nav-host > .app-sidebar-mobile-trigger {
    position: static;
    grid-column: 2;
    grid-row: 1;
  }
  .module-hero.app-mobile-nav-host > :not(:first-child):not(.app-sidebar-mobile-trigger) {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
  .module-hero.app-mobile-nav-host > .primary-button,
  .module-hero.app-mobile-nav-host > .ghost-button {
    justify-content: center;
    margin-left: 0;
  }
  .module-hero > div { min-width: 0; }
  .module-hero .eyebrow,
  .module-hero > div > p:last-child { display: none; }
  .module-hero h1 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.1;
  }
  .module-hero .primary-button {
    min-height: 40px;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 8px 11px;
    font-size: .84rem;
  }
  .module-card {
    min-height: 0;
    padding: 15px;
    border-radius: 17px;
    box-shadow: none;
  }
  .module-card-kicker { display: none; }
  .module-card h2 { font-size: 1.08rem; }

  .inbox-list-header,
  .todos-list-header,
  .reminders-list-header,
  .notes-list-header {
    min-height: 42px;
    flex-direction: row;
    align-items: center;
    margin-bottom: 10px;
  }
  .inbox-list-header h2,
  .todos-list-header h2,
  .reminders-list-header h2,
  .notes-list-header h2 { margin: 0; }
  #refreshInboxBtn,
  #refreshTodosBtn,
  #refreshRemindersBtn,
  #refreshNotesBtn {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 0;
  }
  #refreshInboxBtn::before,
  #refreshTodosBtn::before,
  #refreshRemindersBtn::before,
  #refreshNotesBtn::before {
    content: "↻";
    font-size: 1.15rem;
  }

  .inbox-filter-tabs,
  .todo-filter-tabs,
  .reminder-filter-tabs { display: none; }
  .mobile-workspace-filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: var(--weight-semibold);
  }
  .mobile-workspace-filter select { width: 100%; }

  .module-list-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .module-page-size,
  .module-page-arrows { width: auto; }
  .module-page-size { justify-content: flex-start; }
  .module-page-size select { min-width: 72px; }
  .module-page-arrows { justify-content: flex-end; }
  .module-page-arrows span { min-width: 56px; }

  .notes-search-row { margin-bottom: 10px; }
  .notes-search-row > span { display: none; }

}

/* Canonical Growth Path drawer content states. */
.drawer-section :where(
  .branch-proof-list.empty,
  .branch-note-list.empty,
  .note-item-list.empty,
  .related-links.empty,
  .private-branch-list.empty,
  .branch-reminder-list.empty
) {
  margin: 0 0 12px;
  padding: 12px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.drawer-section .relationship-note {
  border-color: color-mix(in srgb, var(--blue) 22%, var(--line));
  background: var(--blue-soft);
}
html[data-theme="dark"] .drawer-section .notice.success { color: var(--green); }

/* v4.41.33: one contextual Plan dock. Selection replaces the default
   commands instead of stacking another named toolbar above them. */
.visual-controls.has-selection-context .visual-controls-primary {
  display: none !important;
}
.visual-context-controls,
.visual-context-controls.is-single,
.visual-context-controls.is-bulk,
.visual-context-controls.is-targeting {
  position: relative;
  inset: auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}
.visual-context-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 44px;
  align-items: stretch;
  gap: 4px;
}
.visual-context-controls .ghost-button,
.visual-controls-primary > .ghost-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  justify-content: center;
}
.visual-controls-primary > .visual-pod-cluster {
  min-height: 44px;
}
.visual-dock-icon {
  width: 21px;
  height: 21px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.visual-delete-selected { color: var(--red); }
.visual-dock-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text, #fff);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.visual-context-controls .visual-select-toggle { position: relative; }
/* The Relationships trigger is an icon-and-badge control in the same fixed
   44px column as its neighbours; a wider trigger would paint over More. */
.visual-context-controls .visual-context-relationship-menu,
.visual-context-controls .visual-context-relationship-menu > summary {
  width: 44px;
  min-width: 44px;
}
.visual-context-controls .visual-context-relationship-menu > summary {
  justify-content: center;
  padding: 8px;
}
.visual-context-controls .visual-context-relationship-menu > summary::after {
  content: none;
}
.minty-dialog-summary {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  padding: 12px 14px 12px 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-soft);
  color: var(--text);
}
.minty-dialog-danger { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }

/* On a phone or touch screen every action dock, Plan or Atlas, embedded or
   full canvas, is centred with five equal columns. Docks cannot be moved
   there, so the move control is hidden. */
@media (max-width: 720px), (pointer: coarse) {
  :is(.visual-controls, .atlas-controls) .visual-pod-cluster { display: none !important; }
  .visual-controls-primary,
  .visual-shell.visual-fullscreen-fallback .visual-controls-primary,
  .atlas-controls-primary,
  .visual-context-actions {
    display: grid;
    width: min(100%, 360px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: initial;
  }
  .atlas-controls-primary > :is(.ghost-button, .primary-button) {
    width: 100%;
    min-width: 0 !important;
  }
  .visual-controls-primary,
  .visual-shell.visual-fullscreen-fallback .visual-controls-primary,
  .visual-context-controls {
    margin-inline: auto;
  }
  .visual-controls-primary > .ghost-button,
  .visual-shell.visual-fullscreen-fallback .visual-controls-primary > .ghost-button,
  .visual-context-controls .ghost-button,
  .visual-context-controls .visual-context-relationship-menu,
  .visual-context-controls .visual-context-relationship-menu > summary {
    width: 100%;
    min-width: 0;
    min-height: 52px;
  }
  .visual-context-controls .visual-context-relationship-menu {
    padding: 0;
  }
  .visual-context-controls .visual-context-relationship-menu > summary {
    align-self: stretch;
    height: auto;
  }
  .visual-context-controls,
  .visual-context-controls.is-single,
  .visual-context-controls.is-bulk,
  .visual-context-controls.is-targeting {
    width: min(calc(100vw - 20px), 360px);
  }
  .visual-context-controls.is-targeting .visual-context-actions {
    grid-template-columns: 1fr;
  }
}

/* Branch/Path details are an explicit overlay in Plan and compact layouts. The
   desktop Work view overrides this below with its original sibling details pane. */
body:not(.branch-embed) .layout {
  grid-template-columns: minmax(0, 1fr) !important;
}
body:not(.branch-embed) .layout > .map-panel {
  min-width: 0;
  grid-column: 1;
}
body:not(.branch-embed) .drawer {
  position: fixed !important;
  top: 16px !important;
  right: 16px !important;
  bottom: 16px !important;
  left: auto !important;
  z-index: var(--z-details) !important;
  width: min(480px, calc(100vw - 32px)) !important;
  max-height: none !important;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 97%, transparent);
  box-shadow: 0 24px 72px rgba(10, 22, 25, .34);
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform .2s ease, opacity .16s ease, visibility 0s;
}
body:not(.branch-embed) .drawer.drawer-closed,
body:not(.branch-embed) .drawer[aria-hidden="true"] {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .2s ease, opacity .16s ease, visibility 0s .2s;
}
body:not(.branch-embed) .drawer .icon-button#closeDrawer {
  display: inline-grid !important;
}

@media (max-width: 720px) {
  body:not(.branch-embed) .drawer {
    top: auto !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    left: 8px !important;
    width: auto !important;
    max-height: min(82dvh, 760px) !important;
    border-radius: 20px;
    transform: translateY(0);
  }
  body:not(.branch-embed) .drawer.drawer-closed,
  body:not(.branch-embed) .drawer[aria-hidden="true"] {
    transform: translateY(calc(100% + 24px));
  }
}

/* Work keeps the long-standing desktop composition: the Growth Path and its
   details are sibling cards. Do not move the drawer into the map panel—the
   nested grid makes Atlas → Work returns compress and misalign the tree. */
@media (min-width: 1251px) {
  body.work-details-pane:not(.branch-embed) .layout {
    grid-template-columns: minmax(560px, .68fr) minmax(390px, .32fr) !important;
    gap: 18px;
    align-items: start;
  }
  body.work-details-pane:not(.branch-embed) .layout > .map-panel {
    grid-column: 1;
    min-width: 0;
  }
  body.work-details-pane:not(.branch-embed) .layout > .drawer {
    grid-column: 2;
    position: sticky !important;
    top: 14px !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    max-height: calc(100vh - 28px) !important;
    min-width: 0;
    overflow-y: auto;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: none !important;
    z-index: 2 !important;
    padding: 18px;
    border: 1px solid rgba(159,178,177,.38) !important;
    border-radius: var(--radius) !important;
    background: rgba(var(--card-rgb),.86) !important;
    box-shadow: var(--shadow) !important;
  }
  body.work-details-pane:not(.branch-embed) .layout > .drawer.drawer-closed,
  body.work-details-pane:not(.branch-embed) .layout > .drawer[aria-hidden="true"] {
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  body.work-details-pane:not(.branch-embed) .layout > .drawer .icon-button#closeDrawer {
    display: none !important;
  }
}

/* Comfortable touch targets on phones and touch screens (UI-18, COMP-23).
   Small inline icons keep their look and get a larger invisible hit area. */
@media (max-width: 720px), (pointer: coarse) {
  .app-sidebar-close,
  .profile-dialog-close,
  .proof-attachment-remove,
  .module-page-arrows button,
  .inbox-select-control { min-width: 44px; min-height: 44px; }
  .reminder-card-actions .ghost-button,
  .inbox-card-actions .ghost-button,
  .inbox-card-actions .primary-button,
  .inbox-bulk-actions .primary-button,
  .todo-card-actions .ghost-button,
  .note-card-actions .ghost-button,
  .proof-library-actions .ghost-button,
  .branch-reminder-action,
  .branch-reminder-delete,
  .private-branch-entry-actions .text-button { min-height: 44px; }
  .profile-info-button,
  .status-dot-button { position: relative; }
  .profile-info-button::after,
  .status-dot-button::after { content: ''; position: absolute; inset: 50% auto auto 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
}

/* Library lists cut at their load limit say how many are shown (COMP-07). */
.module-list-limit {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: .92rem;
}
