:root {
    --font-sans: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
    --color-brand-navy: #0b1f4a;
    --color-brand-blue: #1f6feb;
    --color-brand-muted: #5b6b7c;
    --color-surface: #f4f7fb;
    --color-card: #ffffff;
    --color-danger: #b42318;
    --color-border: #d7e0ea;
}

/* Runtime panel stylesheet (always linked from partials/assets).
   Keep resources/css/app.css in sync; do not serve Vite/Tailwind builds as panel CSS. */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-brand-navy);
    background: var(--color-surface);
}

/* ---- Login ---- */

.login-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top, #e8f1ff 0%, transparent 45%),
        linear-gradient(180deg, #f8fbff 0%, var(--color-surface) 100%);
}

.login-shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        max(0.85rem, env(safe-area-inset-top))
        max(0.85rem, env(safe-area-inset-right))
        max(0.85rem, env(safe-area-inset-bottom))
        max(0.85rem, env(safe-area-inset-left));
    box-sizing: border-box;
}

.login-card {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
    align-items: center;
    gap: clamp(1rem, 3.5vw, 2.25rem);
    width: min(100%, 46rem);
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    background: var(--color-card);
    box-shadow: 0 18px 40px rgba(11, 31, 74, 0.08);
    box-sizing: border-box;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0;
    min-width: 0;
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 18rem;
    height: auto;
    max-height: min(52vh, 18rem);
    object-fit: contain;
}

.login-form {
    display: grid;
    gap: 0.9rem;
    min-width: 0;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--color-brand-muted);
}

.login-submit {
    width: 100%;
    margin-top: 0.15rem;
}

@media (max-width: 720px) {
    .login-shell {
        align-items: stretch;
        justify-content: flex-start;
        padding: max(0.85rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) max(0.85rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
    }

    /* Portrait phones/tablets: brand above credentials (single column). */
    .login-card {
        flex: 0 1 auto;
        width: 100%;
        max-width: 26rem;
        margin: auto;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        justify-items: stretch;
        align-content: center;
        gap: 1.15rem;
        padding: 1.15rem 1rem 1.25rem;
        border-radius: 0.95rem;
    }

    .login-brand {
        width: 100%;
    }

    .login-logo {
        width: min(100%, 14rem);
        max-width: 14rem;
        max-height: min(28vh, 12rem);
        margin: 0 auto;
    }

    .login-form {
        width: 100%;
        gap: 0.85rem;
    }
}

@media (max-width: 380px) {
    .login-card {
        gap: 1rem;
        padding: 0.95rem 0.8rem 1.1rem;
    }

    .login-logo {
        width: min(100%, 11.5rem);
        max-width: 11.5rem;
        max-height: min(24vh, 9.5rem);
    }
}

/* ---- Shared panel primitives used by existing Blade views ---- */

.panel-body {
    min-height: 100vh;
    background: var(--color-surface);
}

.panel-body.panel-sidebar-lock {
    overflow: hidden;
}

.panel-shell {
    --sidebar-width: 16.5rem;
    --sidebar-collapsed-width: 4.35rem;
    --header-height: 3.65rem;
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}

.panel-workspace {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Keep horizontal clipping here so sticky sidebar is not trapped by body overflow. */
    overflow-x: clip;
}

.panel-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.7rem;
    box-sizing: border-box;
    background: #fff;
    border-right: 1px solid var(--color-border);
    transition: width 0.22s ease, max-width 0.22s ease, transform 0.22s ease, flex-basis 0.22s ease;
    overflow: hidden;
}

.panel-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    padding-right: 0.15rem;
    scrollbar-width: thin;
}

.panel-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
    min-height: 2.4rem;
}

.panel-sidebar-brand {
    min-width: 0;
}

.panel-sidebar-collapse,
.panel-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--color-brand-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.panel-sidebar-collapse:hover,
.panel-menu-toggle:hover {
    background: #eef3f9;
    color: var(--color-brand-navy);
    border-color: #c8d5e4;
}

.panel-menu-toggle {
    display: none;
}

.panel-sidebar-label {
    transition: opacity 0.18s ease, width 0.18s ease;
    white-space: nowrap;
}

.sidebar-link,
.sidebar-sublink {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--color-brand-muted);
    font: inherit;
    font-weight: 600;
    font-size: 0.94rem;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link .icon,
.sidebar-sublink .icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-sublink:hover {
    background: #eef3f9;
    color: var(--color-brand-navy);
}

.sidebar-link.is-active,
.sidebar-sublink.is-active {
    background: #e7f0ff;
    color: var(--color-brand-blue);
}

.sidebar-group-toggle {
    justify-content: flex-start;
}

.sidebar-group-caret {
    margin-left: auto;
    display: inline-flex;
    transition: transform 0.18s ease;
}

.sidebar-group-caret .icon {
    width: 0.95rem;
    height: 0.95rem;
}

.sidebar-group.is-open .sidebar-group-caret {
    transform: rotate(180deg);
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.15rem 0 0.35rem 0.55rem;
    margin: 0 0 0.15rem 0.85rem;
    border-left: 1px solid #e2eaf3;
}

.sidebar-sublink {
    min-height: 2.1rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.9rem;
    font-weight: 550;
}

.sidebar-divider {
    height: 1px;
    margin: 0.55rem 0.45rem;
    background: #e4ebf3;
}

.sidebar-section-label {
    margin: 0.35rem 0.55rem 0.2rem;
    padding: 0;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
}

.panel-shell.is-sidebar-collapsed .panel-sidebar {
    flex-basis: var(--sidebar-collapsed-width);
    width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
}

.panel-shell.is-sidebar-collapsed .panel-sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.panel-shell.is-sidebar-collapsed .sidebar-section-label {
    height: 0;
    margin: 0.25rem 0;
    opacity: 0;
    overflow: hidden;
}

.panel-shell.is-sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

.panel-shell.is-sidebar-collapsed .panel-sidebar-top {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
}

/* Collapsed desktop rail: brand moves to the header (avoid a duplicate mark in the rail). */
.panel-shell.is-sidebar-collapsed .panel-sidebar-brand {
    display: none;
}

.panel-sidebar-backdrop {
    display: none;
}

.panel-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}

.panel-header-inner {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    min-height: var(--header-height);
    padding: 0.55rem clamp(0.75rem, 1.5vw, 1.25rem);
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.panel-header-start {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.panel-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    color: var(--color-brand-navy);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Desktop expanded: brand lives in the sidebar. Collapsed / mobile: brand in the header. */
.panel-brand.panel-header-brand {
    display: none;
}

.panel-shell.is-sidebar-collapsed .panel-brand.panel-header-brand {
    display: inline-flex;
}

.panel-brand-logo {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.panel-brand-text {
    font-size: 1.02rem;
    letter-spacing: 0.01em;
}

.panel-nav {
    display: none;
}

.nav-link,
.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--color-brand-muted);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.nav-link:hover,
.nav-dropdown-toggle:hover {
    background: #eef3f9;
    color: var(--color-brand-navy);
}

.nav-link.is-active,
.nav-dropdown-toggle.is-active {
    background: #e7f0ff;
    color: var(--color-brand-blue);
}

.nav-caret {
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown.is-open .nav-caret {
    transform: rotate(-135deg) translateY(-1px);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 40;
    min-width: 14rem;
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    background: #fff;
    box-shadow: 0 12px 28px rgba(11, 31, 74, 0.12);
}

.nav-dropdown-menu-end {
    left: auto;
    right: 0;
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    color: var(--color-brand-navy);
    font-weight: 600;
    text-decoration: none;
}

.nav-dropdown-menu a .icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--color-brand-muted);
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.is-active {
    background: #f3f4f6;
    color: var(--color-brand-navy);
}

.nav-dropdown-menu a:hover .icon,
.nav-dropdown-menu a.is-active .icon {
    color: currentColor;
}

.nav-dropdown-divider {
    height: 1px;
    margin: 0.35rem 0.45rem;
    background: #e5e7eb;
}

.nav-account-logout {
    margin: 0;
}

.nav-account-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #374151;
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.nav-account-logout-btn .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #6b7280;
}

.nav-account-logout-btn:hover {
    background: #f3f4f6;
}

.panel-header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.panel-account-chip.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.28rem 0.55rem 0.28rem 0.28rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--color-brand-navy);
    font: inherit;
    line-height: 1.15;
    white-space: nowrap;
}

.panel-account-chip.nav-dropdown-toggle:hover,
.panel-account-chip.nav-dropdown-toggle.is-active,
.nav-account-dropdown.is-open .panel-account-chip.nav-dropdown-toggle {
    background: #f3f4f6;
}

.panel-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: linear-gradient(145deg, #dbeafe 0%, #93c5fd 100%);
    color: #1e3a8a;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.panel-account-avatar-lg {
    width: 2.55rem;
    height: 2.55rem;
    font-size: 0.88rem;
}

.panel-account-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    max-width: 11rem;
}

.panel-account-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.panel-account-email {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.panel-account-chevron {
    width: 0.42rem;
    height: 0.42rem;
    margin: 0 0.25rem 0 0.1rem;
    border-right: 2px solid #9ca3af;
    border-bottom: 2px solid #9ca3af;
    transform: rotate(45deg) translateY(-1px);
    flex-shrink: 0;
}

.nav-account-dropdown.is-open .panel-account-chevron {
    transform: rotate(-135deg) translateY(-1px);
}

.nav-account-menu {
    min-width: 17.5rem;
    padding: 0.45rem;
    border-radius: 0.85rem;
    border-color: #e5e7eb;
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
}

.nav-account-menu a {
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.nav-account-menu a .icon {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.nav-account-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem 0.8rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid #e5e7eb;
}

.nav-account-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.nav-account-header-text strong {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 700;
}

.nav-account-header-text span {
    color: #6b7280;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-api-docs-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid color-mix(in srgb, #0f766e 28%, white);
    background: linear-gradient(180deg, #ecfdf8 0%, #d1fae5 100%);
    color: #0f766e;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.panel-api-docs-link .icon {
    width: 15px;
    height: 15px;
}

.panel-api-docs-link:hover,
.panel-api-docs-link.is-active {
    background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%);
    border-color: #0f766e;
    color: #115e59;
}

.panel-trash-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid color-mix(in srgb, var(--color-brand-muted) 35%, white);
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: var(--color-brand-navy);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.panel-trash-link .icon {
    width: 15px;
    height: 15px;
}

.panel-trash-link:hover,
.panel-trash-link.is-active {
    background: linear-gradient(180deg, #fdecec 0%, #f9d4d4 100%);
    border-color: color-mix(in srgb, var(--color-danger) 45%, white);
    color: var(--color-danger);
}

.panel-trash-link.is-full {
    border-color: color-mix(in srgb, #c2410c 35%, white);
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
}

.panel-trash-link.is-full:hover,
.panel-trash-link.is-full.is-active {
    border-color: #c2410c;
    background: linear-gradient(180deg, #ffedd5 0%, #fed7aa 100%);
    color: #9a3412;
}

.panel-trash-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #c2410c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
}

.panel-alerts-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
}

.panel-alerts-bell .icon {
    width: 18px;
    height: 18px;
}

.panel-alerts-bell.is-ok {
    color: #15803d;
    background: #f0fdf4;
    border-color: color-mix(in srgb, #15803d 22%, white);
}

.panel-alerts-bell.is-ok:hover,
.panel-alerts-bell.is-ok.is-active {
    background: #dcfce7;
    border-color: #15803d;
}

.panel-alerts-bell.is-attention {
    color: var(--color-danger);
    background: #fef2f2;
    border-color: color-mix(in srgb, var(--color-danger) 28%, white);
}

.panel-alerts-bell.is-attention:hover,
.panel-alerts-bell.is-attention.is-active {
    background: #fee2e2;
    border-color: var(--color-danger);
}

.panel-alerts-badge {
    position: absolute;
    top: 0.1rem;
    right: 0.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    border: 2px solid #fff;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    box-sizing: border-box;
}

.panel-alerts-badge-ok {
    min-width: 0.7rem;
    width: 0.7rem;
    height: 0.7rem;
    padding: 0;
    background: #22c55e;
    top: 0.28rem;
    right: 0.28rem;
}

#alertas {
    scroll-margin-top: 5rem;
}

.alert-row-unread {
    background: color-mix(in srgb, var(--color-danger) 8%, white);
}

.alert-row-unread td {
    border-color: color-mix(in srgb, var(--color-danger) 18%, var(--color-border));
}

.text-danger {
    color: var(--color-danger);
}

.dash-security-banner {
    border-color: color-mix(in srgb, var(--color-danger) 45%, white);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--color-danger) 10%, white) 0%, #fff 55%),
        #fff;
    margin-bottom: 1rem;
}

.dash-security-banner-inner {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.dash-security-eyebrow {
    margin: 0 0 0.2rem;
    color: var(--color-danger);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dash-security-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.dash-security-list {
    margin: 0.65rem 0 0;
    padding-left: 1.1rem;
}

.dash-security-list li + li {
    margin-top: 0.25rem;
}

.dash-security-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.alerts-meta {
    margin: 0 0 1rem;
}

.mon-orphan-banner {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.5rem;
    border: 1px solid color-mix(in srgb, var(--color-danger) 40%, white);
    background: color-mix(in srgb, var(--color-danger) 10%, white);
    color: var(--color-danger);
    font-size: 0.92rem;
}

.mon-orphan-banner a {
    color: inherit;
    font-weight: 800;
}

.alerts-cron-copy {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.alerts-cron-line {
    display: block;
    flex: 1 1 16rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--color-danger) 25%, white);
    color: var(--color-brand-navy);
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-all;
    white-space: pre-wrap;
}

@media (max-width: 720px) {
    .panel-header-inner {
        align-items: center;
        gap: 0.55rem;
    }

    .panel-header-actions {
        margin-left: auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        max-width: 100%;
    }

    .panel-api-docs-link span,
    .panel-trash-link span {
        display: none;
    }

    .nav-account-dropdown {
        position: relative;
    }

    .nav-account-dropdown .nav-dropdown-menu {
        position: absolute;
        left: auto;
        right: 0;
        width: min(18rem, calc(100vw - 1.5rem));
        box-shadow: 0 12px 28px rgba(11, 31, 74, 0.12);
    }
}

.panel-main {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0.95rem clamp(0.75rem, 1.5vw, 1.35rem) 1.5rem;
    box-sizing: border-box;
    flex: 1 1 auto;
}

.panel-footer {
    width: 100%;
    margin-top: auto;
    padding: 0.65rem clamp(0.75rem, 1.5vw, 1.25rem) max(0.95rem, env(safe-area-inset-bottom));
    box-sizing: border-box;
    border-top: 1px solid color-mix(in srgb, var(--color-border) 85%, transparent);
    background: color-mix(in srgb, var(--color-surface) 92%, white);
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

@media (max-width: 960px) {
    .panel-shell {
        display: block;
    }

    .panel-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 60;
        transform: translateX(-105%);
        box-shadow: 0 18px 40px rgba(11, 31, 74, 0.18);
        flex-basis: var(--sidebar-width);
        width: min(var(--sidebar-width), 86vw);
        max-width: min(var(--sidebar-width), 86vw);
    }

    .panel-shell.is-sidebar-mobile-open .panel-sidebar {
        transform: translateX(0);
    }

    .panel-shell.is-sidebar-collapsed .panel-sidebar {
        flex-basis: min(var(--sidebar-width), 86vw);
        width: min(var(--sidebar-width), 86vw);
        max-width: min(var(--sidebar-width), 86vw);
    }

    .panel-shell.is-sidebar-collapsed .panel-sidebar-label {
        opacity: 1;
        width: auto;
        overflow: visible;
        pointer-events: auto;
    }

    .panel-shell.is-sidebar-collapsed .sidebar-section-label {
        height: auto;
        margin: 0.35rem 0.55rem 0.2rem;
        opacity: 1;
        overflow: visible;
    }

    .panel-shell.is-sidebar-collapsed .sidebar-link {
        justify-content: flex-start;
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .panel-shell.is-sidebar-collapsed .panel-sidebar-brand {
        display: inline-flex;
    }

    .panel-shell.is-sidebar-collapsed .panel-sidebar-top {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .panel-shell.is-sidebar-collapsed .panel-sidebar-brand .panel-brand-logo {
        width: 2rem;
        height: 2rem;
    }

    .panel-menu-toggle {
        display: inline-flex;
    }

    .panel-brand.panel-header-brand {
        display: inline-flex;
    }

    .panel-sidebar-collapse {
        display: none;
    }

    .panel-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(11, 31, 74, 0.42);
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .panel-sidebar-backdrop[hidden] {
        display: none !important;
    }

    .panel-header-brand .panel-brand-text {
        display: inline;
    }
}

@media (min-width: 961px) {
    .panel-shell.is-sidebar-collapsed .sidebar-link[data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 0.55rem);
        top: 50%;
        transform: translateY(-50%);
        z-index: 70;
        padding: 0.35rem 0.55rem;
        border-radius: 0.4rem;
        background: #0b1f4a;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 600;
        white-space: nowrap;
        box-shadow: 0 8px 20px rgba(11, 31, 74, 0.22);
        pointer-events: none;
    }
}

.powered-by {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
    color: #8a97a8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.35;
    user-select: none;
}

.powered-by-mark {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    opacity: 0.92;
}

.powered-by-name {
    color: #f05300;
    font-weight: 750;
}

.powered-by-login {
    font-size: 0.78rem;
    gap: 0.4rem;
    padding: 0.15rem 0.25rem;
}

.powered-by-login .powered-by-mark {
    width: 1.15rem;
    height: 1.15rem;
}

.powered-by-footer {
    display: flex;
    width: 100%;
    opacity: 0.9;
    min-height: 1.5rem;
    padding: 0.1rem 0;
    box-sizing: border-box;
}

.powered-by-version {
    color: #64748b;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
}

.card {
    padding: clamp(0.85rem, 1.5vw, 1.25rem);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background: var(--color-card);
}

.page-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.page-heading-text {
    min-width: 0;
    flex: 1 1 16rem;
}

.page-heading-text h1 {
    margin: 0;
}

.page-heading-text .muted {
    margin: 0.35rem 0 0;
}

.page-actions {
    flex: 0 1 auto;
    justify-content: flex-end;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    align-items: flex-start;
    margin-bottom: 0.85rem;
}

.section-heading h2 {
    margin: 0;
}

.section-heading .muted {
    margin: 0.25rem 0 0;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.85rem;
}

.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.dash-kpi {
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: 0.65rem;
    background: #f8fafc;
}

.dash-kpi-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}

.dash-kpi-value {
    margin: 0.35rem 0 0.2rem;
    font-size: 1.45rem;
    font-weight: 750;
    color: var(--color-brand-navy);
    line-height: 1.15;
    word-break: break-word;
}

.dash-hero {
    margin-bottom: 0.85rem;
}

.dash-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #067647;
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.dash-live-pill::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #12b76a;
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.55);
    animation: dash-live-pulse 1.6s ease-out infinite;
}

.dash-live-pill.is-error {
    color: #b42318;
    background: #fdecec;
    border-color: #fecdca;
}

.dash-live-pill.is-error::before {
    background: #f04438;
    animation: none;
    box-shadow: none;
}

@keyframes dash-live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.55);
    }
    70% {
        box-shadow: 0 0 0 0.45rem rgba(18, 183, 106, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(18, 183, 106, 0);
    }
}


.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.dash-stat-card {
    padding: 1rem 1.05rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 0.9rem;
    background: var(--color-card);
    box-shadow: 0 8px 22px rgba(11, 31, 74, 0.04);
    min-width: 0;
}

.dash-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.dash-stat-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}

.dash-stat-value {
    margin: 0.45rem 0 0.2rem;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--color-brand-navy);
    line-height: 1.1;
}

.dash-stat-suffix {
    font-size: 1rem;
    font-weight: 650;
    color: var(--color-brand-muted);
}

.dash-stat-meta {
    margin: 0;
    font-size: 0.82rem;
    color: var(--color-brand-muted);
}

.dash-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 750;
}

.dash-delta.is-up {
    background: #ecfdf3;
    color: #067647;
}

.dash-delta.is-down {
    background: #fdecec;
    color: #b42318;
}

.dash-spark {
    display: block;
    width: 100%;
    height: 2.4rem;
    margin-top: 0.65rem;
}

.dash-spark-line {
    stroke: #1f6feb;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dash-spark-area {
    fill: rgba(31, 111, 235, 0.12);
    stroke: none;
}

.dash-mini-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-top: 0.75rem;
    align-items: end;
    height: 2.4rem;
}

.dash-mini-bars span {
    display: block;
    height: var(--v, 20%);
    min-height: 0.35rem;
    border-radius: 0.35rem 0.35rem 0.2rem 0.2rem;
    background: linear-gradient(180deg, #93c5fd 0%, #1f6feb 100%);
}

.dash-mini-bars span:last-child {
    background: linear-gradient(180deg, #86efac 0%, #067647 100%);
}

.dash-progress {
    margin-top: 0.75rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.dash-progress-fill {
    height: 100%;
    border-radius: inherit;
}

.dash-progress-fill.is-blue { background: linear-gradient(90deg, #60a5fa, #1f6feb); }
.dash-progress-fill.is-green { background: linear-gradient(90deg, #86efac, #067647); }
.dash-progress-fill.is-red { background: linear-gradient(90deg, #fca5a5, #b42318); }
.dash-progress-fill.is-orange { background: linear-gradient(90deg, #fdba74, #c2410c); }

.dash-charts-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.dash-chart-card {
    min-width: 0;
}

.dash-chart-head {
    margin-bottom: 0.85rem;
}

.dash-chart-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.dash-bars {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.45rem;
    align-items: end;
    min-height: 11rem;
}

.dash-bar-col {
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: 0.25rem;
    align-items: end;
    min-width: 0;
    text-align: center;
}

.dash-bar-track {
    height: 8.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(180deg, #f8fafc 0%, #eef3f9 100%);
    border-radius: 0.55rem;
    padding: 0.35rem 0.2rem;
}

.dash-bar-fill {
    width: 70%;
    max-width: 1.6rem;
    border-radius: 0.4rem 0.4rem 0.2rem 0.2rem;
    background: linear-gradient(180deg, #93c5fd 0%, #1f6feb 100%);
}

.dash-bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-brand-navy);
}

.dash-bar-label {
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--color-brand-muted);
    text-transform: uppercase;
}

.dash-donut-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}

.dash-donut {
    width: 6.5rem;
    height: 6.5rem;
    transform: rotate(-90deg);
}

.dash-donut-track {
    fill: none;
    stroke: #eef2f7;
    stroke-width: 10;
}

.dash-donut-seg {
    fill: none;
    stroke-width: 10;
    stroke-linecap: butt;
}

.dash-donut-center-value,
.dash-donut-center-label {
    transform: rotate(90deg);
    transform-origin: 48px 48px;
    fill: var(--color-brand-navy);
}

.dash-donut-center-value {
    font-size: 14px;
    font-weight: 800;
}

.dash-donut-center-label {
    font-size: 8px;
    fill: var(--color-brand-muted);
}

.dash-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.dash-legend li {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.45rem;
    align-items: center;
    font-size: 0.88rem;
}

.dash-legend-swatch {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
}

.dash-legend-label {
    color: var(--color-brand-navy);
}

.dash-params {
    display: grid;
    gap: 0.85rem;
}

.dash-param-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.dash-host-line {
    margin: 1rem 0 0;
}

.dash-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    align-items: stretch;
    margin-top: 0.85rem;
}

/* Dashboard live block sits flush above the footer without card margins. */
#dashboard-live {
    margin-bottom: 1.75rem;
}

.dash-split > .dash-section {
    margin-top: 0;
    min-width: 0;
    height: 100%;
}

.dash-project-day {
    min-height: 100%;
}

.dash-project-bars {
    display: grid;
    gap: 0.7rem;
}

.dash-project-bar {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.15rem 0.1rem;
    border-radius: 0.45rem;
    transition: background 0.15s ease;
}

.dash-project-bar:hover {
    background: #f5f8fc;
}

.dash-project-bar-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}

.dash-project-bar-name {
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--color-brand-navy);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-project-bar-count {
    font-size: 0.92rem;
    font-weight: 750;
    color: var(--color-brand-blue);
    flex-shrink: 0;
}

.dash-project-bar .dash-progress {
    margin-top: 0;
    height: 0.55rem;
}

.dash-section {
    margin-top: 0.85rem;
}

.dash-section .page-heading {
    margin-bottom: 0.75rem;
}

.dash-section h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-brand-navy);
}

@media (max-width: 1100px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .dash-kpi-grid,
    .dash-split {
        grid-template-columns: 1fr;
    }

    .dash-donut-row {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .dash-bars {
        min-height: 9rem;
    }

    .dash-bar-track {
        height: 6.5rem;
    }
}

.dash-table {
    margin: 0;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.dash-audio {
    display: block;
    width: 100%;
    min-width: 11rem;
    max-width: 20rem;
    height: 2.25rem;
}

.pbx-audio-player {
    display: block;
    width: min(100%, 28rem);
    height: 2.5rem;
}

.dash-call-list {
    display: grid;
    gap: 0.65rem;
}
.dash-call-item {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.7rem 0.8rem;
    background: #fff;
}
.dash-call-item-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    margin-bottom: 0.45rem;
}
.dash-call-item-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1.1rem;
}
.dash-call-item-audio {
    margin-top: 0.55rem;
}
.dash-recent-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: 0.75rem;
}
.dash-recent-pager[hidden] {
    display: none !important;
}
.dash-recent-pager [data-recent-page-label] {
    min-width: 3.5rem;
    text-align: center;
}
.call-legs {
    line-height: 1.35;
}
.call-leg-b {
    color: var(--color-brand-muted);
}
.call-leg-b span {
    margin-right: 0.2rem;
    color: var(--color-brand-blue);
    font-weight: 700;
}

.history-page {
    display: grid;
    gap: 1.75rem;
    align-content: start;
}

.history-page > .page-heading {
    margin-bottom: 0;
}

.history-kpi-grid {
    /* Extra room so dash-stat-card shadows do not collide with Filtros. */
    margin: 0 0 0.65rem;
    position: relative;
    z-index: 1;
}

.history-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100%;
}

.history-stat-card .dash-progress {
    margin-top: auto;
}

.history-stat-progress-spacer {
    visibility: hidden;
}

.history-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    flex-shrink: 0;
}

.history-stat-icon .icon {
    width: 16px;
    height: 16px;
}

.history-stat-icon.is-navy {
    background: #e8eef7;
    color: var(--color-brand-navy);
}

.history-stat-icon.is-blue {
    background: #e7f0ff;
    color: var(--color-brand-blue);
}

.history-stat-icon.is-green {
    background: #ecfdf3;
    color: #067647;
}

.history-stat-icon.is-teal {
    background: #ecfdf8;
    color: #0f766e;
}

.history-filters-card,
.history-results-card {
    margin: 0;
    position: relative;
    z-index: 0;
}

.history-kpi-grid + .history-filters-card {
    margin-top: 0.35rem;
}

.history-filters-head,
.history-results-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.history-filters-title {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.history-filters-title strong,
.history-results-head strong {
    display: block;
    color: var(--color-brand-navy);
    font-size: 1rem;
}

.history-filters-title .muted,
.history-results-head .muted {
    margin: 0.15rem 0 0;
}

.history-filters-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.7rem;
    background: #eef3f9;
    color: var(--color-brand-navy);
    flex-shrink: 0;
}

.call-history-filters {
    display: grid;
    gap: 0.85rem;
}

.history-filter-actions .button {
    gap: 0.4rem;
}

.call-history-list {
    display: grid;
    gap: 0.55rem;
}

.call-history-item.history-item {
    position: relative;
    display: grid;
    gap: 0.45rem;
    align-content: start;
    border: 1px solid var(--color-border);
    border-radius: 0.8rem;
    padding: 0.7rem 0.85rem 0.7rem 1.2rem;
    background:
        linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: 0 6px 16px rgba(11, 31, 74, 0.03);
    overflow: hidden;
}

.history-item-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #94a3b8;
}

.history-item.tone-ok .history-item-accent { background: #12b76a; }
.history-item.tone-error .history-item-accent { background: var(--color-danger); }
.history-item.tone-info .history-item-accent { background: var(--color-brand-blue); }
.history-item.tone-muted .history-item-accent { background: #98a2b3; }

.call-history-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0;
}

.history-pill-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.history-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.14rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.history-pill .icon {
    width: 11px;
    height: 11px;
}

.history-pill.source-api {
    background: #e7f0ff;
    color: #175cd3;
    border-color: #c7d7fe;
}

.history-pill.source-test {
    background: #f2f4f7;
    color: #344054;
    border-color: #e4e7ec;
}

.history-pill.type-bridge {
    background: #eff8ff;
    color: #175cd3;
    border-color: #b2ddff;
}

.history-pill.type-audio {
    background: #f4f3ff;
    color: #5925dc;
    border-color: #d9d6fe;
}

.history-pill.type-sip {
    background: #ecfdf3;
    color: #067647;
    border-color: #abefc6;
}

.history-pill.type-default {
    background: #f8fafc;
    color: #475467;
    border-color: #e4e7ec;
}

.history-pill.status-ok {
    background: #ecfdf3;
    color: #067647;
    border-color: #abefc6;
}

.history-pill.status-error {
    background: #fef3f2;
    color: #b42318;
    border-color: #fecdca;
}

.history-pill.status-info {
    background: #eff8ff;
    color: #175cd3;
    border-color: #b2ddff;
}

.history-pill.status-muted {
    background: #f2f4f7;
    color: #475467;
    border-color: #e4e7ec;
}

.history-pill.is-soft {
    background: #fff;
    color: var(--color-brand-muted);
    border-color: var(--color-border);
    font-weight: 600;
}

.history-pill.is-recording {
    background: #ecfdf8;
    color: #0f766e;
    border-color: #99f6e4;
}

.history-item-primary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem);
    gap: 0.55rem 0.85rem;
    align-items: center;
}

.history-legs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.55rem;
    min-width: 0;
}

.history-leg {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.4rem;
    min-width: 0;
}

.history-leg-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}

.history-leg strong {
    font-size: 0.95rem;
    line-height: 1.25;
}

.history-legs-arrow {
    display: inline-flex;
    color: var(--color-brand-blue);
    opacity: 0.75;
    flex-shrink: 0;
}

.history-legs-arrow .icon {
    width: 14px;
    height: 14px;
}

.history-item-media {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.history-item-media:empty {
    display: none;
}

.history-detail-btn {
    align-self: flex-end;
}

.history-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.15rem;
    min-width: 0;
    padding-top: 0.15rem;
    color: var(--color-brand-navy);
    font-size: 0.82rem;
    line-height: 1.35;
}

.history-meta-chip {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.35rem;
    min-width: 0;
}

.history-meta-chip .muted.small {
    margin: 0;
}

.history-meta-chip + .history-meta-chip::before {
    content: "·";
    margin-right: 0.55rem;
    color: #98a2b3;
    font-weight: 700;
}

.history-ended-human {
    display: inline-block;
    white-space: nowrap;
    margin-left: auto;
}

.history-empty {
    display: grid;
    justify-items: center;
    gap: 0.55rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-brand-muted);
}

.history-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: #eef3f9;
    color: var(--color-brand-navy);
}

.history-pagination {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid #eef2f6;
}

/* Admin panel pagination (replaces Tailwind default views). */
.panel-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
}

.panel-pagination-summary {
    margin: 0;
}

.panel-pagination-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.panel-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--color-brand-navy);
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
}

.panel-page-link:hover {
    border-color: #b7c9e0;
    background: #f5f8fc;
}

.panel-page-link.is-current {
    border-color: color-mix(in srgb, var(--color-brand-blue) 45%, white);
    background: #e7f0ff;
    color: #175cd3;
}

.panel-page-link.is-disabled,
.panel-page-link.is-ellipsis {
    color: #98a2b3;
    background: #f8fafc;
    cursor: default;
    pointer-events: none;
}

.panel-page-link.is-text {
    min-width: auto;
    padding: 0 0.85rem;
}

.panel-pagination-simple .panel-pagination-list {
    width: 100%;
    justify-content: space-between;
}

.panel-pagination svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.call-history-audio {
    max-width: none;
    width: 100%;
    max-height: 2.15rem;
}

.dash-progress-fill.is-teal {
    background: linear-gradient(90deg, #14b8a6, #0f766e);
}

@media (max-width: 900px) {
    .history-item-primary {
        grid-template-columns: 1fr;
    }

    .history-item-media {
        align-items: stretch;
    }

    .history-detail-btn {
        align-self: stretch;
        justify-content: center;
    }
}

@media (max-width: 720px) {
    .history-page {
        gap: 1.35rem;
    }

    .history-kpi-grid {
        margin-bottom: 0.5rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-filters-head,
    .history-results-head {
        flex-direction: column;
        align-items: stretch;
    }

    .history-filters-head .button,
    .history-filter-actions .button {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .panel-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-pagination-list {
        justify-content: center;
    }

    .call-history-item.history-item {
        padding: 0.65rem 0.75rem 0.65rem 1.05rem;
    }

    .history-ended-human {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .history-kpi-grid {
        grid-template-columns: 1fr;
    }

    .history-meta-chip {
        width: 100%;
    }

    .history-meta-chip + .history-meta-chip::before {
        display: none;
    }

    .history-legs {
        gap: 0.25rem 0.45rem;
    }

    .panel-page-link {
        min-width: 2.4rem;
        height: 2.4rem;
    }
}

.hub-card {
    display: block;
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.7rem;
    background: #f8fafc;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hub-card:hover {
    border-color: #b7c9e0;
    background: #eef4fb;
}

.hub-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    color: var(--color-brand-navy);
}

.hub-card .muted {
    margin: 0;
    font-size: 0.9rem;
}

.table-primary-link {
    color: inherit;
    text-decoration: none;
}

.table-primary-link:hover {
    color: var(--color-brand-blue);
    text-decoration: underline;
}

.server-context {
    margin: 0 0 1.25rem;
}

.server-context-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-bottom: 0.55rem;
}

.server-context-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    align-items: center;
}

.server-context-meta .muted {
    margin: 0;
}

.section-form {
    margin-top: 1rem;
}

.panel-section-danger {
    border-top: 1px solid #f0b4b4;
    padding-top: 1rem;
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--color-brand-blue);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.muted {
    color: var(--color-brand-muted);
}

.field-help {
    margin: 0.35rem 0 0;
    color: var(--color-brand-muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.small {
    font-size: 0.85rem;
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field label {
    font-size: 0.95rem;
    font-weight: 600;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font: inherit;
    background: #fff;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: 2px solid color-mix(in srgb, var(--color-brand-blue) 45%, white);
    border-color: var(--color-brand-blue);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    align-items: end;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.35rem 0;
}

.form-section {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 0 0 1rem;
    display: grid;
    gap: 0.85rem;
}

/* `.form-section { display: grid }` would otherwise override the HTML hidden attribute. */
.form-section[hidden],
[data-master-projects-panel][hidden] {
    display: none !important;
}

.form-section legend {
    padding: 0 0.35rem;
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
}

.filters-bar {
    display: grid;
    gap: 0.85rem;
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.65rem;
    background: #f8fafc;
}

@media (min-width: 40rem) {
    .filters-bar {
        grid-template-columns: minmax(0, 1.4fr) minmax(10rem, 0.7fr) auto;
        align-items: end;
    }
}

.filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.block-phone-form {
    margin-top: 0.5rem;
    padding: 1rem;
    border: 1px solid #f1c4c4;
    border-radius: 0.65rem;
    background: #fff5f5;
}

.status-actions-blocked {
    padding: 1rem;
    border: 1px solid #f1c4c4;
    border-radius: 0.65rem;
    background: #fff5f5;
}

.phone-edit-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.phone-edit-status-main {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.phone-edit-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.phone-edit-active-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.phone-block-details {
    margin-top: 0.25rem;
}

.phone-block-details > summary {
    cursor: pointer;
    color: var(--color-danger, #b42318);
    font-weight: 600;
    font-size: 0.9rem;
}

.phone-block-details[open] > summary {
    margin-bottom: 0.65rem;
}

.project-check-grid {
    display: grid;
    gap: 0.45rem;
}

.project-check-grid[hidden],
.project-check-grid .checkbox[hidden],
#project-ddi-hint[hidden] {
    display: none !important;
}

.secrets-reveal {
    border: 1px solid #f0c36d;
    border-radius: 0.65rem;
    background: #fff8e8;
    padding: 1rem 1.1rem;
    margin: 0 0 1.25rem;
}

.secret-box {
    display: block;
    padding: 0.65rem 0.75rem;
    border-radius: 0.45rem;
    background: #111827;
    color: #f9fafb;
    word-break: break-all;
    font-size: 0.9rem;
}

.project-show .page-header {
    margin-bottom: 1.25rem;
}

.project-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1.35rem;
}

.project-info-card {
    border: 1px solid var(--color-border);
    border-radius: 0.85rem;
    background: #fbfcfe;
    padding: 1.05rem 1.15rem;
    display: grid;
    gap: 0.85rem;
    align-content: start;
}

.project-info-card-key {
    border-color: color-mix(in srgb, var(--color-brand-blue) 35%, var(--color-border));
    background: linear-gradient(180deg, #f4f8ff 0%, #eef4ff 100%);
}

.project-info-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-info-card-head h2 {
    margin: 0.15rem 0 0;
    font-size: 1.15rem;
}

.project-info-kicker {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}

.project-meta-list {
    margin: 0;
    display: grid;
    gap: 0.65rem;
}

.project-meta-list > div {
    display: grid;
    gap: 0.15rem;
}

.project-meta-list dt {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-brand-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.project-meta-list dd {
    margin: 0;
    font-size: 0.95rem;
}

.project-webhook-url {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
}

.project-key-action {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.button.button-api-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 0.65rem;
    background: linear-gradient(180deg, #2b7cff 0%, #1f6feb 100%);
    color: #fff;
    font-size: 0.98rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(31, 111, 235, 0.28);
}

.button.button-api-key:hover {
    background: linear-gradient(180deg, #3a86ff 0%, #1a63d8 100%);
}

.button.button-api-key .icon {
    width: 17px;
    height: 17px;
}

.project-config-block {
    border-top: 1px solid var(--color-border);
    padding-top: 1.25rem;
}

.project-config-heading {
    margin: 0 0 1rem;
}

.project-config-heading h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.project-config-heading .muted {
    margin: 0;
}

.form-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

@media (max-width: 860px) {
    .project-overview-grid {
        grid-template-columns: 1fr;
    }
}

.api-docs-page {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #fff;
}

.api-docs-footer {
    border-top: 1px solid var(--color-border);
    background: #fff;
}

html:has(body.api-docs-page) {
    height: 100%;
    overflow: hidden;
}

.api-docs-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.55rem clamp(0.75rem, 1.5vw, 1.25rem);
    border-bottom: 1px solid var(--color-border);
    background: #fff;
    z-index: 5;
}

.api-docs-topbar-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    min-width: 0;
    color: var(--color-brand-navy);
}

.api-docs-topbar-brand a {
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

.api-docs-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.api-docs-brand-logo {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.api-docs-topbar-sep {
    color: #94a3b8;
}

.api-docs-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.api-docs-frame {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Fill the viewport under the topbar; JS marks one scroller per pane. */
.api-docs-frame .scalar-app,
.api-docs-frame .scalar-api-reference,
.api-docs-frame [data-overlay-container],
.api-docs-frame > div {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
}

/* Avoid nested overflow:auto on content (absorbs wheel without scrolling). */
.api-docs-frame .section,
.api-docs-frame .section-container,
.api-docs-frame .narrow-references-container,
.api-docs-frame .content,
.api-docs-frame .references-rendered,
.api-docs-frame .t-doc__content,
.api-docs-frame [class*="content-container"] {
    min-height: 0;
}

.api-docs-frame [data-api-docs-scroll] {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--color-brand-blue);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary {
    background: #e8eef7;
    color: var(--color-brand-navy);
}

.button:disabled,
.button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.button.danger {
    background: #f8e5e3;
    color: var(--color-danger);
}

.button-sm {
    width: auto;
    box-sizing: border-box;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
}

.button:hover {
    filter: brightness(0.96);
}

.error {
    color: var(--color-danger);
    font-size: 0.9rem;
}

.notice-error {
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid #f3b4b0;
    border-radius: 0.55rem;
    background: #fdecec;
    color: #b42318;
    font-weight: 700;
    line-height: 1.35;
}

.status {
    color: #067647;
    font-weight: 600;
}

.notice-warning {
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #f0c36d;
    border-radius: 0.55rem;
    background: #fff8e8;
    color: #8a5a00;
    font-weight: 600;
}

.row-default td {
    background: #f3faf6;
}

.inline {
    display: inline;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 0.7rem 0.65rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    font-size: 0.85rem;
    color: var(--color-brand-muted);
}

.data-table td[data-label="Acciones"],
.data-table td[data-label="Importar"] {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table-compact td {
    padding: 0.55rem 0.6rem;
}

.panel-section {
    margin: 1.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.panel-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.server-context + .panel-section,
.status + .panel-section,
.probe-console + .panel-section,
.notice-error + .panel-section,
.notice-warning + .panel-section,
.error + .panel-section {
    margin-top: 0.75rem;
}

.panel-section > h2 {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
}

.hidden-form {
    display: none;
}

.table-input {
    width: 100%;
    min-width: 10rem;
    max-width: 18rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 0.45rem;
    font: inherit;
    background: #fff;
}

.table-input-sm {
    min-width: 8rem;
    max-width: 12rem;
}

.table-input-narrow {
    min-width: 4.5rem;
    max-width: 6.5rem;
    width: 5.5rem;
}

.checkbox-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    cursor: pointer;
}

.import-row {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.import-row .table-input {
    width: 12rem;
    min-width: 10rem;
}

.create-panel {
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background: #f8fafc;
}

.create-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.85rem 1rem;
    align-items: start;
}

.create-panel-notes {
    grid-column: 1 / -1;
}

.create-panel-grid > .field-help.create-panel-notes {
    margin-top: 0.15rem;
}

.audio-states-table .table-input {
    max-width: none;
}

.audio-states-table td[data-label="Nombre"] {
    min-width: 12rem;
    width: 38%;
}

.audio-states-table td[data-label="Código API"] {
    min-width: 9rem;
    width: 22%;
}

.audio-states-table td[data-label="Activo"],
.audio-states-table td[data-label="Audios"] {
    width: 1%;
    white-space: nowrap;
}

.call-test-form .call-test-shared {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.call-test-form .call-test-mode-hint {
    margin: 0.65rem 0 0;
}

.call-test-form .call-test-mode-block {
    margin-top: 0.95rem;
    padding-top: 0.95rem;
    border-top: 1px solid var(--color-border);
}

.call-test-form .call-test-mode-block[hidden] {
    display: none !important;
}

.call-test-form .call-test-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.call-test-form .call-test-mode-grid-audio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.call-test-form .call-test-audio-field {
    grid-column: 1 / -1;
}

.call-test-form .call-test-footer-note {
    flex: 1;
    min-width: 14rem;
    display: grid;
    gap: 0.25rem;
}

@media (min-width: 56rem) {
    .call-test-form .call-test-shared {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .call-test-form .call-test-mode-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .call-test-form .call-test-mode-grid-audio {
        grid-template-columns: 1.4fr 1fr 1fr 1fr;
    }

    .call-test-form .call-test-audio-field {
        grid-column: auto;
    }
}

.create-panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 0.95rem;
}

.create-panel-footer .button {
    margin-left: auto;
}

.dtmf-map-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.dtmf-map-list[hidden] {
    display: none !important;
}

.dtmf-map-header {
    display: none;
    grid-template-columns: 2.5rem minmax(0, 1fr) minmax(0, 1fr) minmax(7rem, 0.9fr) minmax(9rem, 1.1fr);
    gap: 0.55rem;
    padding: 0 0.1rem;
    color: var(--color-brand-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dtmf-map-row {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: 0.55rem;
    align-items: start;
}

.dtmf-map-row .dtmf-digit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: 0.45rem;
    background: #fff;
    font-weight: 700;
}

.dtmf-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.dtmf-row-error {
    grid-column: 2;
}

.dtmf-summary-list {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
}

.dtmf-summary-list li {
    margin: 0.2rem 0;
}

@media (min-width: 40rem) {
    .dtmf-map-header {
        display: grid;
    }

    .dtmf-fields {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(7rem, 0.9fr) minmax(9rem, 1.1fr);
        gap: 0.55rem;
        align-items: start;
    }
}

.dtmf-play-fields {
    display: grid;
    gap: 0.35rem;
}

.dtmf-play-fields[hidden] {
    display: none !important;
}

.dtmf-loops-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--color-brand-muted);
}

.dtmf-loops-label input {
    width: 4.5rem;
}

.badge {
    display: inline-flex;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef2f7;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-ok {
    background: #e8f8ef;
    color: #067647;
}

.badge-error {
    background: #fdecec;
    color: var(--color-danger);
}

.badge-warn {
    background: #fff4e5;
    color: #b54708;
}

.badge-info {
    background: #e8f1ff;
    color: #175cd3;
}

.badge-off {
    background: #f1f3f6;
    color: var(--color-brand-muted);
}

.recording-audio {
    display: block;
    height: 2rem;
    max-width: 16rem;
    min-width: 12rem;
}

#live-recording-player {
    margin-top: 0.45rem;
}

.call-history-table td {
    vertical-align: middle;
}

.call-history-table .recording-audio {
    display: inline-block;
    vertical-align: middle;
}

.call-history-table td a {
    display: block;
    margin-top: 0.25rem;
}

.action-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    min-width: 0;
}

.action-row > a,
.action-row > form {
    display: inline-flex;
    margin: 0;
    width: auto;
}

.action-icons .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 0.45rem;
    background: #eef3f9;
    color: var(--color-brand-navy);
    text-decoration: none;
    cursor: pointer;
}

.action-icons .icon-btn:hover {
    background: #dde8f6;
}

.action-icons .icon-btn-ok {
    background: #e8f8ef;
    color: #067647;
}

.action-icons .icon-btn-warn {
    background: #fff6e5;
    color: #9a6700;
}

.action-icons .icon-btn-danger {
    background: #fdecec;
    color: var(--color-danger);
}

.action-icons .icon {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

.inline-edit {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.inline-edit input[type="text"] {
    min-width: 12rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 0.45rem;
    font: inherit;
}

.probe-console {
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background: #f8fafc;
}

.probe-console.is-ok {
    border-color: #b7d4a8;
    background: #f3faf0;
}

.probe-console.is-partial {
    border-color: #f0c36d;
    background: #fff8e8;
}

.probe-console.is-error {
    border-color: #f0b4b4;
    background: #fff5f5;
}

.probe-console.is-skip {
    border-color: var(--color-border);
    background: #f8fafc;
}

.probe-console-header {
    margin-bottom: 0.75rem;
}

.probe-console-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.probe-console-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.85rem;
}

.probe-console-grid article,
.probe-result {
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    background: #fff;
}

.probe-result.is-ok {
    border-color: #b7d4a8;
    background: #f7fcf5;
}

.probe-result.is-error {
    border-color: #f0b4b4;
    background: #fff8f8;
}

.probe-result.is-skip {
    border-color: var(--color-border);
    background: #fbfcfe;
}

.probe-result h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.probe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.probe-actions-compact {
    gap: 0.3rem;
}

.probe-actions-compact .button.tiny {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.probe-console code,
.test-history code {
    font-size: 0.85em;
    word-break: break-all;
}

.diagnostics-panel {
    margin-top: 0.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px dashed var(--color-border);
    border-radius: 0.5rem;
    background: #fbfcfe;
}

.diagnostics-panel summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-brand-navy);
}

.diagnostics-hint {
    margin: 0.65rem 0;
    color: var(--color-brand-navy);
}

.diagnostics-log {
    margin: 0.5rem 0 0;
    padding: 0.75rem;
    max-height: 18rem;
    overflow: auto;
    border-radius: 0.4rem;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.sip-pool-help {
    margin: 0 0 1.25rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 0.55rem;
    background: #f8fafc;
}

.sip-pool-help > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-brand-navy);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.sip-pool-dialplan-ver {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.12rem 0.4rem;
    border-radius: 0.3rem;
    background: #e8eef6;
    color: var(--color-brand-navy);
}

.sip-pool-version-banner {
    margin: 0 0 0.9rem;
    padding: 0.65rem 0.75rem;
    border: 1px dashed var(--color-border);
    border-radius: 0.45rem;
    background: #fff;
    color: var(--color-brand-navy);
}

.sip-pool-version-banner .eyebrow {
    margin: 0 0 0.2rem;
}

.sip-pool-help-body {
    margin-top: 0.85rem;
}

.sip-pool-help-steps {
    margin: 0 0 0.85rem;
    padding-left: 1.25rem;
    color: var(--color-brand-navy);
    line-height: 1.55;
}

.sip-pool-help-steps li + li {
    margin-top: 0.35rem;
}

.sip-pool-help-note {
    margin: 0 0 0.9rem;
}

.sip-pool-help-file {
    border-top: 1px dashed var(--color-border);
    padding-top: 0.85rem;
}

.sip-pool-help-file-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.sip-pool-help-file-header .eyebrow {
    margin: 0 0 0.15rem;
}

.sip-pool-dialplan {
    max-height: 22rem;
}

.sip-pool-import-help {
    margin: 0.35rem 0 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px dashed var(--color-border);
    border-radius: 0.65rem;
    background: #fff;
}

.sip-pool-import-cols {
    margin: 0.35rem 0 0;
    padding-left: 1.15rem;
}

.sip-pool-import-cols li + li {
    margin-top: 0.2rem;
}

.sip-pool-import-form {
    margin-top: 0.25rem;
}

.row-highlight {
    background: #f7fbff;
}

.test-history {
    margin-bottom: 1.25rem;
}

.test-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.test-history-grid article {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
}

@media (max-width: 720px) {
    .data-table {
        display: block;
        width: 100%;
        overflow-x: visible;
    }

    .data-table tbody {
        display: grid;
        gap: 0.65rem;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        display: grid;
        gap: 0.45rem;
        padding: 0.85rem 0.9rem;
        border: 1px solid var(--color-border);
        border-radius: 0.75rem;
        background: #fff;
        border-bottom: 1px solid var(--color-border);
    }

    .data-table td {
        display: grid;
        grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
        gap: 0.5rem;
        border: 0;
        padding: 0.15rem 0;
        word-break: break-word;
        min-width: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--color-brand-muted);
    }

    .data-table td:not([data-label])::before,
    .data-table td[data-label=""]::before {
        display: none;
    }

    .data-table td:not([data-label]),
    .data-table td[data-label=""] {
        grid-template-columns: 1fr;
    }

    .data-table td[data-label="Acciones"],
    .data-table td[data-label="Importar"] {
        white-space: normal;
        width: auto;
    }

    .audio-states-table td[data-label="Nombre"],
    .audio-states-table td[data-label="Código API"],
    .audio-states-table td[data-label="Activo"],
    .audio-states-table td[data-label="Audios"] {
        min-width: 0;
        width: auto;
        white-space: normal;
    }

    .audio-states-table .table-input,
    .audio-states-table .table-input-sm {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

.server-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0.35rem;
    border: 1px solid var(--color-border);
    border-radius: 0.65rem;
    background: #f5f8fc;
}

.server-tabs a {
    padding: 0.45rem 0.8rem;
    border-radius: 0.45rem;
    color: var(--color-brand-navy);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.server-tabs a.is-active,
.server-tabs a:hover {
    background: #fff;
    box-shadow: 0 1px 2px rgba(11, 31, 74, 0.06);
}

.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ami-console {
    max-height: 22rem;
    overflow: auto;
    padding: 0.75rem 0.9rem;
    border-radius: 0.55rem;
    background: #0f1720;
    color: #d7e2ef;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.ami-console-modal {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
}
.live-dtmf-card {
    grid-column: span 1; display: flex; flex-direction: column; gap: 0.25rem;
    min-height: 4.5rem; justify-content: center;
    background: linear-gradient(180deg, #f3f8ff 0%, #e8f1ff 100%); border: 1px solid #c5d8f2;
}
.live-dtmf-card.has-digit {
    background: linear-gradient(180deg, #ecfdf3 0%, #dcfce7 100%); border-color: #86efac;
}
.live-dtmf-value {
    font-size: 1.75rem; font-weight: 800; letter-spacing: 0.04em;
    color: var(--color-brand-navy); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.1;
}
body.call-test-live-open { overflow: hidden; }
.call-test-live-modal {
    position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
    padding: 1rem; box-sizing: border-box; opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.call-test-live-modal.is-open { opacity: 1; pointer-events: auto; }
.call-test-live-backdrop {
    position: absolute; inset: 0; background: rgba(11, 31, 74, 0.45); backdrop-filter: blur(3px);
}
.call-test-live-dialog {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    width: min(100%, 56rem); max-height: min(92vh, 48rem);
    padding: 1.1rem 1.25rem 1.25rem; border: 1px solid var(--color-border); border-radius: 1rem;
    background: var(--color-card); box-shadow: 0 24px 60px rgba(11, 31, 74, 0.28);
    box-sizing: border-box; gap: 0.85rem;
    overflow: hidden;
    min-height: 0;
}
.call-test-live-header,
.call-test-live-meta,
.live-sip-creds {
    flex: 0 0 auto;
}
.call-test-live-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.call-test-live-header h2 { margin: 0; font-size: 1.2rem; }
.call-test-live-log-title { margin: 0; font-size: 0.95rem; flex: 0 0 auto; }
.call-test-live-dialog .live-grid { margin: 0; }

/* SIP→B: compact creds + meta so the AMI console stays readable inside the modal */
.call-test-live-dialog.is-sip-to-b {
    width: min(100%, 62rem);
    max-height: min(92vh, 52rem);
    gap: 0.55rem;
}
.call-test-live-dialog.is-sip-to-b .live-sip-creds {
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background: #f8fafc;
}
.call-test-live-dialog.is-sip-to-b .live-sip-creds-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}
.call-test-live-dialog.is-sip-to-b .live-sip-creds-top strong {
    font-size: 0.88rem;
    color: var(--color-brand-navy);
}
.call-test-live-dialog.is-sip-to-b .live-sip-grid {
    gap: 0.4rem 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}
.call-test-live-dialog.is-sip-to-b .live-sip-grid code {
    font-size: 0.82rem;
    user-select: all;
    word-break: break-all;
}
.call-test-live-dialog.is-sip-to-b .live-sip-call-id {
    grid-column: 1 / -1;
}
.call-test-live-dialog.is-sip-to-b .live-grid-sip {
    gap: 0.45rem 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}
.call-test-live-dialog.is-sip-to-b .ami-console-modal {
    min-height: 0;
}

@media (max-width: 720px) {
    .call-test-live-dialog { width: 100%; max-height: 96vh; padding: 1rem; }
}

.ami-line { display: flex; gap: 0.75rem; margin: 0.25rem 0; }
.ami-time { color: #8aa0b8; min-width: 4.2rem; }
.ami-info { color: #7db7ff; }
.ami-success { color: #6fdf9a; }
.ami-warning { color: #f0c36d; }
.ami-error {
    align-items: flex-start;
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(180, 35, 24, 0.35);
    border: 1px solid rgba(255, 141, 133, 0.45);
    color: #ffc9c4;
}
.ami-error .ami-time { color: #ffb4ae; }
.ami-error > span:last-child {
    display: inline-flex;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #fdecec;
    color: #b42318;
    font-weight: 700;
    line-height: 1.35;
}

body.confirm-modal-open { overflow: hidden; }
.confirm-modal {
    position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center;
    padding: 1rem; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.confirm-modal.is-open { opacity: 1; visibility: visible; }
.confirm-modal-backdrop {
    position: absolute; inset: 0; background: rgba(11, 31, 74, .45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.confirm-modal-dialog {
    position: relative; z-index: 1; width: min(100%, 28rem); max-height: min(90vh, 36rem); overflow: auto;
    padding: 1.25rem 1.35rem; border: 1px solid var(--color-border); border-radius: .85rem;
    background: var(--color-card); color: var(--color-brand-navy);
    box-shadow: 0 22px 50px rgba(11, 31, 74, .22);
    transform: translateY(.6rem) scale(.98); transition: transform .2s ease;
}
.confirm-modal.is-open .confirm-modal-dialog { transform: translateY(0) scale(1); }
.confirm-modal-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .85rem; }
.confirm-modal-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.35rem; height: 2.35rem; border-radius: .55rem; flex-shrink: 0;
}
.confirm-modal-icon.is-warning, .confirm-modal-icon.is-info { background: #fff6e5; color: #9a6700; }
.confirm-modal-icon.is-danger { background: #fdecec; color: var(--color-danger); }
.confirm-modal-icon-svg { width: 1.25rem; height: 1.25rem; }
.confirm-modal-title { margin: .15rem 0 0; font-size: 1.1rem; line-height: 1.35; }
.confirm-modal-message { font-size: .95rem; line-height: 1.5; }
.confirm-modal-message p { margin: 0 0 .7rem; }
.confirm-modal-message p:last-child { margin-bottom: 0; }
.confirm-modal-error {
    margin: .85rem 0 0; padding: .55rem .7rem; border-radius: .45rem;
    background: #fdecec; color: var(--color-danger); font-size: .9rem; font-weight: 600;
}
.confirm-modal-challenge {
    margin-top: .95rem;
    padding-top: .85rem;
    border-top: 1px solid var(--color-border);
}
.confirm-modal-challenge-hint {
    margin: 0 0 .65rem;
    font-size: .92rem;
    line-height: 1.45;
}
.confirm-modal-challenge-word {
    display: inline-block;
    margin: 0 .15rem;
    padding: .12rem .4rem;
    border-radius: .35rem;
    background: #eef3fb;
    color: var(--color-brand-navy);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .08em;
}
.confirm-modal-challenge-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--color-brand-muted);
}
.confirm-modal-challenge-input {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.confirm-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.15rem; }
.confirm-btn-primary { background: var(--color-brand-blue); color: #fff; }
.confirm-btn-success { background: #067647; color: #fff; }
.panel-toast-host {
    position: fixed; top: 1rem; right: 1rem; z-index: 1100; display: flex; flex-direction: column;
    gap: .55rem; width: min(100% - 2rem, 24rem); pointer-events: none;
}
.panel-toast {
    display: flex; align-items: flex-start; gap: .65rem; padding: .75rem .85rem; border-radius: .55rem;
    border: 1px solid var(--color-border); background: var(--color-card);
    box-shadow: 0 12px 28px rgba(11, 31, 74, .16); pointer-events: auto;
    opacity: 0; transform: translateY(-.4rem); transition: opacity .2s ease, transform .2s ease;
}
.panel-toast.is-visible { opacity: 1; transform: translateY(0); }
.panel-toast.is-leaving { opacity: 0; transform: translateY(-.3rem); }
.panel-toast-msg { flex: 1; font-size: .92rem; font-weight: 600; line-height: 1.4; }
.panel-toast-close { border: 0; background: transparent; color: var(--color-brand-muted); font-size: 1.1rem; cursor: pointer; }
.panel-toast-success { border-color: #b7e0c4; background: #f3faf0; color: #067647; }
.panel-toast-error { border-color: #f0c2bd; background: #fdecec; color: var(--color-danger); }
.panel-toast-warning { border-color: #f0c36d; background: #fff8e8; color: #8a5a00; }
@media (prefers-color-scheme: dark) {
    :root {
        --color-brand-navy: #e8eef7; --color-brand-blue: #4c8dff; --color-brand-muted: #9aacbf;
        --color-surface: #0f1720; --color-card: #172333; --color-danger: #ff8d85; --color-border: #2a3a4f;
    }
    .confirm-modal-backdrop { background: rgba(0,0,0,.55); }
    .confirm-modal-icon.is-warning, .confirm-modal-icon.is-info { background: #3a2f12; color: #f0c36d; }
    .confirm-modal-icon.is-danger { background: #3a1d1c; color: #ff8d85; }
    .confirm-modal-error { background: #3a1d1c; }
    .confirm-modal-challenge-word { background: #243447; color: #e8eef7; }
    .panel-toast-success { background: #163024; border-color: #2f6b4a; color: #6fdf9a; }
    .panel-toast-error { background: #3a1d1c; border-color: #7a3530; color: #ff8d85; }
    .panel-toast-warning { background: #3a2f12; border-color: #7a5a20; color: #f0c36d; }
}
@media (max-width: 520px) {
    .confirm-modal-actions { flex-direction: column-reverse; }
    .confirm-modal-actions .button { width: 100%; }
    .panel-toast-host { left: 1rem; right: 1rem; width: auto; }
}

.ui-switch-form { display: inline-flex; margin: 0; }
.ui-switch {
    --switch-w: 3.4rem; --switch-h: 1.55rem; --knob: 1.2rem;
    position: relative; display: inline-flex; align-items: center;
    width: var(--switch-w); height: var(--switch-h); padding: 0 0.28rem;
    border: 0; border-radius: 999px; cursor: pointer; box-sizing: border-box;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(255, 255, 255, 0.65);
    font: inherit; line-height: 1; vertical-align: middle;
}
.ui-switch.is-on { background: linear-gradient(180deg, #3ddc84 0%, #22c55e 100%); justify-content: flex-start; }
.ui-switch.is-off { background: linear-gradient(180deg, #e8edf2 0%, #cfd8e3 100%); justify-content: flex-end; }
.ui-switch:focus-visible { outline: 2px solid var(--color-brand-blue); outline-offset: 2px; }
.ui-switch-knob {
    position: absolute; top: 50%; width: var(--knob); height: var(--knob);
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(11, 31, 74, 0.28);
    transform: translateY(-50%); transition: left 0.18s ease, right 0.18s ease;
}
.ui-switch.is-on .ui-switch-knob { right: 0.18rem; left: auto; }
.ui-switch.is-off .ui-switch-knob { left: 0.18rem; right: auto; }
.ui-switch-text { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.04em; user-select: none; }
.ui-switch.is-on .ui-switch-text-on { color: rgba(255, 255, 255, 0.95); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.ui-switch.is-on .ui-switch-text-off { display: none; }
.ui-switch.is-off .ui-switch-text-off { color: #7a8796; }
.ui-switch.is-off .ui-switch-text-on { display: none; }
.label-with-switch { display: inline-flex; align-items: center; gap: 0.55rem; }
.label-with-switch .ui-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; }
.label-with-switch .ui-switch { pointer-events: none; }
.label-with-switch:has(.ui-switch-input:checked) .ui-switch { background: linear-gradient(180deg, #3ddc84 0%, #22c55e 100%); justify-content: flex-start; }
.label-with-switch:has(.ui-switch-input:checked) .ui-switch-knob { right: 0.18rem; left: auto; }
.label-with-switch:has(.ui-switch-input:checked) .ui-switch-text-on { display: inline; color: rgba(255, 255, 255, 0.95); }
.label-with-switch:has(.ui-switch-input:checked) .ui-switch-text-off { display: none; }
.label-with-switch:not(:has(.ui-switch-input:checked)) .ui-switch { background: linear-gradient(180deg, #e8edf2 0%, #cfd8e3 100%); justify-content: flex-end; }
.label-with-switch:not(:has(.ui-switch-input:checked)) .ui-switch-knob { left: 0.18rem; right: auto; }
.label-with-switch:not(:has(.ui-switch-input:checked)) .ui-switch-text-off { display: inline; color: #7a8796; }
.label-with-switch:not(:has(.ui-switch-input:checked)) .ui-switch-text-on { display: none; }

.account-page {
    /* Same full-width card layout as the rest of the panel. */
    width: 100%;
}

.account-form {
    display: grid;
    gap: 0.25rem;
}

.account-section {
    background: #fbfcfe;
}

.account-section .field-help {
    margin: 0;
}

.account-alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: 0.65rem;
    background: #fff;
}

.account-alert-row .muted.small {
    margin: 0.2rem 0 0;
}

.account-alert-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.account-email-list {
    display: grid;
    gap: 0.5rem;
}

.account-email-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.account-test-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.account-test-section {
    margin-top: 0.35rem;
}

.account-alert-row .label-with-switch {
    flex-shrink: 0;
}

.muted.small {
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 640px) {
    .account-alert-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ---- Global mobile / tablet responsiveness ---- */

@media (max-width: 720px) {
    .panel-main {
        padding: 0.85rem max(0.7rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(0.7rem, env(safe-area-inset-left));
        overflow-x: clip;
    }

    .panel-main > .card + .card {
        margin-top: 1rem;
    }

    #dashboard-live {
        margin-bottom: 2rem;
    }

    .field-row,
    .hub-grid,
    .stats-grid,
    .test-history-grid {
        grid-template-columns: 1fr;
    }

    audio,
    .dash-audio {
        width: 100%;
        max-width: 100%;
    }

    .live-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-actions,
    .page-actions,
    .filters-actions,
    .status-action-buttons,
    .account-test-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .form-actions .button,
    .page-actions .button,
    .page-actions a.button,
    .filters-actions .button,
    .status-action-buttons .button {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .action-row {
        flex-wrap: wrap;
        gap: 0.45rem;
    }

    .action-row > a,
    .action-row > form,
    .action-row .button {
        flex: 1 1 auto;
    }

    .server-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .server-tabs a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .confirm-modal {
        padding: 0.65rem;
        align-items: flex-end;
    }

    .confirm-modal-dialog {
        width: 100%;
        max-height: min(92vh, 100%);
        border-radius: 0.85rem 0.85rem 0.5rem 0.5rem;
    }

    .field input,
    .field textarea,
    .field select,
    .login-form input,
    .button {
        font-size: 16px;
    }

    .project-info-card,
    .panel-section,
    .form-section {
        min-width: 0;
    }

    .secret-box,
    code {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .panel-brand-text {
        display: none;
    }

    .panel-help-link > span,
    .panel-api-docs-link > span,
    .panel-trash-link > span:not(.panel-trash-count),
    .panel-account-text {
        display: none;
    }

    .panel-help-link,
    .panel-api-docs-link,
    .panel-trash-link {
        padding: 0.42rem 0.55rem;
    }

    .panel-account-chip.nav-dropdown-toggle {
        padding: 0.2rem;
        gap: 0.35rem;
    }

    .panel-account-chevron {
        margin-right: 0.35rem;
    }

    .live-grid {
        grid-template-columns: 1fr;
    }

    .page-heading-text h1 {
        font-size: 1.35rem;
    }
}

/* System monitor panel */
.mon-panel { margin-top: 0.5rem; }
.mon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}
.mon-block {
    border: 1px solid var(--color-border);
    border-radius: 0.9rem;
    background: var(--color-card);
    padding: 1rem 1.05rem;
}
.mon-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.mon-block-head h2 {
    margin: 0;
    font-size: 1.05rem;
}
.mon-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.85rem;
}
.mon-metrics article {
    min-width: 0;
}
.mon-metrics article span {
    display: block;
    font-size: 0.78rem;
}
.mon-metrics article strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.05rem;
    color: var(--color-brand-navy);
    word-break: break-word;
}
.mon-install-dialog,
.panel-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 0;
    max-width: 36rem;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 2rem);
    height: fit-content;
    overflow: auto;
    background: var(--color-card, #fff);
    color: inherit;
    box-shadow: 0 24px 60px rgba(11, 31, 74, 0.22);
}
.mon-install-dialog::backdrop,
.panel-dialog::backdrop {
    background: rgba(11, 31, 74, 0.42);
}
.panel-dialog-form {
    padding: 1.25rem 1.35rem 1.35rem;
    display: grid;
    gap: 1rem;
}
.panel-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}
.panel-dialog-header .eyebrow {
    margin: 0 0 0.2rem;
}
.panel-dialog-header h2 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.35;
}
.panel-dialog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}
.panel-dialog-field-full {
    grid-column: 1 / -1;
}
.panel-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}
@media (max-width: 640px) {
    .panel-dialog-grid {
        grid-template-columns: 1fr;
    }
}
.mon-install-form {
    padding: 1.25rem 1.35rem 1.35rem;
    display: grid;
    gap: 1rem;
}
.mon-install-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}
.mon-install-header .eyebrow {
    margin: 0 0 0.2rem;
}
.mon-install-header h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.25;
    color: var(--color-brand-navy);
}
.mon-install-target {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--color-brand-blue) 5%, white);
}
.mon-install-target span {
    display: block;
    margin-bottom: 0.15rem;
}
.mon-install-target strong {
    display: block;
    word-break: break-word;
}
.mon-install-note {
    margin: 0;
    line-height: 1.4;
}
.mon-install-fields {
    display: grid;
    gap: 0.9rem;
}
.mon-install-fields .field-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr);
    align-items: start;
}
.mon-install-fields .field-row:nth-child(2),
.mon-install-fields .field-row:nth-child(3) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mon-install-fields .field label {
    display: block;
    margin-bottom: 0.35rem;
    white-space: normal;
}
.mon-install-fields .field input {
    width: 100%;
    min-width: 0;
}
.mon-install-actions {
    margin-top: 0.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--color-border);
}
@media (max-width: 900px) {
    .mon-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .mon-metrics { grid-template-columns: 1fr; }
    .mon-install-target,
    .mon-install-fields .field-row,
    .mon-install-fields .field-row:nth-child(2),
    .mon-install-fields .field-row:nth-child(3) {
        grid-template-columns: 1fr;
    }
}

/* Dashboard server Linux meters */
.dash-server-cards {
    display: grid;
    gap: 0.85rem;
}
.dash-server-card {
    border: 1px solid var(--color-border);
    border-radius: 0.9rem;
    padding: 0.95rem 1rem;
    background: color-mix(in srgb, var(--color-brand-blue) 3%, white);
}
.dash-server-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}
.dash-server-name {
    font-weight: 750;
    font-size: 1.05rem;
    color: var(--color-brand-navy);
    text-decoration: none;
}
.dash-server-name:hover { text-decoration: underline; }
.dash-server-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.dash-resource-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}
.dash-meter {
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border-radius: 0.65rem;
    background: #fff;
    border: 1px solid var(--color-border);
}
.dash-meter-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.dash-meter-top span {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}
.dash-meter-top strong {
    font-size: 0.92rem;
    color: var(--color-brand-navy);
    white-space: nowrap;
}
.dash-meter-track {
    height: 0.45rem;
    border-radius: 999px;
    background: #e8eef7;
    overflow: hidden;
}
.dash-meter-fill {
    height: 100%;
    border-radius: inherit;
    background: #12b76a;
    transition: width 0.35s ease;
}
.dash-meter.is-cool .dash-meter-fill { background: #12b76a; }
.dash-meter.is-warm .dash-meter-fill { background: #f79009; }
.dash-meter.is-hot .dash-meter-fill { background: #f04438; }
.dash-meter.is-net .dash-meter-fill.is-down { background: #2e90fa; }
.dash-meter.is-net .dash-meter-fill.is-up { background: #7a5af8; }
.dash-net-bars {
    display: grid;
    gap: 0.3rem;
}
.dash-net-bar {
    display: grid;
    grid-template-columns: 1rem minmax(0, 1fr);
    gap: 0.35rem;
    align-items: center;
}
.dash-net-bar > span {
    font-size: 0.75rem;
    color: var(--color-brand-muted);
}
.dash-linux-empty {
    margin: 0;
}
.dash-linux-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    border: 1px dashed var(--color-border);
    background: #fff;
}
.dash-linux-cta.is-missing {
    border-color: #d0d5dd;
    background: #f8fafc;
}
.dash-linux-cta.is-offline {
    border-color: #fecdca;
    background: #fef3f2;
}
.dash-linux-cta-text {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}
.dash-linux-cta-text p {
    margin: 0;
}
@media (max-width: 960px) {
    .dash-resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .dash-resource-grid { grid-template-columns: 1fr; }
    .dash-server-card-top { flex-direction: column; }
    .dash-linux-cta { flex-direction: column; align-items: stretch; }
}


/* —— Ayuda / admin manual —— */
.panel-help-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid color-mix(in srgb, #1d4ed8 28%, white);
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.panel-help-link .icon { width: 15px; height: 15px; }
.panel-help-link:hover,
.panel-help-link.is-active {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #1d4ed8;
    color: #1e3a8a;
}

.help-page { display: grid; gap: 1.25rem; }
.help-page-heading { align-items: flex-start; }
.help-page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.help-visuals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.help-visual-card {
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 0.85rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 1rem 1.05rem 1.1rem;
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}
.help-visual-head {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}
.help-visual-title {
    margin: 0;
    font-size: 1rem;
    color: var(--color-brand-navy, #0f172a);
}
.help-step-badge {
    flex: 0 0 auto;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
    background: #0f766e;
}

.help-chrome-bar,
.help-tabs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    padding: 0.55rem;
    border-radius: 0.65rem;
    border: 1px dashed #cbd5e1;
    background: #0b1220;
    color: #e2e8f0;
}

.help-chrome-layout {
    display: grid;
    grid-template-columns: minmax(8.5rem, 11rem) 1fr;
    gap: 0.55rem;
    align-items: stretch;
}

.help-chrome-side {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.55rem;
    border-radius: 0.65rem;
    border: 1px dashed #cbd5e1;
    background: #0b1220;
    color: #e2e8f0;
}

.help-chrome-side .help-chrome-brand {
    margin: 0 0 0.25rem;
}

.help-chrome-sub {
    font-size: 0.65rem;
    color: #94a3b8;
    padding: 0 0.2rem 0.15rem;
    line-height: 1.35;
}

.help-chrome-main {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.help-chrome-main .help-chrome-bar {
    justify-content: flex-end;
}

.help-chrome-canvas {
    flex: 1 1 auto;
    min-height: 4.5rem;
    border-radius: 0.65rem;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    display: grid;
    place-items: center;
    color: #64748b;
}

@media (max-width: 720px) {
    .help-chrome-layout {
        grid-template-columns: 1fr;
    }
}

.help-chrome-brand {
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: #5eead4;
    margin-right: 0.25rem;
}
.help-chrome-item,
.help-chrome-pill,
.help-chrome-bell,
.help-chrome-account,
.help-tab {
    position: relative;
    font-size: 0.72rem;
    font-weight: 650;
    padding: 0.28rem 0.45rem;
    border-radius: 0.35rem;
    background: rgba(148, 163, 184, 0.16);
}
.help-chrome-item.is-accent,
.help-chrome-account.is-help {
    background: #1d4ed8;
    color: #fff;
}
.help-chrome-pill.is-docs {
    background: #0f766e;
    color: #ecfdf5;
}
.help-chrome-spacer { flex: 1 1 0.5rem; min-width: 0.5rem; }
.help-chrome-item[data-tip]::after,
.help-chrome-pill[data-tip]::after,
.help-chrome-bell[data-tip]::after,
.help-chrome-account[data-tip]::after,
.help-tab[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: -0.55rem;
    right: -0.35rem;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: #f59e0b;
    color: #111827;
    font-size: 0.62rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    line-height: 1;
}
.help-chrome-legend,
.help-flow {
    margin: 0;
    padding-left: 1.15rem;
    display: grid;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: #334155;
}
.help-chrome-legend li strong { color: #0f172a; }

.help-tab.is-done { background: #0f766e; color: #ecfdf5; }

.help-flow { list-style: none; padding-left: 0; }
.help-flow li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
    align-items: start;
}
.help-flow-n {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 800;
    background: #e2e8f0;
    color: #0f172a;
}
.help-flow div { display: grid; gap: 0.1rem; }

.help-layout {
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.help-toc {
    position: sticky;
    top: 0.85rem;
    display: grid;
    gap: 0.65rem;
    padding: 1rem;
}
.help-toc-nav {
    display: grid;
    gap: 0.2rem;
    max-height: min(70vh, 36rem);
    overflow: auto;
}
.help-toc-link {
    display: block;
    text-decoration: none;
    color: #334155;
    font-size: 0.86rem;
    padding: 0.28rem 0.4rem;
    border-radius: 0.35rem;
}
.help-toc-link:hover { background: #f1f5f9; color: #0f172a; }
.help-toc-link.is-sub {
    padding-left: 0.95rem;
    font-size: 0.8rem;
    color: #64748b;
}
.help-toc-meta { margin: 0; word-break: break-word; }
.help-body {
    padding: 1.15rem 1.25rem 1.5rem;
    min-width: 0;
}
.prose-help > *:first-child { margin-top: 0; }
.prose-help h1 { font-size: 1.55rem; margin: 0 0 0.75rem; }
.prose-help h2 {
    font-size: 1.2rem;
    margin: 1.6rem 0 0.65rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e2e8f0;
    scroll-margin-top: 1rem;
}
.prose-help h2:first-of-type { border-top: 0; padding-top: 0; }
.prose-help h3 {
    font-size: 1.02rem;
    margin: 1.15rem 0 0.45rem;
    scroll-margin-top: 1rem;
}
.prose-help p, .prose-help li { color: #334155; line-height: 1.55; }
.prose-help ul, .prose-help ol { padding-left: 1.2rem; }
.prose-help code {
    font-size: 0.86em;
    background: #f1f5f9;
    padding: 0.08rem 0.28rem;
    border-radius: 0.3rem;
}
.prose-help pre {
    overflow: auto;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    background: #0b1220;
    color: #e2e8f0;
    font-size: 0.84rem;
}
.prose-help pre code { background: transparent; padding: 0; color: inherit; }
.prose-help table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0.75rem 0 1rem;
}
.prose-help th, .prose-help td {
    border: 1px solid #e2e8f0;
    padding: 0.45rem 0.55rem;
    text-align: left;
    vertical-align: top;
}
.prose-help th { background: #f8fafc; }
.prose-help blockquote {
    margin: 0.85rem 0;
    padding: 0.65rem 0.85rem;
    border-left: 3px solid #0f766e;
    background: #f0fdfa;
    color: #115e59;
}

@media (max-width: 1100px) {
    .help-visuals { grid-template-columns: 1fr; }
    .help-layout { grid-template-columns: 1fr; }
    .help-toc { position: static; }
}

/* Unified call detail */
.call-detail-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.call-detail-hero {
    padding: 1.1rem 1.25rem 1.2rem;
}
.call-detail-hero-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    margin-bottom: 0.85rem;
}
.call-detail-id code {
    font-size: 0.86rem;
}
.call-detail-legs {
    align-items: center;
}
.call-detail-duration {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}
.call-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1rem;
}
.call-detail-card {
    padding: 1.1rem 1.25rem 1.25rem;
}
.call-detail-card-title {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
}
.call-detail-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.call-detail-card-head .call-detail-card-title {
    margin-bottom: 0;
}
.call-detail-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}
.call-detail-facts-compact {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
.call-detail-fact {
    min-width: 0;
}
.call-detail-fact dt {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-brand-muted);
}
.call-detail-fact dd {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.35;
    word-break: break-word;
}
.call-detail-recording-status {
    margin: 0 0 0.65rem;
}
.call-detail-audio {
    width: 100%;
    max-width: 100%;
}
.call-detail-recording-actions {
    margin: 0.75rem 0 0;
}
.call-detail-console {
    max-height: 28rem;
}
.call-detail-payload summary {
    cursor: pointer;
    color: var(--color-brand-blue);
    font-size: 0.85rem;
}
.call-detail-payload pre {
    margin: 0.5rem 0 0;
    max-height: 16rem;
    overflow: auto;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.75rem;
}
@media (max-width: 900px) {
    .call-detail-layout {
        grid-template-columns: 1fr;
    }
    .call-detail-duration {
        margin-left: 0;
        align-items: flex-start;
    }
}
