/* Design-system usability pass. Loaded after the existing revisions; no theme
   geometry or application data is duplicated here. */
:root{
  --dj-fab-secondary-bg:var(--dj-action-secondary-bg);
  --dj-nav-active-indicator-height:2px;
}
/* Late install/account controls must obey their parent's disclosure state,
   even when their own responsive styles set display with !important. */
html body main.main .settings-section.v76-settings-collapsed>:not(h3),
html body main.main .v19-settings-section.v76-settings-collapsed>:not(h3){display:none!important}
.dj-settings-host:has(>[data-dj-settings-moving]){overflow-anchor:none}
.dj-settings-host>[data-dj-settings-moving]{position:relative;z-index:1;outline:2px solid var(--accent);outline-offset:-2px}
.dj-settings-host[data-dj-settings-motion="returning"]>[data-dj-settings-key]:not([data-dj-settings-moving]){visibility:hidden}
@media(max-width:599px){
  html body .app-shell>.main{padding-inline:var(--dj-space-4)!important}
}
@media(min-width:600px) and (max-width:1024px){
  html body .app-shell>.main{padding-inline:var(--dj-space-6)!important}
}

/* Visual priority is separate from existing shape and icon-size tiers. */
html body :is(.topbar .actions,.v76-mobile-main-row) button[data-dj-control-level="utility"]{
  background:transparent!important;border-color:transparent!important;box-shadow:none!important;
}
html body :is(.topbar .actions,.v76-mobile-main-row) button[data-dj-control-level="utility"]:is(:hover,:focus-visible,:active){
  background:var(--dj-action-secondary-bg)!important;
}
html body button[data-dj-control-level="secondary"]{
  background:var(--dj-action-secondary-bg)!important;color:var(--accent)!important;
}
html body button[data-dj-control-level="secondary"]:active{
  background:var(--dj-action-secondary-pressed)!important;
}
html body :is(.r26-dashboard-launchers,.v18-action-dock,.notes-focus-pair) button[data-dj-control-level="secondary"]{
  background:var(--dj-action-secondary-bg)!important;border-color:transparent!important;
}
html body :is(.r26-dashboard-launchers,.v18-action-dock,.notes-focus-pair) button[data-dj-control-level="secondary"] .v22-icon{
  color:var(--accent)!important;
}
html body .rightbar.r26-dashboard [data-r26-dashboard-focus][data-dj-control-level="secondary"] :is(svg,.v22-icon){
  color:var(--accent)!important;filter:none!important;
}
html[data-interface-design="claude"] body :is(.topbar .actions,.v76-mobile-main-row) button[data-dj-control-level="utility"]{
  border-color:var(--line)!important;
}

/* The assistant remains the only filled action in the mobile FAB cluster. */
@media(max-width:599px){
  html:not(.notes-editing) body .v18-action-dock .notes-button{
    background:var(--dj-action-secondary-bg)!important;
    color:var(--accent)!important;
    border-color:transparent!important;
    box-shadow:0 3px 12px color-mix(in srgb,var(--accent) 12%,transparent)!important;
    transition:background .16s ease,color .16s ease,transform .16s ease,opacity .16s ease!important;
  }
  html:not(.notes-editing) body .v18-action-dock .notes-button .v22-icon,
  html:not(.notes-editing) body .v18-action-dock .notes-button .v22-icon *{color:var(--accent)!important;stroke:currentColor!important}
  html:not(.notes-editing) body .v18-action-dock .notes-button:active{
    background:var(--dj-action-secondary-pressed)!important;
    transform:scale(.95);
  }
  html:not(.notes-editing) body #dv-mic{background:var(--accent)!important;color:#fff!important}
  html.v75-mobile-menu-open body :is(.v18-action-dock,#dv-mic-wrap){
    opacity:0!important;visibility:hidden!important;pointer-events:none!important;
    transform:translateY(10px);transition:opacity .16s ease,transform .16s ease,visibility .16s!important;
  }
  html:not(.v75-mobile-menu-open) body :is(.v18-action-dock,#dv-mic-wrap){transition:opacity .16s ease,transform .16s ease,visibility .16s!important}

  /* One top-line indicator, including More. Remove the old frame/fill. */
  html body .sidebar :is(.nav-item[data-r26-phone-primary="true"],.v75-mobile-more){
    position:relative;border:0!important;box-shadow:none!important;
  }
  html body .sidebar :is(.nav-item[data-r26-phone-primary="true"],.v75-mobile-more).active{
    background:transparent!important;border:0!important;box-shadow:none!important;
    color:var(--accent)!important;transform:none!important;
  }
  html body .sidebar :is(.nav-item[data-r26-phone-primary="true"],.v75-mobile-more).active::before{
    content:"";position:absolute;left:18%;right:18%;top:0;
    height:var(--dj-nav-active-indicator-height);background:var(--accent);border-radius:var(--dj-radius-pill,999px);
  }
  html.v75-mobile-menu-open body .sidebar .nav-item[data-r26-phone-primary="true"].active::before{content:none}
  html.v75-mobile-menu-open body .sidebar .v75-mobile-more,
  html.v75-mobile-menu-open body .sidebar .v75-mobile-more:focus{background:transparent!important}
  .v75-mobile-grid.r26-more-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .v75-mobile-sheet:has(.r26-more-grid){height:auto!important;max-height:calc(100dvh - var(--r26-phone-bar-height) - 24px)!important}
  .r26-more-grid .v75-mobile-route{font-family:system-ui!important}
}

/* More is part of the tablet navigation rail, sharing its scroll owner. */
@media(min-width:600px) and (max-width:1024px){
  .sidebar .v76-wide-more-items:not([hidden]){position:static!important;width:100%!important;max-height:none!important;display:flex!important;flex-direction:column;gap:var(--dj-space-1);padding:var(--dj-space-1) 0!important;overflow:visible!important;border:0!important;box-shadow:none!important;background:transparent}
  .sidebar .v76-wide-more-items>button{display:flex!important;flex-direction:row!important;align-items:center;justify-content:flex-start;gap:var(--dj-space-2);min-height:44px;padding:var(--dj-space-2) var(--dj-space-2)!important;border:0!important;text-align:left;font:inherit;min-width:0}
  .sidebar .v76-wide-more-items>button>span:not(.v22-icon):not(.v22-nav-icon){min-width:0;white-space:normal!important}
}
/* Existing body/secondary/reading roles. No menu structure or row size changes. */
.v19-task-menu .r27-critical{
  font-size:var(--dj-text-secondary-size)!important;
  font-weight:var(--dj-text-secondary-weight)!important;
  line-height:var(--dj-text-secondary-line-height)!important;
  color:var(--muted)!important;
}
.v19-task-menu .v19-datchik-cmp-text{
  font-size:var(--dj-text-secondary-size)!important;
  font-weight:var(--dj-text-secondary-weight)!important;
  line-height:var(--dj-text-secondary-line-height)!important;
}
.v19-task-menu .v18-comments .feed-entry :is(.feed-entry-text,.feed-text,.feed-entry-body){
  font-size:var(--dj-text-reading-size)!important;
  font-weight:var(--dj-text-reading-weight)!important;
  line-height:var(--dj-text-reading-line-height)!important;
}

/* Sensor header keeps its action and count together; condition fields use a separate row. */
.v19-task-menu .v19-datchik-header-row>.v19-datchik-toggle{width:var(--dj-touch-min,44px);height:var(--dj-touch-min,44px);min-width:var(--dj-touch-min,44px)}
.v19-task-menu .dj-sensor-condition{display:grid;grid-template-columns:auto minmax(6ch,1fr) minmax(0,2fr);align-items:center;gap:var(--dj-space-2);padding:var(--dj-space-2);border:1px solid var(--line);border-radius:var(--dj-radius-field);background:var(--panel)}
.v19-task-menu .dj-sensor-condition :is(input,select){box-sizing:border-box;width:100%;min-width:0;min-height:var(--dj-touch-min,44px);font:inherit;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:var(--dj-radius-field);padding:var(--dj-space-1)}
.v19-task-menu .dj-sensor-condition .v19-measure-cmp{min-width:0}
.v19-task-menu .dj-sensor-condition .v19-cmp-select{width:auto}

/* Project statistics explain themselves on tap/long-press, while the compact
   metric row and task-card density stay unchanged. */
.r30-stat-help{position:fixed;z-index:12000;max-width:min(290px,calc(100vw - 20px));padding:var(--dj-space-2) var(--dj-space-3);
  border:1px solid var(--line);border-radius:var(--dj-radius-popup);background:var(--panel);color:var(--ink);
  box-shadow:var(--shadow);font-size:var(--dj-text-secondary-size);font-weight:var(--dj-text-secondary-weight)}
.project-history [data-project-history-toggle]{display:flex;align-items:center;gap:var(--dj-space-2)}
.project-history [data-project-history-toggle]::before{content:"";width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(-45deg);transition:transform .22s ease}
.project-history [data-project-history-toggle][aria-expanded="true"]::before{transform:rotate(45deg)}
@media(prefers-reduced-motion:reduce){.v56-month-grid,.project-history [data-project-history-toggle]::before{transition:none!important}}

/* Keep the three global actions reachable while creating a task/project. The
   dialog remains below the title row; its own OK/Cancel controls stay in it.
   The condition is the <html> flag data-dj-editor-backdrop kept by design/ui-semantics.js (rootFlags). It stood here as
   html:has(...): with :has() on the root every DOM change made the browser re-check the styles of the whole document. */
@media(max-width:599px){
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .v76-mobile-main-row{
    grid-template-columns:44px minmax(0,1fr)!important;padding-right:calc(var(--dj-space-8) + var(--dj-space-8) + var(--dj-space-8) + var(--dj-space-8) + var(--dj-space-4) + var(--dj-space-1));box-sizing:border-box;
  }
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .v76-mobile-main-row>:is(.v76-title-create,[data-v76-focus],[data-v76-system]),
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .v76-mobile-actions{display:none!important}
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .v18-action-dock{
    top:9px!important;bottom:auto!important;right:62px!important;left:auto!important;
    flex-direction:row!important;gap:var(--dj-space-2)!important;z-index:100102!important;
  }
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .v18-action-dock .notes-button,
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body #dv-mic{
    width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;
  }
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body #dv-mic-wrap{
    top:9px!important;bottom:auto!important;right:9px!important;z-index:100102!important;
  }
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body #dv-mic-line:not([data-show="1"]){display:none!important}
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body #dv-mic-line[data-show="1"]{
    position:absolute;right:0;top:50px;
  }
  html[data-dj-editor-backdrop] body .r21-entity-backdrop,
  html[data-dj-editor-backdrop][data-dj-editor-backdrop] body .modal-backdrop:has([data-task-form],[data-v40-goal-form]){
    top:62px!important;padding-top:var(--dj-space-3)!important;
  }
}
