﻿@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --portal-bg: #f3f6fb;
    --portal-surface: #ffffff;
    --portal-surface-soft: #edf2ff;
    --portal-primary: #00488d;
    --portal-primary-strong: #005fb8;
    --portal-text: #131b2e;
    --portal-text-muted: #5f6981;
    --portal-danger: #ba1a1a;
    --portal-success: #0f9d58;
    --portal-warning: #b96a14;
    --portal-border: rgba(19, 27, 46, 0.08);
    --portal-shadow: 0 24px 80px -32px rgba(19, 27, 46, 0.18);
    --portal-radius-xl: 28px;
    --portal-radius-lg: 22px;
    --portal-font-sans: 'Outfit', sans-serif;
    --portal-text-title-md: 36px;
    --portal-text-title-md-line: 44px;
    --portal-text-title-sm: 30px;
    --portal-text-title-sm-line: 38px;
    --portal-text-theme-xl: 20px;
    --portal-text-theme-xl-line: 30px;
    --portal-text-theme-sm: 14px;
    --portal-text-theme-sm-line: 20px;
    --portal-text-theme-xs: 12px;
    --portal-text-theme-xs-line: 18px;
}

:root[data-theme="dark"] {
    --portal-bg: #09111f;
    --portal-surface: #0f1b2d;
    --portal-surface-soft: #16253d;
    --portal-primary: #7eb6ff;
    --portal-primary-strong: #4f96ff;
    --portal-text: #edf3ff;
    --portal-text-muted: #9ba9c0;
    --portal-danger: #ff8d8d;
    --portal-success: #6fe2a2;
    --portal-warning: #f3b96f;
    --portal-border: rgba(161, 184, 224, 0.18);
    --portal-shadow: 0 26px 88px -42px rgba(0, 0, 0, 0.62);
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--portal-font-sans);
    background: radial-gradient(circle at top, rgba(0, 93, 181, 0.06), transparent 36%), var(--portal-bg);
    color: var(--portal-text);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: linear-gradient(180deg, #07101c 0%, #0a1422 100%);
    color: var(--portal-text);
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-family: var(--portal-font-sans); margin: 0; }
.public-shell { min-height: 100vh; padding: 32px; }
.hero-shell, .login-shell { max-width: 1280px; margin: 0 auto; }
.hero-shell { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; min-height: calc(100vh - 64px); }
.hero-panel, .login-card, .surface-card, .state-panel { background: var(--portal-surface); border-radius: var(--portal-radius-xl); box-shadow: var(--portal-shadow); }
.hero-panel { padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-panel--primary { background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-strong)); color: white; }
.hero-panel--primary h1 { font-size: clamp(2.8rem, 4vw, 4.4rem); line-height: 1.02; max-width: 10ch; }
.hero-panel--primary p { max-width: 34rem; color: rgba(255,255,255,0.84); font-size: 1.05rem; line-height: 1.7; }
.hero-brand, .hero-panel__eyebrow, .page-heading__eyebrow, .login-grid__eyebrow, .topbar-shell__crumbs { text-transform: uppercase; letter-spacing: .18em; font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); font-weight: 700; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 20px; }
.hero-stats div { display: flex; flex-direction: column; gap: 4px; }
.hero-stats strong { font-size: 1.9rem; }
.hero-stats span { font-size: .74rem; text-transform: uppercase; letter-spacing: .16em; opacity: .75; }
.hero-panel--surface { justify-content: center; gap: 20px; }
.hero-panel--surface h2 { font-size: 2.2rem; }
.hero-panel__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.login-shell { padding: 16px 0 40px; }
.login-shell__brand { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.login-shell__brand-mark, .sidebar-brand__mark, .topbar-user-pill__avatar, .profile-hero__avatar, .sidebar-user-card__avatar { width: 48px; height: 48px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-strong)); color: white; font-family: var(--portal-font-sans); font-weight: 700; }
.login-shell__brand-title, .sidebar-brand__title { font-family: var(--portal-font-sans); font-size: 1.4rem; font-weight: 700; }
.login-shell__brand-subtitle, .sidebar-brand__subtitle { font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); letter-spacing: .14em; text-transform: uppercase; color: var(--portal-text-muted); }
.login-grid { display: grid; grid-template-columns: 1.2fr .95fr; gap: 24px; }
.login-grid__hero { background: linear-gradient(135deg, #0b4f95, #003f7c); color: white; border-radius: var(--portal-radius-xl); padding: 42px; display: flex; flex-direction: column; justify-content: space-between; }
.login-grid__hero h1 { font-size: clamp(2.2rem, 3vw, 3.3rem); max-width: 12ch; line-height: 1.04; margin: 18px 0; }
.login-grid__hero p { font-size: var(--portal-text-theme-xl); line-height: var(--portal-text-theme-xl-line); color: rgba(255,255,255,.82); max-width: 34rem; }
.login-card { padding: 34px; align-self: center; }
.login-card__header h2 { font-size: var(--portal-text-title-sm); line-height: var(--portal-text-title-sm-line); margin-bottom: 8px; font-weight: 700; }
.login-card__header p { color: var(--portal-text-muted); margin: 0 0 20px; font-size: var(--portal-text-theme-sm); line-height: var(--portal-text-theme-sm-line); }
.login-card__cta { width: 100%; }
.login-card__divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--portal-text-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; }
.login-card__divider::before, .login-card__divider::after { content: ''; flex: 1; height: 1px; background: rgba(19,27,46,.12); }
.login-card__fields { display: grid; gap: 14px; }
.login-card__note { margin-top: 18px; font-size: .9rem; color: var(--portal-success); background: rgba(15,157,88,.08); padding: 14px 16px; border-radius: 14px; }
.portal-access-denied { min-height: calc(100vh - 64px); display: grid; align-items: center; }
.portal-access-denied__card { gap: 28px; }
.portal-access-denied__eyebrow { font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--portal-text-muted); margin-bottom: 10px; }
.portal-access-denied__actions { display: grid; gap: 12px; }
.portal-access-denied__actions .login-v2__access { text-decoration: none; }
.portal-button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 16px; font-weight: 700; border: 0; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.portal-button:hover { transform: translateY(-1px); }
.portal-button--primary { background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-strong)); color: #fff; box-shadow: 0 16px 40px -24px rgba(0, 72, 141, 0.65); }
.portal-button--secondary { background: rgba(0, 72, 141, 0.08); color: var(--portal-primary); }
.portal-button--danger { background: rgba(186, 26, 26, 0.08); color: var(--portal-danger); }
.portal-button--compact { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: .92rem; }
.portal-button--icon {
    min-height: 40px;
    width: 40px;
    padding: 0;
    border-radius: 12px;
}
.portal-button--icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.portal-field { display: grid; gap: 8px; }
.portal-field span { font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--portal-text-muted); }
.portal-field input { min-height: 52px; border: 1px solid rgba(19,27,46,.12); border-radius: 16px; padding: 0 16px; background: #f8fbff; color: var(--portal-text); font: inherit; }
.portal-field input:disabled { opacity: 1; color: rgba(19,27,46,.7); }
.co-closed-banner { display: grid; gap: 6px; margin-bottom: 20px; padding: 16px 18px; border-radius: 18px; border: 1px solid rgba(19,27,46,.12); background: #f5f8ff; color: var(--portal-text); }
.co-closed-banner strong { font-size: .95rem; }
.co-closed-banner span { color: var(--portal-text-muted); }
.co-closed-banner--locked { border-color: rgba(181, 44, 61, .24); background: rgba(181, 44, 61, .08); }
.co-closed-banner--editable { border-color: rgba(20, 86, 168, .18); background: rgba(20, 86, 168, .08); }
.co-editor-shell--readonly { pointer-events: none; user-select: none; }
.co-editor-shell--readonly .co-editor-fieldset { opacity: .72; }
.co-editor-fieldset { margin: 0; padding: 0; min-width: 0; border: 0; }
.portal-check { display: inline-flex; align-items: center; gap: 10px; color: var(--portal-text-muted); font-size: .94rem; }
/* Checkbox renderizado como toggle estilo Tailwind (track gris con ✕ apagado / índigo con ✓ encendido). */
.portal-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    margin: 0;
    border-radius: 999px;
    background-color: rgba(19, 27, 46, 0.16);
    cursor: pointer;
    transition: background-color .2s ease;
}
.portal-check input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px 11px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 3 9 9 M9 3 3 9' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    box-shadow: 0 1px 3px rgba(19, 27, 46, 0.28);
    transition: transform .2s ease;
}
.portal-check input[type="checkbox"]:checked {
    background-color: #4f46e5;
}
.portal-check input[type="checkbox"]:checked::before {
    transform: translateX(20px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 7.5 6 10.5 11 4.5' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.portal-check input[type="checkbox"]:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}
.portal-check input[type="checkbox"]:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.portal-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; padding: 4px 0 8px; }
.branch-pager { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 16px 4px 4px; }
.branch-pager__status { color: var(--portal-text-muted); font-size: .9rem; }
.portal-field__error { color: var(--portal-danger); font-size: .82rem; margin-top: 4px; }
.portal-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; color: var(--portal-text); font-size: .95rem; font-weight: 600; }
.portal-switch input { position: absolute; opacity: 0; pointer-events: none; }
.portal-switch__track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: rgba(19, 27, 46, 0.12); transition: background .2s ease; flex: 0 0 auto; }
.portal-switch__thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 999px; background-color: #fff; background-repeat: no-repeat; background-position: center; background-size: 11px 11px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 3 9 9 M9 3 3 9' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); box-shadow: 0 2px 6px rgba(19, 27, 46, 0.2); transition: transform .2s ease; }
.portal-switch input:checked + .portal-switch__track { background: #4f46e5; }
.portal-switch input:checked + .portal-switch__track .portal-switch__thumb { transform: translateX(20px); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 7.5 6 10.5 11 4.5' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.portal-switch__label { color: var(--portal-text-muted); font-weight: 600; }
.portal-switch--compact { gap: 10px; font-size: .88rem; }
.portal-switch--compact .portal-switch__track { width: 40px; height: 22px; }
.portal-switch--compact .portal-switch__thumb { width: 18px; height: 18px; }
.portal-switch--compact input:checked + .portal-switch__track .portal-switch__thumb { transform: translateX(18px); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar-shell { width: 290px; padding: 26px 18px; background: #e9eef6; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 0; min-height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-link { padding: 14px 18px; border-radius: 16px; font-weight: 600; color: var(--portal-text-muted); transition: .2s ease; }
.sidebar-link.active, .sidebar-link:hover { background: rgba(0, 72, 141, 0.12); color: var(--portal-primary); }
.sidebar-link--muted { background: rgba(255,255,255,0.35); }
.sidebar-link--danger { color: var(--portal-danger); }
.sidebar-footer { display: grid; gap: 16px; }
.sidebar-user-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: rgba(255,255,255,.72); border-radius: 18px; }
.sidebar-user-card__name { font-weight: 700; }
.sidebar-user-card__meta { font-size: .82rem; color: var(--portal-text-muted); }
.app-shell__main { flex: 1; min-width: 0; }
.topbar-shell { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 24px 32px 16px; background: linear-gradient(to bottom, rgba(243,246,251,.95), rgba(243,246,251,.72)); backdrop-filter: blur(10px); }
.topbar-shell__title { font-size: var(--portal-text-theme-xl); line-height: var(--portal-text-theme-xl-line); margin-top: 4px; font-weight: 600; }
.topbar-shell__actions { display: flex; align-items: center; gap: 16px; }
.topbar-search { min-width: 280px; }
.topbar-user-pill { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: rgba(255,255,255,.85); border-radius: 18px; }
.topbar-user-pill__avatar { width: 42px; height: 42px; font-size: .95rem; }
.topbar-user-pill__name { font-weight: 700; }
.topbar-user-pill__role { font-size: .8rem; color: var(--portal-text-muted); }
.app-shell__content { padding: 12px 32px 40px; }
.page-section { display: grid; gap: 24px; }
.page-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.page-heading h1 { font-size: clamp(2.3rem, 4vw, var(--portal-text-title-md)); line-height: clamp(3rem, 4.5vw, var(--portal-text-title-md-line)); font-weight: 700; }
.page-heading p { margin: 8px 0 0; color: var(--portal-text-muted); max-width: 52rem; font-size: var(--portal-text-theme-sm); line-height: var(--portal-text-theme-sm-line); }
.page-heading__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.metric-card { padding: 24px; background: white; border-radius: 24px; border: 1px solid var(--portal-border); }
.metric-card__label { font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); text-transform: uppercase; letter-spacing: .12em; color: var(--portal-text-muted); font-weight: 700; }
.metric-card__value { font-family: var(--portal-font-sans); font-size: clamp(2rem, 3vw, var(--portal-text-title-sm)); line-height: 1.1; margin: 12px 0 8px; font-weight: 700; }
.metric-card__caption { color: var(--portal-text-muted); line-height: 1.55; }
.metric-card--primary { background: linear-gradient(135deg, rgba(0,72,141,.08), white); }
.metric-card--success { background: linear-gradient(135deg, rgba(15,157,88,.08), white); }
.metric-card--danger { background: linear-gradient(135deg, rgba(186,26,26,.08), white); }
.home-page { min-height: 320px; display: grid; align-content: center; gap: 12px; padding: 40px; }
.home-page h1 { font-size: clamp(3rem, 7vw, 5.4rem); line-height: .95; max-width: 8ch; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); gap: 20px; }
.content-grid--profile, .content-grid--settings { grid-template-columns: minmax(0, 1fr); }
.side-stack, .settings-stack { display: grid; gap: 20px; }
.settings-stack--inline {
    grid-template-columns: repeat(auto-fit, minmax(260px, max-content));
    align-items: center;
    gap: 14px 24px;
}
.settings-stack--inline .portal-switch {
    min-height: 24px;
}
.surface-card { padding: 26px; border-radius: 26px; background: var(--portal-surface); border: 1px solid var(--portal-border); box-shadow: 0 18px 48px -38px rgba(19, 27, 46, .25); }
.surface-card--emphasis { background: linear-gradient(180deg, rgba(0,72,141,.98), rgba(0,95,184,.94)); color: white; }
.surface-card--danger { background: linear-gradient(180deg, rgba(186,26,26,.06), white); }
.surface-card__header { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 18px; }
.surface-card h2 { font-size: var(--portal-text-title-sm); line-height: var(--portal-text-title-sm-line); font-weight: 700; }
.surface-card p, .surface-card__text { color: var(--portal-text-muted); line-height: 1.6; }
.surface-card--emphasis p, .surface-card--emphasis li { color: rgba(255,255,255,.82); }
.posture-score { font-family: var(--portal-font-sans); font-size: 4rem; margin: 10px 0 14px; font-weight: 700; }
.bullet-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.portal-grid { border-radius: 18px; overflow: hidden; }
.checkpoint-list { display: grid; gap: 12px; }
.checkpoint-item { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(19,27,46,.08); }
.checkpoint-item:last-child { border-bottom: 0; }
.checkpoint-item__meta { color: var(--portal-text-muted); font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: var(--portal-text-theme-xs); line-height: var(--portal-text-theme-xs-line); letter-spacing: .08em; text-transform: uppercase; }
.status-pill--primary, .status-pill--neutral { background: rgba(0,72,141,.1); color: var(--portal-primary); }
.status-pill--success { background: rgba(15,157,88,.12); color: var(--portal-success); }
.status-pill--warning { background: rgba(185,106,20,.12); color: var(--portal-warning); }
.status-pill--danger { background: rgba(186,26,26,.12); color: var(--portal-danger); }
.profile-hero { display: flex; align-items: center; gap: 22px; }
.profile-hero__avatar { width: 92px; height: 92px; border-radius: 28px; font-size: 1.5rem; }
.profile-hero__content { flex: 1; display: grid; gap: 10px; }
.profile-hero__row { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.profile-hero__mail, .profile-hero__meta { color: var(--portal-text-muted); }
.profile-hero__meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .95rem; }
.settings-form { display: grid; gap: 22px; }
.settings-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 0; border-bottom: 1px solid rgba(19,27,46,.08); }
.settings-row--stacked { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 0; padding-top: 8px; }
.settings-row p { margin: 4px 0 0; }
.settings-actions { display: flex; gap: 12px; justify-content: end; margin-top: 18px; flex-wrap: wrap; }
.state-panel { padding: 28px; }
.state-panel__title { font-family: 'Manrope', sans-serif; font-size: 1.4rem; margin-bottom: 8px; }
.state-panel__text { color: var(--portal-text-muted); line-height: 1.6; }
.state-panel--loading { background: linear-gradient(135deg, rgba(0,72,141,.08), white); }
.state-panel--error { background: linear-gradient(135deg, rgba(186,26,26,.08), white); }
.state-panel--empty { background: linear-gradient(135deg, rgba(66,71,82,.08), white); }
.simple-state-page { min-height: 70vh; display: grid; place-content: center; gap: 14px; justify-items: start; max-width: 680px; margin: 0 auto; }
.simple-state-page p { color: var(--portal-text-muted); }
@media (max-width: 1180px) { .hero-shell, .login-grid, .content-grid { grid-template-columns: 1fr; } .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 920px) { .app-shell { display: block; } .sidebar-shell { position: static; width: auto; min-height: auto; } .topbar-shell, .app-shell__content, .public-shell { padding-left: 20px; padding-right: 20px; } .topbar-shell { flex-direction: column; align-items: stretch; } .topbar-search { min-width: 100%; } .page-heading { flex-direction: column; align-items: stretch; } }
@media (max-width: 640px) { .metrics-grid, .settings-row--stacked { grid-template-columns: 1fr; } .hero-panel, .login-grid__hero, .login-card, .surface-card { padding: 22px; } .hero-panel--primary h1, .login-grid__hero h1, .page-heading h1 { max-width: none; } .profile-hero, .profile-hero__row, .settings-row { flex-direction: column; align-items: stretch; } }
.branch-module {
    gap: 28px;
}
.branch-module__hero {
    margin-bottom: 4px;
}
.branch-filter-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(160px, .6fr)) auto auto;
    gap: 14px;
    align-items: center;
    padding: 20px;
    background: rgba(255,255,255,.7);
    border-radius: 24px;
    border: 1px solid var(--portal-border);
}
.branch-filter-bar__search {
    min-width: 0;
}
.branch-stat-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.branch-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr);
    gap: 22px;
    align-items: start;
}
.branch-content-grid--full {
    grid-template-columns: minmax(0, 1fr);
}
.branch-table-card {
    padding: 0;
    overflow: hidden;
}
.branch-table-wrap {
    overflow-x: auto;
}
/* Grilla ancha (reportes con muchas columnas): crece a su contenido y habilita scroll horizontal.
   Selector con doble clase para ganar especificidad sobre las reglas base de .branch-table. */
.branch-table.branch-table--wide {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}
.branch-table.branch-table--wide th,
.branch-table.branch-table--wide td {
    white-space: nowrap;
    word-break: normal;
    padding: 14px 18px;
}
.project-enable-users-table { width: min(50%, 620px); min-width: 460px; }
.user-projects-table { width: 100%; min-width: 0; }
.user-privilege-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}
.user-privilege-sidebar {
    display: grid;
    gap: 14px;
}
.user-privilege-role-list {
    display: grid;
    gap: 10px;
}
.user-privilege-role-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(19,27,46,.08);
    background: rgba(0,72,141,.04);
    color: var(--portal-text);
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
}
.user-privilege-role-button:hover,
.user-privilege-role-button.is-active {
    border-color: rgba(0,72,141,.18);
    background: rgba(0,72,141,.1);
    color: var(--portal-primary);
}
.user-privilege-role-meta {
    color: var(--portal-text-muted);
    font-size: .82rem;
    font-weight: 700;
}
.user-privilege-panel {
    min-width: 0;
}
.user-privilege-summary {
    display: grid;
    align-content: end;
    min-height: 100%;
}
.user-privilege-summary strong {
    display: block;
    padding: 13px 16px;
    border-radius: 16px;
    background: rgba(0,72,141,.06);
    color: var(--portal-text);
}
.user-privilege-row--section td {
    background: color-mix(in srgb, var(--portal-surface-soft) 84%, #eef4ff 16%);
    font-weight: 700;
}
.user-privilege-name {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-privilege-name--child {
    padding-left: 18px;
    position: relative;
}
.user-privilege-name--child::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: rgba(19,27,46,.28);
}
.portal-switch--solo {
    justify-content: center;
}
.portal-switch--solo .portal-switch__label {
    display: none;
}
.surface-card--nested {
    padding: 22px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--portal-surface) 92%, #eef4ff 8%);
}
.user-organization-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}
.user-organization-grid__actions {
    display: grid;
    gap: 12px;
}
.user-multi-select {
    min-height: 260px;
    padding-block: 10px;
}
.user-table td {
    vertical-align: middle;
}
.branch-form-grid--users {
    align-items: end;
}
.branch-form-grid__action {
    display: flex;
    align-items: end;
    min-height: 100%;
}
.branch-form-grid__action .portal-button {
    align-self: end;
}
.branch-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.branch-table__col--id {
    width: 124px;
}
.branch-table__col--client {
    width: 210px;
}
.branch-table__col--branch {
    width: 31%;
}
.branch-table__col--location {
    width: 18%;
}
.branch-table__col--contact {
    width: 140px;
}
.branch-table__col--details {
    width: 18%;
}
.branch-table__col--status {
    width: 170px;
}
.branch-table__col--actions {
    width: 190px;
}
.branch-table thead th {
    background: var(--portal-surface-soft);
    color: var(--portal-text-muted);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .7rem;
    text-align: left;
    padding: 18px 20px;
}
.branch-table tbody td {
    padding: 18px 20px;
    vertical-align: top;
    border-top: 1px solid rgba(19,27,46,.06);
}
.branch-table tbody tr {
    cursor: pointer;
    transition: background .2s ease;
}
.branch-table tbody tr:hover,
.branch-table tbody tr.is-selected {
    background: rgba(0,72,141,.04);
}
.branch-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 96px;
    min-width: 72px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0,72,141,.1);
    color: var(--portal-primary);
    font-weight: 800;
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
    box-sizing: border-box;
}
.branch-table__meta {
    color: var(--portal-text-muted);
    font-size: .82rem;
    margin-top: 4px;
}
.branch-table strong,
.branch-table td {
    word-break: break-word;
}
.branch-table__actions-cell {
    min-width: 150px;
}
.branch-table__actions {
    display: flex;
    gap: 8px;
    justify-content: end;
    flex-wrap: nowrap;
}
.branch-table__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border: 0;
    background: rgba(0,72,141,.08);
    color: var(--portal-primary);
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    min-width: 56px;
}
.branch-table__action--static {
    cursor: default;
}
.branch-table__action--danger {
    background: rgba(186,26,26,.08);
    color: var(--portal-danger);
}
.branch-detail-card__header,
.branch-component-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}
.branch-detail-card__empty p,
.branch-component-card__empty {
    color: var(--portal-text-muted);
}
.branch-detail-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.branch-detail-card__grid label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--portal-text-muted);
    margin-bottom: 6px;
    font-weight: 700;
}
.branch-detail-card__cv {
    margin-top: 24px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(15,157,88,.08);
}
.branch-editor-grid {
    display: grid;
    gap: 20px;
}
.branch-editor-page__full {
    grid-column: 1 / -1;
}
.branch-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.branch-form-grid--toggle-row {
    align-items: start;
}
.branch-form-grid__toggle {
    display: flex;
    align-items: center;
    min-height: 48px;
}
.branch-form-grid__spacer {
    min-height: 48px;
}
.branch-form-grid__wide {
    grid-column: span 2;
}
.branch-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}
.branch-select,
.branch-input {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid rgba(19,27,46,.12);
    background: #f8fbff;
    padding: 0 14px;
    font: inherit;
    color: var(--portal-text);
    width: 100%;
    box-sizing: border-box;
}
.branch-component-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.branch-component-card__adder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    gap: 12px;
    align-items: center;
}
.branch-component-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}
.branch-component-list__item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    background: rgba(0,72,141,.04);
    border-radius: 16px;
}
.branch-component-list__item span {
    display: block;
    color: var(--portal-text-muted);
    margin-top: 4px;
    font-size: .85rem;
}
@media (max-width: 1180px) {
    .branch-content-grid,
    .branch-component-grid,
    .branch-filter-bar,
    .branch-form-grid {
        grid-template-columns: 1fr;
    }
    .user-privilege-layout {
        grid-template-columns: 1fr;
    }
    .branch-form-grid__wide {
        grid-column: auto;
    }
}
.branch-module {
    gap: 24px;
}
.branch-module__hero {
    align-items: flex-end;
}
.branch-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
    gap: 22px;
    align-items: stretch;
}
.branch-filter-card {
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(244,248,255,.92));
    padding-bottom: 24px;
}
.branch-filter-card__header,
.branch-table-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 22px;
}
.branch-filter-card__header h2,
.branch-table-card__header h2 {
    font-size: 1.5rem;
    margin-top: 8px;
}
.branch-icon-button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 16px;
    background: rgba(0,72,141,.1);
    color: var(--portal-primary);
    cursor: pointer;
}
.branch-filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1.25fr) repeat(2, minmax(160px, .55fr)) minmax(180px, .6fr);
    gap: 16px;
    align-items: end;
    padding: 0;
    background: transparent;
    border: 0;
}
.branch-filter-bar--compact {
    grid-template-columns: minmax(260px, 1.35fr) minmax(180px, .7fr) minmax(180px, .7fr) minmax(180px, .7fr) auto;
}
.branch-filter-bar__footer {
    display: grid;
    gap: 14px;
    align-self: stretch;
    align-content: end;
}
.branch-filter-bar__footer--inline {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: flex-end;
    align-self: end;
    white-space: nowrap;
}
.branch-input-label {
    display: block;
    margin-bottom: 8px;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--portal-text-muted);
}
.branch-input,
.branch-select {
    min-height: 54px;
    border-radius: 18px;
    background: #f7f9ff;
}
.branch-table-card {
    padding: 24px 0 0;
}
.branch-table-card__header {
    padding: 0 24px 18px;
}
.branch-table-card__summary {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(0,72,141,.08);
    color: var(--portal-primary);
    font-weight: 700;
}
.branch-table-card__summary-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.report-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}
/* Separación extra antes de un subtítulo de sección (ej. "Kit de material publicitario"). */
.surface-card__header--gap {
    margin-top: 28px;
}
.report-placeholder {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 48px 24px;
}
.branch-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 24px 24px;
    border-top: 1px solid rgba(19,27,46,.06);
}
.branch-pagination__summary {
    color: var(--portal-text-muted);
    font-weight: 600;
}
.branch-pagination__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.branch-pagination__actions .portal-button {
    min-width: 48px;
    min-height: 42px;
    border-radius: 14px;
}
.branch-table thead th {
    font-size: .68rem;
    letter-spacing: .14em;
}
.branch-table tbody td {
    padding: 20px;
}
.branch-detail-card {
    position: sticky;
    top: 116px;
}
.branch-detail-card__empty h2 {
    margin: 10px 0 8px;
    font-size: 1.45rem;
}
.branch-detail-card__grid strong {
    display: block;
    line-height: 1.5;
}
.branch-table td .status-pill {
    white-space: nowrap;
    min-width: 108px;
}
.ticket-module {
    gap: 24px;
}

.ticket-module .branch-filter-card {
    padding: 18px 20px;
}

.ticket-module .branch-filter-card__header {
    margin-bottom: 12px;
}

.ticket-module .branch-filter-card__header h2 {
    margin-top: 4px;
}

.ticket-module .branch-filter-bar {
    gap: 14px;
}
.ticket-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.ticket-status-card {
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid var(--portal-border);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,248,255,.95));
    box-shadow: 0 18px 48px -38px rgba(19, 27, 46, .25);
    min-height: 112px;
}
.ticket-status-card__eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--portal-text-muted);
}
.ticket-status-card__count {
    font-family: 'Manrope', sans-serif;
    font-size: 1.8rem;
    margin: 8px 0 6px;
}
.ticket-status-card__name {
    font-weight: 700;
    line-height: 1.3;
    font-size: .98rem;
}
.ticket-status-card--success {
    background: linear-gradient(180deg, rgba(15,157,88,.10), #fff);
}
.ticket-status-card--danger {
    background: linear-gradient(180deg, rgba(186,26,26,.10), #fff);
}
.ticket-status-card--warning {
    background: linear-gradient(180deg, rgba(185,106,20,.10), #fff);
}
.ticket-status-card--primary {
    background: linear-gradient(180deg, rgba(0,72,141,.10), #fff);
}
.ticket-status-card--neutral {
    background: linear-gradient(180deg, rgba(102,112,133,.10), #fff);
}
.ticket-truncate-note {
    margin: 0 24px 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(185,106,20,.08);
    color: var(--portal-warning);
    font-weight: 600;
}
.ticket-table__ticket {
    font-weight: 800;
    color: var(--portal-primary);
}
.ticket-table__col--ticket {
    width: 170px;
}
.ticket-table__col--client {
    width: 210px;
}
.ticket-table__col--project {
    width: 220px;
}
.ticket-table__col--site {
    width: 240px;
}
.ticket-table__col--status {
    width: 220px;
}
.ticket-table__col--created {
    width: 110px;
}
.ticket-table__col--code {
    width: 170px;
}
.ticket-table__col--location {
    width: 170px;
}
.ticket-table__col--actions {
    width: 120px;
}
@media (max-width: 1180px) {
    .branch-overview-grid,
    .branch-filter-bar,
    .branch-content-grid,
    .user-organization-grid {
        grid-template-columns: 1fr;
    }
    .branch-detail-card {
        position: static;
    }
    .branch-table {
        table-layout: auto;
    }
    .ticket-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .branch-filter-bar__footer--inline {
        flex-wrap: wrap;
        justify-content: flex-start;
        white-space: normal;
    }
    .user-organization-grid__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .branch-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    .branch-pagination__actions {
        justify-content: flex-start;
    }
}
@media (max-width: 720px) {
    .settings-stack--inline {
        grid-template-columns: 1fr;
    }
    .ticket-status-grid {
        grid-template-columns: 1fr;
    }
}
.portal-admin-shell {
    display: flex;
    min-height: 100vh;
    background: #f9fafb;
}

.portal-admin-shell__overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 70;
}

.portal-admin-shell__overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.portal-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.42);
    z-index: 110;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 32px;
}

.portal-modal__card {
    width: min(960px, 100%);
    max-height: calc(100vh - 64px);
    overflow: auto;
    background: #fff;
    border: 1px solid #dbe3f0;
    border-radius: 28px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

.portal-modal--xl .portal-modal__card {
    width: min(1240px, 100%);
}

.portal-modal__header,
.portal-modal__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    border-bottom: 1px solid #e6edf7;
}

.portal-modal__footer {
    border-bottom: none;
    border-top: 1px solid #e6edf7;
}

.portal-modal__body {
    display: grid;
    gap: 18px;
    padding: 24px 28px 28px;
}

.bulk-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.bulk-upload-helper {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f5f9ff 0%, #eef4ff 100%);
    border: 1px solid #d8e5ff;
    color: #274374;
}

.bulk-upload-picker {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
    border: 1px dashed #b7c8e6;
    background: #fbfdff;
}

.bulk-upload-picker__filename {
    color: #667085;
    font-weight: 600;
}

.bulk-upload-feedback {
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 600;
}

.bulk-upload-feedback--success {
    background: #ecfdf3;
    color: #067647;
    border: 1px solid #abefc6;
}

.bulk-upload-feedback--error {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

.bulk-upload-log {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}

.bulk-upload-log__item {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: .95rem;
    line-height: 1.45;
}

.bulk-upload-log__item--success {
    background: #f2f9f5;
    color: #11633c;
}

.bulk-upload-log__item--error {
    background: #fff5f4;
    color: #b42318;
}

.bulk-upload-log__item--info {
    background: #f8fafc;
    color: #344054;
}

.bulk-upload-log__item--warning {
    background: #fff8ec;
    color: #b54708;
}

.ticket-workspace {
    display: grid;
    gap: 20px;
}

.ticket-workspace__summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.ticket-workspace__summary-card {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid #e4e7ec;
    background: #fff;
}

.ticket-workspace__summary-card--highlight {
    background: linear-gradient(135deg, #0b4f95, #003f7c);
    border-color: transparent;
    color: #fff;
}

.ticket-workspace__summary-card span,
.ticket-workspace__info-grid span,
.ticket-workspace__stack-head span {
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ticket-workspace__summary-card--highlight span {
    color: rgba(255,255,255,.74);
}

.ticket-workspace__summary-card strong {
    color: #101828;
    font-size: 1.08rem;
    line-height: 1.35;
    font-weight: 700;
}

.ticket-workspace__summary-card--highlight strong {
    color: #fff;
}

.ticket-workspace__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.ticket-workspace__section {
    display: grid;
    gap: 18px;
    padding: 22px;
    border-radius: 22px;
    border: 1px solid #e4e7ec;
    background: #fff;
}

.ticket-workspace__section--tracking {
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.ticket-workspace__tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 4px 4px;
    border-bottom: 1px solid #e4e7ec;
    overflow-x: auto;
    scrollbar-width: thin;
}

.ticket-workspace__tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 2px 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #667085;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, opacity .2s ease;
}

.ticket-workspace__tab:hover {
    color: #344054;
}

.ticket-workspace__tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background .2s ease;
}

.ticket-workspace__tab--active {
    color: #1d2939;
}

.ticket-workspace__tab--active::after {
    background: linear-gradient(135deg, #465fff, #335cff);
}

.ticket-workspace__tab--disabled {
    color: #b0b8c6;
    cursor: not-allowed;
    opacity: .75;
}

.ticket-workspace__tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: currentColor;
    flex: 0 0 22px;
}

.ticket-workspace__tab-icon svg {
    width: 100%;
    height: 100%;
}

.ticket-workspace__tab-label {
    line-height: 1;
}

.ticket-workspace__section--cv {
    background: linear-gradient(180deg, #fff9f3 0%, #ffffff 100%);
}

.ticket-workspace__section-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
}

.ticket-workspace__section-head h3 {
    color: #101828;
    font-size: 20px;
    line-height: 30px;
    font-weight: 600;
}

.ticket-workspace__flags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-workspace__flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 700;
    white-space: nowrap;
}

.ticket-workspace__flag--primary {
    background: #eef4ff;
    color: #175cd3;
}

.ticket-workspace__flag--warning {
    background: #fffaeb;
    color: #b54708;
}

.ticket-workspace__flag--danger {
    background: #fef3f2;
    color: #d92d20;
}

.ticket-workspace__flag--success {
    background: #ecfdf3;
    color: #027a48;
}

.ticket-workspace__flag--neutral {
    background: #f2f4f7;
    color: #344054;
}

.ticket-workspace__timeline {
    display: grid;
    gap: 14px;
}

.ticket-workspace__timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 14px;
}

.ticket-workspace__timeline-dot {
    width: 12px;
    height: 12px;
    margin-top: 7px;
    border-radius: 999px;
    background: #465fff;
    box-shadow: 0 0 0 5px rgba(70, 95, 255, 0.12);
}

.ticket-workspace__timeline-body {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid #e4e7ec;
    background: #fff;
}

.ticket-workspace__timeline-head,
.ticket-workspace__stack-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.ticket-workspace__timeline-head strong,
.ticket-workspace__stack-head strong,
.ticket-workspace__info-grid strong,
.ticket-workspace__movement-card strong,
.ticket-workspace__code-item strong {
    color: #101828;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 700;
}

.ticket-workspace__timeline-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: #667085;
    font-size: .92rem;
}

.ticket-workspace__info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.ticket-workspace__info-grid > div {
    display: grid;
    gap: 8px;
}

.ticket-workspace__info-grid-full {
    grid-column: 1 / -1;
}

.ticket-workspace__description,
.ticket-workspace__empty,
.ticket-workspace__movement-card span,
.ticket-workspace__code-item span,
.ticket-workspace__code-item p,
.ticket-workspace__stack-item p {
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: 1.65;
}

.ticket-workspace__code-list,
.ticket-workspace__stack {
    display: grid;
    gap: 12px;
}

.ticket-workspace__code-item,
.ticket-workspace__stack-item {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid #e4e7ec;
    background: #fff;
}

.ticket-workspace__movement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.ticket-workspace__movement-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid #e4e7ec;
    background: #fff;
}

.portal-sidebar {
    position: sticky;
    top: 0;
    width: 290px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e4e7ec;
    display: flex;
    flex-direction: column;
    z-index: 80;
}

.portal-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 32px 24px 24px;
}

.portal-sidebar__brand-mark,
.portal-header__user-avatar,
.portal-sidebar__user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #465fff, #3641f5);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
}

.portal-sidebar__brand-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #101828;
}

.portal-sidebar__brand-subtitle,
.portal-sidebar__group-title,
.branch-input-label {
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #98a2b3;
    font-weight: 700;
}

.portal-sidebar__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 16px 24px;
}

.portal-sidebar__group {
    margin-bottom: 12px;
}

.portal-sidebar__group-title {
    padding: 0 10px;
    margin-bottom: 10px;
}

.portal-sidebar__nav {
    display: grid;
    gap: 8px;
}

.portal-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 14px;
    color: #667085;
    font-size: var(--portal-text-theme-xl);
    line-height: var(--portal-text-theme-xl-line);
    font-weight: 500;
    transition: background .2s ease, color .2s ease;
}

.portal-sidebar__link.active,
.portal-sidebar__link:hover {
    background: #f2f4f7;
    color: #1d2939;
}

.portal-sidebar__icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex: 0 0 24px;
}

.portal-sidebar__icon svg,
.portal-header__menu-button svg,
.portal-header__icon-button svg,
.portal-header__search svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.portal-sidebar__footer {
    margin-top: auto;
    flex: 0 0 auto;
    padding: 18px 16px 24px;
    border-top: 1px solid #e4e7ec;
    display: grid;
    gap: 14px;
    background: inherit;
}

.portal-sidebar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    background: #fff;
}

.portal-sidebar__user-name,
.portal-header__user-name {
    font-weight: 700;
    color: #101828;
}

.portal-sidebar__user-role,
.portal-header__user-role {
    color: #667085;
    font-size: .86rem;
}

.portal-sidebar__signout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
    background: #101828;
    color: #fff;
    font-weight: 700;
}

.app-shell__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-header {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 81px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid #e4e7ec;
}

.portal-header__left,
.portal-header__right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.portal-header__menu-button,
.portal-header__icon-button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid #e4e7ec;
    color: #667085;
    cursor: pointer;
}

.portal-header__icon-button.is-active {
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-strong));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 16px 36px -24px rgba(0, 72, 141, 0.75);
}

.portal-header__menu-button {
    display: none;
}

.portal-header__search {
    min-width: min(430px, 48vw);
    height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid #e4e7ec;
    background: #fff;
    color: #98a2b3;
}

.portal-header__search svg {
    width: 18px;
    height: 18px;
}

.portal-header__search input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: #101828;
}

.portal-header__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 4px;
}

.app-shell__content {
    padding: 24px;
}

.page-section {
    max-width: 100%;
}

@media (max-width: 1024px) {
    .portal-header__menu-button {
        display: grid;
    }

    .portal-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 24px 80px -32px rgba(16, 24, 40, .45);
    }

    .portal-sidebar.is-open {
        transform: translateX(0);
    }
}

@media (max-width: 720px) {
    .portal-header {
        padding: 14px 16px;
    }

    .portal-header__search {
        min-width: 0;
        width: 100%;
    }

    .portal-header__right {
        gap: 10px;
    }

    .portal-header__user {
        display: none;
    }

    .app-shell__content {
        padding: 16px;
    }
}



html[data-theme="dark"] .portal-admin-shell {
    background: #09111f;
}

html[data-theme="dark"] .portal-sidebar {
    background: linear-gradient(180deg, rgba(10, 18, 32, 0.98), rgba(13, 24, 42, 0.96));
    border-right-color: rgba(161, 184, 224, 0.12);
}

html[data-theme="dark"] .portal-sidebar__group-title,
html[data-theme="dark"] .portal-sidebar__brand-subtitle,
html[data-theme="dark"] .portal-sidebar__user-role,
html[data-theme="dark"] .portal-header__user-role {
    color: var(--portal-text-muted);
}

html[data-theme="dark"] .portal-sidebar__brand-title,
html[data-theme="dark"] .portal-header__user-name,
html[data-theme="dark"] .portal-sidebar__user-name,
html[data-theme="dark"] .surface-card h2,
html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .branch-table strong,
html[data-theme="dark"] .ticket-table strong {
    color: var(--portal-text);
}

html[data-theme="dark"] .portal-sidebar__link {
    color: #b6c4db;
}

html[data-theme="dark"] .portal-sidebar__link.active,
html[data-theme="dark"] .portal-sidebar__link:hover {
    background: rgba(126, 182, 255, 0.16);
    color: var(--portal-primary);
}

html[data-theme="dark"] .portal-sidebar__user,
html[data-theme="dark"] .surface-card,
html[data-theme="dark"] .branch-table-card,
html[data-theme="dark"] .ticket-status-card,
html[data-theme="dark"] .portal-modal__card {
    background: var(--portal-surface);
    border-color: var(--portal-border);
    box-shadow: var(--portal-shadow);
}

html[data-theme="dark"] .portal-sidebar__signout {
    background: #17263d;
    color: var(--portal-text);
}

html[data-theme="dark"] .portal-header {
    background: rgba(9, 17, 31, 0.88);
    border-bottom-color: rgba(161, 184, 224, 0.12);
}

html[data-theme="dark"] .portal-header__menu-button,
html[data-theme="dark"] .portal-header__icon-button,
html[data-theme="dark"] .portal-header__search,
html[data-theme="dark"] .portal-modal__header,
html[data-theme="dark"] .portal-modal__footer,
html[data-theme="dark"] .branch-filter-bar,
html[data-theme="dark"] .bulk-upload-picker,
html[data-theme="dark"] .branch-component-item,
html[data-theme="dark"] .branch-component-picker select,
html[data-theme="dark"] .branch-component-picker input,
html[data-theme="dark"] select,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea {
    background: #0f1b2d;
    color: var(--portal-text);
    border-color: rgba(161, 184, 224, 0.14);
}

html[data-theme="dark"] .portal-button--secondary,
html[data-theme="dark"] .branch-table__action {
    background: rgba(126, 182, 255, 0.12);
    color: var(--portal-primary);
}

html[data-theme="dark"] .portal-header__icon-button.is-active {
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-strong));
    color: #07101c;
    border-color: transparent;
    box-shadow: 0 16px 36px -24px rgba(79, 150, 255, 0.8);
}

html[data-theme="dark"] .branch-table thead th,
html[data-theme="dark"] .ticket-table thead th,
html[data-theme="dark"] .portal-surface-soft {
    background: var(--portal-surface-soft);
}

html[data-theme="dark"] .branch-table tbody tr:hover,
html[data-theme="dark"] .branch-table tbody tr.is-selected,
html[data-theme="dark"] .ticket-table tbody tr:hover,
html[data-theme="dark"] .ticket-table tbody tr.is-selected {
    background: rgba(126, 182, 255, 0.06);
}

html[data-theme="dark"] .status-pill--neutral,
html[data-theme="dark"] .status-pill--primary {
    background: rgba(126, 182, 255, 0.16);
    color: var(--portal-primary);
}

html[data-theme="dark"] .ticket-workspace__tabs {
    border-bottom-color: rgba(161, 184, 224, 0.14);
}

html[data-theme="dark"] .ticket-workspace__tab {
    color: #98a5bb;
}

html[data-theme="dark"] .ticket-workspace__tab:hover,
html[data-theme="dark"] .ticket-workspace__tab--active {
    color: var(--portal-text);
}

html[data-theme="dark"] .ticket-workspace__tab--disabled {
    color: #66748a;
}

html[data-theme="dark"] .ticket-workspace__summary-card {
    background: #13233a;
    border-color: rgba(161, 184, 224, 0.14);
}

html[data-theme="dark"] .ticket-workspace__summary-card--highlight {
    background: linear-gradient(135deg, #335cff, #1f4acc);
    border-color: transparent;
}

html[data-theme="dark"] .ticket-workspace__summary-card span,
html[data-theme="dark"] .ticket-workspace__info-grid span,
html[data-theme="dark"] .ticket-workspace__stack-head span {
    color: #94a3b8;
}

html[data-theme="dark"] .ticket-workspace__summary-card strong,
html[data-theme="dark"] .ticket-workspace__section-head h3,
html[data-theme="dark"] .ticket-workspace__timeline-head strong,
html[data-theme="dark"] .ticket-workspace__stack-head strong,
html[data-theme="dark"] .ticket-workspace__info-grid strong,
html[data-theme="dark"] .ticket-workspace__movement-card strong,
html[data-theme="dark"] .ticket-workspace__code-item strong {
    color: var(--portal-text);
}

html[data-theme="dark"] .ticket-workspace__section {
    background: #0f1b2d;
    border-color: rgba(161, 184, 224, 0.14);
}

html[data-theme="dark"] .ticket-workspace__section--tracking {
    background: linear-gradient(180deg, rgba(19, 35, 58, 0.96) 0%, rgba(15, 27, 45, 1) 100%);
}

html[data-theme="dark"] .ticket-workspace__section--cv {
    background: linear-gradient(180deg, rgba(52, 39, 19, 0.34) 0%, rgba(15, 27, 45, 1) 100%);
}

html[data-theme="dark"] .ticket-workspace__timeline-body,
html[data-theme="dark"] .ticket-workspace__movement-card,
html[data-theme="dark"] .ticket-workspace__code-item,
html[data-theme="dark"] .ticket-workspace__stack-item,
html[data-theme="dark"] .ticket-workspace__task-card {
    background: #13233a;
    border-color: rgba(161, 184, 224, 0.14);
}

html[data-theme="dark"] .ticket-workspace__timeline-meta,
html[data-theme="dark"] .ticket-workspace__description,
html[data-theme="dark"] .ticket-workspace__empty,
html[data-theme="dark"] .ticket-workspace__movement-card span,
html[data-theme="dark"] .ticket-workspace__code-item span,
html[data-theme="dark"] .ticket-workspace__code-item p,
html[data-theme="dark"] .ticket-workspace__stack-item p,
html[data-theme="dark"] .ticket-workspace__task-state p,
html[data-theme="dark"] .ticket-workspace__task-card span {
    color: #9ba9c0;
}

html[data-theme="dark"] .ticket-workspace__timeline-dot {
    background: #7eb6ff;
    box-shadow: 0 0 0 5px rgba(126, 182, 255, 0.18);
}

html[data-theme="dark"] .ticket-workspace__flag--primary {
    background: rgba(126, 182, 255, 0.14);
    color: #9bc4ff;
}

html[data-theme="dark"] .ticket-workspace__flag--warning {
    background: rgba(243, 185, 111, 0.14);
    color: #f3c48e;
}

html[data-theme="dark"] .ticket-workspace__flag--danger {
    background: rgba(255, 141, 141, 0.14);
    color: #ffb1b1;
}

html[data-theme="dark"] .ticket-workspace__flag--success {
    background: rgba(111, 226, 162, 0.14);
    color: #8ce9b9;
}

html[data-theme="dark"] .ticket-workspace__flag--neutral {
    background: rgba(155, 169, 192, 0.16);
    color: #d2daea;
}

html[data-theme="dark"] .portal-field input::placeholder,
html[data-theme="dark"] .portal-header__search input::placeholder {
    color: #8696af;
}

.portal-notification-stack {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
}

.portal-notification {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 32px;
    align-items: start;
    gap: 14px;
    padding: 16px 16px 16px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(228, 231, 236, 0.9);
    box-shadow: 0 24px 48px -24px rgba(16, 24, 40, 0.28);
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

.portal-notification::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
    background: #ef4444;
}

.portal-notification--success::after {
    background: #16a34a;
}

.portal-notification--info::after {
    background: var(--portal-primary);
}

.portal-notification__icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #fef2f2;
    color: #ef4444;
}

.portal-notification--success .portal-notification__icon {
    background: #ecfdf3;
    color: #16a34a;
}

.portal-notification--info .portal-notification__icon {
    background: #eff6ff;
    color: var(--portal-primary);
}

.portal-notification__icon svg,
.portal-notification__close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.portal-notification__content {
    min-width: 0;
}

.portal-notification__title {
    color: #101828;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.2;
}

.portal-notification__message {
    margin-top: 6px;
    color: #667085;
    font-size: 0.98rem;
    line-height: 1.45;
}

.portal-notification__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #98a2b3;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.portal-notification__close:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #475467;
}

html[data-theme="dark"] .portal-notification {
    background: rgba(10, 18, 32, 0.96);
    border-color: rgba(161, 184, 224, 0.14);
    box-shadow: 0 28px 64px -30px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .portal-notification__title {
    color: var(--portal-text);
}

html[data-theme="dark"] .portal-notification__message {
    color: var(--portal-text-muted);
}

html[data-theme="dark"] .portal-notification__close {
    color: #94a3b8;
}

html[data-theme="dark"] .portal-notification__close:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

@media (max-width: 720px) {
    .portal-notification-stack {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 24px);
    }
}

.login-v2__error { margin-bottom: 16px; padding: 14px 16px; border-radius: 16px; background: rgba(220, 38, 38, .08); color: #b91c1c; font-weight: 600; }
.login-v2__mode-pill { display: inline-flex; align-items: center; margin-bottom: 16px; padding: 10px 14px; border-radius: 999px; background: rgba(12, 78, 150, .08); color: #0c4e96; font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-v2__access { border: none; cursor: pointer; font: inherit; }


/* Dynamic permission sidebar */
.portal-sidebar__brand-copy,
.portal-sidebar__user-copy {
    min-width: 0;
}

.portal-sidebar__empty {
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    color: #667085;
    font-size: .92rem;
}

.portal-sidebar__nav--collapsed {
    gap: 10px;
}

.portal-sidebar__link--collapsed {
    justify-content: center;
    padding: 0;
}

.portal-sidebar__role-group {
    display: grid;
    gap: 2px;
}

.portal-sidebar__role-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 6px 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #344054;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.portal-sidebar__role-content {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.portal-sidebar__role-button:hover {
    background: #f8fafc;
    color: #1d2939;
}

.portal-sidebar__role-group.is-expanded .portal-sidebar__role-button {
    background: #eef4ff;
    color: #194185;
    box-shadow: inset 0 0 0 1px rgba(70, 95, 255, 0.06);
}

.portal-sidebar__nav--hierarchy {
    gap: 10px;
    padding-left: 28px;
}

.portal-sidebar__role-group > .portal-sidebar__nav {
    margin-top: -2px;
}

.portal-sidebar__category {
    display: grid;
    gap: 8px;
}

.portal-sidebar__category-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 0 10px 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #475467;
    font-size: var(--portal-text-theme-xl);
    line-height: var(--portal-text-theme-xl-line);
    font-weight: 500;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.portal-sidebar__category-button:hover,
.portal-sidebar__category.is-expanded .portal-sidebar__category-button {
    background: transparent;
    color: #1d2939;
}

.portal-sidebar__category-content {
    display: inline-flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}

.portal-sidebar__chevron {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    color: currentColor;
    transition: transform .2s ease;
}

.portal-sidebar__chevron svg {
    width: 20px;
    height: 20px;
}

.portal-sidebar__role-group.is-expanded > .portal-sidebar__role-button .portal-sidebar__chevron,
.portal-sidebar__category.is-expanded .portal-sidebar__chevron {
    transform: rotate(180deg);
}

.portal-sidebar__children {
    display: grid;
    gap: 6px;
    padding-left: 16px;
    margin-left: 12px;
}

.portal-sidebar__sublink {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border-radius: 12px;
    color: #667085;
    font-size: var(--portal-text-theme-xl);
    line-height: var(--portal-text-theme-xl-line);
    font-weight: 500;
}

.portal-sidebar__sublink.active,
.portal-sidebar__sublink:hover {
    background: #f2f4f7;
    color: #1d2939;
}

.portal-sidebar__sublink-text {
    min-width: 0;
}

.portal-sidebar__badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eff8ff;
    color: #175cd3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 800;
}

.portal-sidebar__badge--danger {
    background: #fef3f2;
    color: #d92d20;
}

.portal-sidebar.is-collapsed {
    width: 92px;
}

.portal-sidebar.is-collapsed .portal-sidebar__brand,
.portal-sidebar.is-collapsed .portal-sidebar__footer {
    padding-left: 16px;
    padding-right: 16px;
}

.portal-sidebar.is-collapsed .portal-sidebar__brand-copy,
.portal-sidebar.is-collapsed .portal-sidebar__group-title,
.portal-sidebar.is-collapsed .portal-sidebar__role-button,
.portal-sidebar.is-collapsed .portal-sidebar__group,
.portal-sidebar.is-collapsed .portal-sidebar__user-copy,
.portal-sidebar.is-collapsed .portal-sidebar__signout {
    display: none;
}

.portal-sidebar.is-collapsed .portal-sidebar__footer {
    justify-items: center;
}

.portal-sidebar.is-collapsed .portal-sidebar__user {
    justify-content: center;
    width: 100%;
    padding: 10px;
}

.portal-sidebar.is-collapsed .portal-sidebar__scroll {
    padding-left: 12px;
    padding-right: 12px;
}

.portal-sidebar.is-collapsed .portal-sidebar__brand {
    justify-content: center;
}

html[data-theme="dark"] .portal-sidebar__empty {
    background: rgba(255,255,255,0.04);
    color: #98a2b3;
}

html[data-theme="dark"] .portal-sidebar__role-button,
html[data-theme="dark"] .portal-sidebar__category-button,
html[data-theme="dark"] .portal-sidebar__sublink {
    color: #cfd6e4;
}

html[data-theme="dark"] .portal-sidebar__role-button:hover {
    background: rgba(255,255,255,0.04);
}

html[data-theme="dark"] .portal-sidebar__role-group.is-expanded .portal-sidebar__role-button {
    background: rgba(126, 182, 255, 0.16);
    color: #ffffff;
}

html[data-theme="dark"] .portal-sidebar__category-button:hover,
html[data-theme="dark"] .portal-sidebar__category.is-expanded .portal-sidebar__category-button,
html[data-theme="dark"] .portal-sidebar__sublink.active,
html[data-theme="dark"] .portal-sidebar__sublink:hover {
    background: transparent;
    color: #ffffff;
}

html[data-theme="dark"] .portal-sidebar__role-group.is-expanded .portal-sidebar__role-button,
html[data-theme="dark"] .portal-sidebar__role-button:hover {
    color: #ffffff;
}

html[data-theme="dark"] .portal-sidebar__badge {
    background: rgba(23,92,211,0.18);
    color: #9cc3ff;
}

html[data-theme="dark"] .portal-sidebar__badge--danger {
    background: rgba(217,45,32,0.18);
    color: #ffb3ad;
}

@media (max-width: 1180px) {
    .portal-sidebar.is-collapsed {
        width: 290px;
    }

    .portal-sidebar.is-collapsed .portal-sidebar__brand-copy,
    .portal-sidebar.is-collapsed .portal-sidebar__group-title,
    .portal-sidebar.is-collapsed .portal-sidebar__role-title,
    .portal-sidebar.is-collapsed .portal-sidebar__group,
    .portal-sidebar.is-collapsed .portal-sidebar__user-copy,
    .portal-sidebar.is-collapsed .portal-sidebar__signout {
        display: initial;
    }
}

.dashboard-neo {
    gap: 24px;
}

.dashboard-neo__hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-neo__eyebrow {
    margin-bottom: 10px;
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.dashboard-neo__hero h1 {
    font-size: var(--portal-text-title-md);
    line-height: var(--portal-text-title-md-line);
    font-weight: 700;
    color: #101828;
}

.dashboard-neo__hero p {
    margin-top: 10px;
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    max-width: 680px;
}

.dashboard-neo__hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-neo__ghost-button,
.dashboard-neo__primary-button,
.dashboard-neo__filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    min-height: 44px;
    padding: 0 18px;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.dashboard-neo__ghost-button {
    background: #ffffff;
    border-color: #d0d5dd;
    color: #344054;
}

.dashboard-neo__ghost-button:hover,
.dashboard-neo__filter-button:hover {
    background: #f9fafb;
    color: #1d2939;
}

.dashboard-neo__primary-button {
    background: #465fff;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(70, 95, 255, 0.2);
}

.dashboard-neo__primary-button:hover {
    transform: translateY(-1px);
    background: #3647d8;
}

.dashboard-neo__primary-button:disabled {
    opacity: .72;
    cursor: default;
    transform: none;
}

.dashboard-neo__metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-neo__metric-card,
.dashboard-neo__panel {
    border: 1px solid #e4e7ec;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 16px 38px rgba(16, 24, 40, 0.06);
}

.dashboard-neo__metric-card {
    padding: 20px;
}

.dashboard-neo__metric-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: #f2f4f7;
    color: #101828;
}

.dashboard-neo__metric-icon svg {
    width: 24px;
    height: 24px;
}

.dashboard-neo__metric-footer {
    margin-top: 20px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
}

.dashboard-neo__metric-label {
    display: block;
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
}

.dashboard-neo__metric-card h4 {
    margin-top: 8px;
    color: #101828;
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
}

.dashboard-neo__metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-neo__metric-badge svg {
    width: 12px;
    height: 12px;
}

.dashboard-neo__metric-badge--success {
    background: #ecfdf3;
    color: #039855;
}

.dashboard-neo__metric-badge--danger {
    background: #fef3f2;
    color: #d92d20;
}

.dashboard-neo__metric-badge--info,
.dashboard-neo__metric-badge--neutral {
    background: #eef4ff;
    color: #465fff;
}

.dashboard-neo__top-grid,
.dashboard-neo__bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(360px, .92fr);
    gap: 20px;
}

.dashboard-neo__panel {
    padding: 20px;
}

.dashboard-neo__panel--chart {
    overflow: hidden;
}

.dashboard-neo__panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-neo__panel-head--stack {
    align-items: center;
}

.dashboard-neo__panel-head h3 {
    color: #101828;
    font-size: 20px;
    line-height: 30px;
    font-weight: 600;
}

.dashboard-neo__panel-head p {
    margin-top: 4px;
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
}

.dashboard-neo__panel-menu {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: #98a2b3;
}

.dashboard-neo__panel-menu:hover {
    background: #f9fafb;
    color: #344054;
}

.dashboard-neo__panel-menu svg {
    width: 24px;
    height: 24px;
}

.dashboard-neo__bars-wrap {
    display: grid;
    gap: 16px;
}

.dashboard-neo__bar-row {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(0, 1.5fr) auto;
    align-items: center;
    gap: 14px;
}

.dashboard-neo__bar-meta {
    display: grid;
    gap: 2px;
}

.dashboard-neo__bar-meta strong {
    color: #101828;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
}

.dashboard-neo__bar-meta span {
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
}

.dashboard-neo__bar-track {
    height: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
}

.dashboard-neo__bar {
    display: block;
    height: 10px;
    border-radius: 999px;
}

.dashboard-neo__bar--read {
    background: #465fff;
}

.dashboard-neo__bar--insert {
    background: #12b76a;
}

.dashboard-neo__bar--update {
    background: #f79009;
}

.dashboard-neo__bar-values {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #667085;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    white-space: nowrap;
}

.dashboard-neo__panel--target {
    padding: 0;
    background: #f2f4f7;
}

.dashboard-neo__target-card {
    padding: 20px 20px 18px;
    border-radius: 20px;
    background: #ffffff;
}

.dashboard-neo__target-ring-wrap {
    position: relative;
    display: grid;
    place-items: center;
    margin: 4px 0 12px;
}

.dashboard-neo__target-ring {
    width: 208px;
    height: 208px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#465fff 0 calc(var(--progress) * 1%), #d0d5dd calc(var(--progress) * 1%) 100%);
}

.dashboard-neo__target-ring-core {
    width: 160px;
    height: 160px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffffff;
    text-align: center;
}

.dashboard-neo__target-ring-core span {
    color: #667085;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dashboard-neo__target-ring-core strong {
    color: #101828;
    font-size: 36px;
    line-height: 44px;
    font-weight: 700;
}

.dashboard-neo__target-pill {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 0 14px;
    background: #ecfdf3;
    color: #039855;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
}

.dashboard-neo__target-copy {
    max-width: 360px;
    margin: 0 auto;
    text-align: center;
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
}

.dashboard-neo__target-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 16px 20px 18px;
}

.dashboard-neo__target-stat {
    display: grid;
    gap: 6px;
    text-align: center;
}

.dashboard-neo__target-stat span {
    color: #667085;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
}

.dashboard-neo__target-stat strong {
    color: #101828;
    font-size: 18px;
    line-height: 28px;
    font-weight: 600;
}

.dashboard-neo__segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 12px;
    background: #f2f4f7;
}

.dashboard-neo__segmented button {
    min-height: 36px;
    border: 0;
    border-radius: 10px;
    padding: 0 14px;
    background: transparent;
    color: #667085;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 500;
}

.dashboard-neo__segmented button.is-active {
    background: #ffffff;
    color: #101828;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.dashboard-neo__trend-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 16px;
    min-height: 260px;
    align-items: end;
}

.dashboard-neo__trend-column {
    display: grid;
    gap: 12px;
    justify-items: center;
}

.dashboard-neo__trend-bars {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
}

.dashboard-neo__trend-bar {
    width: min(26px, 26%);
    border-radius: 10px 10px 4px 4px;
}

.dashboard-neo__trend-bar--read {
    background: #465fff;
}

.dashboard-neo__trend-bar--insert {
    background: rgba(70, 95, 255, 0.18);
}

.dashboard-neo__trend-bar--update {
    background: #c7d7fe;
}

.dashboard-neo__trend-label {
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 600;
}

.dashboard-neo__checkpoint-list {
    display: grid;
    gap: 18px;
}

.dashboard-neo__checkpoint-item {
    display: grid;
    gap: 10px;
}

.dashboard-neo__checkpoint-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.dashboard-neo__checkpoint-main strong {
    color: #101828;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
}

.dashboard-neo__checkpoint-main span {
    display: block;
    margin-top: 2px;
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
}

.dashboard-neo__checkpoint-progress {
    min-width: 140px;
    display: grid;
    gap: 6px;
}

.dashboard-neo__checkpoint-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #eaecf0;
    overflow: hidden;
}

.dashboard-neo__checkpoint-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #465fff;
}

.dashboard-neo__checkpoint-progress p {
    margin: 0;
    text-align: right;
    color: #667085;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 600;
}

.dashboard-neo__filter-button {
    background: #ffffff;
    border-color: #d0d5dd;
    color: #344054;
}

.dashboard-neo__table-wrap {
    overflow-x: auto;
}

.dashboard-neo__table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.dashboard-neo__table th {
    padding: 14px 16px;
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid #eaecf0;
}

.dashboard-neo__table td {
    padding: 16px;
    color: #344054;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    border-bottom: 1px solid #f2f4f7;
}

.dashboard-neo__table-job {
    display: grid;
    gap: 2px;
}

.dashboard-neo__table-job strong {
    color: #101828;
    font-size: var(--portal-text-theme-sm);
    line-height: var(--portal-text-theme-sm-line);
    font-weight: 600;
}

.dashboard-neo__table-job span {
    color: #98a2b3;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
}

.dashboard-neo__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: var(--portal-text-theme-xs);
    line-height: var(--portal-text-theme-xs-line);
    font-weight: 700;
}

.dashboard-neo__status--success {
    background: #ecfdf3;
    color: #027a48;
}

.dashboard-neo__status--warning {
    background: #fffaeb;
    color: #b54708;
}

.dashboard-neo__status--danger {
    background: #fef3f2;
    color: #b42318;
}

.dashboard-neo__status--neutral {
    background: #f2f4f7;
    color: #344054;
}

html[data-theme="dark"] .dashboard-neo__metric-card,
html[data-theme="dark"] .dashboard-neo__panel,
html[data-theme="dark"] .dashboard-neo__target-card {
    border-color: rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    box-shadow: none;
}

html[data-theme="dark"] .dashboard-neo__panel--target {
    background: rgba(255,255,255,0.03);
}

html[data-theme="dark"] .dashboard-neo__hero h1,
html[data-theme="dark"] .dashboard-neo__panel-head h3,
html[data-theme="dark"] .dashboard-neo__metric-card h4,
html[data-theme="dark"] .dashboard-neo__target-ring-core strong,
html[data-theme="dark"] .dashboard-neo__target-stat strong,
html[data-theme="dark"] .dashboard-neo__table-job strong,
html[data-theme="dark"] .dashboard-neo__checkpoint-main strong {
    color: #f8fafc;
}

html[data-theme="dark"] .dashboard-neo__hero p,
html[data-theme="dark"] .dashboard-neo__panel-head p,
html[data-theme="dark"] .dashboard-neo__metric-label,
html[data-theme="dark"] .dashboard-neo__target-copy,
html[data-theme="dark"] .dashboard-neo__target-stat span,
html[data-theme="dark"] .dashboard-neo__table td,
html[data-theme="dark"] .dashboard-neo__checkpoint-progress p {
    color: #98a2b3;
}

html[data-theme="dark"] .dashboard-neo__metric-icon,
html[data-theme="dark"] .dashboard-neo__segmented,
html[data-theme="dark"] .dashboard-neo__ghost-button,
html[data-theme="dark"] .dashboard-neo__filter-button {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
    color: #e4e7ec;
}

html[data-theme="dark"] .dashboard-neo__segmented button.is-active,
html[data-theme="dark"] .dashboard-neo__target-ring-core {
    background: #0f172a;
    color: #ffffff;
}

html[data-theme="dark"] .dashboard-neo__checkpoint-track {
    background: rgba(255,255,255,0.08);
}

html[data-theme="dark"] .dashboard-neo__table th,
html[data-theme="dark"] .dashboard-neo__table td {
    border-bottom-color: rgba(255,255,255,0.08);
}

@media (max-width: 1280px) {
    .dashboard-neo__metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-neo__top-grid,
    .dashboard-neo__bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-neo__hero {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-neo__hero-actions {
        justify-content: stretch;
    }

    .dashboard-neo__hero-actions > * {
        flex: 1 1 0;
    }

    .dashboard-neo__metric-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-neo__bar-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .dashboard-neo__panel-head--stack {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-neo__trend-chart {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-neo__checkpoint-main {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ====== Comentarios (tracking interno) — usado por Continuidad y Gestión CV ====== */
.branch-input--textarea {
    min-height: 122px;
    padding: 14px 16px;
    resize: vertical;
    line-height: 1.5;
}

.branch-input--textarea:focus,
.branch-input--textarea:focus-visible {
    outline: none;
    border-color: rgba(19, 27, 46, 0.18);
    box-shadow: none;
}

.co-comments {
    display: grid;
    gap: 18px;
}

.co-comments__composer {
    display: grid;
    gap: 14px;
}

.co-comments__actions {
    display: flex;
    justify-content: flex-end;
}

.co-comments__list {
    display: grid;
    gap: 12px;
}

.co-comments__item {
    border: 1px solid rgba(19, 27, 46, 0.1);
    border-radius: 18px;
    padding: 16px 18px;
    background: #f7f9ff;
    min-width: 0;
    overflow-wrap: anywhere;
}

.co-comments__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.92rem;
    color: var(--portal-muted);
}

.co-comments__text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.55;
    color: var(--portal-text);
}

html[data-theme="dark"] .co-comments__item {
    background: linear-gradient(180deg, rgba(21, 39, 64, 0.96) 0%, rgba(16, 30, 50, 1) 100%);
    border-color: rgba(126, 182, 255, 0.14);
}
