/* Primary navigation and the in-flow More disclosure. */
.sidebar-more { min-width: 0; }
.sidebar-more > summary { display: flex; align-items: center; gap: var(--ui-space-2); list-style: none; cursor: pointer; }
.sidebar-more > summary::-webkit-details-marker { display: none; }
.sidebar-more-current { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ui-font-size-caption); }
.sidebar-more-chevron { margin-left: auto; }
.sidebar-more[open] .sidebar-more-chevron { transform: rotate(180deg); }
.sidebar-more-items { display: grid; gap: var(--ui-space-1); padding: var(--ui-space-1) 0; }
.sidebar-more .menu-item { width: 100%; text-align: left; }
.sidebar-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

:root { --app-sidebar-font: var(--ui-font-family); }

@media (max-width: 768px) {
  #appShell { grid-template-columns: minmax(0, 1fr); }
  #appShell > .sidebar { display: none; }
}

@media (min-width: 769px) {
  #appShell {
    --app-sidebar-rail: calc(var(--ui-space-16) + var(--ui-space-2));
    --app-sidebar-inset: var(--ui-space-2);
    --app-sidebar-icon-column: calc(var(--app-sidebar-rail) - 2 * var(--app-sidebar-inset));
    grid-template-columns: var(--app-sidebar-column, var(--ui-secondary-nav-width)) minmax(0, 1fr);
    width: 100%;
    max-width: none;
    gap: 0;
    margin: 0;
    padding: 0;
  }
  #appShell.is-sidebar-compact { --app-sidebar-column: var(--app-sidebar-rail); }
  #appShell > .content { min-width: 0; margin: 0; padding: var(--ui-space-4) var(--ui-space-5) var(--ui-space-6); }
  #appShell > .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    width: var(--app-sidebar-column, var(--ui-secondary-nav-width));
    height: 100dvh;
    max-height: 100dvh;
    min-width: 0;
    min-height: 0;
    gap: var(--ui-space-4);
    margin: 0;
    padding: var(--ui-space-6) var(--app-sidebar-inset) var(--ui-space-4);
    border: 0;
    border-radius: 0;
    background: var(--ui-bg-sidebar);
    box-shadow: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-gutter: auto;
    font-family: var(--app-sidebar-font);
  }
  #appShell > .sidebar > .sidebar-top {
    flex: none;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
  }
  #appShell > .sidebar .brand-title {
    display: grid;
    grid-template-columns: var(--app-sidebar-icon-column) minmax(0, 1fr);
    align-items: center;
    min-height: var(--ui-control-height-lg);
    gap: 0;
    margin: 0 0 var(--ui-space-4);
    padding: 0;
    font-size: var(--ui-font-size-card-title);
    line-height: var(--ui-line-height-tight);
  }
  #appShell > .sidebar .brand-title__logo {
    justify-self: center;
    width: var(--ui-space-8);
    height: var(--ui-space-8);
    padding: 0;
    border: 0;
    border-radius: var(--ui-radius-card);
    box-shadow: none;
  }
  #appShell > .sidebar .brand-title > span::after { content: none; }
  #appShell > .sidebar .menu,
  #appShell > .sidebar .sidebar-more-items { gap: var(--ui-space-1); }
  #appShell > .sidebar .menu { padding: 0; }
  #appShell > .sidebar :is(.menu-item, .sidebar-menu-settings-button) {
    display: grid;
    grid-template-columns: var(--app-sidebar-icon-column) minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: var(--ui-control-height);
    height: var(--ui-control-height);
    margin: 0;
    padding: 0 var(--ui-space-2) 0 0;
    gap: 0;
    border: 0;
    border-radius: var(--ui-radius-control);
    box-shadow: none;
    background: transparent;
    color: var(--ui-text-secondary);
    font-family: inherit;
    font-size: var(--ui-font-size-secondary);
    line-height: var(--ui-line-height-tight);
    font-weight: var(--ui-font-weight-medium);
    text-align: left;
  }
  #appShell > .sidebar :is(.menu-item, .sidebar-menu-settings-button) > .ui-icon {
    justify-self: center;
    width: var(--ui-icon-size);
    height: var(--ui-icon-size);
    margin: 0;
  }
  #appShell > .sidebar :is(.menu-item, .sidebar-menu-settings-button):hover { background: var(--ui-bg-muted); }
  #appShell > .sidebar .menu-item.active {
    color: var(--ui-accent-active);
    background: var(--ui-accent-subtle);
    box-shadow: inset 2px 0 var(--ui-accent-primary);
  }
  #appShell > .sidebar .menu-item.danger { color: var(--ui-status-danger); }
  #appShell > .sidebar .ui-icon-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #appShell > .sidebar .sidebar-menu-tools {
    gap: var(--ui-space-1);
    padding: var(--ui-space-2) 0 0;
    margin: var(--ui-space-1) 0 0;
    border-top: var(--ui-border-card);
  }
  #appShell > .sidebar > .sidebar-status { margin: 0; padding: 0; width: 100%; }
  #appShell > .sidebar .dashboard-sidebar-note { display: none; }
  #appShell > .sidebar .sidebar-width-toggle[aria-expanded="true"] > .ui-icon { transform: rotate(180deg); }
  #appShell.is-sidebar-compact > .sidebar :is(.brand-title, .menu-item, .sidebar-menu-settings-button) {
    grid-template-columns: var(--app-sidebar-icon-column);
    padding-inline: 0;
  }
  #appShell.is-sidebar-compact > .sidebar :is(.brand-title > span, .ui-icon-label, #sidebarMenuSaveStatus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  #appShell.is-sidebar-compact > .sidebar > .sidebar-status { display: none; }
}
.coord-task-audience { margin-bottom: var(--ui-space-4); flex-wrap: wrap; }
#coordTabs[hidden] { display: none; }

#coordRoot .coord-task-audience { display: flex; width: 100%; gap: var(--ui-space-1); padding: 0 0 var(--ui-space-3); border: 0; border-bottom: 1px solid var(--ui-border-subtle); border-radius: 0; background: transparent; box-shadow: none; }
#coordRoot .coord-task-audience > button { width: auto; flex: 0 0 auto; min-height: var(--ui-control-height-sm); padding: var(--ui-space-2) var(--ui-space-3); border-color: transparent; background: transparent; box-shadow: none; }
#coordRoot .coord-task-audience > button.active { background: var(--accent-soft); color: var(--accent); }
