/* =====================================================================
   Edge HQ composition layer.

   Loaded after the verbatim ECU portal style.css. Everything here uses the
   portal's tokens and components; it only composes HQ-specific layouts
   (page header, project toolbar, tiles, workspace header, phone table cards).
   The portal snapshot itself is never edited.
   ===================================================================== */

/* Layout guard: allow the content column to shrink so wide tables scroll
   inside their card instead of widening the whole page. */
.main-content, .content-area { min-width: 0; }
.content-area { max-width: 100%; }
#projects-results, #deployments-results, #activity-results, #models-results { min-width: 0; }
#deployments-results .table-responsive { max-width: 100%; }

/* The portal's second body.standalone rule resolves var(--bg), which is the
   light wash in light theme. HQ keeps the reviewed auth treatment: a dark
   backdrop with a light card in either theme. */
body.standalone {
    background:
        radial-gradient(ellipse at 18% 0%, rgba(17,86,253,.18) 0%, transparent 55%),
        radial-gradient(ellipse at 82% 100%, rgba(17,86,253,.12) 0%, transparent 50%),
        #0b1524;
}

.hq-login-brand {
    margin: 10px 0 2px;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

/* The portal brand rail fits "Edge" + version + close; "Edge HQ" + Cloud needs
   the close button pinned right and the version dropped in the narrow phone
   drawer so the wordmark never wraps. */
.brand-text { white-space: nowrap; }
.sidebar-brand .nav-close { margin-left: auto; }

/* Sidebar footer role line (the portal shows name + logout only). */
.user-role {
    font-size: .6875rem;
    font-weight: 500;
    line-height: 1.2;
    margin-top: 1px;
    color: rgba(255, 255, 255, .55);
}

.user-name,
.user-email {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-email {
    font-size: .65rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, .42);
}

/* - Page header - */
.hq-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.hq-page-head-text { min-width: 0; }

.hq-page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
    color: var(--text);
}

.hq-page-desc {
    margin: 2px 0 0;
    font-size: .8125rem;
    color: var(--text-muted);
}

.hq-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* - Projects toolbar - */
.hq-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.hq-list-search { flex: 1 1 260px; max-width: 340px; }
.hq-sort { width: 200px; flex: 0 0 auto; }

/* Every list toolbar shares one control rhythm: search + filters on the left,
   options (sort / project) and the view toggle grouped on the right. */
.hq-list-toolbar .form-select { width: 200px; flex: 0 0 auto; }
.hq-list-toolbar .seg { height: 38px; align-items: center; }

.hq-toolbar-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Disabled row actions stay visible (with their reason tooltip) but read as
   unavailable — e.g. self / built-in / last-admin user rows. */
.icon-btn:disabled,
.icon-btn[aria-disabled="true"] {
    opacity: .35;
    cursor: not-allowed;
}
.icon-btn:disabled:hover,
.icon-btn[aria-disabled="true"]:hover {
    background: transparent;
    color: var(--text-muted);
}

.hq-view-toggle { height: 38px; align-items: center; }
.hq-view-toggle .seg-btn { height: 30px; padding: 0 10px; }
.hq-view-toggle .seg-btn .icon { width: 15px; height: 15px; }

/* - Project tiles - */
.hq-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.hq-project-tile {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hq-project-tile .card-body { padding: 16px 18px 14px; }

.hq-tile-name {
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.hq-tile-name a { color: var(--text); }
.hq-tile-name a:hover { color: var(--accent); }

.hq-tile-site {
    margin-top: 2px;
    font-size: .75rem;
    color: var(--text-muted);
}

.hq-tile-customer {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-size: .8125rem;
    color: var(--text-secondary);
    min-width: 0;
}

.hq-tile-customer .icon { width: 13px; height: 13px; color: var(--text-muted); }

.hq-tile-stats {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 7px;
    font-size: .75rem;
    color: var(--text-muted);
}

.hq-tile-stats .icon { width: 12px; height: 12px; }
.hq-tile-dot { color: var(--border); }

.hq-tile-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 10px 18px;
    border-top: 1px solid var(--border-light);
}

/* - Table / pager - */
.hq-project-link {
    color: var(--text);
    font-weight: 600;
}

.hq-project-link:hover { color: var(--accent); }

.hq-table-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
}

/* - Empty states - */
.hq-empty { padding: 28px 0; }
.hq-empty-hint { font-size: .75rem; color: var(--text-muted); }

/* - Project workspace - */
.hq-project-identity { min-width: 0; flex: 1 1 auto; }

.hq-project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.hq-project-desc {
    margin: 8px 0 0;
    max-width: 72ch;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hq-profile-deployed {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: .75rem;
    color: var(--text-muted);
}
.hq-profile-deployed .icon { width: 13px; height: 13px; }

.hq-tile-desc {
    margin-top: 6px;
    font-size: .75rem;
    line-height: 1.4;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hq-project-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
    color: var(--text);
}

.hq-project-meta {
    margin-top: 3px;
    font-size: .75rem;
    color: var(--text-muted);
}

.hq-meta-sep { color: var(--border); }

.hq-project-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.hq-project-desc {
    margin: 12px 0 0;
    max-width: 760px;
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-line;
}

.hq-section-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
}

/* - Account / password form - */
.hq-narrow-card { max-width: 640px; }

.hq-pw-rules {
    list-style: none;
    padding-left: 0 !important;
}

/* - Phone composition - */
@media (max-width: 1100px) {
    .hq-tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
    .sidebar-brand { gap: 10px; padding: 18px 16px; }
    .sidebar-brand .brand-version { display: none; }

    /* The topbar title owns the page title on phones; hide the in-content
       duplicate (and its description) instead of truncating two copies. */
    .hq-page-head-text { display: none; }
    .hq-page-actions { width: 100%; margin-left: 0; }
    .hq-page-actions .btn { width: 100%; }

    /* Phones keep one layout: the table becomes labelled cards and the tiles
       already are cards. The desktop-only mode switch is hidden. */
    .hq-view-toggle { display: none !important; }

    .hq-list-search { flex: 1 1 100%; max-width: none; }
    .hq-sort { width: 100%; }
    .hq-list-toolbar .form-select { width: 100%; }
    .hq-toolbar-end { width: 100%; margin-left: 0; }
    .hq-toolbar-end .form-select { flex: 1 1 100%; }
    .hq-table-foot { padding: 12px 16px; }

    /* Projects table - labelled cards (portal table-card pattern). */
    #projects-results .table-responsive { overflow-x: visible; }
    #projects-results .table,
    #projects-results .table tbody,
    #projects-results .table tr,
    #projects-results .table td { display: block; width: auto; }
    #projects-results .table thead { display: none; }
    #projects-results .table tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    #projects-results .table tbody tr:last-child { margin-bottom: 0; }
    #projects-results .table td {
        border: none;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #projects-results .table td[data-label="Project"] {
        font-size: .8125rem;
        font-weight: 600;
        padding-bottom: 6px;
    }
    #projects-results .table td[data-label="Project"] .hq-project-link { font-size: .9375rem; }
    #projects-results .table td:not([data-label="Project"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: minmax(104px, 36%) 1fr;
        gap: 10px;
        align-items: start;
    }
    #projects-results .table td:not([data-label="Project"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 3px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
        white-space: normal;
    }
    #projects-results .table td.col-num { text-align: left; }
    #projects-results .table td[data-label="Actions"] {
        padding-top: 8px;
        text-align: left;
    }
}

@media (max-width: 700px) {
    .hq-tile-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   M2 - Edge profiles, workspace lists and the profile editor.
   ===================================================================== */

.hq-project-head .hq-project-identity { min-width: 0; }

.hq-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.hq-profile-tile { display: flex; flex-direction: column; min-width: 0; }
.hq-profile-tile .card-body { padding: 12px 18px 8px; }
.hq-profile-name {
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}
.hq-profile-name:hover { color: var(--accent); }
.hq-profile-tile .net-card-head { padding: 13px 18px; gap: 8px; }
.hq-profile-tile .net-card-head .state-chip { margin-left: auto; }
.hq-profile-foot { padding: 10px 18px; }
.hq-profile-foot .net-foot-note { font-size: .75rem; }

.hq-kv {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: .8125rem;
}
.hq-kv:last-child { border-bottom: none; }
.hq-kv .k { color: var(--text-muted); flex-shrink: 0; }
.hq-kv .v {
    min-width: 0;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.hq-status { white-space: nowrap; }
.hq-status.neutral { background: var(--surface-alt); border-color: var(--border); color: var(--text-secondary); }

/* Kebab menus */
.hq-menu { position: relative; display: inline-flex; }
.hq-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    z-index: 30;
    min-width: 150px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg, 0 14px 30px rgba(15,23,42,.16));
}
/* While open, JS lifts the menu into the viewport so scroll containers
   (table cards, drawers, dialogs) cannot clip it. top/left are set inline
   from the toggle's bounding box; right alignment is preserved there. */
.hq-menu-pop.hq-menu-pop--floating {
    position: fixed;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
}
.hq-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: .8125rem;
    text-align: left;
    cursor: pointer;
}
.hq-menu-item:hover, .hq-menu-item:focus-visible { background: var(--surface-alt); color: var(--text); }
.hq-menu-item .icon { width: 15px; height: 15px; }

/* Editor */
.hq-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.hq-editor-identity { min-width: 0; }
.hq-editor-actions { flex-shrink: 0; }
.hq-editor-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.hq-editor-tabs .nav-link { white-space: nowrap; }
.hq-editor-tabs .tab-dirty-dot { margin-left: 7px; }
.hq-editor-form { min-width: 0; }
.hq-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.hq-pane { border: 0; padding: 0; margin: 0; min-width: 0; }
.hq-pane[hidden] { display: none !important; }

.hq-prefix { flex: 0 0 240px; width: 240px; }
.hq-half-field { max-width: calc(50% - 6px); }
.hq-poll-field { max-width: 150px; }
.hq-save-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}
.hq-save-bar .integration-action-bar { margin-top: 0; }

.hq-error-list {
    margin: 6px 0 0;
    padding-left: 1.1rem;
    font-size: .75rem;
}
.hq-error-list li { margin-bottom: 2px; }

.hq-inline-link {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Validation report */
.hq-check-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.hq-check-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: .8125rem;
}
.hq-check-list li:last-child { border-bottom: none; }
.hq-check-icon { display: inline-flex; padding-top: 1px; }
.hq-check-icon .icon { width: 16px; height: 16px; }
.hq-check-list .ok .hq-check-icon { color: var(--success); }
.hq-check-list .fail .hq-check-icon { color: var(--danger); }
.hq-check-label { font-weight: 600; color: var(--text); }
.hq-check-detail { color: var(--text-muted); font-size: .75rem; margin-top: 1px; }

/* Onboarding */
.hq-ob-actions { }
.hq-ob-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hq-ob-table thead th { white-space: normal; }
.hq-ob-table td { vertical-align: middle; }
.hq-ob-empty { padding: 18px 0; }
.hq-ob-empty .icon { width: 22px; height: 22px; }

.hq-stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.hq-stat-row > div {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}
.hq-stat-value { display: block; font-size: 1.125rem; font-weight: 700; line-height: 1.2; }
.hq-stat-label { display: block; font-size: .6875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.hq-code-block {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .6875rem;
    overflow-wrap: anywhere;
}
.hq-key-pem {
    margin: 0;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.55;
}
.hq-key-value { overflow-wrap: anywhere; }

/* Credential library */
.hq-credential-list { list-style: none; margin: 0; padding: 0; }
.hq-credential-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}
.hq-credential-item:last-child { border-bottom: none; }
.hq-credential-main { min-width: 0; flex: 1 1 auto; }
.hq-credential-name { font-size: .8125rem; font-weight: 600; color: var(--text); }
.hq-credential-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 4px;
    font-size: .6875rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.hq-empty-compact { padding: 14px 0; }
.hq-empty-compact .icon { width: 22px; height: 22px; }

/* Profile table */
.hq-profiles-table td, .hq-profiles-table th { vertical-align: middle; }
.hq-profiles-table td .hq-project-link { font-weight: 600; }

@media (max-width: 1100px) {
    .hq-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
    .hq-profile-grid { grid-template-columns: 1fr; }
    .hq-project-head .hq-new-profile { width: 100%; margin-left: 0 !important; }
    .hq-editor-head { gap: 10px; }
    .hq-editor-actions { width: 100%; justify-content: flex-start; }
    .hq-prefix { flex: 1 1 100%; width: auto; }
    .hq-half-field { max-width: none; }
    .hq-save-bar { align-items: stretch; }
    .hq-save-bar > div.ms-auto { width: 100%; }
    .hq-save-bar > div.ms-auto .btn { flex: 1 1 auto; }
    /* The onboarding form is not inside a padded card body, so the generic
       full-bleed -16px save-bar margins would push it past the viewport. */
    #onboarding-form > .hq-save-bar { margin-left: 0; margin-right: 0; margin-bottom: 0; }
    .hq-ob-actions { width: 100%; margin-left: 0 !important; justify-content: flex-start; }
    .hq-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .hq-profiles-table, .hq-profiles-table tbody,
    .hq-profiles-table tr, .hq-profiles-table td { display: block; width: auto; }
    .hq-profiles-table thead { display: none; }
    .hq-profiles-table tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .hq-profiles-table tbody tr:last-child { margin-bottom: 0; }
    .hq-profiles-table td {
        border: none;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .hq-profiles-table td[data-label="Profile"] { font-size: .9375rem; padding-bottom: 5px; }
    .hq-profiles-table td:not([data-label="Profile"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: minmax(104px, 38%) 1fr;
        gap: 10px;
        align-items: start;
    }
    .hq-profiles-table td:not([data-label="Profile"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 3px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
    }
    .hq-profiles-table td[data-label="Actions"] { padding-top: 8px; }
    .hq-profiles-table td[data-label="Actions"] .btn { min-height: 32px; }

    #onboarding-form .hq-ob-table-wrap { border: 0; }
    #onboarding-form .hq-ob-table, #onboarding-form .hq-ob-table tbody { display: block; width: auto; }
    #onboarding-form .hq-ob-table thead { display: none; }
    #onboarding-form .hq-ob-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 9px 12px;
        margin-bottom: 10px;
    }
    #onboarding-form .hq-ob-table tbody tr:last-child { margin-bottom: 0; }
    #onboarding-form .hq-ob-table td {
        display: grid;
        grid-template-columns: minmax(104px, 38%) 1fr;
        gap: 10px;
        border: 0;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #onboarding-form .hq-ob-table td::before {
        content: attr(data-label);
        padding-top: 2px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
    }
    #onboarding-form .hq-ob-table td[colspan] { display: block; }
    #onboarding-form .hq-ob-table td[colspan]::before { content: none; }
    #onboarding-form .hq-ob-table td[data-label="Row actions"] { display: flex; justify-content: flex-end; padding-top: 6px; }
    #onboarding-form .hq-ob-table td[data-label="Row actions"]::before { content: none; }
}

@media (max-width: 640px) {
    .field-row { flex-wrap: wrap; row-gap: 12px; }
    .field-row > * { flex: 1 1 100%; width: auto; min-width: 0; }
    .hq-prefix { width: auto; }
}

.hq-profiles-table-wrap { overflow: visible; }
@media (max-width: 991.98px) {
    .hq-profiles-table-wrap { overflow-x: auto; }
}

@media (max-width: 767.98px) {
    .hq-profiles-table-wrap { overflow: visible; }
}

/* Portal card-head rule gives a lone button margin-left:auto; the onboarding
   header has a deliberate action group instead. */
.net-card-head .hq-ob-actions .btn { margin-left: 0; }

.hq-profiles-table { table-layout: fixed; }
.hq-profiles-table th, .hq-profiles-table td {
    padding-left: 10px;
    padding-right: 10px;
    overflow-wrap: anywhere;
}
.hq-profiles-table td.col-actions, .hq-profiles-table th.col-actions { padding-right: 12px; }

.hq-kv-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 0;
}
.hq-kv-detail {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .6875rem;
    font-weight: 400;
    color: var(--text-muted);
}

.hq-ob-table { table-layout: fixed; }
.hq-ob-table th, .hq-ob-table td { padding-left: 8px; padding-right: 8px; }
.hq-ob-table th { overflow-wrap: normal; word-break: normal; }
.hq-ob-table td { overflow-wrap: anywhere; }
.hq-ob-table td.col-actions, .hq-ob-table th.col-actions { padding-right: 10px; }

#integration-validation { scroll-margin-top: 80px; scroll-margin-bottom: 110px; }

.hq-profiles-table thead th { white-space: nowrap; }
.hq-profiles-table th, .hq-profiles-table td { padding-left: 8px; padding-right: 8px; }


.hq-ob-code { font-size: .6875rem; }

.hq-profile-tile-head { display: block; }
.hq-tile-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.hq-tile-title-row .hq-profile-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hq-tile-title-row .state-chip { flex-shrink: 0; }
.hq-tile-model-row { margin-top: 6px; }

@media (max-width: 991.98px) {
    .hq-profiles-table-wrap { overflow: visible; }
}

.hq-cell-stack { display: block; min-width: 0; }

@media (max-width: 767.98px) {
    .hq-profiles-table td[data-label="Status"] .state-chip {
        justify-self: start;
        width: max-content;
        max-width: 100%;
    }
}

/* =====================================================================
   M3 - package export.
   ===================================================================== */
.hq-profile-foot-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}
.hq-profile-foot-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-wrap: wrap;
}
.hq-export-download { margin-left: 4px; }
.hq-export-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: .6875rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.hq-export-chip.is-current {
    border-color: rgba(22, 163, 74, .28);
    background: var(--success-light);
    color: var(--success);
}
.hq-table-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}
.hq-icon-download { color: var(--accent); }
.hq-icon-download:disabled { color: var(--text-muted); opacity: .45; }
.hq-export-summary {
    border-top: 1px solid var(--border);
    padding-top: 4px;
}
.hq-strength {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.hq-strength span {
    width: 28px;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
}
.hq-strength.weak span:nth-child(-n+1) { background: var(--danger); }
.hq-strength.fair span:nth-child(-n+2) { background: var(--warning); }
.hq-strength.strong span { background: var(--success); }

.hq-export-summary .hq-kv { align-items: flex-start; }
.hq-export-summary .hq-kv .v { max-width: 74%; }
.hq-signature-chip {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    font-size: .6875rem;
    line-height: 1.35;
}

/* =====================================================================
   M4a - deployment ledger, report import and report detail.
   ===================================================================== */
.hq-history-status {
    flex-wrap: wrap;
    align-items: center;
}
.hq-history-project { width: 190px; flex: 0 0 auto; }
.hq-import-report { margin-left: auto; }

.hq-deployments-table td, .hq-deployments-table th { vertical-align: middle; }
.hq-deployments-table thead th { white-space: nowrap; }

/* Keep row actions visible while a wide ledger scrolls horizontally. */
@media (min-width: 769px) {
    .hq-deployments-table th.col-actions,
    .hq-deployments-table td.col-actions {
        position: sticky;
        right: 0;
        z-index: 2;
        background: var(--surface);
        box-shadow: -10px 0 12px -14px rgba(15, 23, 42, .45);
    }
    .hq-deployments-table tbody tr:hover td.col-actions { background: var(--accent-light); }
}
.hq-deployment-profile { color: var(--text); }
.hq-deployment-profile:hover { color: var(--accent); }

.hq-package-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.hq-package-version { font-size: .8125rem; font-weight: 600; color: var(--text); }
.hq-package-hash {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .6875rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.hq-package-downloads {
    font-size: .625rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.net-chip.hq-status-muted {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.hq-import-checks { line-height: 1.45; }

.hq-report-summary .hq-kv { align-items: flex-start; }
.hq-report-summary .hq-kv .v { max-width: 66%; }
.hq-report-hash { font-size: .625rem; line-height: 1.35; }
.hq-report-section-title {
    margin: 1.1rem 0 .45rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.hq-check-list .warn .hq-check-icon { color: var(--warning); }
.hq-check-list .neutral .hq-check-icon { color: var(--text-muted); }

.hq-report-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hq-report-table { font-size: .75rem; }
.hq-report-table th {
    padding: 7px 9px;
    font-size: .625rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    white-space: nowrap;
}
.hq-report-table td { padding: 7px 9px; vertical-align: top; }
.hq-report-table td .net-chip { font-size: .625rem; }
.hq-report-warnings {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .75rem;
    color: var(--text-secondary);
}
.hq-report-warnings li { margin-bottom: 4px; }

/* =====================================================================
   M4b - activity feed.
   ===================================================================== */
.hq-activity-status {
    flex-wrap: wrap;
    align-items: center;
}
.hq-activity-project { width: 190px; flex: 0 0 auto; }
.hq-activity-search { margin-left: auto; }

.hq-activity-card { padding: 6px 20px 16px; }
.hq-activity-feed .audit-day:first-child { margin-top: 8px; }

.hq-act-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.hq-act-row:last-child { border-bottom: none; padding-bottom: 2px; }

.hq-act-tile {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
}
.hq-act-tile .icon { width: 16px; height: 16px; }
.hq-act-tile--report {
    background: var(--success-light);
    color: var(--action-success);
}
.hq-act-tile--project {
    background: var(--surface-alt);
    color: var(--text-secondary);
}
.hq-act-tile--admin {
    background: var(--warning-light);
    color: var(--warning);
}

.hq-act-main { flex: 1 1 auto; min-width: 0; }
.hq-act-title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text);
}
.hq-act-title a { color: var(--text); }
.hq-act-title a:hover { color: var(--accent); }
.hq-act-meta {
    margin-top: 1px;
    font-size: .75rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.hq-act-time {
    font-size: .8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 2px;
    width: 52px;
    text-align: right;
    flex: 0 0 auto;
}
.hq-act-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 132px;
    padding-top: 1px;
    flex: 0 0 auto;
}

@media (max-width: 767.98px) {
    .hq-activity-status {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .hq-activity-project { width: 100%; }
    .hq-activity-search { margin-left: 0; }
    .hq-activity-card { padding: 6px 16px 14px; }

    .hq-act-row { flex-wrap: wrap; }
    .hq-act-row {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .hq-act-row:last-child { margin-bottom: 0; }
    .hq-act-status {
        order: 3;
        width: calc(100% - 46px);
        margin-left: 46px;
        margin-top: 6px;
        justify-content: flex-start;
    }
    .hq-act-time {
        order: 4;
        width: calc(100% - 46px);
        margin-left: 46px;
        margin-top: 2px;
        padding-top: 0;
        text-align: left;
    }
}

/* =====================================================================
   Administration - Users.
   ===================================================================== */
.hq-user-name { font-size: .8125rem; color: var(--text); }
.hq-builtin-chip { background: var(--surface-alt); color: var(--text-muted); }
.icon-btn.hq-icon-danger:hover { color: var(--danger); }
.hq-users-table td, .hq-users-table th { vertical-align: middle; }

#tenant-users-table-region .hq-users-table td > .icon-btn { opacity: 1; }
#master-admins-table-region .hq-users-table td > .icon-btn { opacity: 1; }
@media (max-width: 767.98px) {
    #tenant-users-table-region .hq-users-table td[data-label="Actions"] .icon-btn,
    #master-admins-table-region .hq-users-table td[data-label="Actions"] .icon-btn {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 767.98px) {
    #users-table-region .table-responsive { overflow-x: visible; }
    #users-table-region .table,
    #users-table-region .table tbody,
    #users-table-region .table tr,
    #users-table-region .table td { display: block; width: auto; }
    #users-table-region .table thead { display: none; }
    #users-table-region .table tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    #users-table-region .table tbody tr:last-child { margin-bottom: 0; }
    #users-table-region .table td {
        border: none;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #users-table-region .table td[data-label="User"] {
        font-size: .8125rem;
        font-weight: 600;
        padding-bottom: 5px;
    }
    #users-table-region .table td:not([data-label="User"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: minmax(104px, 38%) 1fr;
        gap: 10px;
        align-items: start;
    }
    #users-table-region .table td:not([data-label="User"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 3px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
    }
    #users-table-region .table td.col-num { text-align: left; }
    #users-table-region .table td[data-label="Actions"] { padding-top: 8px; text-align: left; }
}

/* =====================================================================
   First-run bootstrap hint and Machine ID copy rows.
   ===================================================================== */
.hq-bootstrap-hint {
    margin-bottom: 1rem;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
}
.hq-bootstrap-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
}
.hq-bootstrap-grid {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 7px 14px;
    align-items: center;
}
.hq-bootstrap-key {
    font-size: .75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.hq-bootstrap-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px 8px;
    min-width: 0;
    font-size: .75rem;
    color: var(--text);
    text-align: right;
}
.hq-bootstrap-value code {
    flex: 0 0 auto;
    min-width: 0;
    font-size: .6875rem;
    white-space: nowrap;
}
.hq-copy-btn {
    flex-shrink: 0;
    padding: .28rem .5rem;
    font-size: .6875rem;
    white-space: nowrap;
}
.hq-copy-btn.is-copied { color: var(--success); border-color: var(--success); }
.hq-copy-btn.is-copy-failed { color: var(--danger); border-color: var(--danger); }
@media (max-width: 380px) {
    .hq-bootstrap-grid { grid-template-columns: 1fr; gap: 3px; }
    .hq-bootstrap-value { justify-content: flex-start; flex-wrap: wrap; text-align: left; }
}
.hq-machine-id { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hq-machine-id code { font-size: .6875rem; overflow-wrap: anywhere; }

/* =====================================================================
   Archive lifecycle - project/profile scopes and archived chips.
   ===================================================================== */
.hq-archived-chip {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: .6875rem;
}
.hq-archive-scope, .hq-profile-scope { flex-wrap: nowrap; }
.hq-profile-scope { flex-shrink: 0; }

/* =====================================================================
   M5b - per-user preferences.
   ===================================================================== */
#preferences-form .card { height: 100%; }
#preferences-form .seg { flex-wrap: wrap; }
#preferences-form .seg-opt { cursor: pointer; }
#preferences-form .hq-kv { align-items: center; }
#preferences-form .hq-kv .v { max-width: 62%; overflow-wrap: anywhere; }
#preferences-form select[data-timezone-select] { max-width: 100%; }

@media (max-width: 767.98px) {
    #preferences-form .d-flex.justify-content-end .btn { width: 100%; }
    #preferences-form .seg { width: 100%; }
    #preferences-form .seg-opt { flex: 1 1 auto; justify-content: center; }
}

/* =====================================================================
   M5a - Edge model administration.
   ===================================================================== */
.hq-model-new { margin-left: auto; }
.hq-model-link { color: var(--text); font-weight: 600; }
.hq-model-link:hover { color: var(--accent); }
.hq-model-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .75rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.hq-models-table td, .hq-models-table th { vertical-align: middle; }
.hq-models-table thead th { white-space: nowrap; }
.hq-model-card-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.hq-model-card-preview .net-chip { font-size: .6875rem; }

@media (max-width: 767.98px) {
    .hq-model-new { width: 100%; margin-left: 0; }

    #models-results .table-responsive { overflow-x: visible; }
    #models-results .table,
    #models-results .table tbody,
    #models-results .table tr,
    #models-results .table td { display: block; width: auto; }
    #models-results .table thead { display: none; }
    #models-results .table tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    #models-results .table tbody tr:last-child { margin-bottom: 0; }
    #models-results .table td {
        border: none;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #models-results .table td[data-label="Model"] {
        font-size: .8125rem;
        font-weight: 600;
        padding-bottom: 5px;
    }
    #models-results .table td:not([data-label="Model"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: minmax(104px, 38%) 1fr;
        gap: 10px;
        align-items: start;
    }
    #models-results .table td:not([data-label="Model"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 3px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
    }
    #models-results .table td.col-num { text-align: left; }
    #models-results .table td[data-label="Actions"] { padding-top: 8px; text-align: left; }
}

@media (max-width: 767.98px) {
    .hq-history-status {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .hq-history-project { width: 100%; }
    .hq-import-report { width: 100%; margin-left: 0; }

    /* Ledger table - labelled cards (portal table-card pattern). */
    #deployments-results .table-responsive { overflow-x: visible; }
    #deployments-results .table,
    #deployments-results .table tbody,
    #deployments-results .table tr,
    #deployments-results .table td { display: block; width: auto; }
    #deployments-results .table thead { display: none; }
    #deployments-results .table tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-alt);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    #deployments-results .table tbody tr:last-child { margin-bottom: 0; }
    #deployments-results .table td {
        border: none;
        padding: 3px 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #deployments-results .table td[data-label="Project"] {
        font-size: .8125rem;
        font-weight: 600;
        padding-bottom: 5px;
    }
    #deployments-results .table td:not([data-label="Project"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: minmax(104px, 38%) 1fr;
        gap: 10px;
        align-items: start;
    }
    #deployments-results .table td:not([data-label="Project"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 3px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
        white-space: normal;
    }
    #deployments-results .table td.col-num { text-align: left; }
    #deployments-results .table td[data-label="Actions"] {
        padding-top: 8px;
        text-align: left;
    }
    #deployments-results .table td[data-label="Actions"] .btn { width: 100%; }

    .hq-report-summary .hq-kv .v { max-width: 58%; }
}

/* =====================================================================
   Deployment codes (one-time Edge provisioning).
   ===================================================================== */
.hq-icon-code { color: var(--accent); }
.hq-icon-code:disabled { color: var(--text-muted); opacity: .45; }

.hq-code-reveal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
}

.hq-code-value {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .14em;
    color: var(--text);
    overflow-wrap: anywhere;
    user-select: all;
}

.hq-code-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .hq-code-reveal { flex-direction: column; align-items: stretch; }
    .hq-code-actions { margin-left: 0; width: 100%; }
    .hq-code-actions .btn { width: 100%; }
    .hq-code-value {
        flex: 0 0 auto;
        width: 100%;
        font-size: 1.05rem;
        letter-spacing: .08em;
    }
}

/* ---------------------------------------------------------- multi-tenancy */
.hq-tenant-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 30px;
    padding: .2rem .6rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 999px;
    background: var(--bs-tertiary-bg, #f8f9fa);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 16rem;
}
.hq-tenant-chip > span:not(.net-chip) {
    overflow: hidden;
    text-overflow: ellipsis;
}
.hq-tenant-chip--master {
    border-style: dashed;
}
.hq-master-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .8rem;
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid #f0c36d;
    border-left: 4px solid #d99a1b;
    border-radius: .65rem;
    background: rgba(217, 154, 27, .1);
    color: inherit;
}
.hq-master-banner-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(217, 154, 27, .18);
    flex: 0 0 auto;
}
.hq-master-banner-text { font-size: .875rem; line-height: 1.35; }
.hq-drawer-section-title {
    margin: 1.1rem 0 .65rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
}
.hq-drawer-section-title:first-child { margin-top: 0; }
.drawer-520 { width: min(520px, 100vw); }
.hq-tenant-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.hq-admin-row > .min-w-0 { min-width: 0; }

/* Master tenant list and cross-tenant user list collapse to labeled rows on
   phones so status, usage and actions stay reachable without side-scrolling. */
@media (max-width: 767.98px) {
    #tenants-results .table-responsive,
    #tenant-users-table-region .table-responsive,
    #master-admins-table-region .table-responsive { overflow-x: visible; }
    #tenants-results .table,
    #tenants-results thead,
    #tenants-results tbody,
    #tenants-results tr,
    #tenants-results th,
    #tenants-results td,
    #tenant-users-table-region .table,
    #tenant-users-table-region thead,
    #tenant-users-table-region tbody,
    #tenant-users-table-region tr,
    #tenant-users-table-region th,
    #tenant-users-table-region td,
    #master-admins-table-region .table,
    #master-admins-table-region thead,
    #master-admins-table-region tbody,
    #master-admins-table-region tr,
    #master-admins-table-region th,
    #master-admins-table-region td {
        display: block;
        width: 100%;
    }
    #tenants-results thead,
    #tenant-users-table-region thead,
    #master-admins-table-region thead { display: none; }
    #tenants-results tbody tr,
    #tenant-users-table-region tbody tr,
    #master-admins-table-region tbody tr {
        padding: .85rem 1rem;
        border-top: 1px solid var(--border, #e2e8f0);
    }
    #tenants-results tbody tr:first-child,
    #tenant-users-table-region tbody tr:first-child,
    #master-admins-table-region tbody tr:first-child { border-top: 0; }
    #tenants-results td,
    #tenant-users-table-region td,
    #master-admins-table-region td {
        border: 0;
        padding: .18rem 0;
        text-align: left;
    }
    #tenants-results td[data-label="Tenant"],
    #tenant-users-table-region td[data-label="User"],
    #master-admins-table-region td[data-label="Master"] { padding-bottom: .45rem; }
    #tenants-results td[data-label]:not([data-label="Tenant"]):not([data-label="Actions"]),
    #tenant-users-table-region td[data-label]:not([data-label="User"]):not([data-label="Actions"]),
    #master-admins-table-region td[data-label]:not([data-label="Master"]):not([data-label="Actions"]) {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: .5rem;
        align-items: start;
    }
    #tenants-results td[data-label]:not([data-label="Tenant"]):not([data-label="Actions"])::before,
    #tenant-users-table-region td[data-label]:not([data-label="User"]):not([data-label="Actions"])::before,
    #master-admins-table-region td[data-label]:not([data-label="Master"]):not([data-label="Actions"])::before {
        content: attr(data-label);
        padding-top: 2px;
        font-size: .6875rem;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--text-muted, #64748b);
    }
    #tenants-results td.col-num,
    #tenant-users-table-region td.col-num,
    #master-admins-table-region td.col-num { text-align: left; }
    #tenants-results td[data-label="Actions"],
    #tenant-users-table-region td[data-label="Actions"],
    #master-admins-table-region td[data-label="Actions"] { padding-top: .65rem; }
    #tenants-results td[data-label="Actions"]::before,
    #tenant-users-table-region td[data-label="Actions"]::before,
    #master-admins-table-region td[data-label="Actions"]::before { content: none; }
    #tenants-results td[data-label="Actions"] > span,
    #tenant-users-table-region td[data-label="Actions"] > span,
    #master-admins-table-region td[data-label="Actions"] > span {
        display: flex;
        width: 100%;
        align-items: center;
        gap: .5rem;
    }
    #tenants-results td[data-label="Actions"] .btn,
    #tenant-users-table-region td[data-label="Actions"] .btn,
    #master-admins-table-region td[data-label="Actions"] .btn {
        flex: 1 1 auto;
        width: auto;
    }
}
@media (max-width: 991.98px) {
    .hq-tenant-grid { grid-template-columns: minmax(0, 1fr); }
}
.hq-usage-row {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
    margin-bottom: .7rem;
}
.hq-usage-row:last-child { margin-bottom: 0; }
.hq-usage-label { font-size: .82rem; font-weight: 600; }
.hq-usage-track {
    height: .5rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bs-tertiary-bg, #e9ecef);
}
.hq-usage-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary, #0d6efd);
}
.hq-usage-track > span.is-over { background: #c0392b; }
.hq-usage-val { font-size: .78rem; color: var(--bs-secondary-color, #6c757d); white-space: nowrap; }
.hq-admin-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,.06));
}
.hq-admin-row:last-child { border-bottom: 0; }
.hq-admin-row .user-avatar { width: 2rem; height: 2rem; font-size: .8rem; }
.hq-backlink {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .5rem;
    font-size: .82rem;
    text-decoration: none;
}
.hq-inline-link { font-size: .82rem; font-weight: 600; }
.hq-table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem 1rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

/* -- Platform certificate (installation-wide) --------------------------- */
.hq-cert-panel-content {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.hq-cert-panel-content > .ring-gauge { margin: 0; }
.hq-cert-page .cert-detail-grid > div,
.hq-cert-page .hq-cert-summary { min-width: 0; }
.hq-cert-page .cert-detail-val,
.hq-cert-page .hq-cert-sans {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.hq-cert-page .hq-cert-sans { max-height: 8.5em; overflow-y: auto; }
.hq-field-error {
    margin-top: .25rem;
    font-size: .75rem;
    color: var(--danger);
}
@media (max-width: 575.98px) {
    .hq-tenant-chip--master { display: none; }
    .hq-cert-panel-content { grid-template-columns: 1fr; gap: 12px; }
    .hq-cert-page .cert-detail-grid { grid-template-columns: 1fr; }
    .hq-cert-page .ring-gauge.ring-sm { margin: 0; }
    .hq-cert-card .net-card-head { padding: 12px 16px; }
    .hq-cert-card .card-body { padding: 16px; }
    .hq-cert-card .net-card-foot { padding: 12px 16px; }
}
