.ac-page {
    width: min(100%, var(--ac-content-width));
    margin: 0 auto;
    padding: 8px 10px 14px;
}

/* Header */
.ac-header {
    display: grid;
    grid-template-columns: minmax(350px, 1fr) auto minmax(350px, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 62px;
    padding: 7px 22px;
    background: rgba(4, 11, 25, .97);
    border: 1px solid #263a5a;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.22);
}
html[data-theme="light"] .ac-header {
    background: rgba(255,255,255,.98);
    border-color: #afc5d9;
}
.ac-brand-group,
.ac-brand,
.ac-nav,
.ac-header-tools,
.ac-auth,
.ac-card-title-row,
.ac-title-with-count,
.ac-direction-legend,
.ac-subhead,
.ac-action-legend,
.ac-downstream-footer,
.ac-detail-actions,
.ac-favorite-dialog-actions {
    display: flex;
    align-items: center;
}
.ac-brand-group { min-width: 0; gap: 10px; }
.ac-brand { min-width: 0; gap: 8px; border-radius: 8px; }
.ac-brand:focus-visible { outline: 2px solid rgba(255, 215, 92, .78); outline-offset: 3px; }
.ac-brand-logo { width: 44px; height: 44px; flex: 0 0 44px; filter: drop-shadow(0 0 8px rgba(61,145,255,.30)); }
.ac-logo-star { fill: none; stroke: #ffcf27; stroke-width: 3; stroke-linejoin: round; transition: fill .18s ease, stroke .18s ease, filter .18s ease, opacity .18s ease; }
.ac-logo-wave { fill: none; stroke: #3d91ff; stroke-width: 3.4; stroke-linecap: round; }
.ac-logo-wave-two { stroke: #8b4bea; }
.ac-logo-dot { fill: #38d9ff; }
.ac-brand-name { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -.025em; white-space: nowrap; }
html[data-theme="light"] .ac-brand-name { color: #0e2942; }
.ac-brand:hover .ac-logo-star { stroke: #fff0a0; filter: drop-shadow(0 0 6px rgba(255,207,39,.75)); }
.ac-brand.has-update .ac-logo-star {
    fill: rgba(255,224,82,.36);
    stroke: #fff5a8;
    filter: drop-shadow(0 0 6px rgba(255,235,115,.95)) drop-shadow(0 0 14px rgba(255,157,47,.78));
    animation: ac-update-star 1.65s ease-in-out infinite;
}
@keyframes ac-update-star {
    0%, 100% { opacity: .76; filter: drop-shadow(0 0 4px rgba(255,235,115,.7)) drop-shadow(0 0 9px rgba(255,157,47,.48)); }
    50% { opacity: 1; filter: drop-shadow(0 0 9px rgba(255,255,190,1)) drop-shadow(0 0 22px rgba(255,116,42,.92)); }
}
@media (prefers-reduced-motion: reduce) {
    .ac-brand.has-update .ac-logo-star { animation: none; }
}
.ac-nav { justify-content: center; gap: 5px; }
.ac-nav-link {
    min-width: 132px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: #f4f6fc;
    background: #0c172a;
    border: 1px solid #1d304d;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 760;
    text-align: center;
}
.ac-nav-link:hover { background: #12223b; border-color: #36547d; }
.ac-nav-link.is-active { color: #fff; background: linear-gradient(180deg,#6d34c9,#5525a6); border-color: #824ddd; box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
html[data-theme="light"] .ac-nav-link { color: #173d5d; background: #edf4fa; border-color: #c4d4e4; }
html[data-theme="light"] .ac-nav-link:hover { background: #e1eef8; border-color: #8eacc7; }
html[data-theme="light"] .ac-nav-link.is-active { color: #fff; background: linear-gradient(180deg,#2b88d6,#176db9); border-color: #1f76bd; }
.ac-header-tools { justify-content: flex-end; gap: 14px; }
.ac-theme-toggle { position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: center; width: 58px; height: 30px; padding: 2px; color: #dce7f8; background: #081325; border: 1px solid #355277; border-radius: 999px; }
.ac-theme-toggle::before { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .18s ease; }
html[data-theme="dark"] .ac-theme-toggle::before { transform: translateX(26px); }
html[data-theme="light"] .ac-theme-toggle { color: #194267; background: #e9f2fa; border-color: #8eabc4; }
html[data-theme="light"] .ac-theme-toggle::before { transform: translateX(0); background: #1675c1; }
.ac-theme-toggle span { position: relative; z-index: 1; font-size: 13px; }
html[data-theme="dark"] .ac-theme-moon { color: #172840; }
html[data-theme="light"] .ac-theme-sun { color: #fff; }
.ac-auth { justify-content: flex-end; gap: 8px; min-width: 0; }
.ac-user-icon { display: grid; place-items: center; width: 27px; height: 29px; color: #70b2ff; border: 1px solid #34547a; border-radius: 50%; font-size: 21px; }
.ac-auth-copy { display: grid; line-height: 1.05; }
.ac-auth-copy strong { color: var(--ac-text); font-size: 13px; }
.ac-auth-copy small { margin-top: 3px; color: var(--ac-muted); font-size: 10px; }
.ac-auth-pill,
.ac-auth-button { padding: 8px 12px; color: #e8fff0; background: rgba(30,133,70,.18); border: 1px solid rgba(75,211,123,.5); border-radius: 7px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.ac-auth-button { color: var(--ac-text); background: var(--ac-panel-2); border-color: var(--ac-border-strong); text-transform: none; }
.ac-warning { margin: 8px 10px 0; padding: 9px 12px; color: #ffe5a0; background: rgba(126,84,8,.2); border: 1px solid rgba(255,196,58,.35); border-radius: 8px; font-weight: 650; }

/* Fixed-width dashboard. The page grows naturally; only long data lists scroll. */
.ac-dashboard {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr) 320px;
    gap: 10px;
    align-items: start;
    padding: 10px 0 0;
}
.ac-left-column,
.ac-center-column,
.ac-right-column { min-width: 0; min-height: 0; }
.ac-left-column { display: block; }
.ac-center-column { display: grid; grid-template-rows: auto 430px; gap: 10px; }
.ac-right-column { display: grid; grid-template-rows: auto auto; gap: 10px; }
.ac-card {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(14,27,49,.99), rgba(7,16,31,.995));
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
}
html[data-theme="light"] .ac-card { background: linear-gradient(180deg,#fff,#f8fbfe); border-color: #b7c9da; }
.ac-card-title-row {
    justify-content: space-between;
    gap: 10px;
    min-height: 49px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(17,31,54,.97), rgba(11,23,42,.96));
    border-bottom: 1px solid rgba(62,85,118,.72);
}
html[data-theme="light"] .ac-card-title-row { background: linear-gradient(180deg,#f9fcff,#eaf3fa); border-bottom-color: #c6d5e3; }
.ac-card-title-row h2,
.ac-card-title-row h3,
.ac-subhead h3,
.ac-connect-section h3 { margin: 0; color: var(--ac-text); }
.ac-downstream-title-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}

.ac-scan-mode {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    background: #081426;
    border: 1px solid #334d70;
    border-radius: 7px;
}

.ac-scan-mode-button {
    min-height: 27px;
    padding: 0 9px;
    color: var(--ac-muted);
    background: transparent;
    border: 0;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 850;
    white-space: nowrap;
}

.ac-scan-mode-button:hover:not(:disabled),
.ac-scan-mode-button:focus-visible:not(:disabled) {
    color: var(--ac-text);
    background: rgba(92,169,255,.12);
}

.ac-scan-mode-button.is-active {
    color: #ffffff;
    background: linear-gradient(180deg,#2e85d4,#176db9);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

.ac-scan-mode-button:disabled {
    cursor: default;
}

html[data-theme="light"] .ac-scan-mode {
    background: #edf4fa;
    border-color: #aebfd1;
}

html[data-theme="light"] .ac-scan-mode-button.is-active {
    color: #ffffff;
    background: linear-gradient(180deg,#2e85d4,#176db9);
}

.ac-card-title-row h2 { font-size: 17px; font-weight: 790; }
.ac-card-title-row p { margin: 2px 0 0; color: var(--ac-muted); font-size: 11px; }
.ac-title-with-count { gap: 9px; min-width: 0; }
.ac-count { display: inline-grid; place-items: center; min-width: 24px; height: 21px; padding: 0 6px; color: #fff; background: #6b2fc2; border: 1px solid #844ddd; border-radius: 999px; font-size: 11px; }
html[data-theme="light"] .ac-count { background: #1a73bd; border-color: #3188d0; }
.ac-node-offline[hidden] { display: none !important; }
.ac-node-offline {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 9px;
    color: #ffffff;
    background: #9f2d3a;
    border: 1px solid #e05d69;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .025em;
    white-space: nowrap;
}
html[data-theme="light"] .ac-node-offline {
    color: #8b1724;
    background: #ffe5e8;
    border-color: #c94451;
}
.ac-info-dot { display: grid; place-items: center; width: 20px; height: 20px; color: #d9e6f7; border: 1px solid #617896; border-radius: 50%; font-size: 12px; font-weight: 800; }
.ac-icon-link,
.ac-text-button,
.ac-view-all { color: #66adff; background: transparent; border: 0; font-weight: 750; }
.ac-icon-link:hover,
.ac-text-button:hover,
.ac-view-all:hover { color: #b0d8ff; }
html[data-theme="light"] .ac-icon-link,
html[data-theme="light"] .ac-text-button,
html[data-theme="light"] .ac-view-all { color: #0d6fbd; }

/* Left combined Connect + Favorites */
.ac-control-card { display: grid; grid-template-rows: auto auto 1px auto; }
.ac-connect-section { padding: 13px 14px 15px; }
.ac-connect-section h3 { font-size: 15px; }
.ac-section-note { margin: 2px 0 10px; color: var(--ac-muted); font-size: 11px; }
.ac-network-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 11px; }
.ac-network-tabs button { min-height: 35px; color: #eef2fb; background: #0a1527; border: 1px solid #2d4568; opacity: 1; }
.ac-network-tabs button:first-child { border-radius: 6px 0 0 6px; }
.ac-network-tabs button:last-child { border-radius: 0 6px 6px 0; }
.ac-network-tabs button.is-active { color: #fff; background: linear-gradient(180deg,#7135cf,#5524a9); border-color: #8149dc; }
html[data-theme="light"] .ac-network-tabs button { color: #173d5d; background: #f1f6fb; border-color: #b9cddd; }
html[data-theme="light"] .ac-network-tabs button.is-active { color: #fff; background: linear-gradient(180deg,#2e85d4,#176db9); border-color: #1f76bd; }
.ac-field { display: grid; gap: 6px; margin-top: 10px; color: var(--ac-text); font-size: 12px; font-weight: 700; }
.ac-field input,
.ac-field select,
.ac-favorite-dialog input,
.ac-favorite-dialog textarea,
.ac-compact-field select,
.ac-downstream-search input {
    width: 100%;
    min-height: 37px;
    padding: 8px 10px;
    color: var(--ac-text);
    background: #091426;
    border: 1px solid #2c4263;
    border-radius: 6px;
    outline: none;
    opacity: 1;
}
.ac-field input:disabled,
.ac-field select:disabled,
.ac-network-tabs button:disabled,
.ac-primary-button:disabled { opacity: 1; }
.ac-field input::placeholder,
.ac-favorite-dialog input::placeholder,
.ac-favorite-dialog textarea::placeholder,
.ac-downstream-search input::placeholder { color: #8090a8; }
html[data-theme="light"] .ac-field input,
html[data-theme="light"] .ac-field select,
html[data-theme="light"] .ac-favorite-dialog input,
html[data-theme="light"] .ac-favorite-dialog textarea,
html[data-theme="light"] .ac-compact-field select,
html[data-theme="light"] .ac-downstream-search input {
    color: #102d48;
    background: #fff;
    border-color: #aebfd1;
}
html[data-theme="light"] .ac-field input::placeholder,
html[data-theme="light"] .ac-favorite-dialog input::placeholder,
html[data-theme="light"] .ac-favorite-dialog textarea::placeholder,
html[data-theme="light"] .ac-downstream-search input::placeholder { color: #6b8297; }
.ac-field input:focus,
.ac-field select:focus,
.ac-compact-field select:focus,
.ac-downstream-search input:focus { border-color: #7c50d7; box-shadow: 0 0 0 2px rgba(122,77,219,.16); }
html[data-theme="light"] .ac-field input:focus,
html[data-theme="light"] .ac-field select:focus,
html[data-theme="light"] .ac-compact-field select:focus,
html[data-theme="light"] .ac-downstream-search input:focus { border-color: #1976c3; box-shadow: 0 0 0 2px rgba(25,118,195,.14); }
.ac-input-with-action { display: grid; grid-template-columns: minmax(0,1fr) auto auto; }
.ac-input-with-action input { min-width: 0; border-radius: 6px 0 0 6px; }
.ac-inline-search { width: 35px; color: var(--ac-text); background: #0c172a; border: 1px solid #2c4263; border-left: 0; border-radius: 0; opacity: 1; }
.ac-inline-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ac-inline-star { width: 39px; color: #ffcf2e; background: #0c172a; border: 1px solid #2c4263; border-left: 0; border-radius: 0 6px 6px 0; font-size: 21px; opacity: 1; }
html[data-theme="light"] .ac-inline-search,
html[data-theme="light"] .ac-inline-star { background: #f6f9fc; border-color: #aebfd1; }
.ac-callsign-results { display: grid; gap: 4px; max-height: 220px; margin-top: 6px; padding: 5px; overflow-y: auto; background: #0c172a; border: 1px solid #2c4263; border-radius: 6px; }
.ac-callsign-results[hidden] { display: none; }
html[data-theme="light"] .ac-callsign-results { background: #f6f9fc; border-color: #aebfd1; }
.ac-callsign-result { display: grid; gap: 2px; width: 100%; padding: 7px 8px; color: var(--ac-text); text-align: left; background: transparent; border: 1px solid transparent; border-radius: 4px; }
.ac-callsign-result:hover,
.ac-callsign-result:focus-visible { border-color: #7c50d7; background: rgba(122,77,219,.12); }
html[data-theme="light"] .ac-callsign-result:hover,
html[data-theme="light"] .ac-callsign-result:focus-visible { border-color: #1976c3; background: rgba(25,118,195,.09); }
.ac-callsign-result strong { font-size: 13px; }
.ac-callsign-result span { font-size: 11px; color: var(--ac-muted); }
.ac-primary-button,
.ac-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 39px;
    margin-top: 12px;
    padding: 0 15px;
    color: #fff;
    background: linear-gradient(180deg,#7d40dc,#5a28b4);
    border: 1px solid #8952e4;
    border-radius: 6px;
    font-weight: 780;
    text-transform: uppercase;
    opacity: 1;
}
html[data-theme="light"] .ac-primary-button { background: linear-gradient(180deg,#2c88d7,#176db9); border-color: #1f76bd; }
.ac-connect-section > .ac-primary-button { width: 100%; }
.ac-secondary-button { color: var(--ac-text); background: #111c2f; border-color: #3a506f; text-transform: none; }
html[data-theme="light"] .ac-secondary-button { color: #173653; background: #edf4fa; border-color: #aebfd1; }
.ac-card-divider { height: 1px; margin: 0 14px; background: rgba(59,82,116,.72); }
html[data-theme="light"] .ac-card-divider { background: #c7d5e2; }
.ac-favorites-section { display: grid; grid-template-rows: auto auto auto; min-height: 0; padding: 13px 14px 14px; }
.ac-subhead { justify-content: space-between; }
.ac-subhead h3 { font-size: 15px; }
.ac-favorites-section > .ac-subhead {
    justify-content: flex-start;
    padding-left: 4px;
}
.ac-favorites-section > .ac-subhead h3 {
    width: auto;
    text-align: left;
}
.ac-favorites-list { min-height: 0; max-height: 250px; margin-top: 7px; overflow-y: auto; overflow-x: hidden; }
.ac-empty-inline { display: grid; gap: 6px; padding: 14px 0; }
.ac-empty-inline strong { color: var(--ac-text); }
.ac-empty-inline span { color: var(--ac-muted); font-size: 11px; line-height: 1.45; }
.ac-view-all { display: block; width: 100%; padding: 9px 0 0; }

/* Current Connections */
.ac-connections-card {
    container-name: connections-card;
    container-type: inline-size;
    display: grid;
    grid-template-rows: auto 34px auto 34px;
    min-height: 300px;
}
.ac-direction-legend { gap: 12px; color: var(--ac-muted); font-size: 10px; font-weight: 820; text-transform: uppercase; }
.ac-connections-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
}
.ac-system-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.ac-connections-node-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ac-connections-title-row .ac-direction-legend {
    justify-content: flex-end;
}
.ac-system-pills {
    display: none;
    align-items: center;
    gap: 3px;
    min-width: 0;
}
.ac-system-pill {
    display: inline-grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 23px;
    padding: 0 5px;
    background: #081524;
    border: 1px solid #456987;
    border-radius: 999px;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, .62),
        inset 0 -1px 0 rgba(118, 170, 211, .14);
    font-family: "Segoe UI", Arial, sans-serif;
    line-height: 1;
    text-shadow: none;
    white-space: nowrap;
}
.ac-system-pill > span {
    color: #a9c7df;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .01em;
    text-transform: uppercase;
}
.ac-system-pill > strong {
    color: #ffd12f;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}
html[data-theme="light"] .ac-system-pill {
    background: #e5eef5;
    border-color: #96aec2;
    box-shadow:
        inset 0 2px 4px rgba(47, 75, 98, .17),
        inset 0 -1px 0 rgba(255, 255, 255, .85);
}
html[data-theme="light"] .ac-system-pill > span { color: #4f708b; }
html[data-theme="light"] .ac-system-pill > strong { color: #805700; }

/*
 * Show the six readouts only when the Current Connections card itself has
 * enough room and the device has a desktop-style pointer. This keeps them
 * off phones even when a mobile browser requests a wide/desktop viewport.
 */
@media (hover: hover) and (pointer: fine) {
    @container connections-card (min-width: 800px) {
        .ac-connections-title-row {
            position: relative;
            display: flex;
            flex-wrap: nowrap;
            gap: 10px;
            min-height: 49px;
            padding: 10px 14px;
            white-space: nowrap;
        }
        .ac-connections-title-row > .ac-title-with-count {
            position: relative;
            z-index: 2;
            flex: 0 0 auto;
            gap: 9px;
        }
        .ac-connections-title-row > .ac-title-with-count h2 {
            font-size: 17px;
            font-weight: 790;
            letter-spacing: normal;
        }
        .ac-connections-title-row > .ac-title-with-count .ac-count {
            min-width: 24px;
            height: 21px;
            padding: 0 6px;
            font-size: 11px;
            font-weight: 400;
        }
        .ac-system-cluster {
            position: absolute;
            z-index: 1;
            top: 50%;
            left: calc(50% + 9px);
            display: flex;
            gap: 3px;
            transform: translate(-50%, -50%);
        }
        .ac-system-pills {
            display: flex;
            flex: 0 0 auto;
            gap: 3px;
        }
        .ac-connections-node-center {
            flex: 0 0 auto;
        }
        .ac-connections-title-row .ac-local-node-pill {
            min-height: 23px;
            padding: 0 7px;
            font-size: 9px;
            font-weight: 600;
        }
        .ac-connections-title-row .ac-direction-legend {
            position: relative;
            z-index: 2;
            flex: 0 0 auto;
            gap: 7px;
            margin-left: auto;
            font-size: 8px;
            font-weight: 650;
        }
        .ac-connections-title-row .ac-panel-expand {
            gap: 5px;
            min-height: 27px;
            padding: 0 10px;
            font-size: 0.67rem;
            font-weight: 850;
        }
        .ac-connections-title-row .ac-panel-expand > span {
            font-size: 0.92rem;
        }
    }
}

/* Hard mobile/touch safeguard: never show the six desktop readouts. */
@media (max-width: 1180px), (hover: none), (pointer: coarse) {
    .ac-system-pills { display: none !important; }
    .ac-system-cluster {
        position: static !important;
        transform: none !important;
    }
}
.ac-audio-toggle { min-height: 28px; padding: 0 10px; color: #dfffe6; background: rgba(38,145,75,.20); border: 1px solid rgba(82,215,124,.55); border-radius: 999px; font-size: 9px; font-weight: 800; text-transform: none; }
.ac-audio-toggle.is-off { color: #d8e0eb; background: #111d30; border-color: #405573; }
html[data-theme="light"] .ac-audio-toggle { color: #0b5b2b; background: #e7f8ed; border-color: #69b885; }
html[data-theme="light"] .ac-audio-toggle.is-off { color: #294a66; background: #edf3f8; border-color: #a8bccd; }
.ac-direction-legend .is-incoming { color: #64ed63; }
.ac-direction-legend .is-outgoing { color: #5daeff; }
html[data-theme="light"] .ac-direction-legend .is-incoming { color: #138a3b; }
html[data-theme="light"] .ac-direction-legend .is-outgoing { color: #0d6fbd; }
.ac-connection-table-head,
.allstar-connect-connection-row {
    display: grid;
    grid-template-columns: 26px 92px minmax(105px,1fr) 70px 56px 58px 196px;
    align-items: center;
    gap: 5px;
}
.ac-connection-table-head {
    margin: 0 10px;
    padding: 0 10px;
    color: #d9e2f0;
    background: linear-gradient(180deg,#15243c,#101c31);
    border: 1px solid #2c4263;
    border-radius: 6px 6px 0 0;
    font-size: 10px;
    font-weight: 760;
}
html[data-theme="light"] .ac-connection-table-head { color: #244a69; background: linear-gradient(180deg,#e9f2f9,#ddeaf4); border-color: #aebfd1; }
.allstar-connect-connection-list {
    min-height: 170px;
    max-height: 270px;
    margin: 0 10px;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(4,10,22,.42);
    border: 1px solid #2c4263;
    border-top: 0;
    border-radius: 0 0 6px 6px;
}
html[data-theme="light"] .allstar-connect-connection-list { background: #fff; border-color: #aebfd1; }
.allstar-connect-connection-row {
    min-height: 43px;
    padding: 5px 10px;
    color: var(--ac-text);
    border-bottom: 1px solid rgba(55,76,106,.62);
    cursor: pointer;
}
.allstar-connect-connection-row:last-child { border-bottom: 0; }
.allstar-connect-connection-row:hover { background: rgba(58,88,130,.20); }
.allstar-connect-connection-row.is-selected { background: linear-gradient(90deg,rgba(98,44,181,.45),rgba(25,39,67,.25)); box-shadow: inset 3px 0 0 #8b4bea; }
.allstar-connect-connection-row.is-keyed { box-shadow: inset 3px 0 0 #ff4d55, 0 0 12px rgba(255,77,85,.16); }
html[data-theme="light"] .allstar-connect-connection-row { color: #102d48; border-bottom-color: #cbd8e4; }
html[data-theme="light"] .allstar-connect-connection-row:hover { background: #edf5fb; }
html[data-theme="light"] .allstar-connect-connection-row.is-selected { background: linear-gradient(90deg,#dcecff,#f6faff); box-shadow: inset 3px 0 0 #1976c3; }
.ac-connection-dir { color: #5ca9ff; font-size: 24px; font-weight: 900; text-align: center; }
.ac-connection-dir.is-in { color: #59e85a; }
html[data-theme="light"] .ac-connection-dir { color: #0d6fbd; }
html[data-theme="light"] .ac-connection-dir.is-in { color: #138a3b; }
.ac-connection-node { min-width: 0; display: grid; }
.ac-connection-node strong { color: var(--ac-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-connection-node small { color: #66adff; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-theme="light"] .ac-connection-node small { color: #0d6fbd; }
.ac-connection-identity,
.ac-connection-mode,
.ac-connection-time,
.ac-connection-link { min-width: 0; color: #e8edf7; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-theme="light"] .ac-connection-identity,
html[data-theme="light"] .ac-connection-mode,
html[data-theme="light"] .ac-connection-time,
html[data-theme="light"] .ac-connection-link { color: #1c3e5b; }
.ac-keyed-inline { display: inline-flex; margin-right: 6px; padding: 2px 5px; color: #fff; background: #d93647; border-radius: 4px; font-size: 8px; }
.ac-row-actions { display: grid; grid-template-columns: 24px 78px 86px; gap: 4px; align-items: center; }
.ac-favorite-star { width: 24px; height: 29px; color: #ffd12f; background: transparent; border: 0; border-radius: 6px; font-size: 22px; }
.ac-favorite-star:hover { background: rgba(255,209,47,.12); }
.ac-row-action { min-height: 29px; padding: 0 5px; border-radius: 5px; font-size: 9px; font-weight: 740; opacity: 1; }
.ac-disconnect-button { color: #ff727a; background: rgba(129,19,31,.12); border: 1px solid #e33947; }
.ac-mode-select { color: #f2eaff; background: #121a2b; border: 1px solid #7541c5; }
html[data-theme="light"] .ac-mode-select { color: #102d48; background: #fff; border-color: #2a7fc7; }
.ac-action-legend { gap: 24px; padding: 8px 14px 10px; color: var(--ac-muted); font-size: 10px; }
.ac-action-legend b { color: #ffd12f; font-size: 17px; font-weight: 500; }
.ac-action-legend b.is-red { color: #ff4f5a; }

/* Downstream */
.ac-downstream-card { display: grid; grid-template-rows: auto auto auto minmax(0,1fr) 32px; min-height: 0; }
.ac-downstream-total { color: #5daeff; font-size: 12px; font-weight: 760; white-space: nowrap; }
html[data-theme="light"] .ac-downstream-total { color: #0d6fbd; }
.ac-downstream-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px 7px; }
.ac-downstream-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ac-compact-field { display: grid; grid-template-columns: auto minmax(140px,190px); align-items: center; gap: 7px; color: var(--ac-muted); font-size: 10px; font-weight: 750; }
.ac-compact-field select { min-height: 34px; }
.ac-downstream-search input { width: 150px; min-height: 34px; }
.ac-downstream-filters,
.allstar-connect-downstream-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.ac-downstream-filters button,
.allstar-connect-downstream-filter { min-height: 29px; padding: 0 9px; color: #dbe5f3; background: #111d31; border: 1px solid #314968; border-radius: 999px; font-size: 9px; font-weight: 780; }
.ac-downstream-filters button.is-active,
.allstar-connect-downstream-filter.is-active { color: #fff; background: #6b2fc2; border-color: #8750df; }
html[data-theme="light"] .ac-downstream-filters button,
html[data-theme="light"] .allstar-connect-downstream-filter { color: #244a69; background: #eef5fa; border-color: #afc2d4; }
html[data-theme="light"] .ac-downstream-filters button.is-active,
html[data-theme="light"] .allstar-connect-downstream-filter.is-active { color: #fff; background: #1c75bf; border-color: #1768ad; }
.ac-downstream-note { min-height: 21px; padding: 0 13px 6px; color: var(--ac-muted); font-size: 10px; }
.allstar-connect-downstream-list { min-height: 0; height: 100%; margin: 0 10px; padding: 8px; overflow: auto; background: rgba(4,10,22,.34); border: 1px solid rgba(44,66,99,.72); border-radius: 6px; }
html[data-theme="light"] .allstar-connect-downstream-list { background: #fbfdff; border-color: #b6c8d8; }
.ac-downstream-footer { justify-content: space-between; gap: 10px; padding: 7px 12px; color: var(--ac-muted); border-top: 1px solid rgba(52,74,105,.62); font-size: 9px; }
html[data-theme="light"] .ac-downstream-footer { border-top-color: #c5d4e1; }





































/* Right details + persistent favorite editor */
.ac-details-card { display: grid; grid-template-rows: auto auto auto auto auto; }
.ac-refresh { color: #c8d8e9; font-size: 22px; }
html[data-theme="light"] .ac-refresh { color: #345f80; }
.ac-detail-hero { display: grid; gap: 1px; padding: 12px 14px 8px; }
.ac-detail-hero strong { color: var(--ac-text); font-size: 24px; }
.ac-detail-hero span { color: #5da7ff; font-size: 17px; font-weight: 760; }
html[data-theme="light"] .ac-detail-hero span { color: #0d6fbd; }
.ac-detail-list { display: grid; gap: 0; margin: 0; padding: 0 14px 8px; overflow: visible; }
.ac-detail-list div { display: grid; grid-template-columns: 108px minmax(0,1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(50,69,98,.52); }
html[data-theme="light"] .ac-detail-list div { border-bottom-color: #cbd8e4; }
.ac-detail-list dt { color: var(--ac-muted); }
.ac-detail-list dd { margin: 0; color: var(--ac-text); overflow-wrap: anywhere; }
.ac-detail-description { margin: 0 14px 10px; padding: 9px 10px; color: var(--ac-muted); background: rgba(8,15,27,.64); border: 1px solid rgba(47,65,91,.68); border-radius: 6px; font-size: 10px; }
html[data-theme="light"] .ac-detail-description { color: #3d5c75; background: #f2f7fb; border-color: #c4d3e0; }
.ac-detail-actions { gap: 9px; padding: 0 14px 13px; }
.ac-detail-actions a,
.ac-favorite-detail,
.ac-detail-load { flex: 1 1 0; min-width: 0; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; color: #fff; background: linear-gradient(180deg,#6f35cb,#5224a4); border: 1px solid #7a46d5; border-radius: 6px; font-weight: 740; white-space: nowrap; }
html[data-theme="light"] .ac-detail-actions a { background: linear-gradient(180deg,#2c88d7,#176db9); border-color: #1f76bd; }
.ac-detail-load {
    flex: 0 0 auto;
    min-width: 54px;
    color: #dff2ff;
    background: linear-gradient(180deg, #15304b, #0d2238);
    border-color: #46789f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.ac-detail-load:hover,
.ac-detail-load:focus-visible {
    color: #ffffff;
    background: linear-gradient(180deg, #1b3f61, #102c47);
    border-color: #6aa4cf;
    outline: none;
}
html[data-theme="light"] .ac-detail-load {
    color: #0f4f7d;
    background: linear-gradient(180deg, #f4f9fd, #dceaf5);
    border-color: #78a5c6;
}
html[data-theme="light"] .ac-detail-load:hover,
html[data-theme="light"] .ac-detail-load:focus-visible {
    color: #0b4168;
    background: linear-gradient(180deg, #ffffff, #d2e6f4);
    border-color: #4d8bb8;
}
.ac-favorite-detail { color: #ffe7a2; background: #121a29; border-color: #9b7343; }
html[data-theme="light"] .ac-favorite-detail { color: #6e4a00; background: #fff8e7; border-color: #bc9452; }
.ac-detail-actions .is-disabled,
.ac-favorite-detail:disabled,
.ac-detail-load:disabled { opacity: .55; box-shadow: none; pointer-events: none; }
.ac-favorite-editor { display: grid; grid-template-rows: auto auto; }
.ac-editor-title-row { min-height: 52px; }
.ac-editor-close { color: var(--ac-muted); background: transparent; border: 0; font-size: 23px; }
.ac-favorite-dialog { display: grid; align-content: start; padding: 11px 14px 13px; overflow: visible; }
.ac-favorite-dialog label { display: grid; gap: 5px; margin-top: 8px; color: var(--ac-text); font-size: 11px; font-weight: 700; }
.ac-favorite-dialog textarea { resize: vertical; min-height: 63px; }
.ac-favorite-dialog-actions { gap: 9px; margin-top: 2px; }
.ac-favorite-dialog-actions .ac-primary-button,
.ac-favorite-dialog-actions .ac-secondary-button { flex: 1; margin-top: 10px; }

/* Empty states */
.ac-empty-state,
.allstar-connect-empty { display: flex; min-height: 100%; flex-direction: column; align-items: center; justify-content: center; padding: 22px; color: var(--ac-muted); text-align: center; }
.ac-empty-state strong,
.allstar-connect-empty strong { color: var(--ac-text); }
.ac-empty-state p,
.allstar-connect-empty p { max-width: 520px; margin: 5px 0 0; color: var(--ac-muted); font-size: 11px; }
.ac-empty-symbol,
.allstar-connect-empty-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 8px; color: #d173ff; background: rgba(111,52,201,.16); border: 1px solid rgba(144,80,222,.52); border-radius: 50%; font-size: 17px; }
html[data-theme="light"] .ac-empty-symbol,
html[data-theme="light"] .allstar-connect-empty-icon { color: #176fb9; background: rgba(23,111,185,.10); border-color: rgba(23,111,185,.35); }
.ac-scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: #3c5272 transparent; }
.ac-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.ac-scroll::-webkit-scrollbar-thumb { background: #3c5272; border-radius: 999px; }
html[data-theme="light"] .ac-scroll { scrollbar-color: #93abc1 transparent; }
html[data-theme="light"] .ac-scroll::-webkit-scrollbar-thumb { background: #93abc1; }
.ac-hidden-activity { position: fixed; left: -10000px; top: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Activity rows are retained for the floating activity window */
.allstar-connect-activity-list { min-height: 0; overflow: auto; }
.allstar-connect-activity-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 38px; padding: 5px 7px; color: var(--ac-text); background: transparent; border: 0; border-bottom: 1px solid rgba(55,76,106,.55); text-align: left; }
.allstar-connect-activity-row:hover,
.allstar-connect-activity-row:focus-visible {
    background: rgba(92,169,255,.10);
    outline: none;
}
html[data-theme="light"] .allstar-connect-activity-row:hover,
html[data-theme="light"] .allstar-connect-activity-row:focus-visible {
    background: #edf6ff;
}
.allstar-connect-activity-type { min-width: 64px; padding: 3px 6px; border-radius: 999px; font-size: 9px; font-weight: 800; text-align: center; }
.allstar-connect-activity-main { display: grid; min-width: 0; }
.allstar-connect-activity-main strong { color: var(--ac-text); }
.allstar-connect-activity-main span { color: var(--ac-muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-key { color: #ffd6d9; background: rgba(213,62,73,.25); }
.activity-unkey { color: #cfe8ff; background: rgba(50,132,210,.22); }
.activity-connect { color: #d6ffde; background: rgba(48,166,83,.22); }
.activity-disconnect { color: #ffd4d8; background: rgba(177,37,54,.24); }

/* Floating windows */
.allstar-connect-floating-window { position: fixed; z-index: 9000; display: flex; flex-direction: column; min-width: 420px; min-height: 300px; max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); overflow: hidden; resize: both; color: var(--ac-text); background: var(--ac-panel); border: 1px solid #4b6791; border-radius: 9px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.allstar-connect-connections-window { width: min(1100px,calc(100vw - 30px)); height: min(620px,calc(100vh - 30px)); }
.allstar-connect-downstream-window { width: min(1200px,calc(100vw - 30px)); height: min(760px,calc(100vh - 30px)); }
.allstar-connect-activity-window { width: min(760px,calc(100vw - 30px)); height: min(560px,calc(100vh - 30px)); }
.allstar-connect-floating-window-header { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; min-height: 47px; padding: 8px 11px; background: #0a1528; border-bottom: 1px solid var(--ac-border); cursor: move; user-select: none; }
html[data-theme="light"] .allstar-connect-floating-window-header { background: #eaf3fb; }
.allstar-connect-floating-window-heading { display: grid; }
.allstar-connect-floating-window-heading span { color: var(--ac-muted); font-size: 10px; }
.allstar-connect-floating-window-move-cue { width: 24px; height: 24px; color: #75b5ff; }
.allstar-connect-floating-window-move-cue svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }
.allstar-connect-floating-window-close { color: #fff; background: transparent; border: 0; font-size: 24px; }
html[data-theme="light"] .allstar-connect-floating-window-close { color: #173653; }
.allstar-connect-floating-window-body { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 10px; }
.allstar-connect-floating-window-list { flex: 1; min-height: 0; max-height: none; margin: 0; }
.allstar-connect-floating-window-hint { padding-top: 8px; color: var(--ac-muted); font-size: 10px; }
.allstar-connect-floating-window-legend { padding: 0 0 8px; }
.ac-floating-table-head { margin: 0; }


/* Compact control panel and keyed-state presentation. */
.ac-control-utilities { display: grid; gap: 9px; margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(59,82,116,.68); }
html[data-theme="light"] .ac-control-utilities { border-top-color: #c7d5e2; }
.ac-control-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ac-check-control { display: inline-flex; align-items: center; gap: 7px; color: var(--ac-text); font-size: 10px; font-weight: 720; }
.ac-check-control input { width: 16px; height: 16px; margin: 0; accent-color: var(--ac-purple-bright); }
html[data-theme="light"] .ac-check-control { color: #173653; }
.ac-dtmf-control { display: grid; grid-template-columns: auto minmax(125px,1fr) 74px 58px; gap: 4px; align-items: center; }
.ac-dtmf-control label { color: #e9b9ff; font-size: 9px; font-weight: 850; letter-spacing: .06em; }
html[data-theme="light"] .ac-dtmf-control label { color: #176fb9; }
.ac-dtmf-control input { min-width: 0; height: 31px; padding: 0 9px; color: var(--ac-text); background: #070e1c; border: 1px solid #3a5275; border-radius: 6px; font-size: 11px; font-weight: 700; }
html[data-theme="light"] .ac-dtmf-control input { color: #102d48; background: #fff; border-color: #9fb5c9; }
.ac-dtmf-control button { height: 31px; color: #fff; background: linear-gradient(180deg,#6f35cb,#5224a4); border: 1px solid #7a46d5; border-radius: 6px; font-size: 10px; font-weight: 800; }
html[data-theme="light"] .ac-dtmf-control button { background: linear-gradient(180deg,#2c88d7,#176db9); border-color: #1f76bd; }
.ac-dtmf-control button:disabled { opacity: .45; }
.ac-control-status { min-height: 17px; color: var(--ac-muted); font-size: 9px; line-height: 1.25; }
.ac-control-status.is-error { color: #ff7d86; }
html[data-theme="light"] .ac-control-status.is-error { color: #b51f2b; }

/* Keep the live table inside the center column at normal desktop widths. */
.ac-connection-table-head,
.allstar-connect-connection-row { grid-template-columns: 24px 78px minmax(82px,1fr) 58px 48px 50px 168px; gap: 4px; }
.ac-row-actions { grid-template-columns: 22px 68px 70px; gap: 4px; }
.ac-favorite-star { width: 22px; }
.ac-row-action { padding-inline: 3px; font-size: 8px; }
.allstar-connect-connection-list { overflow-y: auto; overflow-x: hidden; }

/* A keyed node lights the live row, tree node, and containing live window. */
@keyframes ac-keyed-glow { 0%,100% { box-shadow: inset 4px 0 0 #ff4d55, 0 0 10px rgba(255,77,85,.20); } 50% { box-shadow: inset 4px 0 0 #ff4d55, 0 0 20px rgba(255,77,85,.52); } }
.allstar-connect-connection-row.is-keyed { background: linear-gradient(90deg,rgba(170,24,43,.30),rgba(63,25,95,.48)); animation: ac-keyed-glow 1.1s ease-in-out infinite; }
html[data-theme="light"] .allstar-connect-connection-row.is-keyed { background: linear-gradient(90deg,#ffe7e9,#edf5ff); }


.ac-connections-card:has(.allstar-connect-connection-row.is-keyed) { border-color: rgba(255,79,90,.72); box-shadow: 0 0 18px rgba(255,79,90,.16); }


/* The normal dashboard should not show scrollbars unless content truly exceeds its bounded area. */
.allstar-connect-downstream-list { scrollbar-gutter: stable; }






/* Responsive behavior */
@media (max-width: 1320px) {
    .ac-header { grid-template-columns: minmax(320px,1fr) auto minmax(300px,1fr); padding-inline: 14px; }
    .ac-dashboard { grid-template-columns: 300px minmax(0,1fr) 292px; gap: 8px; }
    .ac-nav-link { min-width: 112px; }
    .ac-connection-table-head,
    .allstar-connect-connection-row { grid-template-columns: 22px 72px minmax(74px,1fr) 54px 46px 48px 158px; gap: 3px; }
    .ac-detail-list div { grid-template-columns: 92px minmax(0,1fr); }
}
@media (max-width: 1120px) {
    .ac-header { grid-template-columns: 1fr auto; }
    .ac-nav { grid-column: 1 / -1; grid-row: 2; }
    .ac-dashboard { grid-template-columns: 290px minmax(0,1fr); }
    .ac-center-column { grid-template-rows: auto 430px; }
    .ac-right-column { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
}
@media (max-width: 820px) {
    body { padding: 0; }
    .ac-header { grid-template-columns: minmax(0,1fr) auto; padding: 7px 9px; border-radius: 0; }
    .ac-brand-logo { width: 38px; height: 38px; flex-basis: 38px; }
    .ac-brand-name { font-size: 19px; }
    .ac-header-tools { gap: 7px; }
    .ac-auth-copy,
    .ac-auth-pill { display: none; }
    .ac-nav { width: 100%; overflow-x: auto; justify-content: flex-start; }
    .ac-nav-link { min-width: 116px; }
    .ac-dashboard { display: block; height: auto; padding: 8px 5px; }
    .ac-left-column,
    .ac-center-column,
    .ac-right-column { display: grid; margin-bottom: 10px; }
    .ac-control-card { min-height: auto; }
    .ac-dtmf-control { grid-template-columns: auto minmax(0,1fr) auto 62px; }
    .ac-center-column { min-height: 0; grid-template-rows: auto auto; }
    .ac-right-column { grid-template-columns: 1fr; grid-template-rows: auto auto; }
    .ac-connections-card { min-height: 390px; }
    .ac-downstream-card { min-height: 460px; }
    .ac-connection-table-head { display: none; }
    .allstar-connect-connection-list { margin: 0 10px 10px; border-top: 1px solid #273b59; border-radius: 6px; }
    .allstar-connect-connection-row { grid-template-columns: 32px minmax(0,1fr) auto; min-width: 0; padding: 8px; }
    .ac-connection-identity,
    .ac-connection-time,
    .ac-connection-link { display: none; }
    .ac-row-actions { grid-column: 2 / 4; grid-template-columns: 31px 1fr 1fr; margin-top: 6px; }
    .ac-downstream-toolbar { align-items: flex-start; flex-direction: column; }
    .ac-downstream-controls { width: 100%; min-width: 0; }
    .ac-compact-field { flex: 1; grid-template-columns: auto minmax(120px,1fr); }
    .ac-downstream-search { flex: 1; }
    .ac-downstream-search input { width: 100%; }
    .ac-downstream-filters { justify-content: flex-start; }
    .ac-downstream-footer { align-items: flex-start; flex-direction: column; }


    .allstar-connect-floating-window { display: none !important; }
}

html[data-theme="light"] .ac-auth-pill { color:#0b5b2b; background:#e7f8ed; border-color:#69b885; }

/* Desktop composition and bounded downstream preview. */
@media (min-width: 1181px) {
    .ac-page { padding: 8px 12px 14px; }
    .ac-header { min-height: 62px; }
    .ac-dashboard {
        grid-template-columns: 360px minmax(0, 1fr) 330px;
        gap: 10px;
        align-items: stretch;
    }
    .ac-left-column,
    .ac-center-column,
    .ac-right-column { height: 810px; }
    .ac-control-card { height: 810px; grid-template-rows: auto auto 1px minmax(0,1fr); }
    .ac-center-column { grid-template-rows: 370px 430px; }
    .ac-right-column { grid-template-rows: 445px 355px; }
    .ac-connections-card,
    .ac-downstream-card,
    .ac-details-card,
    .ac-favorite-editor { height: 100%; }
}

@media (min-width: 1181px) and (max-width: 1450px) {
    .ac-dashboard { grid-template-columns: 330px minmax(0,1fr) 310px; gap: 8px; }
    .ac-left-column,
    .ac-center-column,
    .ac-right-column { height: 800px; }
    .ac-control-card { height: 800px; }
    .ac-center-column { grid-template-rows: 365px 425px; }
    .ac-right-column { grid-template-rows: 440px 350px; }
    .ac-header { grid-template-columns: minmax(310px,1fr) auto minmax(280px,1fr); gap: 10px; padding-inline: 14px; }
    .ac-brand-name { font-size: 22px; }
    .ac-nav-link { min-width: 112px; }
}

.ac-favorites-section { grid-template-rows: auto minmax(0,1fr) auto; }
.ac-favorites-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; border-top: 1px solid rgba(59,82,116,.62); padding-top: 8px; }
html[data-theme="light"] .ac-favorites-footer { border-top-color: #c7d5e2; }
.ac-favorites-footer .ac-view-all { min-height: 32px; padding: 0 5px; border: 1px solid #2c4263; border-radius: 6px; background: #0b1729; }
html[data-theme="light"] .ac-favorites-footer .ac-view-all { background: #edf5fb; border-color: #aebfd1; color: #0d6fbd; }

.ac-connections-card { grid-template-rows: auto 34px minmax(0,1fr) 34px; }
.allstar-connect-connection-list { max-height: none; height: 100%; }
.ac-connection-table-head,
.allstar-connect-connection-row {
    grid-template-columns: 26px 96px minmax(118px,1fr) 76px 62px 70px 210px;
    gap: 5px;
}
.ac-row-actions { grid-template-columns: 28px 82px 92px; gap: 4px; }
.ac-favorite-star { width: 28px; }
.ac-row-action { min-height: 29px; padding-inline: 5px; font-size: 9px; white-space: nowrap; }
.allstar-connect-connection-row { min-height: 44px; }
.ac-connection-node strong,
.ac-connection-identity strong { font-size: 11px; }
.ac-connection-node span,
.ac-connection-identity span { font-size: 9px; }

.ac-downstream-card { grid-template-rows: auto auto auto minmax(0,1fr) 32px; }
.allstar-connect-downstream-list { overflow: hidden; padding: 10px 12px; }
.allstar-connect-downstream-window .allstar-connect-downstream-list { overflow: auto; }
.ac-downstream-toolbar { padding-block: 8px 6px; }
.ac-downstream-note { padding-bottom: 5px; }


.ac-overview-root { position: relative; display: flex; justify-content: center; width: 100%; }
.ac-overview-root::after { content:""; position:absolute; left:50%; bottom:-18px; width:2px; height:18px; background:var(--branch-color); transform:translateX(-50%); }
.ac-overview-grid {
    position: relative;
    width: min(100%, 820px);
    display: grid;
    grid-template-columns: repeat(var(--overview-columns), minmax(0,1fr));
    align-items: start;
    gap: 14px;
    padding-top: 18px;
}
.ac-overview-grid::before { content:""; position:absolute; top:0; left:calc(50% / var(--overview-columns)); right:calc(50% / var(--overview-columns)); height:2px; background:var(--branch-color); }
.ac-overview-branch { position:relative; min-width:0; display:grid; justify-items:center; gap:12px; padding-top:0; }
.ac-overview-branch::before { content:""; position:absolute; top:-18px; left:50%; width:2px; height:18px; background:var(--branch-color); transform:translateX(-50%); }
.ac-overview-grandchildren { position:relative; width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; padding-top:13px; }
.ac-overview-grandchildren::before { content:""; position:absolute; top:0; left:50%; width:2px; height:13px; background:var(--branch-color); transform:translateX(-50%); }
.ac-overview-grandchild { position:relative; min-width:0; display:flex; justify-content:center; padding-top:8px; }
.ac-overview-grandchild::before { content:""; position:absolute; top:0; left:50%; width:2px; height:8px; background:var(--branch-color); transform:translateX(-50%); }




.ac-overview-more,
.ac-overview-direct-more,
.ac-overview-empty { color:var(--ac-muted); font-size:9px; text-align:center; }
.ac-overview-more { margin-top:-5px; }
.ac-overview-direct-more { align-self:end; padding:4px 10px; border:1px dashed var(--branch-color); border-radius:999px; background:rgba(7,16,31,.88); }
html[data-theme="light"] .ac-overview-direct-more { background:#fff; }

.ac-details-card { display:grid; grid-template-rows:auto auto auto minmax(42px,auto) auto; }
.ac-detail-hero { padding:12px 14px 8px; }
.ac-detail-hero strong { font-size:25px; }
.ac-detail-list { padding:0 14px; }
.ac-detail-list div { min-height:32px; grid-template-columns:105px minmax(0,1fr); }
.ac-detail-description { min-height:42px; max-height:64px; margin:8px 14px; overflow:auto; }
.ac-detail-actions { padding:0 14px 13px; }
.ac-detail-actions a,
.ac-detail-actions button { min-height:39px; }

.ac-favorite-editor { display:grid; grid-template-rows:auto minmax(0,1fr); }
.ac-favorite-dialog { display:grid; grid-template-rows:repeat(3,auto) minmax(0,1fr) auto; gap:8px; padding:10px 14px 12px; }
.ac-favorite-dialog label { gap:4px; }
.ac-favorite-dialog input { min-height:34px; }
.ac-favorite-dialog textarea { min-height:58px; height:100%; resize:none; }
.ac-favorite-dialog-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.ac-favorite-dialog-actions .ac-primary-button,
.ac-favorite-dialog-actions .ac-secondary-button { width:100%; min-width:0; margin-top:0; white-space:nowrap; font-size:11px; }

/* Ensure disabled staged controls remain legible in both themes. */
.ac-page button:disabled,
.ac-page input:disabled,
.ac-page select:disabled,
.ac-page textarea:disabled { opacity:1; }
html[data-theme="light"] .ac-card,
html[data-theme="light"] .ac-card * { text-shadow:none; }
html[data-theme="light"] .ac-card-title-row h2,
html[data-theme="light"] .ac-card-title-row h3,
html[data-theme="light"] .ac-connect-section h3,
html[data-theme="light"] .ac-subhead h3,
html[data-theme="light"] .ac-field,
html[data-theme="light"] .ac-detail-list dt,
html[data-theme="light"] .ac-detail-list dd,
html[data-theme="light"] .ac-favorite-dialog label { color:#102d48; }
html[data-theme="light"] .ac-section-note,
html[data-theme="light"] .ac-card-title-row p,
html[data-theme="light"] .ac-downstream-note,
html[data-theme="light"] .ac-downstream-footer,
html[data-theme="light"] .ac-action-legend,
html[data-theme="light"] .ac-empty-state p { color:#3d5b75; }
html[data-theme="light"] .activity-key { color:#8c1722; background:#ffe2e5; border-color:#e99aa2; }
html[data-theme="light"] .activity-unkey { color:#0b548d; background:#e1f1ff; border-color:#92c3e9; }
html[data-theme="light"] .activity-connect { color:#0a6b30; background:#e2f7e9; border-color:#84c99d; }
html[data-theme="light"] .activity-disconnect { color:#8c1722; background:#ffe2e5; border-color:#e99aa2; }

@media (max-width: 1300px) and (min-width: 1181px) {
    .ac-dashboard { grid-template-columns: 310px minmax(0,1fr) 295px; }
    .ac-connection-table-head,
    .allstar-connect-connection-row { grid-template-columns:22px 78px minmax(80px,1fr) 62px 54px 56px 176px; gap:3px; }
    .ac-row-actions { grid-template-columns:24px 70px 74px; gap:3px; }
    .ac-row-action { font-size:8px; padding-inline:3px; }

}

/* Fit the complete right column without hidden fields or internal scrolling. */
.ac-detail-hero { padding: 9px 14px 5px; }
.ac-detail-hero strong { font-size: 23px; line-height: 1; }
.ac-detail-hero span { margin-top: 4px; }
.ac-detail-list div { min-height: 27px; padding-block: 3px; }
.ac-detail-description { min-height: 34px; max-height: 44px; margin: 6px 14px; padding: 7px 9px; }
.ac-detail-actions { padding: 0 14px 9px; gap: 7px; }
.ac-detail-actions a,
.ac-detail-actions button { min-height: 35px; padding-inline: 8px; font-size: 10px; }
.ac-favorite-editor .ac-card-title-row { min-height: 48px; padding-block: 7px; }
.ac-favorite-editor .ac-card-title-row p { margin-top: 1px; }
.ac-favorite-dialog { gap: 5px; padding-top: 7px; padding-bottom: 8px; }
.ac-favorite-dialog label { gap: 2px; font-size: 10px; }
.ac-favorite-dialog input { min-height: 31px; padding-block: 5px; }
.ac-favorite-dialog textarea { min-height: 50px; }
.ac-favorite-dialog-actions .ac-primary-button,
.ac-favorite-dialog-actions .ac-secondary-button { min-height: 34px; }

/* Downstream list */
.allstar-connect-downstream-list {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 10px 12px !important;
}
.ac-ds-group {
    --ds-branch: #4d9cff;
    overflow: hidden;
    margin: 0 0 10px;
    background: rgba(11, 23, 42, .72);
    border: 1px solid color-mix(in srgb, var(--ds-branch) 45%, #233a59);
    border-radius: 9px;
}
.ac-ds-root,
.ac-ds-row {
    width: 100%;
    display: grid;
    align-items: center;
    color: var(--ac-text);
    background: transparent;
    border: 0;
    font: inherit;
    text-align: left;
}
.ac-ds-root {
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 52px;
    padding: 9px 11px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--ds-branch) 13%, #0c1a30), rgba(15, 24, 43, .94));
    border-bottom: 1px solid rgba(62, 85, 119, .52);
    cursor: pointer;
}
.ac-ds-root.ac-ds-static { cursor: default; }
.ac-ds-children { overflow: hidden; }
.ac-ds-row {
    grid-template-columns: 24px 9px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 43px;
    padding: 7px 10px 7px 14px;
    border-top: 1px solid rgba(255,255,255,.045);
    cursor: pointer;
}
.ac-ds-row.depth-2 { padding-left: 29px; }
.ac-ds-row.depth-3 { padding-left: 44px; }
.ac-ds-row.depth-4 { padding-left: 59px; }
.ac-ds-row.depth-deep { padding-left: 74px; }
.ac-ds-root:hover,
.ac-ds-row:hover,
.ac-ds-root:focus-visible,
.ac-ds-row:focus-visible { background-color: color-mix(in srgb, var(--ds-branch) 12%, transparent); outline: none; }
.ac-ds-root.is-selected,
.ac-ds-row.is-selected { box-shadow: inset 4px 0 0 var(--ds-branch); background-color: color-mix(in srgb, var(--ds-branch) 10%, transparent); }
.ac-ds-branch { color: var(--ds-branch); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 800; }
.ac-ds-dot { width: 8px; height: 8px; background: var(--ds-branch); border-radius: 50%; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ds-branch) 18%, transparent); }
.ac-ds-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-ds-main strong { overflow: hidden; color: var(--ac-text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ac-ds-main span { overflow: hidden; color: #c2cfdf; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ac-ds-state { min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.ac-ds-count,
.ac-ds-chip,
.ac-ds-keyed { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.ac-ds-count { color: #d8e6f6; background: rgba(77,156,255,.10); border: 1px solid rgba(77,156,255,.34); }
.ac-ds-chip-private { color: #ffe7a0; background: rgba(201,138,8,.16); border: 1px solid #c98a08; }
.ac-ds-private { --ds-type: #d6a11c; }
.ac-ds-private .ac-ds-dot { background: #d6a11c; box-shadow: 0 0 0 2px rgba(214,161,28,.18); }
.ac-ds-private .ac-ds-main strong,
.ac-ds-private .ac-ds-branch { color: #ffe09a; }
.ac-ds-chip-echo { color: #ead7ff; background: rgba(184,96,255,.15); border: 1px solid #8f52cf; }
.ac-ds-echolink .ac-ds-dot { background: #b860ff; box-shadow: 0 0 0 2px rgba(184,96,255,.18); }
.ac-ds-echolink .ac-ds-main strong { color: #e5c9ff; }
.ac-ds-chip-client { color: #ffd9ca; background: rgba(255,120,95,.12); border: 1px solid #b95d49; }
.ac-ds-client .ac-ds-dot { background: #ff785f; box-shadow: 0 0 0 2px rgba(255,120,95,.16); }
.ac-ds-client .ac-ds-main strong { color: #ffd9ca; }
.ac-ds-keyed { color: #fff; background: #d93647; border: 1px solid #ff6d79; box-shadow: 0 0 10px rgba(255,72,88,.42); }
.ac-ds-root.is-keyed,
.ac-ds-row.is-keyed { box-shadow: inset 4px 0 0 #ff4f5a, 0 0 14px rgba(255,79,90,.15); }
.ac-ds-none { padding: 12px; color: var(--ac-muted); font-size: 10px; text-align: center; }
html[data-theme="light"] .ac-ds-group { background: #fff; border-color: color-mix(in srgb, var(--ds-branch) 42%, #c9d8e7); }
html[data-theme="light"] .ac-ds-root { background: linear-gradient(90deg, color-mix(in srgb, var(--ds-branch) 9%, #fff), #fff); border-bottom-color: #dbe6ef; }
html[data-theme="light"] .ac-ds-row { border-top-color: #e4edf5; }
html[data-theme="light"] .ac-ds-main strong { color: #102d48; }
html[data-theme="light"] .ac-ds-main span { color: #4a657d; }
html[data-theme="light"] .ac-ds-count { color: #205f98; background: #eef6ff; border-color: #9bc4e7; }
html[data-theme="light"] .ac-ds-private .ac-ds-main strong,
html[data-theme="light"] .ac-ds-private .ac-ds-branch { color: #8a5b00; }
html[data-theme="light"] .ac-ds-chip-private { color: #704800; background: #fff7d7; border-color: #c98a08; }
html[data-theme="light"] .ac-ds-echolink .ac-ds-main strong { color: #71379f; }
html[data-theme="light"] .ac-ds-chip-echo { color: #6d2f9e; background: #f5ebff; border-color: #ad78d1; }
html[data-theme="light"] .ac-ds-client .ac-ds-main strong { color: #8f3d27; }
html[data-theme="light"] .ac-ds-chip-client { color: #8f3d27; background: #fff4ef; border-color: #d99b88; }
@media (max-width: 720px) {
    .ac-ds-root { grid-template-columns: 9px minmax(0,1fr); }
    .ac-ds-row { grid-template-columns: 22px 8px minmax(0,1fr); }
    .ac-ds-state { grid-column: 2 / -1; justify-content: flex-start; padding-left: 17px; }
}

/* Downstream color hierarchy */
.ac-ds-group { --ds-branch: #5ca9ff !important; }
.ac-ds-root .ac-ds-dot {
    color: #5ca9ff;
    background: currentColor;
    box-shadow: 0 0 9px currentColor;
}
.ac-ds-row .ac-ds-branch,
.ac-ds-row .ac-ds-dot {
    color: #d86cf2;
}
.ac-ds-row .ac-ds-dot {
    background: currentColor;
    box-shadow: 0 0 9px currentColor;
}
.ac-ds-row.is-nested .ac-ds-branch,
.ac-ds-row.is-nested .ac-ds-dot {
    color: #4fd1c5;
}
.ac-ds-row.ac-ds-private .ac-ds-branch,
.ac-ds-row.ac-ds-private .ac-ds-dot,
.ac-ds-row.ac-ds-private .ac-ds-main strong {
    color: #ffcb5c !important;
}
.ac-ds-row.ac-ds-echolink .ac-ds-branch,
.ac-ds-row.ac-ds-echolink .ac-ds-dot,
.ac-ds-row.ac-ds-echolink .ac-ds-main strong {
    color: #d86cf2 !important;
}
.ac-ds-row.ac-ds-client .ac-ds-branch,
.ac-ds-row.ac-ds-client .ac-ds-dot,
.ac-ds-row.ac-ds-client .ac-ds-main strong {
    color: #ff785f !important;
}
html[data-theme="light"] .ac-ds-root .ac-ds-dot { color: #225d94; }
html[data-theme="light"] .ac-ds-row .ac-ds-branch,
html[data-theme="light"] .ac-ds-row .ac-ds-dot { color: #8a2b9a; }
html[data-theme="light"] .ac-ds-row.is-nested .ac-ds-branch,
html[data-theme="light"] .ac-ds-row.is-nested .ac-ds-dot { color: #087f7a; }
html[data-theme="light"] .ac-ds-row.ac-ds-private .ac-ds-branch,
html[data-theme="light"] .ac-ds-row.ac-ds-private .ac-ds-dot,
html[data-theme="light"] .ac-ds-row.ac-ds-private .ac-ds-main strong { color: #8a5b00 !important; }
html[data-theme="light"] .ac-ds-row.ac-ds-echolink .ac-ds-branch,
html[data-theme="light"] .ac-ds-row.ac-ds-echolink .ac-ds-dot,
html[data-theme="light"] .ac-ds-row.ac-ds-echolink .ac-ds-main strong { color: #71379f !important; }
html[data-theme="light"] .ac-ds-row.ac-ds-client .ac-ds-branch,
html[data-theme="light"] .ac-ds-row.ac-ds-client .ac-ds-dot,
html[data-theme="light"] .ac-ds-row.ac-ds-client .ac-ds-main strong { color: #8f3d27 !important; }

/* Dedicated Favorites page. */
.ac-favorites-main {
    width: min(var(--ac-content-width), calc(100% - 24px));
    margin: 10px auto 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}
.ac-favorites-manager { min-height: 0; }
.ac-favorites-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ac-border);
}
.ac-favorites-search { display: grid; gap: 5px; color: var(--ac-text); font-size: 11px; font-weight: 800; }
.ac-favorites-toolbar > .ac-callsign-results { grid-column: 1 / -1; margin-top: 0; max-height: 430px; }
.ac-favorites-toolbar .ac-callsign-result.is-static:hover {
    border-color: transparent;
    background: transparent;
}
.ac-favorites-toolbar .ac-callsign-result.is-asl > strong { color: #5ca9ff; }
.ac-favorites-toolbar .ac-callsign-result.is-echo > strong { color: #b874ff; }
html[data-theme="light"] .ac-favorites-toolbar .ac-callsign-result.is-asl > strong { color: #225d94; }
html[data-theme="light"] .ac-favorites-toolbar .ac-callsign-result.is-echo > strong { color: #7c3696; }
.ac-favorites-node-add {
    align-self: end;
    justify-self: end;
    min-height: 34px;
    margin-top: 0;
    padding: 0 12px;
    text-transform: none;
    white-space: nowrap;
}
.ac-favorites-search input::-webkit-search-cancel-button {
    cursor: pointer;
}
.ac-favorites-search input,
.ac-favorite-page-form input,
.ac-favorite-page-form select,
.ac-favorite-page-form textarea {
    width: 100%;
    min-width: 0;
    color: var(--ac-text);
    background: #071225;
    border: 1px solid #324b70;
    border-radius: 7px;
    padding: 8px 10px;
}
html[data-theme="light"] .ac-favorites-search input,
html[data-theme="light"] .ac-favorite-page-form input,
html[data-theme="light"] .ac-favorite-page-form select,
html[data-theme="light"] .ac-favorite-page-form textarea {
    color: #102d48;
    background: #fff;
    border-color: #9fb5c9;
}
.ac-favorites-toolbar .ac-primary-button { width: auto; min-width: 140px; margin: 0; padding-inline: 18px; }
.ac-favorites-table-wrap {
    max-height: 520px;
    overflow-x: auto;
    overflow-y: auto;
}
.ac-favorites-table { width: 100%; border-collapse: collapse; }
.ac-favorites-table th,
.ac-favorites-table td { padding: 10px 12px; text-align: left; vertical-align: middle; }
.ac-favorites-table thead tr { border-bottom: 1px solid var(--ac-border); }
.ac-favorites-table tbody tr { border-bottom: 1px solid var(--ac-border); }
.ac-favorites-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: var(--ac-muted);
    background: rgba(18,32,55,.98);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
html[data-theme="light"] .ac-favorites-table th { color: #24445f; background: #eaf3fb; }
.ac-favorites-table th button { padding: 0; color: inherit; background: transparent; border: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.ac-favorites-table td { color: var(--ac-text); }

/* Subtle zebra rows prevent the horizontal separators from appearing crooked. */
.ac-favorites-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, .012);
}
.ac-favorites-table tbody tr:nth-child(even) {
    background: rgba(70, 132, 192, .045);
}
html[data-theme="light"] .ac-favorites-table tbody tr:nth-child(odd) {
    background: #ffffff;
}
html[data-theme="light"] .ac-favorites-table tbody tr:nth-child(even) {
    background: #f4f8fb;
}
.ac-favorites-table tbody tr[data-network] > td {
    transition: background-color .15s ease;
}
.ac-favorites-table tbody tr[data-network]:hover > td {
    background: rgba(92,169,255,.08);
}
html[data-theme="light"] .ac-favorites-table tbody tr[data-network]:hover > td {
    background: #eef6ff;
}

.ac-favorite-row-edit { padding: 0; color: #75b5ff; background: transparent; border: 0; font-weight: 850; }
html[data-theme="light"] .ac-favorite-row-edit { color: #0d6fbd; }
.ac-favorite-network-badge,
.ac-small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 27px;
    padding: 0 8px;
    border: 1px solid var(--ac-border-strong);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}
.ac-favorite-network-badge.is-asl { color: #d6eaff; background: rgba(74,144,226,.15); border-color: rgba(92,169,255,.5); }
.ac-favorite-network-badge.is-echo { color: #f1ddff; background: rgba(152,86,219,.17); border-color: rgba(184,116,255,.52); }
html[data-theme="light"] .ac-favorite-network-badge.is-asl { color: #225d94; background: #eef6ff; border-color: #9ec4ea; }
html[data-theme="light"] .ac-favorite-network-badge.is-echo { color: #7c3696; background: #f7effd; border-color: #cda5e3; }
.ac-favorite-table-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.ac-small-button {
    color: var(--ac-text);
    background: #0b1729;
    border-radius: 6px;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

/* Load */
.ac-favorite-table-actions > a.ac-small-button {
    color: #d8ffe4;
    background: rgba(40, 167, 96, .16);
    border-color: #3f9b66;
}
.ac-favorite-table-actions > a.ac-small-button:hover,
.ac-favorite-table-actions > a.ac-small-button:focus-visible {
    color: #ffffff;
    background: #217d48;
    border-color: #65c989;
    outline: none;
}

/* Edit */
.ac-favorite-table-actions > button.ac-small-button:not(.is-danger) {
    color: #d9ecff;
    background: rgba(53, 130, 220, .18);
    border-color: #468bd1;
}
.ac-favorite-table-actions > button.ac-small-button:not(.is-danger):hover,
.ac-favorite-table-actions > button.ac-small-button:not(.is-danger):focus-visible {
    color: #ffffff;
    background: #216fae;
    border-color: #69aef0;
    outline: none;
}

/* Remove */
.ac-favorite-table-actions > .ac-small-button.is-danger {
    color: #ffd6d9;
    background: rgba(178, 53, 67, .16);
    border-color: #9f3540;
}
.ac-favorite-table-actions > .ac-small-button.is-danger:hover,
.ac-favorite-table-actions > .ac-small-button.is-danger:focus-visible {
    color: #ffffff;
    background: #9f3540;
    border-color: #dc6570;
    outline: none;
}

html[data-theme="light"] .ac-small-button {
    color: #173653;
    background: #edf5fb;
    border-color: #9fb5c9;
}
html[data-theme="light"] .ac-favorite-table-actions > a.ac-small-button {
    color: #176538;
    background: #edf9f1;
    border-color: #7fb991;
}
html[data-theme="light"] .ac-favorite-table-actions > a.ac-small-button:hover,
html[data-theme="light"] .ac-favorite-table-actions > a.ac-small-button:focus-visible {
    color: #104f2c;
    background: #d5efdf;
    border-color: #4d9c69;
}
html[data-theme="light"] .ac-favorite-table-actions > button.ac-small-button:not(.is-danger) {
    color: #155f9f;
    background: #edf6ff;
    border-color: #8ab8df;
}
html[data-theme="light"] .ac-favorite-table-actions > button.ac-small-button:not(.is-danger):hover,
html[data-theme="light"] .ac-favorite-table-actions > button.ac-small-button:not(.is-danger):focus-visible {
    color: #0c4f88;
    background: #d8ebfb;
    border-color: #5899cf;
}
html[data-theme="light"] .ac-favorite-table-actions > .ac-small-button.is-danger {
    color: #a51f2b;
    background: #fff0f1;
    border-color: #d6949a;
}
html[data-theme="light"] .ac-favorite-table-actions > .ac-small-button.is-danger:hover,
html[data-theme="light"] .ac-favorite-table-actions > .ac-small-button.is-danger:focus-visible {
    color: #861824;
    background: #ffe0e3;
    border-color: #c65f69;
}
.ac-favorite-page-form { display: grid; gap: 11px; padding: 14px; }
.ac-favorite-page-form label { display: grid; gap: 5px; color: var(--ac-text); font-size: 11px; font-weight: 800; }
.ac-favorite-page-form textarea { resize: vertical; min-height: 110px; }
@media (max-width: 980px) {
    .ac-favorites-main { width: calc(100% - 12px); }
}
@media (max-width: 620px) {
    .ac-favorites-toolbar { grid-template-columns: 1fr; }
    .ac-favorites-toolbar .ac-primary-button { width: 100%; }

    .ac-favorites-table-wrap {
        display: block;
        max-height: none;
        overflow: visible;
    }

    .ac-favorites-table,
    .ac-favorites-table tbody,
    .ac-favorites-table tr,
    .ac-favorites-table td {
        display: block;
        width: 100%;
    }

    .ac-favorites-table thead { display: none; }

    .ac-favorites-table tbody {
        max-height: min(760px, 62vh);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        scrollbar-width: thin;
        scrollbar-color: #3c5272 transparent;
    }

    html[data-theme="light"] .ac-favorites-table tbody {
        scrollbar-color: #93abc1 transparent;
    }

    .ac-favorites-table tbody::-webkit-scrollbar {
        width: 8px;
    }

    .ac-favorites-table tbody::-webkit-scrollbar-thumb {
        background: #3c5272;
        border-radius: 999px;
    }

    html[data-theme="light"] .ac-favorites-table tbody::-webkit-scrollbar-thumb {
        background: #93abc1;
    }

    .ac-favorites-table tr {
        padding: 10px;
    }

    .ac-favorites-table td {
        padding: 5px 0;
        border: 0;
    }
}

.ac-dashboard-favorite {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 18px 55px minmax(0,1fr) auto;
    gap: 6px;
    align-items: center;
    padding: 7px 4px;
    color: var(--ac-text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(59,82,116,.48);
    text-align: left;
}
.ac-dashboard-favorite:hover,
.ac-dashboard-favorite:focus-visible { background: rgba(92,169,255,.08); outline: 1px solid rgba(92,169,255,.34); }
.ac-dashboard-favorite-star { color: #ffd12f; font-size: 15px; }
.ac-dashboard-favorite strong { color: var(--ac-text); font-size: 10px; }
.ac-dashboard-favorite span:not(.ac-dashboard-favorite-star) { overflow: hidden; color: var(--ac-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ac-dashboard-favorite small { color: var(--ac-soft); font-size: 8px; }
html[data-theme="light"] .ac-dashboard-favorite { border-bottom-color: #d5e0ea; }
html[data-theme="light"] .ac-dashboard-favorite:hover,
html[data-theme="light"] .ac-dashboard-favorite:focus-visible { background: #eef6ff; }

/* Favorites Scan activity indication. Red means activity was detected
   recently by Stats and does not necessarily mean the node is keyed now. */
.ac-dashboard-favorite.activity-detected,
.ac-dashboard-favorite.activity-detected:hover,
.ac-dashboard-favorite.activity-detected:focus-visible {
    color: #ffffff;
    background: #c62828;
    border-bottom-color: #ef6a6a;
    outline-color: #ff8a8a;
}

.ac-dashboard-favorite.activity-detected strong,
.ac-dashboard-favorite.activity-detected span:not(.ac-dashboard-favorite-star),
.ac-dashboard-favorite.activity-detected small {
    color: #ffffff;
}

.ac-dashboard-favorite.activity-detected small {
    font-size: 7.5px;
}

html[data-theme="light"] .ac-dashboard-favorite.activity-detected,
html[data-theme="light"] .ac-dashboard-favorite.activity-detected:hover,
html[data-theme="light"] .ac-dashboard-favorite.activity-detected:focus-visible {
    background: #c62828;
}


/* Local-node details and automatic Favorite identity status. */
.ac-local-node-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    color: #ffffff;
    background: linear-gradient(180deg, #7938c8, #5c259e);
    border: 1px solid rgba(171, 91, 255, .82);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .01em;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
}
.ac-local-node-pill:hover {
    color: #ffffff;
    background: linear-gradient(180deg, #8a48d8, #6930ad);
    border-color: #c291ff;
}
.ac-local-node-pill.is-disabled { color: var(--ac-muted); border-color: var(--ac-border); background: var(--ac-panel-2); box-shadow: none; }
html[data-theme="light"] .ac-local-node-pill {
    color: #ffffff;
    background: linear-gradient(180deg, #2c88d7, #176db9);
    border-color: #1f76bd;
}
html[data-theme="light"] .ac-local-node-pill:hover {
    color: #ffffff;
    background: linear-gradient(180deg, #3896e3, #1f78c5);
    border-color: #155f9c;
}
#allstar-connect-favorite-helper.is-error { color: #ff9da7; }
html[data-theme="light"] #allstar-connect-favorite-helper.is-error { color: #a91f2d; }
@media (max-width: 780px) {
    .ac-direction-legend { flex-wrap: wrap; justify-content: flex-end; }
    .ac-connections-title-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .ac-connections-node-center {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
    }
}

/* Never label an unreported direction as outgoing. */
.ac-connection-dir.is-unknown { color: #98a6b8; font-size: 18px; }
html[data-theme="light"] .ac-connection-dir.is-unknown { color: #60758a; }

/* Favorite popup and focused right column */
.ac-favorite-modal-backdrop[hidden] { display: none !important; }
body.ac-modal-open { overflow: hidden; }
.ac-favorite-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(1, 5, 14, .76);
    backdrop-filter: blur(3px);
}
.ac-favorite-modal-card {
    position: relative;
    width: min(520px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 20px;
    color: var(--ac-text);
    background: linear-gradient(180deg, #111d31, #091426);
    border: 1px solid #6f3fc0;
    border-radius: 12px;
    box-shadow: 0 22px 65px rgba(0, 0, 0, .58), 0 0 0 1px rgba(151, 83, 225, .13);
}
.ac-favorite-modal-card h2 {
    margin: 0 40px 4px 0;
    color: #fff;
    font-size: 21px;
}
.ac-favorite-modal-help {
    min-height: 34px;
    margin: 0 36px 14px 0;
    color: #b9c9dd;
    font-size: 12px;
    line-height: 1.45;
}
.ac-favorite-modal-help.is-error { color: #ff9da7; }
.ac-favorite-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #dce7f4;
    background: #0b1729;
    border: 1px solid #395274;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
}
.ac-favorite-modal-close:hover,
.ac-favorite-modal-close:focus-visible { color: #fff; border-color: #9b61e5; background: #25123f; }
.ac-favorite-modal-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.ac-favorite-modal-summary label,
.ac-favorite-modal-card .ac-favorite-dialog label {
    display: grid;
    gap: 5px;
    color: #f2f6fb;
    font-size: 11px;
    font-weight: 800;
}
.ac-favorite-modal-card input,
.ac-favorite-modal-card textarea {
    width: 100%;
    min-width: 0;
    color: #f7f9fc;
    background: #091426;
    border: 1px solid #3b5272;
    border-radius: 7px;
}
.ac-favorite-modal-card input { min-height: 38px; padding: 7px 10px; }
.ac-favorite-modal-card textarea { min-height: 92px; padding: 9px 10px; resize: vertical; }
.ac-favorite-modal-card input[readonly] { color: #d9e4f2; background: #0c192c; }
.ac-favorite-modal-card .ac-favorite-dialog {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 10px;
    padding: 0;
    overflow: visible;
}
.ac-favorite-modal-card .ac-favorite-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}
.ac-favorite-modal-card .ac-favorite-dialog-actions button {
    width: 100%;
    min-height: 39px;
    margin: 0;
}
html[data-theme="light"] .ac-favorite-modal-backdrop { background: rgba(22, 39, 60, .48); }
html[data-theme="light"] .ac-favorite-modal-card {
    color: #102d48;
    background: #fff;
    border-color: #287dc3;
    box-shadow: 0 22px 60px rgba(21, 50, 78, .28);
}
html[data-theme="light"] .ac-favorite-modal-card h2,
html[data-theme="light"] .ac-favorite-modal-summary label,
html[data-theme="light"] .ac-favorite-modal-card .ac-favorite-dialog label { color: #102d48; }
html[data-theme="light"] .ac-favorite-modal-help { color: #3d5b75; }
html[data-theme="light"] .ac-favorite-modal-help.is-error { color: #a91f2d; }
html[data-theme="light"] .ac-favorite-modal-close { color: #173653; background: #edf5fb; border-color: #9fb5c9; }
html[data-theme="light"] .ac-favorite-modal-card input,
html[data-theme="light"] .ac-favorite-modal-card textarea { color: #102d48; background: #fff; border-color: #9fb5c9; }
html[data-theme="light"] .ac-favorite-modal-card input[readonly] { color: #24445f; background: #edf5fb; }

@media (min-width: 1181px) {
    .ac-right-column { display: block; }
    .ac-right-column .ac-details-card { min-height: 445px; height: 100%; }
}
@media (max-width: 560px) {
    .ac-favorite-modal-backdrop { padding: 8px; align-items: end; }
    .ac-favorite-modal-card { width: 100%; max-height: calc(100vh - 16px); padding: 16px 14px; border-radius: 12px 12px 8px 8px; }
    .ac-favorite-modal-summary { grid-template-columns: 1fr; gap: 8px; }
    .ac-favorite-modal-card .ac-favorite-dialog-actions { grid-template-columns: 1fr; }
}


/* Compact Node Details, visible Live Activity, and helper text. */
.ac-favorites-footer { grid-template-columns: 1fr; }

.ac-activity-card {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    height: 100%;
}
.allstar-connect-activity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 12px 7px;
    border-bottom: 1px solid rgba(55, 76, 106, .55);
}
.allstar-connect-activity-legend span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
}
.ac-activity-card > .allstar-connect-activity-list {
    min-height: 0;
    height: 100%;
    margin: 0 10px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid rgba(55, 76, 106, .55);
    border-radius: 7px;
    background: rgba(5, 13, 27, .32);
}
html[data-theme="light"] .ac-activity-card > .allstar-connect-activity-list {
    border-color: #c5d4e1;
    background: #f8fbfe;
}
.ac-activity-toggle {
    min-height: 32px;
    margin: 0 10px 9px;
    color: #d8e8fa;
    background: #0b1729;
    border: 1px solid #365172;
    border-radius: 6px;
    font-weight: 800;
}
html[data-theme="light"] .ac-activity-toggle {
    color: #0d5f9d;
    background: #edf5fb;
    border-color: #9fb5c9;
}

/* Node Details uses only the height its real content requires. */
.ac-details-card { height: auto; min-height: 0; align-self: start; }
.ac-detail-description { max-height: 52px; }

/* Bring all secondary copy up one readable contrast step. */
.ac-card-title-row p,
.ac-section-note,
.ac-empty-inline span,
.ac-action-legend,
.ac-downstream-note,
.ac-downstream-footer,
.ac-detail-list dt,
.ac-detail-description,
.allstar-connect-activity-main span,
.allstar-connect-floating-window-heading span,
.allstar-connect-floating-window-hint,
.ac-control-status,
.ac-dashboard-favorite span:not(.ac-dashboard-favorite-star),
.ac-dashboard-favorite small {
    font-weight: 560;
}
.ac-card-title-row p,
.ac-section-note { font-size: 12px; }
.ac-control-status,
.ac-downstream-footer,
.ac-dashboard-favorite small { font-size: 10px; }
html[data-theme="dark"] .ac-card-title-row p,
html[data-theme="dark"] .ac-section-note,
html[data-theme="dark"] .ac-empty-inline span,
html[data-theme="dark"] .ac-action-legend,
html[data-theme="dark"] .ac-downstream-note,
html[data-theme="dark"] .ac-downstream-footer,
html[data-theme="dark"] .ac-detail-list dt,
html[data-theme="dark"] .ac-detail-description,
html[data-theme="dark"] .allstar-connect-activity-main span,
html[data-theme="dark"] .ac-control-status:not(.is-error) { color: #d5ddea; }
html[data-theme="light"] .ac-card-title-row p,
html[data-theme="light"] .ac-section-note,
html[data-theme="light"] .ac-empty-inline span,
html[data-theme="light"] .ac-action-legend,
html[data-theme="light"] .ac-downstream-note,
html[data-theme="light"] .ac-downstream-footer,
html[data-theme="light"] .ac-detail-list dt,
html[data-theme="light"] .ac-detail-description,
html[data-theme="light"] .allstar-connect-activity-main span,
html[data-theme="light"] .ac-control-status { color: #2f4e68; }

@media (min-width: 1181px) {
    .ac-right-column {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 10px;
    }
    .ac-right-column .ac-details-card {
        min-height: 0;
        height: auto;
    }
}
@media (max-width: 1120px) and (min-width: 821px) {
    .ac-right-column { align-items: start; }
    .ac-activity-card { min-height: 360px; }
}
@media (max-width: 820px) {
    .ac-activity-card { min-height: 360px; }
}

/* Desktop expand controls for live panels */
.ac-panel-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 27px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(216, 108, 242, 0.16);
    border: 1px solid rgba(240, 156, 255, 0.72);
    border-radius: 999px;
    font: inherit;
    font-size: 0.67rem;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.ac-panel-expand > span {
    font-size: 0.92rem;
    line-height: 1;
}
.ac-panel-expand:hover,
.ac-panel-expand:focus-visible,
.ac-panel-expand.is-active {
    color: #ffffff;
    background: rgba(216, 108, 242, 0.29);
    border-color: #f0a0ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(240, 156, 255, 0.18);
}
html[data-theme="light"] .ac-panel-expand {
    color: #5a187d;
    background: #f8e9ff;
    border-color: #bf76d8;
}
html[data-theme="light"] .ac-panel-expand:hover,
html[data-theme="light"] .ac-panel-expand:focus-visible,
html[data-theme="light"] .ac-panel-expand.is-active {
    color: #44105f;
    background: #efd5f8;
    border-color: #9e4fbb;
    box-shadow: 0 0 0 2px rgba(158, 79, 187, 0.16);
}

/* Keep the local-node Stats pill visually secondary to the panel title. */
.ac-local-node-pill {
    min-height: 24px;
    padding: 0 8px;
    font-size: 9px;
    font-weight: 820;
}

/* View-only users may see Favorite status, but not an editing action. */
.ac-favorite-detail[hidden] { display: none !important; }

@media (max-width: 820px) {
    .ac-panel-expand {
        display: none !important;
    }
}


/* Centered Favorites management and sortable headings */
.ac-favorites-footer .ac-view-all.ac-manage-favorites {
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: #ffe39a;
    background: rgba(255, 193, 61, .035);
    border: 1px solid #a77b22;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 850;
    text-align: center;
}
.ac-favorites-footer .ac-view-all.ac-manage-favorites:hover,
.ac-favorites-footer .ac-view-all.ac-manage-favorites:focus-visible {
    color: #fff2c7;
    background: rgba(255, 193, 61, .11);
    border-color: #d4a13a;
}
html[data-theme="light"] .ac-favorites-footer .ac-view-all.ac-manage-favorites {
    color: #765000;
    background: #fff9e9;
    border-color: #b9871d;
}
html[data-theme="light"] .ac-favorites-footer .ac-view-all.ac-manage-favorites:hover,
html[data-theme="light"] .ac-favorites-footer .ac-view-all.ac-manage-favorites:focus-visible {
    color: #5f3f00;
    background: #fff2c8;
    border-color: #8f6508;
}
.ac-favorites-sort-button {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    padding: 1px 0 !important;
    color: inherit;
    cursor: pointer;
}
.ac-favorites-sort-button:hover { color: #d9ecff; }
.ac-favorites-sort-button:focus-visible {
    outline: 2px solid #8f58e8;
    outline-offset: 3px;
    border-radius: 3px;
}
.ac-sort-indicator {
    display: inline-flex;
    min-width: 12px;
    align-items: center;
    justify-content: center;
    color: #c9a7f4;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}
html[data-theme="light"] .ac-favorites-sort-button:hover { color: #0b5e9c; }
html[data-theme="light"] .ac-sort-indicator { color: #6f3aa7; }
.ac-actions-heading { white-space: nowrap; }


.ac-favorite-page-modal-form {
    padding: 0;
}
.ac-favorite-page-modal-form .ac-favorite-modal-summary {
    margin-bottom: 10px;
}
.ac-favorite-page-modal-form .ac-control-status {
    margin-top: 0;
}

/* Fixed sortable dashboard Favorites header. */
.ac-dashboard-favorites-head {
    display: grid;
    grid-template-columns: 18px 55px minmax(0, 1fr) 68px;
    gap: 6px;
    align-items: center;
    margin-top: 7px;
    padding: 0 4px 5px;
    border-bottom: 1px solid rgba(59,82,116,.72);
}
.ac-dashboard-favorites-head-spacer {
    display: block;
}
.ac-dashboard-favorites-sort {
    min-width: 0;
    display: inline-flex;
    gap: 3px;
    align-items: center;
    justify-content: flex-start;
    padding: 2px 0;
    color: var(--ac-muted);
    background: transparent;
    border: 0;
    font-size: 9px;
    font-weight: 850;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
}
.ac-dashboard-favorites-sort:hover,
.ac-dashboard-favorites-sort:focus-visible,
.ac-dashboard-favorites-sort.is-active {
    color: var(--ac-text);
}
.ac-dashboard-favorites-sort:focus-visible {
    outline: 1px solid rgba(92,169,255,.55);
    outline-offset: 2px;
}
.ac-dashboard-favorites-sort:last-child {
    justify-content: flex-end;
    text-align: right;
}
.ac-dashboard-favorites-sort-indicator {
    color: var(--ac-soft);
    font-size: 8px;
}
.ac-dashboard-favorites-sort.is-active .ac-dashboard-favorites-sort-indicator {
    color: #75b5ff;
}
html[data-theme="light"] .ac-dashboard-favorites-head {
    border-bottom-color: #c7d5e2;
}
html[data-theme="light"] .ac-dashboard-favorites-sort.is-active .ac-dashboard-favorites-sort-indicator {
    color: #0d6fbd;
}

@media (min-width: 761px) {
    .ac-favorites-section {
        grid-template-rows: auto auto minmax(0,1fr) auto;
    }
    .ac-favorites-list {
        margin-top: 0;
    }
    .ac-dashboard-favorite {
        grid-template-columns: 18px 55px minmax(0,1fr) 68px;
    }
    .ac-dashboard-favorite small {
        text-align: right;
    }
}

@media (max-width: 760px) {
    .ac-dashboard-favorites-head {
        display: none;
    }
}

/* Mobile bounded Current Connections and Downstream panels. */
@media (max-width: 820px) {
    /*
     * The desktop table heading is hidden on mobile, so Current Connections
     * needs three grid tracks rather than the desktop four-track structure.
     * About four mobile rows remain visible; additional rows scroll.
     */
    .ac-connections-card {
        min-height: 0;
        grid-template-rows: auto minmax(0, 320px) auto;
    }

    .allstar-connect-connection-list {
        min-height: 0;
        height: auto;
        max-height: 320px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /*
     * Explicitly place the mobile connection cells. Without fixed grid rows,
     * the action strip can occupy the main row and leave only the far-left
     * direction arrow as a dependable selection target.
     */
    .allstar-connect-connection-row {
        grid-template-rows: auto auto;
    }

    .allstar-connect-connection-row .ac-connection-dir {
        grid-column: 1;
        grid-row: 1 / 3;
        align-self: stretch;
        display: grid;
        place-items: center;
    }

    .allstar-connect-connection-row .ac-connection-node {
        grid-column: 2;
        grid-row: 1;
    }

    .allstar-connect-connection-row .ac-connection-mode {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }

    .allstar-connect-connection-row .ac-row-actions {
        grid-column: 2 / 4;
        grid-row: 2;
    }

    /*
     * Keep the normal Downstream dashboard preview bounded. The expanded
     * desktop window remains unaffected.
     */
    .ac-downstream-card {
        min-height: 0;
        grid-template-rows: auto auto auto minmax(0, 240px) auto;
    }

    .allstar-connect-downstream-list {
        min-height: 0;
        height: auto;
        max-height: 240px;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* Fixed dashboard Downstream root and compact mobile header. */

/*
 * The normal dashboard displays one selected direct branch. Keep that direct
 * root stationary while only its children scroll beneath it. The desktop
 * expanded window remains the complete independently scrolling tree.
 */
#allstar-connect-downstream {
    min-height: 0;
    overflow: hidden !important;
}

#allstar-connect-downstream > .ac-ds-group {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
    margin-bottom: 0;
}

#allstar-connect-downstream > .ac-ds-group > .ac-ds-children {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

/*
 * Preserve the complete product name on a cellphone. The blue account-circle
 * icon is decorative; Login/Logout and the light/dark switch remain visible.
 */
@media (max-width: 820px) {
    .ac-header {
        gap: 8px;
    }

    .ac-brand {
        gap: 6px;
    }

    .ac-brand-name {
        overflow: visible;
        font-size: 18px;
        text-overflow: clip;
    }

    .ac-header-tools {
        gap: 6px;
    }

    .ac-user-icon {
        display: none !important;
    }

    .ac-auth {
        gap: 0;
    }

    #allstar-connect-downstream {
        height: 240px;
        max-height: 240px;
    }
}

@media (max-width: 390px) {
    .ac-brand-logo {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .ac-brand-name {
        font-size: 17px;
    }

    .ac-auth-button {
        padding-inline: 9px;
    }
}

/* Cellphone-only Downstream sheet; desktop floating windows are unchanged. */
.ac-mobile-downstream-open,
.ac-mobile-downstream-sheet {
    display: none;
}

.ac-mobile-downstream-sheet[hidden] {
    display: none !important;
}

@media (max-width: 820px) {
    body.ac-mobile-downstream-sheet-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    .ac-mobile-downstream-open {
        display: inline-flex;
        width: 100%;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        padding: 0 12px;
        color: #ffffff;
        background: rgba(105, 64, 190, .32);
        border: 1px solid rgba(164, 122, 232, .82);
        border-radius: 7px;
        font: inherit;
        font-size: 11px;
        font-weight: 850;
        cursor: pointer;
    }

    html[data-theme="light"] .ac-mobile-downstream-open {
        color: #4a196a;
        background: #f4e8fb;
        border-color: #ad6cc5;
    }

    .ac-mobile-downstream-sheet {
        position: fixed;
        z-index: 10000;
        inset: 0;
        display: grid;
        grid-template-rows: auto auto auto minmax(0, 1fr);
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
        padding:
            max(8px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
        overflow: hidden;
        color: var(--ac-text);
        background: var(--ac-bg);
        box-sizing: border-box;
    }

    .ac-mobile-downstream-sheet-header {
        display: flex;
        min-width: 0;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 7px 8px 9px;
        border-bottom: 1px solid var(--ac-border);
    }

    .ac-mobile-downstream-sheet-header > div {
        display: grid;
        min-width: 0;
        gap: 2px;
    }

    .ac-mobile-downstream-sheet-header strong {
        font-size: 18px;
        line-height: 1.15;
    }

    .ac-mobile-downstream-sheet-header span {
        color: var(--ac-muted);
        font-size: 11px;
    }

    .ac-mobile-downstream-close {
        flex: 0 0 42px;
        width: 42px;
        min-width: 42px;
        height: 42px;
        padding: 0;
        color: var(--ac-text);
        background: transparent;
        border: 1px solid var(--ac-border);
        border-radius: 7px;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
    }

    .ac-mobile-downstream-sheet-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(110px, .72fr);
        gap: 7px;
        padding: 8px 8px 6px;
    }

    .ac-mobile-downstream-sheet-controls .ac-compact-field {
        grid-template-columns: auto minmax(0, 1fr);
        min-width: 0;
    }

    .ac-mobile-downstream-sheet-controls select,
    .ac-mobile-downstream-sheet-controls input {
        width: 100%;
        min-width: 0;
        min-height: 36px;
    }

    .ac-mobile-downstream-sheet-filters {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 5px;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 8px 7px;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .ac-mobile-downstream-sheet-filters .allstar-connect-downstream-filter {
        flex: 0 0 auto;
    }

    .ac-mobile-downstream-sheet-list {
        display: block;
        min-width: 0;
        min-height: 0;
        width: auto;
        height: auto;
        max-height: none;
        margin: 0 8px 8px;
        padding: 8px !important;
        overflow: hidden !important;
    }

    .ac-mobile-downstream-sheet-list > .ac-ds-group {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 0;
        height: 100%;
        margin-bottom: 0;
    }

    .ac-mobile-downstream-sheet-list
    > .ac-ds-group
    > .ac-ds-children {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
        -webkit-overflow-scrolling: touch;
    }
}

/* DTMF Favorites: compact desktop control and first-class cellphone layout. */
.ac-dtmf-control .ac-dtmf-favorites-button {
    min-width: 0;
    padding: 0 6px;
    white-space: nowrap;
    font-size: 9px;
    color: #ecdfff;
    background: linear-gradient(180deg, #24163a, #160d27);
    border-color: #68439b;
}
.ac-dtmf-control .ac-dtmf-favorites-button:hover,
.ac-dtmf-control .ac-dtmf-favorites-button:focus-visible {
    color: #fff;
    border-color: #a26ee1;
    background: linear-gradient(180deg, #342052, #201139);
}
html[data-theme="light"] .ac-dtmf-control .ac-dtmf-favorites-button {
    color: #1e65a0;
    background: #edf5fb;
    border-color: #8fb5d4;
}
html[data-theme="light"] .ac-dtmf-control .ac-dtmf-favorites-button:hover,
html[data-theme="light"] .ac-dtmf-control .ac-dtmf-favorites-button:focus-visible {
    color: #0d538d;
    background: #deeffc;
    border-color: #4d94ca;
}

.ac-dtmf-favorites-card { width: min(560px, calc(100vw - 28px)); }

.ac-dtmf-favorites-list {
    display: grid;
    gap: 7px;
    max-height: 270px;
    margin: 0 0 14px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid #2c4263;
    border-radius: 8px;
    background: rgba(4, 11, 23, .45);
}
html[data-theme="light"] .ac-dtmf-favorites-list {
    border-color: #bfd0df;
    background: #f5f9fc;
}

.ac-dtmf-favorites-empty {
    display: grid;
    gap: 3px;
    padding: 18px 12px;
    text-align: center;
    color: var(--ac-muted);
}
.ac-dtmf-favorites-empty strong { color: var(--ac-text); font-size: 12px; }
.ac-dtmf-favorites-empty span { font-size: 11px; }

.ac-dtmf-favorite-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto auto;
    gap: 6px;
    align-items: stretch;
}

.ac-dtmf-favorite-info {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    min-height: 38px;
    padding: 6px 9px;
    color: var(--ac-text);
    background: #0b1729;
    border: 1px solid #334b6c;
    border-radius: 7px;
}
.ac-dtmf-favorite-info strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}
.ac-dtmf-favorite-info span {
    color: #ddbaff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 800;
}
html[data-theme="light"] .ac-dtmf-favorite-info {
    color: #173653;
    background: #fff;
    border-color: #aebfd1;
}
html[data-theme="light"] .ac-dtmf-favorite-info span { color: #176fb9; }

.ac-dtmf-favorite-row-action {
    min-width: 54px;
    padding: 0 8px;
    color: #d9e6f4;
    background: #0b1729;
    border: 1px solid #365172;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 800;
}
.ac-dtmf-favorite-row-action.is-load {
    color: #fff;
    background: linear-gradient(180deg,#6f35cb,#5224a4);
    border-color: #7a46d5;
}
.ac-dtmf-favorite-row-action.is-danger {
    color: #ffd6d9;
    border-color: #8d3943;
}
html[data-theme="light"] .ac-dtmf-favorite-row-action {
    color: #175b90;
    background: #edf5fb;
    border-color: #9fb5c9;
}
html[data-theme="light"] .ac-dtmf-favorite-row-action.is-load {
    color: #fff;
    background: linear-gradient(180deg,#2c88d7,#176db9);
    border-color: #1f76bd;
}
html[data-theme="light"] .ac-dtmf-favorite-row-action.is-danger {
    color: #a51f2b;
    background: #fff0f1;
    border-color: #d6949a;
}

.ac-dtmf-favorite-editor {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #304562;
}
html[data-theme="light"] .ac-dtmf-favorite-editor { border-top-color: #c7d5e2; }

.ac-dtmf-favorite-fields {
    display: grid;
    grid-template-columns: minmax(0,1fr) 150px;
    gap: 10px;
}
.ac-dtmf-favorite-fields label {
    display: grid;
    gap: 5px;
    color: #f2f6fb;
    font-size: 11px;
    font-weight: 800;
}
html[data-theme="light"] .ac-dtmf-favorite-fields label { color: #102d48; }

@media (max-width: 760px) {
    .ac-dtmf-control {
        grid-template-columns: auto minmax(0,1fr) 68px;
        align-items: center;
    }
    .ac-dtmf-control label {
        grid-column: 1;
        grid-row: 1;
    }
    .ac-dtmf-control input {
        grid-column: 2 / 4;
        grid-row: 1;
    }
    .ac-dtmf-control .ac-dtmf-favorites-button {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        min-width: 0;
    }
    .ac-dtmf-control #send-dtmf-button {
        grid-column: 3;
        grid-row: 2;
        width: 100%;
    }

    .ac-dtmf-favorite-row {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
    .ac-dtmf-favorite-info {
        grid-column: 1 / -1;
    }
    .ac-dtmf-favorite-row-action {
        width: 100%;
        min-height: 34px;
    }
    .ac-dtmf-favorite-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .ac-dtmf-favorites-card { padding-inline: 12px; }
    .ac-dtmf-favorite-row {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
    .ac-dtmf-favorite-info {
        grid-column: 1 / -1;
    }
    .ac-dtmf-favorite-row-action {
        min-width: 0;
        min-height: 32px;
        padding-inline: 4px;
    }
}


@media (max-width: 820px) {
    .ac-downstream-card > .ac-card-title-row {
        flex-wrap: wrap;
    }

    .ac-downstream-title-actions {
        width: 100%;
        margin-left: 0;
    }

    .ac-scan-mode {
        width: 100%;
    }

    .ac-scan-mode-button {
        flex: 1 1 50%;
    }
}

/* Favorites Scan: underline the node most recently checked. */
.ac-dashboard-favorite.is-scanning > strong {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}
