:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-strong: #f0f4f8;
    --ink: #0f1728;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #1a6b82;
    --primary-soft: #e0f2fe;
    --accent: #f97316;
    --accent-soft: #fff7ed;
    --danger: #dc2626;
    --success: #16a34a;
    --shadow-sm: 0 1px 3px rgba(15, 23, 40, 0.06), 0 1px 2px rgba(15, 23, 40, 0.04);
    --shadow: 0 4px 16px rgba(15, 23, 40, 0.08), 0 1px 4px rgba(15, 23, 40, 0.04);
    --shadow-lg: 0 12px 40px rgba(15, 23, 40, 0.10), 0 2px 8px rgba(15, 23, 40, 0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f5f7fa;
    color: var(--ink);
    letter-spacing: -0.01em;
}

[hidden] {
    display: none !important;
}

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

body:has(.app-frame) {
    background: #f1f5f9;
}

body:has(.login-screen) {
    background: #13040a;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #172126;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px #e8f4fb;
}

main:focus {
    outline: none;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9999;
    transform: translateY(-140%);
    padding: 12px 16px;
    border-radius: 8px;
    background: #172126;
    color: #fff;
    font-weight: 400;
    transition: transform 120ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    background: rgba(247, 244, 238, 0.88);
    border-bottom: 1px solid rgba(221, 211, 196, 0.75);
}

.header-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand strong,
.panel h2,
.hero h1,
.section-title {
    font-family: inherit;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #113f52);
    color: white;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.brand-logo {
    display: block;
    width: 126px;
    height: 52px;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 4px 8px rgba(24, 33, 38, 0.1));
}

.app-frame {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    padding: 22px 14px;
    background: linear-gradient(180deg, #0b1220 0%, #111827 58%, #0f172a 100%);
    box-shadow: 18px 0 46px rgba(15, 23, 42, 0.16);
}

.sidebar-brand {
    width: 100%;
    min-height: 88px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 8px 10px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
    transition: opacity 160ms ease;
}

.sidebar-brand:hover {
    opacity: 0.9;
}

.sidebar-brand .brand-logo {
    width: min(100%, 178px);
    height: 70px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.22));
    box-shadow: none;
}

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

.sidebar-brand strong {
    display: block;
    max-width: 230px;
    color: #f8fafc;
    font-size: 1.05rem;
    line-height: 1.18;
}

.sidebar-brand small {
    margin-top: 4px;
    color: rgba(248, 250, 252, 0.72);
    font-weight: 400;
}

.sidebar-nav {
    display: grid;
    align-content: start;
    gap: 4px;
    overflow-y: auto;
    padding: 0 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.34) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.34);
    border-radius: 999px;
}

.sidebar-nav a,
.sidebar-nav summary {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    color: rgba(226, 232, 240, 0.84);
    font-weight: 400;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-nav summary {
    cursor: pointer;
    list-style: none;
    justify-content: space-between;
}

.sidebar-nav summary::after {
    content: "›";
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    margin-left: 10px;
    border-radius: 10px;
    color: rgba(226, 232, 240, 0.78);
    background: rgba(148, 163, 184, 0.12);
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.sidebar-nav summary::-webkit-details-marker {
    display: none;
}

.sidebar-nav details {
    display: grid;
    gap: 4px;
    overflow: hidden;
    padding: 3px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
}

.sidebar-nav details[open] {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
}

.sidebar-nav details[open] summary {
    background: rgba(20, 184, 166, 0.14);
    color: #f8fafc;
}

.sidebar-nav details[open] summary::after {
    transform: rotate(90deg);
    background: rgba(20, 184, 166, 0.18);
    color: #99f6e4;
}

.sidebar-nav details a {
    margin-left: 0;
    padding-left: 16px;
    min-height: 40px;
    border-radius: 10px;
    font-weight: 400;
    font-size: 0.93rem;
}

.sidebar-nav a:hover,
.sidebar-nav summary:hover,
.sidebar-nav a.active {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    box-shadow: none;
}

.sidebar-nav a.active {
    background: #ffffff;
    color: #0f172a;
}

.sidebar-footer {
    display: grid;
    gap: 8px;
    padding: 14px 4px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.sidebar-footer small {
    color: rgba(203, 213, 225, 0.72);
}

.sidebar-footer strong {
    color: #f8fafc;
    font-size: 0.95rem;
}

.sidebar-user {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.sidebar-user strong,
.sidebar-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user span {
    color: rgba(203, 213, 225, 0.72);
    font-size: 0.84rem;
    font-weight: 400;
}

.sidebar-footer .button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
    color: #f8fafc;
}

.content-frame {
    width: min(1160px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 0 64px;
}

.brand small,
.panel-heading p,
.hero p,
.stat-card p,
.meta,
.empty-state {
    display: block;
    color: var(--muted);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.page-shell {
    padding: 28px 0 56px;
}

.hero,
.panel,
.stat-card,
.metric-card,
.subpanel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.hero {
    padding: 32px 36px;
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
    background:
        linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
    border-left: 4px solid var(--accent);
}

.login-screen {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 40px 16px;
}

.login-bg,
.login-overlay,
.login-radial {
    position: absolute;
    inset: 0;
}

.login-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.login-overlay {
    background: linear-gradient(120deg, rgba(26, 4, 12, 0.74), rgba(96, 29, 47, 0.24) 46%, rgba(12, 2, 8, 0.68));
}

.login-radial {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 42%);
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
    padding: 32px;
    border: 1px solid rgba(176, 84, 19, 0.42);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(238, 238, 238, 0.92) 54%, rgba(76, 76, 76, 0.9) 100%);
    box-shadow: 0 26px 80px -34px rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(14px);
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.login-logo {
    display: block;
    width: 100%;
    max-height: 128px;
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.18));
}

.login-card .stack {
    gap: 16px;
}

.login-card label {
    color: #2f2f2f;
    font-size: 0.9rem;
}

.login-card input {
    min-height: 44px;
    border-color: rgba(176, 84, 19, 0.46);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: #1f1f1f;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    outline: none;
}

.login-card input:focus {
    border-color: rgba(199, 83, 9, 0.88);
    box-shadow: 0 0 0 4px rgba(199, 83, 9, 0.2);
}

.login-card button {
    min-height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #8a3208, #c75309 54%, #9d3b08);
    color: white;
    box-shadow: 0 18px 28px rgba(138, 50, 8, 0.28);
}

.login-card button:hover {
    background: linear-gradient(135deg, #9d3b08, #dd6b19 54%, #8a3208);
}

.login-card .alert {
    margin-bottom: 16px;
    border-radius: 8px;
    background: #fce9e8;
    border-color: #e0b4af;
    color: #7f1d1d;
}

.login-card .error-list {
    margin-bottom: 0;
}

.hero:has(.hero-actions) {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.hero-actions,
.button-row,
.split-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button,
button,
input[type="submit"] {
    appearance: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: background 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    white-space: nowrap;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: #1a7d98;
    box-shadow: 0 2px 8px rgba(26, 107, 130, 0.28);
}

.button-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.button-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: none;
}

.button-accent {
    background: var(--accent);
    border-color: transparent;
}

.button-accent:hover {
    background: #ea6c0a;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.30);
}

.button-danger {
    background: var(--danger);
    border-color: transparent;
}

.button-danger:hover {
    background: #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}

.button-small {
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.8rem;
}

.process-actions {
    align-items: center;
}

.analysis-subtabs {
    display: grid;
    gap: 16px;
}

.analysis-subtab-panels {
    display: grid;
    gap: 16px;
}

.operational-timeline-panel {
    margin-top: 16px;
}

.operational-timeline-panel details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style-position: inside;
}

.operational-timeline-panel details > summary strong,
.operational-timeline-panel details > summary .meta {
    display: block;
}

.operational-timeline-panel .operational-timeline {
    margin-top: 16px;
}

.document-checklist-actions {
    gap: 8px;
}

.document-review-panel {
    margin: 0 0 16px;
}

.document-review-list {
    display: grid;
    gap: 10px;
}

.document-review-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.document-review-summary {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
}

.document-review-badges,
.document-review-actions,
.document-review-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.document-review-quick-actions {
    padding: 0 14px 12px;
}

.document-review-details {
    display: grid;
    gap: 12px;
    padding: 0 14px 14px;
}

.document-review-details > summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 400;
}

.document-review-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.document-review-metadata p {
    margin: 0;
}

.document-review-metadata strong,
.document-review-metadata span {
    display: block;
}

.document-review-form {
    gap: 8px;
}

.alert {
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-success {
    background: #e8f5ee;
    border-color: #b0dbbf;
    color: var(--success);
}

.alert-danger {
    background: #fce9e8;
    border-color: #e0b4af;
    color: var(--danger);
}

.alert-info {
    background: #eef7f4;
    border-color: #c1d8d2;
    color: var(--primary);
}

.error-list {
    margin: 8px 0 0;
    padding-left: 18px;
}

.grid,
.stats-grid {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 22px;
}

.stat-card,
.metric-card {
    min-height: 136px;
    padding: 22px 20px;
}

.stat-card strong,
.metric-card strong {
    display: block;
    margin-bottom: 12px;
    color: #0f172a;
    font-size: clamp(1.8rem, 2vw, 2.25rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-card p,
.metric-card p {
    margin: 0;
    color: #475467;
    line-height: 1.35;
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.panel-heading {
    margin-bottom: 18px;
}

.panel-heading h2 {
    color: #0f172a;
    font-size: clamp(1.1rem, 1.7vw, 1.45rem);
    line-height: 1.18;
}

.panel-heading p {
    max-width: 680px;
    line-height: 1.45;
}

.stack {
    display: grid;
    gap: 18px;
}

.subpanel {
    padding: 18px;
    margin-bottom: 12px;
}

.dossier-tabs {
    display: grid;
    gap: 16px;
}

.tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
}

.tab-button {
    min-height: 38px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 0.92rem;
}

.tab-button:hover,
.tab-button:focus-visible {
    background: var(--surface);
    border-color: var(--line);
    color: var(--primary);
}

.tab-button.active {
    background: var(--surface);
    border-color: var(--primary-soft);
    color: var(--primary);
    box-shadow: 0 6px 16px rgba(24, 33, 38, 0.08);
}

.tab-panels {
    display: grid;
}

.tab-panel {
    margin-bottom: 0;
}

.tab-panel[hidden] {
    display: none;
}

.workflow-panel {
    scroll-margin-top: 24px;
}

.workflow-grid {
    display: grid;
    gap: 10px;
}

.workflow-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dossier-area-panels {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workflow-step {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    font-weight: 400;
}

.workflow-step.active {
    border-color: #92400e;
    background: #fff7ed;
    color: #7c2d12;
    box-shadow: inset 4px 0 0 #b45309;
}

.section-heading span {
    display: inline-grid;
    place-items: center;
    min-width: max-content;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 0.78rem;
    font-weight: 400;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.section-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.compact-stats .metric-card {
    min-height: auto;
    padding: 16px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 4px solid #b45309;
    border-radius: 10px;
    background: #ffffff;
}

.timeline-item strong,
.timeline-item p {
    margin: 0;
}

.timeline-item p {
    color: var(--muted);
}

.change-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: grid;
    gap: 4px;
}

.change-list li {
    font-size: 0.875rem;
    color: var(--text);
}

.modal {
    width: min(920px, calc(100% - 32px));
    max-height: min(86vh, 840px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.48);
}

.modal-panel {
    max-height: min(86vh, 840px);
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
}

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

.modal-header h2,
.modal-header p {
    margin: 0;
}

.modal-header p {
    margin-top: 4px;
    color: var(--muted);
}

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

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 400;
}

fieldset.choice-tag-field {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--muted);
    font-weight: 400;
}

.choice-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    min-height: 48px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.choice-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--ink);
    font-weight: 400;
}

.choice-tag input {
    width: auto;
}

.required-field > span::after {
    content: " *";
    color: var(--danger);
}

.full-width {
    grid-column: 1 / -1;
}

.form-section-title {
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.form-section-title:first-child {
    padding-top: 0;
    border-top: 0;
}

.form-section-title h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
}

.repeatable-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.additional-contacts {
    display: grid;
    gap: 12px;
}

.additional-contact-list {
    display: grid;
    gap: 12px;
}

.additional-contact-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.citizen-document-row {
    grid-template-columns: minmax(190px, 1fr) minmax(160px, 220px) minmax(260px, 1.4fr) auto;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.field-action {
    display: flex;
    align-items: end;
}

.lookup-result-list {
    display: grid;
    gap: 8px;
}

.lookup-result-button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--ink);
    text-align: left;
}

.lookup-result-button:hover {
    background: var(--surface-strong);
}

.protocol-preview {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

@media (max-width: 900px) {
    .citizen-document-row {
        grid-template-columns: 1fr;
    }
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    background: #fff;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 107, 130, 0.12);
}

textarea {
    resize: vertical;
}

.check-field {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
    gap: 12px;
}

.check-field input {
    width: auto;
}

.permission-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

.permission-group legend {
    padding: 0 8px;
    color: var(--ink);
    font-weight: 400;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px 14px;
    margin-top: 10px;
}

.permission-subgroup + .permission-subgroup {
    margin-top: 16px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 400;
    background: #f8fafc;
}

td {
    color: #1e293b;
    font-size: 0.9rem;
}

tr:hover td {
    background: #fafbfc;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 20px;
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.pagination-row {
    margin-top: 14px;
}

.audit-json {
    max-width: 620px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--ink);
}

.territorial-map {
    min-height: 560px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-strong);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.chart-panel {
    min-height: 360px;
}

.chart-panel canvas {
    width: 100% !important;
    min-height: 240px;
}

.portal-main {
    padding: 0;
}

.portal-home {
    background:
        linear-gradient(180deg, #f5efe6 0%, #fffaf2 42%, #f6f2ea 100%);
    color: var(--ink);
    overflow: hidden;
}

.portal-hero {
    position: relative;
    min-height: 590px;
    background: #141414;
    overflow: hidden;
}

.portal-slide {
    position: absolute;
    inset: 0;
    display: grid;
    align-items: center;
    min-height: 590px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 500ms ease;
}

.portal-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.portal-slide-image,
.portal-slide-overlay {
    position: absolute;
    inset: 0;
}

.portal-slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.05) contrast(1.02);
}

.portal-slide-image-left {
    object-position: 28% center;
}

.portal-slide-image-center {
    object-position: center;
}

.portal-slide-image-right {
    object-position: 72% center;
}

.portal-slide-overlay {
    background:
        linear-gradient(90deg, rgba(9, 9, 9, 0.92) 0%, rgba(17, 17, 17, 0.82) 42%, rgba(17, 17, 17, 0.28) 100%),
        linear-gradient(0deg, rgba(197, 83, 9, 0.22), rgba(197, 83, 9, 0.02));
}

.portal-hero-content {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 88px 0 118px;
}

.portal-hero-content h1,
.portal-hero-content h2,
.portal-section-heading h2,
.portal-cycle-copy h2 {
    max-width: 760px;
    margin: 0;
    font-family: inherit;
    line-height: 1.05;
}

.portal-hero-content h1,
.portal-hero-content h2 {
    color: #fffaf2;
    font-size: clamp(2.6rem, 5vw, 5rem);
}

.portal-hero-content p {
    max-width: 680px;
    color: rgba(255, 250, 242, 0.84);
    font-size: 1.12rem;
    line-height: 1.58;
}

.portal-kicker {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 18px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(199, 83, 9, 0.16);
    color: #d75e13;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-hero .portal-kicker {
    background: rgba(255, 255, 255, 0.12);
    color: #f18a31;
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.portal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 13px 18px;
    border-radius: 8px;
    font-weight: 400;
    line-height: 1;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.portal-button:hover {
    transform: translateY(-1px);
}

.portal-button-primary {
    background: linear-gradient(135deg, #8a3208, #c75309 54%, #9d3b08);
    color: #fff;
    box-shadow: 0 16px 32px rgba(138, 50, 8, 0.26);
}

.portal-button-primary:hover {
    background: linear-gradient(135deg, #9d3b08, #dd6b19 54%, #8a3208);
}

.portal-button-light {
    background: rgba(255, 250, 242, 0.94);
    color: #232323;
}

.portal-carousel-controls {
    position: absolute;
    left: 50%;
    bottom: 34px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(-50%);
}

.portal-carousel-controls button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    backdrop-filter: blur(10px);
}

.portal-carousel-dots {
    display: inline-flex;
    gap: 8px;
}

.portal-carousel-dots button {
    width: 10px;
    height: 10px;
    border: 0;
    background: rgba(255, 255, 255, 0.4);
}

.portal-carousel-dots button.is-active {
    width: 28px;
    background: #d75e13;
}

.portal-section {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 76px 0;
}

.portal-section-heading {
    max-width: 760px;
    margin-bottom: 30px;
}

.portal-section-heading-row {
    max-width: none;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.portal-section-heading h2,
.portal-cycle-copy h2 {
    font-size: clamp(2rem, 3vw, 3.25rem);
}

.portal-section-heading p:not(.portal-kicker),
.portal-cycle-copy p {
    color: #52606b;
    font-size: 1.04rem;
    line-height: 1.6;
}

.portal-service-grid,
.portal-update-grid,
.portal-process-grid {
    display: grid;
    gap: 18px;
}

.portal-service-grid {
    grid-template-columns: 1.25fr repeat(3, 1fr);
}

.portal-service-card,
.portal-update-card,
.portal-process-grid article {
    border: 1px solid rgba(33, 33, 33, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 20px 52px rgba(29, 25, 20, 0.08);
}

.portal-service-card {
    min-height: 240px;
    display: grid;
    align-content: end;
    gap: 14px;
    padding: 24px;
    color: var(--ink);
}

.portal-service-card:hover {
    border-color: rgba(199, 83, 9, 0.4);
    transform: translateY(-2px);
}

.portal-service-card span,
.portal-process-grid span {
    color: #c75309;
    font-weight: 400;
}

.portal-service-card strong {
    font-size: 1.25rem;
}

.portal-service-card p,
.portal-update-card p,
.portal-process-grid p {
    margin: 0;
    color: #52606b;
    line-height: 1.48;
}

.portal-service-card-featured {
    background: linear-gradient(160deg, rgba(14, 90, 90, 0.92), rgba(9, 52, 55, 0.94));
    color: #fff;
}

.portal-service-card-featured span,
.portal-service-card-featured p {
    color: rgba(255, 255, 255, 0.82);
}

.portal-cycle-band {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    align-items: center;
    gap: 42px;
    margin: 0;
    padding: 72px max(24px, calc((100% - 1240px) / 2));
    background: #111;
    color: #fffaf2;
}

.portal-cycle-copy p {
    max-width: 680px;
    color: rgba(255, 250, 242, 0.72);
}

.portal-cycle-panel {
    display: grid;
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

.portal-cycle-panel div {
    display: grid;
    gap: 8px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.06);
}

.portal-cycle-panel span,
.portal-update-card time {
    color: #d75e13;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-cycle-panel strong {
    font-size: 1.1rem;
}

.portal-text-link {
    color: #9d3b08;
    font-weight: 400;
}

.portal-update-grid {
    grid-template-columns: repeat(3, 1fr);
}

.portal-update-card {
    min-height: 220px;
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 24px;
}

.portal-update-card h3,
.portal-process-grid h3 {
    margin: 0;
    font-size: 1.25rem;
}

.portal-process {
    padding-top: 26px;
}

.portal-process-grid {
    grid-template-columns: repeat(4, 1fr);
}

.portal-process-grid article {
    min-height: 210px;
    padding: 24px;
}

.portal-process-grid span {
    display: block;
    margin-bottom: 32px;
    font-size: 2.6rem;
    line-height: 1;
}

.site-header {
    background: rgba(255, 255, 255, 0.96);
}

.site-header .brand strong {
    font-family: inherit;
}

.site-header .nav-links a {
    color: #071d41;
}

.site-header .nav-links .button {
    background: #1351b4;
    color: #fff;
    border-radius: 999px;
}

.gov-portal {
    min-height: 100vh;
    background: #fff;
    color: #1b1b1b;
    font-family: "Rawline", "Raleway", "Noto Sans", "Segoe UI", Arial, sans-serif;
}

.gov-container {
    width: min(1152px, calc(100% - 48px));
    margin: 0 auto;
}

.gov-titlebar {
    padding: 28px 0 18px;
}

.gov-titlebar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gov-titlebar h1 {
    margin: 0;
    color: #333;
    font-size: clamp(1.4rem, 2.4vw, 1.65rem);
    font-weight: 400;
    letter-spacing: 0;
}

.gov-menu-mark {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 16px;
    border-top: 3px solid #1351b4;
    border-bottom: 3px solid #1351b4;
}

.gov-menu-mark::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 3px solid #1351b4;
    transform: translateY(-50%);
}

.gov-search {
    padding: 34px 0 30px;
}

.gov-search form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: center;
    padding: 14px 18px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
}

.gov-search input {
    height: 50px;
    border: 1px solid #b8b8b8;
    border-right: 0;
    border-radius: 2px 0 0 2px;
    padding: 0 22px;
    color: #333;
    font-size: 1.12rem;
    font-style: italic;
}

.gov-search button {
    position: relative;
    height: 50px;
    border: 1px solid #b8b8b8;
    border-left: 0;
    border-radius: 0 2px 2px 0;
    background: #fff;
    color: #1351b4;
}

.gov-search button::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 4px solid currentColor;
    border-radius: 50%;
    top: 13px;
    left: 19px;
}

.gov-search button::after {
    content: "";
    position: absolute;
    width: 12px;
    border-top: 4px solid currentColor;
    top: 33px;
    left: 35px;
    transform: rotate(45deg);
    transform-origin: left center;
}

.gov-banner {
    position: relative;
    min-height: 320px;
    margin-bottom: 36px;
    overflow: hidden;
    background: #eaf3ff;
}

.gov-banner-slide {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    min-height: 320px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 420ms ease;
}

.gov-banner-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.gov-banner-copy {
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 38px 46px;
    background: linear-gradient(135deg, #0b4ea2, #1351b4 56%, #0b2f73);
    color: #fff;
}

.gov-banner-copy span {
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: uppercase;
}

.gov-banner-copy h2 {
    max-width: 620px;
    margin: 0;
    font-size: clamp(1.8rem, 3.1vw, 3rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.gov-banner-copy p {
    max-width: 620px;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05rem;
    line-height: 1.45;
}

.gov-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.gov-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 400;
}

.gov-button-primary {
    background: #fff;
    color: #1351b4;
}

.gov-button-secondary {
    border: 1px solid rgba(255, 255, 255, 0.72);
    color: #fff;
}

.gov-banner-art {
    position: relative;
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 44px;
    overflow: hidden;
    background:
        radial-gradient(circle at 24% 44%, rgba(255, 205, 0, 0.95) 0 72px, transparent 73px),
        radial-gradient(circle at 78% 30%, rgba(0, 156, 59, 0.78) 0 88px, transparent 89px),
        linear-gradient(135deg, #e7f3ff, #f7fbff);
}

.gov-banner-art::before,
.gov-banner-art::after {
    content: "";
    position: absolute;
    border-radius: 22px;
    background: rgba(19, 81, 180, 0.12);
    transform: rotate(-10deg);
}

.gov-banner-art::before {
    width: 210px;
    height: 150px;
    right: 76px;
    top: 58px;
}

.gov-banner-art::after {
    width: 160px;
    height: 110px;
    right: 138px;
    bottom: 46px;
    background: rgba(0, 156, 59, 0.12);
}

.gov-banner-art strong,
.gov-banner-art span {
    position: relative;
    z-index: 1;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #071d41;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.gov-banner-art strong {
    font-size: 1.55rem;
}

.gov-banner-art-alt {
    background:
        radial-gradient(circle at 28% 38%, rgba(0, 156, 59, 0.72) 0 74px, transparent 75px),
        radial-gradient(circle at 76% 66%, rgba(255, 205, 0, 0.9) 0 84px, transparent 85px),
        linear-gradient(135deg, #edf7ef, #fffdf0);
}

.gov-banner-art-docs {
    background:
        radial-gradient(circle at 25% 72%, rgba(255, 205, 0, 0.85) 0 78px, transparent 79px),
        radial-gradient(circle at 78% 36%, rgba(19, 81, 180, 0.32) 0 92px, transparent 93px),
        linear-gradient(135deg, #f5f7ff, #eaf3ff);
}

.gov-carousel-controls {
    position: absolute;
    right: 16px;
    bottom: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gov-carousel-controls > button {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: #1351b4;
    color: #fff;
}

.gov-carousel-controls > button::before {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    top: 12px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
}

.gov-carousel-controls > button[data-carousel-prev]::before {
    left: 14px;
    transform: rotate(-135deg);
}

.gov-carousel-controls > button[data-carousel-next]::before {
    left: 11px;
    transform: rotate(45deg);
}

.gov-carousel-dots {
    display: inline-flex;
    gap: 6px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
}

.gov-carousel-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    background: #9aa6b2;
}

.gov-carousel-dots button.is-active {
    width: 24px;
    background: #1351b4;
}

.gov-services {
    padding: 6px 0 48px;
}

.gov-services > h2 {
    margin: 0 0 52px;
    text-align: center;
    color: #333;
    font-size: clamp(2rem, 3.4vw, 2.45rem);
    font-weight: 400;
}

.gov-service-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.gov-service-column {
    min-height: 420px;
    padding: 0 24px 18px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.gov-column-title {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    transform: translateY(-16px);
}

.gov-column-title::before,
.gov-column-title::after {
    content: "";
    border-top: 1px solid #d0d0d0;
}

.gov-column-title span {
    display: none;
}

.gov-column-title h3 {
    margin: 0;
    color: #222;
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
}

.gov-service-column > a,
.gov-ranked-list a,
.gov-feature-column article a {
    display: block;
    color: #003078;
    font-size: 1.06rem;
    font-weight: 400;
    line-height: 1.25;
}

.gov-service-column > a {
    padding: 15px 0;
    border-bottom: 1px solid #d8d8d8;
}

.gov-service-column > a:last-child {
    border-bottom: 0;
}

.gov-ranked-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: gov-ranking;
}

.gov-ranked-list li {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid #d8d8d8;
    counter-increment: gov-ranking;
}

.gov-ranked-list li::before {
    content: counter(gov-ranking);
    color: #d8d8d8;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
}

.gov-feature-column article {
    padding: 15px 0;
    border-bottom: 1px solid #d8d8d8;
}

.gov-feature-column article:last-child {
    border-bottom: 0;
}

.gov-feature-column small {
    display: block;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 0.78rem;
}

.gov-updates {
    padding: 36px 0 80px;
}

.gov-section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 18px;
    border-bottom: 1px solid #d8d8d8;
    padding-bottom: 14px;
}

.gov-section-header h2 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 400;
}

.gov-section-header a {
    color: #1351b4;
    font-weight: 400;
}

.gov-update-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.gov-update-list article {
    padding: 22px 0;
    border-bottom: 1px solid #d8d8d8;
}

.gov-update-list time {
    display: block;
    margin-bottom: 10px;
    color: #6b7280;
    font-size: 0.86rem;
}

.gov-update-list h3 {
    margin: 0 0 8px;
    color: #003078;
    font-size: 1.2rem;
}

.gov-update-list p {
    margin: 0;
    color: #4b5563;
    line-height: 1.45;
}

.portal-home-body {
    background: #f2f2f4;
}

.portal-home-body .site-header {
    background: #e8f4fb;
    border-bottom: 4px solid #3655ff;
    box-shadow: none;
}

.portal-bb-header-grid {
    min-height: 54px;
    display: grid;
    grid-template-columns: auto auto minmax(220px, 320px) auto 1fr;
    align-items: center;
    gap: 22px;
}

.portal-bb-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding-right: 18px;
    border-right: 1px solid rgba(54, 85, 255, 0.38);
}

.portal-bb-brand img {
    width: 96px;
    height: 38px;
    object-fit: contain;
}

.portal-bb-menu {
    position: relative;
    width: 22px;
    height: 16px;
    border-top: 3px solid #3155ff;
    border-bottom: 3px solid #3155ff;
}

.portal-bb-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 3px solid #3155ff;
    transform: translateY(-50%);
}

.portal-bb-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.portal-bb-nav a,
.portal-bb-login {
    color: #2b82b9;
    font-weight: 400;
    white-space: nowrap;
}

.portal-bb-search {
    position: relative;
}

.portal-bb-search::before {
    content: "";
    position: absolute;
    width: 13px;
    height: 13px;
    left: 14px;
    top: 50%;
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translateY(-55%);
    opacity: 0.9;
}

.portal-bb-search::after {
    content: "";
    position: absolute;
    width: 10px;
    left: 27px;
    top: 32px;
    border-top: 3px solid #fff;
    transform: rotate(45deg);
    opacity: 0.9;
}

.portal-bb-search input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 42px;
    border: 0;
    border-radius: 4px;
    background: #4263f5;
    color: #fff;
    font-weight: 400;
}

.portal-bb-search input::placeholder {
    color: rgba(255, 255, 255, 0.92);
}

.portal-bb-login {
    justify-self: end;
    text-transform: uppercase;
}

.bb-portal {
    min-height: 100vh;
    background: #f2f2f4;
    color: #2d2d2d;
    font-family: "Rawline", "Raleway", "Noto Sans", "Segoe UI", Arial, sans-serif;
}

.bb-container {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
}

.bb-hero {
    position: relative;
    min-height: calc(100vh - 58px);
    overflow: hidden;
    background:
        linear-gradient(115deg, #e8f4fb 0%, #e8f4fb 43%, #08d9c7 43%, #08d9c7 100%);
}

.bb-hero-slide {
    position: absolute;
    inset: 0;
    min-height: calc(100vh - 58px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 450ms ease;
}

.bb-hero-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.bb-hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 78% center;
    opacity: 0.82;
    mix-blend-mode: multiply;
}

.bb-hero-image-alt {
    object-position: 68% center;
}

.bb-hero-image-focus {
    object-position: 88% center;
}

.bb-hero-tint {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(105deg, rgba(255, 247, 25, 0.95) 0%, rgba(255, 247, 25, 0.92) 34%, rgba(255, 247, 25, 0.2) 66%),
        linear-gradient(135deg, rgba(8, 217, 199, 0.72), rgba(54, 85, 255, 0.22));
}

.bb-hero-panel {
    position: relative;
    z-index: 1;
    width: min(440px, calc(100% - 32px));
    margin-left: max(24px, calc((100% - 1120px) / 2));
    top: 50%;
    transform: translateY(-50%);
    padding: 28px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 20px 46px rgba(8, 20, 44, 0.18);
    backdrop-filter: blur(8px);
}

.bb-eyebrow {
    display: inline-flex;
    margin-bottom: 12px;
    color: #2b82b9;
    font-size: 0.82rem;
    font-weight: 400;
    text-transform: uppercase;
}

.bb-hero-panel h1,
.bb-hero-panel h2 {
    margin: 0;
    color: #2b82b9;
    font-size: clamp(2.1rem, 4vw, 3.7rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.bb-hero-panel p {
    margin: 16px 0 0;
    color: #313131;
    font-size: 1.04rem;
    line-height: 1.45;
}

.bb-hero-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0 0;
}

.bb-hero-facts div {
    padding: 12px;
    border-radius: 8px;
    background: #f7f7fb;
}

.bb-hero-facts dt {
    margin-bottom: 4px;
    color: #5f6368;
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
}

.bb-hero-facts dd {
    margin: 0;
    color: #172126;
    font-weight: 400;
}

.bb-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.bb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 400;
    line-height: 1;
}

.bb-button-primary {
    background: #2b82b9;
    color: #e8f4fb;
}

.bb-button-secondary {
    background: #e8f4fb;
    color: #2b82b9;
}

.bb-carousel-controls {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 9px;
    transform: translateX(-50%);
}

.bb-carousel-controls > button:not(.bb-carousel-toggle) {
    position: relative;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: #2b82b9;
    color: #e8f4fb;
}

.bb-carousel-controls > button:not(.bb-carousel-toggle)::before {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    top: 11px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
}

.bb-carousel-controls > button[data-carousel-prev]::before {
    left: 13px;
    transform: rotate(-135deg);
}

.bb-carousel-controls > button[data-carousel-next]::before {
    left: 10px;
    transform: rotate(45deg);
}

.bb-carousel-dots {
    display: inline-flex;
    gap: 8px;
}

.bb-carousel-dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    background: rgba(36, 76, 255, 0.35);
}

.bb-carousel-dots button.is-active {
    width: 28px;
    background: #2b82b9;
}

.bb-carousel-toggle {
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #172126;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
}

.bb-services {
    padding: 88px 0 54px;
}

.bb-section-heading {
    margin-bottom: 28px;
}

.bb-section-heading h2,
.bb-facilities h2 {
    margin: 0 0 8px;
    color: #2b82b9;
    font-size: clamp(2rem, 3vw, 2.6rem);
    letter-spacing: 0;
}

.bb-section-heading p {
    margin: 0;
    color: #4b5563;
    font-size: 1.1rem;
}

.bb-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.bb-feature-card,
.bb-side-card,
.bb-product-card,
.bb-life-card,
.bb-facility-grid a {
    border: 1px solid rgba(22, 35, 80, 0.16);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.bb-feature-card {
    grid-column: span 2;
    min-height: 280px;
    display: grid;
    grid-template-columns: 1fr 0.82fr;
    background: #2b82b9;
    color: #fff;
}

.bb-feature-card > div,
.bb-side-card > div,
.bb-product-card > div {
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 32px;
}

.bb-feature-card img,
.bb-side-card img,
.bb-product-card img,
.bb-life-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bb-feature-card img {
    object-position: 78% center;
    opacity: 0.86;
}

.bb-side-card {
    min-height: 280px;
    display: grid;
    grid-template-columns: 1fr 0.9fr;
    background: #ffb4a8;
    color: #2b82b9;
}

.bb-side-card img {
    opacity: 0.28;
    mix-blend-mode: multiply;
}

.bb-product-card {
    min-height: 390px;
    display: grid;
    grid-template-rows: 190px 1fr;
}

.bb-product-card img {
    object-position: 80% center;
}

.bb-card-blue img {
    filter: hue-rotate(150deg) saturate(1.7) brightness(1.3);
}

.bb-card-lilac img {
    filter: hue-rotate(220deg) saturate(1.25) brightness(1.25);
}

.bb-card-aqua img {
    filter: hue-rotate(95deg) saturate(1.5) brightness(1.2);
}

.bb-card-grid h3,
.bb-life-card h3 {
    margin: 0;
    color: inherit;
    font-size: 1.55rem;
    line-height: 1.06;
}

.bb-card-grid p,
.bb-life-card p {
    margin: 0;
    color: inherit;
    line-height: 1.45;
}

.bb-card-grid span,
.bb-life-card a {
    width: fit-content;
    color: #2b82b9;
    font-weight: 400;
}

.bb-feature-card span {
    padding: 10px 14px;
    border-radius: 6px;
    background: #e8f4fb;
}

.bb-side-card span,
.bb-product-card span {
    padding: 8px 12px;
    border-radius: 5px;
    background: #2b82b9;
    color: #e8f4fb;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.bb-life {
    padding: 40px 0 70px;
}

.bb-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 30px 0 28px;
}

.bb-tabs a {
    border-bottom: 3px solid #5c5c5c;
    padding-bottom: 9px;
    color: #3e3e3e;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 400;
    text-transform: uppercase;
}

.bb-tabs .active {
    border-color: #2b82b9;
    color: #2b82b9;
}

.bb-life-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.55fr;
    gap: 18px;
}

.bb-life-card {
    position: relative;
    min-height: 300px;
    padding: 26px;
    display: grid;
    align-content: end;
    color: #fff;
}

.bb-life-card img {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.bb-life-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.72));
}

.bb-life-card > div {
    position: relative;
    z-index: 2;
}

.bb-life-card-green {
    background: #08d9c7;
    color: #111;
}

.bb-life-card-green a,
.bb-life-card-green h3,
.bb-life-card-green p {
    color: #111;
}

.bb-life-card-wide img {
    object-position: 82% center;
}

.bb-facilities {
    padding: 34px 0 96px;
}

.bb-facility-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-top: 30px;
}

.bb-facility-grid a {
    min-height: 142px;
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 18px;
    color: #2b82b9;
    font-weight: 400;
}

.bb-facility-grid span {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #e8f4fb;
    color: #2b82b9;
    font-weight: 400;
}

.bb-open-cycles {
    padding: 8px 0 44px;
}

.bb-open-cycle-grid {
    display: grid;
    gap: 14px;
}

.bb-open-cycle-card {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.7fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(0, 95, 143, 0.15);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(0, 67, 112, 0.08);
}

.bb-open-cycle-card span {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e8f4fb;
    color: var(--crato-blue-deep);
    font-size: 0.76rem;
    font-weight: 400;
}

.bb-open-cycle-card h3 {
    margin: 10px 0 6px;
    color: var(--crato-blue-deep);
    font-size: clamp(1.2rem, 2vw, 1.65rem);
}

.bb-open-cycle-card p {
    margin: 0;
    color: #3f5f72;
}

.bb-open-cycle-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.bb-open-cycle-card dl div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px;
    border-radius: 8px;
    background: #f4f9fc;
}

.bb-open-cycle-card dt {
    color: #3f5f72;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
}

.bb-open-cycle-card dd {
    margin: 0;
    color: #102d3c;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.bb-open-cycle-actions {
    display: grid;
    gap: 8px;
    min-width: 150px;
}

.bb-open-cycle-actions a {
    display: inline-flex;
    justify-content: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--crato-blue);
    color: #fff;
    font-weight: 400;
}

.bb-open-cycle-actions a:first-child {
    background: #e8f4fb;
    color: var(--crato-blue-dark);
}

.bb-open-cycle-empty {
    margin: 0;
    padding: 18px;
    border: 1px solid rgba(0, 95, 143, 0.15);
    border-radius: 8px;
    background: #fff;
    color: #3f5f72;
    font-weight: 400;
}

.public-cycle-summary,
.public-cycle-info-grid {
    display: grid;
    gap: 12px;
}

.public-cycle-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.public-cycle-summary article,
.public-cycle-info-grid section {
    padding: 14px;
    border: 1px solid rgba(0, 95, 143, 0.14);
    border-radius: 8px;
    background: #f8fcff;
}

.public-cycle-summary span,
.public-cycle-info-grid dt {
    color: #3f5f72;
    font-size: 0.74rem;
    font-weight: 400;
    text-transform: uppercase;
}

.public-cycle-summary strong {
    display: block;
    margin-top: 6px;
    color: var(--crato-blue-deep);
    font-size: 1.18rem;
}

.public-cycle-summary small {
    display: block;
    margin-top: 4px;
    color: #3f5f72;
    font-weight: 400;
}

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

.public-cycle-info-grid h3 {
    margin: 0 0 12px;
    color: var(--crato-blue-deep);
}

.public-cycle-info-grid dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.public-cycle-info-grid div {
    display: grid;
    gap: 3px;
}

.public-cycle-info-grid dd {
    margin: 0;
    color: #102d3c;
    font-weight: 400;
}

.public-cycle-actions {
    margin-top: 18px;
}

.bb-accessibility {
    padding: 28px 0 90px;
}

.bb-accessibility .bb-section-heading {
    max-width: 760px;
}

.bb-accessibility-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.bb-accessibility-grid article {
    min-height: 170px;
    padding: 22px;
    border: 1px solid rgba(22, 35, 80, 0.16);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.bb-accessibility-grid strong {
    display: block;
    margin-bottom: 10px;
    color: #2b82b9;
    font-size: 1.12rem;
}

.bb-accessibility-grid p {
    margin: 0;
    color: #3f4752;
    line-height: 1.45;
}

.bb-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 28px 18px;
    background: #4263f5;
    color: #e8f4fb;
}

.bb-cta strong {
    font-size: clamp(1.4rem, 2.6vw, 2rem);
}

.bb-cta a {
    padding: 14px 32px;
    border-radius: 6px;
    background: #e8f4fb;
    color: #2b82b9;
    font-weight: 400;
}

@media (max-width: 900px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .content-frame {
        width: min(100% - 32px, 1180px);
    }

    .header-grid,
    .hero-grid,
    .hero:has(.hero-actions) {
        grid-template-columns: 1fr;
        display: grid;
    }

    .nav-links {
        justify-content: flex-start;
    }

    .portal-hero,
    .portal-slide {
        min-height: 620px;
    }

    .portal-hero-content,
    .portal-section {
        width: min(100% - 32px, 1240px);
    }

    .portal-hero-content {
        padding: 68px 0 108px;
    }

    .portal-slide-overlay {
        background:
            linear-gradient(90deg, rgba(9, 9, 9, 0.94) 0%, rgba(17, 17, 17, 0.78) 100%),
            linear-gradient(0deg, rgba(197, 83, 9, 0.2), rgba(197, 83, 9, 0.02));
    }

    .portal-service-grid,
    .portal-update-grid,
    .portal-process-grid,
    .portal-cycle-band {
        grid-template-columns: 1fr;
    }

    .portal-section-heading-row {
        align-items: start;
        flex-direction: column;
    }

    .portal-cycle-band {
        padding: 56px 16px;
    }

    .portal-section {
        padding: 54px 0;
    }

    .gov-container {
        width: min(100% - 28px, 1152px);
    }

    .gov-search {
        padding: 22px 0 24px;
    }

    .gov-search form {
        grid-template-columns: minmax(0, 1fr) 50px;
        padding: 10px;
    }

    .gov-search input,
    .gov-search button {
        height: 46px;
    }

    .gov-search button::before {
        top: 11px;
        left: 13px;
    }

    .gov-search button::after {
        top: 31px;
        left: 29px;
    }

    .gov-banner,
    .gov-banner-slide {
        min-height: 560px;
    }

    .gov-banner-slide {
        grid-template-columns: 1fr;
    }

    .gov-banner-copy {
        padding: 30px 22px 84px;
    }

    .gov-banner-art {
        min-height: 190px;
        padding: 24px;
    }

    .gov-carousel-controls {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .gov-services > h2 {
        margin-bottom: 36px;
        text-align: left;
    }

    .gov-service-columns,
    .gov-update-list {
        grid-template-columns: 1fr;
    }

    .gov-service-column {
        min-height: auto;
    }

    .gov-section-header {
        align-items: start;
        flex-direction: column;
    }

    .portal-bb-header-grid {
        grid-template-columns: auto 1fr;
        gap: 12px;
        padding: 8px 0;
    }

    .portal-bb-brand {
        border-right: 0;
        padding-right: 0;
    }

    .portal-bb-nav {
        grid-column: 1 / -1;
        gap: 14px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .portal-bb-nav::-webkit-scrollbar {
        display: none;
    }

    .portal-bb-search {
        grid-column: 1 / -1;
    }

    .portal-bb-login {
        justify-self: end;
    }

    .bb-container {
        width: min(100% - 28px, 1120px);
    }

    .bb-hero,
    .bb-hero-slide {
        min-height: 720px;
    }

    .bb-hero-tint {
        background:
            linear-gradient(180deg, rgba(255, 247, 25, 0.96) 0%, rgba(255, 247, 25, 0.9) 46%, rgba(8, 217, 199, 0.72) 100%);
    }

    .bb-hero-image {
        opacity: 0.42;
        object-position: center;
    }

    .bb-hero-panel {
        width: min(100% - 28px, 440px);
        margin: 110px auto 0;
        top: auto;
        transform: none;
    }

    .bb-hero-facts,
    .bb-feature-card,
    .bb-side-card,
    .bb-card-grid,
    .bb-life-grid,
    .bb-facility-grid,
    .bb-open-cycle-card,
    .bb-open-cycle-card dl,
    .public-cycle-summary,
    .public-cycle-info-grid,
    .bb-accessibility-grid {
        grid-template-columns: 1fr;
    }

    .bb-feature-card,
    .bb-side-card {
        min-height: auto;
    }

    .bb-feature-card img,
    .bb-side-card img {
        min-height: 170px;
    }

    .bb-product-card {
        min-height: auto;
    }

    .bb-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .bb-cta {
        align-items: stretch;
        flex-direction: column;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Portal do Crato */
:root {
    --crato-blue: #2b82b9;
    --crato-blue-dark: #005f8f;
    --crato-blue-deep: #004c73;
    --crato-blue-soft: #e8f4fb;
    --crato-green: #2f9b65;
    --crato-red: #d83b3b;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline-color: var(--crato-blue-deep);
    box-shadow: 0 0 0 6px rgba(43, 130, 185, 0.22);
}

.portal-home-body,
.bb-portal {
    background: #f3f7fb;
}

.portal-public-body:not(.portal-home-body) {
    background:
        linear-gradient(180deg, #f3f7fb 0%, #edf5fa 46%, #f7fafc 100%);
}

.portal-home-body .site-header {
    background: #fff;
    border-bottom: 0;
}

.portal-crato-header {
    background: #fff;
    border-bottom: 0;
    box-shadow: 0 2px 10px rgba(0, 76, 115, 0.12);
}

.portal-crato-brandbar-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.portal-crato-brandbar {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 247, 252, 0.88)),
        radial-gradient(circle at 12% 18%, rgba(43, 130, 185, 0.11), transparent 30%);
}

.portal-crato-brandbar-grid {
    min-height: 118px;
}

.portal-crato-brand {
    display: inline-flex;
    align-items: center;
}

.portal-crato-brand img {
    width: min(260px, 52vw);
    height: auto;
    object-fit: contain;
}

.portal-crato-brand strong {
    display: block;
    color: var(--crato-blue-deep);
    font-size: clamp(2.6rem, 5vw, 4.4rem);
    line-height: 0.9;
    letter-spacing: 0;
}

.portal-crato-brand small {
    display: block;
    margin-top: 8px;
    color: #243746;
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.portal-crato-program {
    padding: 18px 24px;
    border-left: 1px solid rgba(0, 95, 143, 0.2);
    color: #244657;
    text-align: right;
}

.portal-crato-program strong {
    display: block;
    color: var(--crato-blue-deep);
    font-size: 1.28rem;
}

.portal-crato-program small {
    display: block;
    margin-top: 4px;
    color: #536879;
    font-weight: 400;
}

.portal-crato-navrow {
    background: var(--crato-blue);
}

.portal-bb-header-grid {
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr) minmax(230px, 320px) auto;
    gap: 18px;
}

.portal-bb-brand {
    color: #fff;
    border-right-color: rgba(255, 255, 255, 0.28);
    font-weight: 400;
}

.portal-bb-menu,
.portal-bb-menu::before {
    border-color: #fff;
}

.portal-bb-nav a,
.portal-bb-login {
    color: #fff;
}

.portal-bb-nav a {
    position: relative;
}

.portal-public-body:not(.portal-home-body) .portal-bb-nav a.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -15px;
    left: 0;
    height: 3px;
    border-radius: 999px;
    background: #fff;
}

.portal-bb-login {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
}

.portal-bb-search::before,
.portal-bb-search::after {
    border-color: #fff;
}

.portal-bb-search input {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.portal-page-main {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 32px 0 78px;
}

.portal-page-main .alert {
    border-radius: 8px;
    box-shadow: 0 12px 26px rgba(0, 76, 115, 0.08);
}

.portal-page-main .hero,
.portal-page-main .panel {
    border-radius: 8px;
    border-color: rgba(0, 95, 143, 0.18);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 44px rgba(0, 76, 115, 0.1);
}

.portal-page-main .hero {
    position: relative;
    min-height: 250px;
    overflow: hidden;
    align-items: center;
    padding: 42px 34px;
    background: var(--crato-blue-deep);
    color: #fff;
}

.portal-page-main .hero::before,
.portal-page-main .hero::after {
    content: "";
    position: absolute;
    inset: 0;
}

.portal-page-main .hero::before {
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(0, 76, 115, 0.94) 0%, rgba(0, 95, 143, 0.76) 52%, rgba(0, 76, 115, 0.26) 100%),
        linear-gradient(180deg, rgba(43, 130, 185, 0.16), rgba(0, 76, 115, 0.42));
}

.portal-page-main .hero::after {
    background-image: var(--portal-hero-image);
    background-size: cover;
    background-position: center;
    opacity: 0.72;
}

.portal-page-main .hero > * {
    position: relative;
    z-index: 2;
}

.portal-page-main .hero > div:not(.hero-grid),
.portal-page-main .hero-grid > div:first-child {
    max-width: 720px;
}

.portal-page-main .hero h1,
.portal-page-main .panel h2 {
    font-family: "Rawline", "Raleway", "Noto Sans", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

.portal-page-main .hero h1 {
    max-width: 760px;
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.02;
}

.portal-page-main .hero p {
    max-width: 780px;
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.5;
}

.portal-page-main .hero .badge {
    display: inline-flex;
    width: auto;
    margin-bottom: 14px;
    background: rgba(232, 244, 251, 0.92);
    color: var(--crato-blue-deep);
}

.portal-page-main .hero .panel {
    color: var(--ink);
    box-shadow: 0 20px 46px rgba(0, 42, 66, 0.22);
}

.portal-page-main .hero .panel p,
.portal-page-main .hero .panel .meta {
    color: var(--muted);
}

.portal-page-main .panel {
    padding: 28px 32px;
}

.portal-page-main .panel h2 {
    color: var(--crato-blue-deep);
    font-size: clamp(1.35rem, 2.2vw, 1.9rem);
}

.public-guidance-panel {
    display: grid;
    gap: 16px;
}

.public-criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.public-criteria-card {
    min-height: 78px;
    padding: 16px;
    border: 1px solid rgba(0, 95, 143, 0.14);
    border-radius: 8px;
    background: #f8fcff;
}

.public-criteria-card strong {
    color: #102d3c;
    font-size: 1rem;
    line-height: 1.35;
}

.public-document-list {
    display: grid;
    gap: 12px;
}

.public-document-card {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
    gap: 16px;
    padding: 16px;
    border: 1px solid rgba(0, 95, 143, 0.14);
    border-radius: 8px;
    background: #fff;
}

.public-document-card h3 {
    margin: 0 0 8px;
    color: var(--crato-blue-deep);
    font-size: 1.08rem;
    line-height: 1.25;
}

.public-document-card p {
    margin: 0;
    color: #3f5f72;
    line-height: 1.45;
}

.public-document-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.public-document-card dl div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px;
    border-radius: 8px;
    background: #f4f9fc;
}

.public-document-card dt {
    color: #3f5f72;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
}

.public-document-card dd {
    margin: 0;
    color: #102d3c;
    font-weight: 400;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.schedule-picker {
    display: grid;
    gap: 14px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.schedule-picker legend {
    color: var(--crato-blue-dark);
    font-size: 1.05rem;
    font-weight: 400;
}

.schedule-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: #3f5f72;
    font-size: 0.92rem;
    font-weight: 400;
}

.schedule-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.schedule-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.schedule-dot-available {
    background: #15803d;
}

.schedule-dot-full {
    background: #b45309;
}

.schedule-dot-blocked {
    background: #64748b;
}

.schedule-dot-empty {
    background: #cbd5e1;
}

.schedule-view-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    width: fit-content;
    overflow: hidden;
    border: 1px solid rgba(0, 95, 143, 0.18);
    border-radius: 8px;
    background: #fff;
}

.schedule-view-tabs span {
    min-width: 92px;
    padding: 9px 14px;
    color: #3f5f72;
    font-size: 0.86rem;
    font-weight: 400;
    text-align: center;
}

.schedule-view-tabs span.active {
    background: var(--crato-blue);
    color: #fff;
}

.portal-calendar-month {
    display: grid;
    gap: 10px;
}

.portal-calendar-weekdays,
.portal-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.portal-calendar-weekdays {
    gap: 8px;
}

.portal-calendar-weekdays span {
    padding: 0 4px;
    color: #547084;
    font-size: 0.78rem;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
}

.portal-calendar-grid {
    overflow: hidden;
    border: 1px solid rgba(0, 95, 143, 0.16);
    border-radius: 8px;
    background: rgba(0, 95, 143, 0.12);
    gap: 1px;
}

.portal-calendar-day {
    min-height: 150px;
    display: grid;
    align-content: start;
    gap: 9px;
    padding: 10px;
    background: #ffffff;
}

.portal-calendar-day header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.portal-calendar-day header strong {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #e8f4fb;
    color: var(--crato-blue-deep);
    font-size: 0.95rem;
    font-weight: 400;
}

.portal-calendar-day header span {
    color: #547084;
    font-size: 0.76rem;
    font-weight: 400;
    text-transform: uppercase;
}

.portal-calendar-day > p {
    margin: 0;
    color: #7a8fa0;
    font-size: 0.82rem;
    font-weight: 400;
}

.portal-calendar-day.is-muted {
    background: #f5f8fb;
}

.portal-calendar-day.is-muted header strong {
    background: #e2e8f0;
    color: #64748b;
}

.portal-calendar-day.has-available {
    box-shadow: inset 0 3px 0 #15803d;
}

.portal-calendar-day.has-full {
    box-shadow: inset 0 3px 0 #b45309;
}

.portal-calendar-day.has-blocked {
    box-shadow: inset 0 3px 0 #64748b;
}

.portal-calendar-slots {
    display: grid;
    gap: 7px;
    max-height: 220px;
    overflow: auto;
    padding-right: 2px;
}

.portal-calendar-slots .schedule-slot {
    min-height: 58px;
    padding: 8px;
    gap: 3px 8px;
}

.portal-calendar-slots .schedule-time {
    font-size: 0.92rem;
}

.portal-calendar-slots .schedule-status {
    padding: 3px 7px;
    font-size: 0.7rem;
}

.portal-calendar-slots .schedule-location {
    font-size: 0.74rem;
}

.schedule-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.schedule-summary-grid section {
    min-height: 112px;
    padding: 14px;
    border: 1px solid rgba(0, 95, 143, 0.14);
    border-radius: 8px;
    background: #f8fcff;
}

.schedule-summary-grid h3 {
    margin: 0 0 8px;
    color: var(--crato-blue-deep);
    font-size: 1rem;
}

.schedule-summary-grid p {
    margin: 0 0 6px;
    color: #3f5f72;
    font-size: 0.9rem;
    font-weight: 400;
}

.schedule-details-panel {
    display: grid;
    gap: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(0, 95, 143, 0.14);
}

.schedule-details-panel[hidden] {
    display: none;
}

.schedule-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.schedule-day {
    overflow: hidden;
    border: 1px solid rgba(0, 95, 143, 0.16);
    border-radius: 8px;
    background: #f8fcff;
}

.schedule-day header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 95, 143, 0.12);
    background: #e8f4fb;
    color: var(--crato-blue-deep);
}

.schedule-day header strong {
    font-size: 1.15rem;
}

.schedule-day header span {
    font-size: 0.86rem;
    font-weight: 400;
}

.schedule-slots {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.schedule-slot {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    align-items: center;
    min-height: 74px;
    padding: 12px;
    border: 1px solid rgba(0, 95, 143, 0.18);
    border-radius: 8px;
    background: #fff;
    color: #17384a;
    cursor: pointer;
}

.schedule-slot input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
}

.schedule-slot:has(input:focus-visible) {
    outline: 3px solid rgba(43, 130, 185, 0.35);
    outline-offset: 2px;
}

.schedule-slot:has(input:checked) {
    border-color: var(--crato-blue);
    background: #e8f4fb;
    box-shadow: 0 0 0 3px rgba(43, 130, 185, 0.18);
}

.schedule-slot.is-disabled {
    cursor: not-allowed;
    opacity: 0.66;
}

.schedule-time {
    color: var(--crato-blue-dark);
    font-size: 1.06rem;
    font-weight: 400;
}

.schedule-status {
    justify-self: end;
    padding: 4px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.76rem;
    font-weight: 400;
}

.schedule-slot-full .schedule-status {
    background: #ffedd5;
    color: #9a3412;
}

.schedule-slot-blocked .schedule-status {
    background: #e2e8f0;
    color: #475569;
}

.schedule-location {
    grid-column: 1 / -1;
    color: #3f5f72;
    font-size: 0.84rem;
    line-height: 1.3;
}

.portal-page-main .panel-heading {
    margin-bottom: 22px;
}

.portal-page-main .stats-grid {
    margin-bottom: 0;
}

.portal-page-main .stats-grid > div,
.portal-page-main .subpanel {
    border: 1px solid rgba(0, 95, 143, 0.14);
    border-radius: 8px;
    padding: 16px;
    background: #f3f9fc;
}

.portal-page-main .stats-grid strong {
    color: #142d3c;
}

.portal-page-main .badge {
    background: var(--crato-blue-soft);
    color: var(--crato-blue-deep);
}

.portal-page-main .button,
.portal-page-main button,
.portal-page-main input[type="submit"] {
    border-radius: 8px;
    background: var(--crato-blue);
    color: #fff;
}

.portal-page-main .button-secondary {
    background: var(--crato-blue-soft);
    color: var(--crato-blue-deep);
}

.portal-page-main .button-accent {
    background: var(--crato-green);
}

.portal-page-main input,
.portal-page-main select,
.portal-page-main textarea {
    border-radius: 8px;
    border-color: rgba(0, 95, 143, 0.24);
    background: #fff;
}

.portal-page-main input:focus,
.portal-page-main select:focus,
.portal-page-main textarea:focus {
    border-color: var(--crato-blue);
    outline: none;
    box-shadow: 0 0 0 4px rgba(43, 130, 185, 0.16);
}

.portal-page-main th {
    color: #3f5f72;
}

.portal-page-main td,
.portal-page-main th {
    border-bottom-color: rgba(0, 95, 143, 0.14);
}

.bb-hero {
    min-height: calc(100vh - 206px);
    background: var(--crato-blue-deep);
}

.bb-hero-slide {
    min-height: calc(100vh - 206px);
}

.bb-hero-image {
    opacity: 1;
    mix-blend-mode: normal;
    object-position: center;
}

.bb-hero-image-family {
    object-position: 60% center;
}

.bb-hero-image-alt {
    object-position: 58% center;
}

.bb-hero-image-focus {
    object-position: center;
}

.bb-hero-slide-background-only .bb-hero-image {
    opacity: 1;
    mix-blend-mode: normal;
}

.bb-hero-tint {
    background:
        linear-gradient(90deg, rgba(0, 76, 115, 0.68) 0%, rgba(0, 95, 143, 0.42) 42%, rgba(0, 76, 115, 0.08) 100%),
        linear-gradient(180deg, rgba(7, 102, 151, 0.06), rgba(0, 76, 115, 0.18));
}

.bb-hero-panel {
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 22px 48px rgba(0, 42, 66, 0.28);
}

.bb-eyebrow,
.bb-hero-panel h1,
.bb-hero-panel h2,
.bb-section-heading h2,
.bb-facilities h2,
.bb-accessibility-grid strong,
.bb-tabs .active {
    color: var(--crato-blue-dark);
}

.bb-hero-panel h1,
.bb-hero-panel h2 {
    font-size: clamp(1.85rem, 3vw, 3rem);
    line-height: 1.05;
}

.bb-button-primary,
.bb-side-card span,
.bb-product-card span,
.bb-carousel-controls > button:not(.bb-carousel-toggle),
.bb-carousel-dots button.is-active {
    background: var(--crato-blue);
    color: #fff;
}

.bb-button-secondary,
.bb-feature-card span,
.bb-cta a {
    background: var(--crato-blue-soft);
    color: var(--crato-blue-deep);
}

.bb-carousel-dots button {
    background: rgba(43, 130, 185, 0.36);
}

.bb-carousel-toggle {
    background: var(--crato-blue-deep);
    color: #fff;
}

.bb-feature-card {
    background: var(--crato-blue-dark);
}

.bb-side-card {
    background: #dff0f8;
    color: var(--crato-blue-deep);
}

.bb-feature-card img,
.bb-side-card img,
.bb-product-card img {
    opacity: 1;
    mix-blend-mode: normal;
    filter: none;
}

.bb-feature-card img {
    object-position: 64% center;
}

.bb-side-card img {
    object-position: center;
}

.bb-product-card img {
    object-position: center;
}

.bb-card-grid span,
.bb-life-card a {
    color: var(--crato-blue-dark);
}

.bb-feature-card span,
.bb-side-card span,
.bb-product-card span,
.bb-life-card a {
    color: #fff;
}

.bb-feature-card span {
    background: rgba(255, 255, 255, 0.18);
}

.bb-life-card-green {
    background: var(--crato-blue-soft);
    color: #17384a;
}

.bb-life-card-green a,
.bb-life-card-green h3,
.bb-life-card-green p {
    color: #17384a;
}

.bb-life-card-green.bb-life-card-with-image a,
.bb-life-card-green.bb-life-card-with-image h3,
.bb-life-card-green.bb-life-card-with-image p {
    color: #fff;
}

.bb-facility-grid a {
    color: var(--crato-blue-dark);
}

.bb-facility-grid span {
    background: var(--crato-blue-soft);
    color: var(--crato-blue-dark);
}

.bb-accessibility-grid article,
.bb-feature-card,
.bb-side-card,
.bb-product-card,
.bb-life-card,
.bb-facility-grid a {
    border-color: rgba(0, 95, 143, 0.16);
}

.bb-cta {
    background: var(--crato-blue);
    color: #fff;
}

@media (max-width: 900px) {
    .portal-crato-brandbar-grid {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 10px 0;
    }

    .portal-crato-brandbar-grid {
        min-height: auto;
        padding: 16px 0;
    }

    .portal-crato-brand img {
        width: min(230px, 74vw);
        height: auto;
    }

    .portal-crato-brand strong {
        font-size: 2.5rem;
    }

    .portal-crato-program {
        width: 100%;
        padding: 12px 0 0;
        border-top: 1px solid rgba(0, 95, 143, 0.18);
        border-left: 0;
        text-align: left;
    }

    .portal-bb-header-grid {
        grid-template-columns: auto 1fr;
    }

    .portal-bb-search,
    .portal-bb-nav {
        grid-column: 1 / -1;
    }

    .portal-public-body:not(.portal-home-body) .portal-bb-nav a.active::after {
        bottom: -7px;
    }

    .portal-page-main {
        width: min(100% - 28px, 1120px);
        padding: 24px 0 56px;
    }

    .portal-page-main .hero,
    .portal-page-main .panel {
        padding: 24px 20px;
    }

    .portal-page-main .hero {
        min-height: 360px;
    }

    .public-document-card,
    .public-document-card dl {
        grid-template-columns: 1fr;
    }

    .portal-calendar-weekdays {
        display: none;
    }

    .portal-calendar-grid {
        grid-template-columns: 1fr;
    }

    .portal-calendar-day {
        min-height: auto;
    }

    .schedule-summary-grid {
        grid-template-columns: 1fr;
    }

    .portal-page-main .hero::before {
        background:
            linear-gradient(180deg, rgba(0, 76, 115, 0.9) 0%, rgba(0, 95, 143, 0.72) 58%, rgba(0, 76, 115, 0.44) 100%);
    }

    .bb-hero,
    .bb-hero-slide {
        min-height: 760px;
    }

    .bb-hero-tint {
        background:
            linear-gradient(180deg, rgba(0, 76, 115, 0.82) 0%, rgba(0, 95, 143, 0.66) 48%, rgba(0, 76, 115, 0.38) 100%);
    }

    .bb-hero-image {
        opacity: 0.9;
    }
}

/* Internal app redesign */
.internal-app-body {
    --bg: #18130f;
    --surface: #fffdf9;
    --surface-strong: #f5eee6;
    --ink: #19130f;
    --muted: #6f6258;
    --line: #e5d8cc;
    --primary: #c2410c;
    --primary-soft: #fff1e6;
    --accent: #f97316;
    --danger: #9f1d15;
    --success: #246b46;
    --shadow: 0 18px 44px rgba(45, 22, 7, 0.1);
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.026) 0 1px, transparent 1px),
        linear-gradient(180deg, #17110d 0%, #21160f 24%, #5a3825 38%, #d8cbbf 54%, #ece4dc 100%);
    background-size: 44px 44px, 100% 100%;
    color: var(--ink);
}

body.internal-app-body:has(.app-frame) {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.026) 0 1px, transparent 1px),
        linear-gradient(180deg, #17110d 0%, #21160f 24%, #5a3825 38%, #d8cbbf 54%, #ece4dc 100%);
    background-size: 44px 44px, 100% 100%;
}

.internal-app-body a:focus-visible,
.internal-app-body button:focus-visible,
.internal-app-body input:focus-visible,
.internal-app-body select:focus-visible,
.internal-app-body textarea:focus-visible,
.internal-app-body summary:focus-visible,
.internal-app-body [tabindex]:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.24);
}

.internal-app-body .skip-link {
    border-radius: 8px;
    background: #2b160c;
    color: #fff7ed;
}

.internal-app-body .app-frame {
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: 100vh;
}

.internal-app-body .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    gap: 14px;
    padding: 18px 12px 14px;
    overflow: hidden;
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 1px 0 0 rgba(255,255,255,0.04);
}

.internal-app-body .sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 0% 0%, rgba(249, 115, 22, 0.08) 0%, transparent 60%);
}

.internal-app-body .sidebar > * {
    position: relative;
    z-index: 1;
}

.internal-app-body .sidebar-brand {
    min-height: 104px;
    padding: 0;
    border-radius: 8px;
    opacity: 1;
}

.internal-app-body .sidebar-brand:hover {
    opacity: 1;
}

.internal-app-body .sidebar-brand-card {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 94px;
    overflow: hidden;
    border: 1px solid rgba(249, 115, 22, 0.26);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.018)),
        linear-gradient(145deg, rgba(124, 45, 18, 0.52), rgba(18, 13, 10, 0.92) 58%, rgba(194, 65, 12, 0.34));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 18px 42px rgba(0, 0, 0, 0.24);
}

.internal-app-body .sidebar-brand-card::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(255, 237, 213, 0.08);
    border-radius: 6px;
    pointer-events: none;
}

.internal-app-body .sidebar-brand .brand-logo {
    width: min(100%, 220px);
    height: 90px;
    padding: 4px 8px;
    object-fit: contain;
    filter:
        drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42))
        drop-shadow(0 0 16px rgba(249, 115, 22, 0.16));
}

.internal-app-body .sidebar-nav {
    gap: 3px;
    padding: 2px 2px 8px;
    scrollbar-color: rgba(249, 115, 22, 0.42) transparent;
}

.internal-app-body .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(249, 115, 22, 0.42);
}

.internal-app-body .sidebar-nav details {
    gap: 1px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 10px;
    margin-bottom: 2px;
}

.internal-app-body .sidebar-nav details + details {
    border-top: 1px solid rgba(255, 237, 213, 0.07);
    padding-top: 5px;
    margin-top: 2px;
}

.internal-app-body .sidebar-nav details[open] {
    border-color: rgba(249, 115, 22, 0.16);
    background: rgba(255, 247, 237, 0.05);
    margin-bottom: 4px;
}

.internal-app-body .sidebar-nav a,
.internal-app-body .sidebar-nav summary {
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 8px;
    color: rgba(255, 247, 237, 0.75);
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    transition: background 180ms ease, color 180ms ease, transform 150ms ease, box-shadow 180ms ease;
}

.internal-app-body .sidebar-nav summary {
    color: rgba(255, 247, 237, 0.92);
    font-size: 0.87rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.internal-app-body .sidebar-nav summary::after {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    color: #fed7aa;
    background: rgba(249, 115, 22, 0.14);
}

.internal-app-body .sidebar-nav details[open] summary {
    background: linear-gradient(135deg, rgba(124, 45, 18, 0.65), rgba(194, 65, 12, 0.28));
    color: #fff3e0;
    border-radius: 7px;
}

.internal-app-body .sidebar-nav details[open] summary::after {
    background: rgba(255, 237, 213, 0.16);
    color: #fff7ed;
}

.internal-app-body .sidebar-nav details a {
    min-height: 34px;
    padding-left: 18px;
    padding-right: 11px;
    color: rgba(255, 247, 237, 0.6);
    font-size: 0.84rem;
    font-weight: 400;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
    margin-left: 4px;
}

.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav summary:hover {
    background: rgba(255, 247, 237, 0.08);
    color: #fffaf5;
    transform: translateX(2px);
}

.internal-app-body .sidebar-nav details a:hover {
    border-left-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.08);
    color: #ffd8aa;
    transform: translateX(3px);
}

.internal-app-body .sidebar-nav a.active {
    color: #fffaf5;
    background: linear-gradient(135deg, #7c2d12 0%, #c2410c 54%, #f97316 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 6px 18px rgba(194, 65, 12, 0.32),
        0 0 0 1px rgba(249, 115, 22, 0.3);
    border-left-color: transparent;
    transform: none;
}

.internal-app-body .sidebar-footer {
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(249, 115, 22, 0.16);
    border-radius: 8px;
    background: rgba(255, 247, 237, 0.055);
}

.internal-app-body .sidebar-footer small {
    color: rgba(255, 237, 213, 0.6);
    font-size: 0.76rem;
}

.internal-app-body .sidebar-footer strong {
    color: #fffaf5;
}

.internal-app-body .sidebar-user {
    padding: 10px 11px;
    border: 1px solid rgba(255, 237, 213, 0.08);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
}

.internal-app-body .sidebar-user span {
    color: rgba(255, 237, 213, 0.58);
}

.internal-app-body .sidebar-footer .button {
    min-height: 38px;
    border: 1px solid rgba(255, 237, 213, 0.12);
    border-radius: 8px;
    background: rgba(255, 247, 237, 0.08);
    color: #fff7ed;
}

.internal-app-body .sidebar-footer .button:hover {
    background: rgba(249, 115, 22, 0.2);
    box-shadow: none;
}

.internal-app-body .content-frame {
    width: min(1260px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 52px;
}

.internal-app-body .hero,
.internal-app-body .panel,
.internal-app-body .stat-card,
.internal-app-body .metric-card,
.internal-app-body .subpanel {
    border: 1px solid rgba(94, 54, 29, 0.14);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 252, 247, 0.96));
    box-shadow: var(--shadow);
}

.internal-app-body .hero {
    position: relative;
    min-height: 166px;
    margin-bottom: 18px;
    overflow: hidden;
    padding: 26px 30px;
    background:
        linear-gradient(135deg, rgba(255, 252, 247, 0.98), rgba(255, 242, 226, 0.92)),
        linear-gradient(120deg, rgba(124, 45, 18, 0.08), rgba(249, 115, 22, 0.16));
}

.internal-app-body .hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #7c2d12, #f97316);
}

.internal-app-body .hero > * {
    position: relative;
}

.internal-app-body .hero:has(.hero-actions) {
    align-items: center;
}

.internal-app-body .hero h1 {
    margin: 8px 0 8px;
    color: #0f172a;
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.internal-app-body .hero p,
.internal-app-body .panel-heading p,
.internal-app-body .stat-card p,
.internal-app-body .metric-card p,
.internal-app-body .meta,
.internal-app-body .empty-state {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.internal-app-body .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.internal-app-body .stat-card,
.internal-app-body .metric-card {
    min-height: 112px;
    padding: 18px 18px 16px;
}

.internal-app-body .stat-card strong,
.internal-app-body .metric-card strong {
    margin-bottom: 10px;
    color: #1f1209;
    font-size: 1.85rem;
    line-height: 1;
    letter-spacing: 0;
}

.internal-app-body .stat-card p,
.internal-app-body .metric-card p {
    font-size: 0.9rem;
}

.internal-app-body .panel {
    margin-bottom: 18px;
    padding: 20px;
}

.internal-app-body .subpanel {
    padding: 16px;
}

.internal-app-body .panel-heading {
    margin-bottom: 14px;
}

.internal-app-body .panel-heading h2 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.internal-app-body .panel-heading p {
    margin: 0;
    max-width: 760px;
}

.internal-app-body .badge {
    min-height: 26px;
    padding: 5px 10px;
    border: 1px solid rgba(194, 65, 12, 0.18);
    border-radius: 999px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: #9a3412;
    font-size: 0.74rem;
    letter-spacing: 0;
}

.internal-app-body .button,
.internal-app-body button,
.internal-app-body input[type="submit"] {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #7c2d12, #c2410c 58%, #f97316);
    color: #fffaf5;
    font-weight: 400;
    box-shadow: 0 12px 24px rgba(194, 65, 12, 0.18);
}

.internal-app-body .button:hover,
.internal-app-body button:hover,
.internal-app-body input[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(194, 65, 12, 0.22);
}

.internal-app-body .button-secondary {
    border-color: rgba(124, 45, 18, 0.18);
    background: #fff7ed;
    color: #7c2d12;
    box-shadow: none;
}

.internal-app-body .button-accent {
    background: linear-gradient(135deg, #9a3412, #f97316);
}

.internal-app-body .button-danger {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
}

.internal-app-body input,
.internal-app-body select,
.internal-app-body textarea {
    border-color: #decfc0;
    border-radius: 8px;
    background: #fffdf9;
    color: #1f1209;
}

.internal-app-body input:focus,
.internal-app-body select:focus,
.internal-app-body textarea:focus {
    border-color: #f97316;
    outline: none;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
}

.internal-app-body label {
    color: #5f5147;
    gap: 7px;
}

.internal-app-body fieldset.choice-tag-field {
    color: #5f5147;
}

.internal-app-body .choice-tag-list {
    border-color: #decfc0;
    border-radius: 8px;
    background: #fffdf9;
}

.internal-app-body .choice-tag {
    border-color: #decfc0;
    background: #f5eee6;
    color: #1f1209;
}

.internal-app-body .form-grid {
    gap: 12px;
}

.internal-app-body .tab-list {
    padding: 6px;
    border-color: rgba(124, 45, 18, 0.16);
    border-radius: 8px;
    background: #f5eee6;
}

.internal-app-body .tab-button {
    min-height: 36px;
    border-radius: 8px;
    color: #6f6258;
}

.internal-app-body .tab-button:hover,
.internal-app-body .tab-button:focus-visible {
    color: #9a3412;
    background: #fffdf9;
}

.internal-app-body .tab-button.active {
    border-color: rgba(194, 65, 12, 0.22);
    background: #fffdf9;
    color: #9a3412;
    box-shadow: 0 8px 16px rgba(45, 22, 7, 0.08);
}

.internal-app-body .table-wrap {
    border: 1px solid rgba(124, 45, 18, 0.12);
    border-radius: 8px;
    background: #fffdf9;
}

.internal-app-body table {
    border-collapse: separate;
    border-spacing: 0;
}

.internal-app-body th,
.internal-app-body td {
    padding: 11px 12px;
    border-bottom-color: rgba(124, 45, 18, 0.13);
}

.internal-app-body th {
    background: #faf4ec;
    color: #7c2d12;
    font-size: 0.74rem;
    letter-spacing: 0;
}

.internal-app-body td {
    color: #2f241d;
}

.internal-app-body tbody tr:hover td {
    background: rgba(255, 247, 237, 0.78);
}

.internal-app-body .selection-cycle-panel {
    padding: 20px;
}

.internal-app-body .cycle-card-list {
    display: grid;
    gap: 14px;
}

.internal-app-body .cycle-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(124, 45, 18, 0.14);
    border-radius: 8px;
    background: linear-gradient(180deg, #fffdf9 0%, #fffaf4 100%);
    box-shadow: 0 12px 28px rgba(45, 22, 7, 0.06);
}

.internal-app-body .cycle-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
}

.internal-app-body .cycle-card-title {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.internal-app-body .cycle-eyebrow {
    color: #9a3412;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
}

.internal-app-body .cycle-card h2 {
    margin: 0;
    color: #1f1209;
    font-size: clamp(1.08rem, 1.5vw, 1.32rem);
    line-height: 1.18;
}

.internal-app-body .cycle-card p {
    margin: 0;
    color: #5f5147;
    line-height: 1.38;
}

.internal-app-body .cycle-start-hint {
    max-width: 760px;
    padding: 9px 11px;
    border: 1px solid rgba(15, 82, 111, 0.12);
    border-radius: 8px;
    background: #eff8ff;
    color: #0f526f;
    font-size: 0.88rem;
    font-weight: 400;
}

.internal-app-body .cycle-start-hint-warning {
    border-color: rgba(180, 83, 9, 0.18);
    background: #fffbeb;
    color: #92400e;
}

.internal-app-body .cycle-chip-row,
.internal-app-body .cycle-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.internal-app-body .cycle-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 10px;
    border: 1px solid rgba(15, 82, 111, 0.16);
    border-radius: 999px;
    background: #eff8ff;
    color: #0f526f;
    font-size: 0.74rem;
    font-weight: 400;
}

.internal-app-body .cycle-chip-success {
    border-color: rgba(22, 101, 52, 0.18);
    background: #ecfdf3;
    color: #166534;
}

.internal-app-body .cycle-chip-muted {
    border-color: rgba(100, 116, 139, 0.18);
    background: #f1f5f9;
    color: #475569;
}

.internal-app-body .cycle-portal-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    border: 1px solid rgba(22, 101, 52, 0.18);
    border-radius: 8px;
    background: #ecfdf3;
    color: #166534;
    font-weight: 400;
    white-space: nowrap;
}

.internal-app-body .cycle-card-actions {
    justify-content: flex-end;
    max-width: 360px;
}

.internal-app-body .cycle-card-actions .button,
.internal-app-body .cycle-card-actions button {
    min-height: 38px;
    padding: 9px 12px;
    white-space: nowrap;
}

.internal-app-body .cycle-card-actions form {
    margin: 0;
}

.internal-app-body .cycle-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.internal-app-body .cycle-metric-grid div {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(124, 45, 18, 0.1);
    border-radius: 8px;
    background: #ffffff;
}

.internal-app-body .cycle-metric-grid span,
.internal-app-body .cycle-detail-grid dt {
    color: #7a6b5f;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
}

.internal-app-body .cycle-metric-grid strong {
    overflow: hidden;
    color: #1f1209;
    font-size: 1.18rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.internal-app-body .cycle-metric-grid small {
    overflow: hidden;
    color: #5f5147;
    font-weight: 400;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.internal-app-body .cycle-details {
    border-top: 1px solid rgba(124, 45, 18, 0.12);
    padding-top: 4px;
}

.internal-app-body .cycle-details summary {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    color: #7c2d12;
    font-weight: 400;
    cursor: pointer;
}

.internal-app-body .cycle-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.internal-app-body .cycle-detail-grid section {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(124, 45, 18, 0.1);
    border-radius: 8px;
    background: #fff;
}

.internal-app-body .cycle-detail-grid h3 {
    margin: 0 0 10px;
    color: #1f1209;
    font-size: 0.9rem;
}

.internal-app-body .cycle-detail-grid dl {
    display: grid;
    gap: 9px;
    margin: 0;
}

.internal-app-body .cycle-detail-grid div {
    display: grid;
    gap: 2px;
}

.internal-app-body .cycle-detail-grid dd {
    margin: 0;
    color: #2f241d;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

.internal-app-body .appointment-calendar-panel {
    display: grid;
    gap: 16px;
}

.internal-app-body .calendar-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.internal-app-body .calendar-toolbar h2,
.internal-app-body .calendar-day-heading h2 {
    margin: 0;
    color: #1f1209;
    font-size: 1.24rem;
}

.internal-app-body .calendar-toolbar p,
.internal-app-body .calendar-day-heading p {
    margin: 5px 0 0;
    color: #5f5147;
}

.internal-app-body .calendar-reference {
    color: #9a3412;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
}

.internal-app-body .calendar-toolbar-actions,
.internal-app-body .calendar-view-tabs,
.internal-app-body .calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.internal-app-body .calendar-toolbar-actions .button {
    min-height: 36px;
    padding: 8px 11px;
}

.internal-app-body .calendar-view-tabs {
    padding: 6px;
    border: 1px solid rgba(124, 45, 18, 0.14);
    border-radius: 8px;
    background: #f5eee6;
}

.internal-app-body .calendar-view-tabs a {
    min-height: 34px;
    padding: 8px 14px;
    border-radius: 8px;
    color: #6f6258;
    font-weight: 400;
}

.internal-app-body .calendar-view-tabs a.active {
    background: #fffdf9;
    color: #7c2d12;
    box-shadow: 0 8px 16px rgba(45, 22, 7, 0.08);
}

.internal-app-body .calendar-legend {
    color: #5f5147;
    font-size: 0.86rem;
    font-weight: 400;
}

.internal-app-body .calendar-legend span {
    display: inline-flex;
    gap: 7px;
    align-items: center;
}

.internal-app-body .calendar-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.internal-app-body .calendar-dot-free {
    background: #15803d;
}

.internal-app-body .calendar-dot-busy {
    background: #2563eb;
}

.internal-app-body .calendar-dot-full {
    background: #b45309;
}

.internal-app-body .calendar-dot-blocked {
    background: #64748b;
}

.internal-app-body .calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border: 1px solid rgba(124, 45, 18, 0.14);
    border-radius: 8px;
    overflow: hidden;
    background: #fffdf9;
}

.internal-app-body .calendar-weekday {
    padding: 10px;
    background: #faf4ec;
    color: #7c2d12;
    font-size: 0.76rem;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
}

.internal-app-body .calendar-day-cell {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 154px;
    padding: 10px;
    border-top: 1px solid rgba(124, 45, 18, 0.1);
    border-left: 1px solid rgba(124, 45, 18, 0.1);
    background: #fff;
}

.internal-app-body .calendar-day-cell:nth-child(7n + 1) {
    border-left: 0;
}

.internal-app-body .calendar-day-cell.outside-month {
    background: #f8f3ed;
    color: #8b7c70;
}

.internal-app-body .calendar-day-cell.is-today {
    box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.38);
}

.internal-app-body .calendar-day-cell header,
.internal-app-body .calendar-week-column header,
.internal-app-body .calendar-day-slot-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.internal-app-body .calendar-day-cell header a,
.internal-app-body .calendar-week-column header a {
    color: #1f1209;
    font-weight: 400;
}

.internal-app-body .calendar-day-cell header span {
    color: #7c2d12;
    font-size: 0.78rem;
    font-weight: 400;
}

.internal-app-body .calendar-slot-stack,
.internal-app-body .calendar-week-slots,
.internal-app-body .calendar-day-slots {
    display: grid;
    gap: 8px;
}

.internal-app-body .calendar-slot-pill,
.internal-app-body .calendar-week-slot {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 8px;
    border-left: 4px solid #15803d;
    border-radius: 8px;
    background: #ecfdf3;
    color: #14532d;
}

.internal-app-body .calendar-slot-pill strong,
.internal-app-body .calendar-week-slot strong {
    font-size: 0.86rem;
}

.internal-app-body .calendar-slot-pill span,
.internal-app-body .calendar-week-slot span,
.internal-app-body .calendar-week-slot small {
    overflow: hidden;
    font-size: 0.74rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.internal-app-body .calendar-slot-busy {
    border-left-color: #2563eb;
    background: #eff6ff;
    color: #1e3a8a;
}

.internal-app-body .calendar-slot-full {
    border-left-color: #b45309;
    background: #ffedd5;
    color: #9a3412;
}

.internal-app-body .calendar-slot-blocked,
.internal-app-body .calendar-slot-closed {
    border-left-color: #64748b;
    background: #f1f5f9;
    color: #475569;
}

.internal-app-body .calendar-empty-day,
.internal-app-body .calendar-more-link {
    color: #8b7c70;
    font-size: 0.78rem;
    font-weight: 400;
}

.internal-app-body .calendar-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.internal-app-body .calendar-week-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 420px;
    padding: 12px;
    border: 1px solid rgba(124, 45, 18, 0.14);
    border-radius: 8px;
    background: #fffdf9;
}

.internal-app-body .calendar-week-column.is-today {
    border-color: rgba(249, 115, 22, 0.48);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.internal-app-body .calendar-week-column header span {
    color: #7c2d12;
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
}

.internal-app-body .calendar-day-view {
    display: grid;
    gap: 14px;
}

.internal-app-body .calendar-day-slot {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(124, 45, 18, 0.12);
    border-left: 5px solid #15803d;
    border-radius: 8px;
    background: #fff;
}

.internal-app-body .calendar-day-slot-main {
    align-items: flex-start;
}

.internal-app-body .calendar-day-slot-main p {
    margin: 4px 0 0;
    color: #5f5147;
}

.internal-app-body .calendar-day-time {
    display: block;
    color: #7c2d12;
    font-size: 0.78rem;
    font-weight: 400;
}

.internal-app-body .calendar-day-capacity {
    display: grid;
    justify-items: end;
    gap: 2px;
    min-width: 96px;
}

.internal-app-body .calendar-day-capacity span {
    color: #1f1209;
    font-size: 1.2rem;
    font-weight: 400;
}

.internal-app-body .calendar-day-capacity small {
    color: #5f5147;
    font-size: 0.76rem;
    font-weight: 400;
}

.internal-app-body .calendar-booking-list {
    display: grid;
    gap: 7px;
    padding: 10px;
    border-radius: 8px;
    background: #f8f3ed;
}

.internal-app-body .calendar-booking-list h3 {
    margin: 0;
    color: #1f1209;
    font-size: 0.88rem;
}

.internal-app-body .calendar-booking-list a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fffdf9;
}

.internal-app-body .calendar-booking-list span {
    color: #5f5147;
    font-size: 0.82rem;
    font-weight: 400;
}

.internal-app-body .calendar-slot-edit {
    border-top: 1px solid rgba(124, 45, 18, 0.1);
    padding-top: 8px;
}

.internal-app-body .calendar-slot-edit summary {
    color: #7c2d12;
    font-weight: 400;
    cursor: pointer;
}

@media (max-width: 1180px) {
    .internal-app-body .cycle-card-header {
        grid-template-columns: 1fr;
    }

    .internal-app-body .cycle-card-actions {
        justify-content: flex-start;
        max-width: none;
    }

    .internal-app-body .cycle-metric-grid,
    .internal-app-body .cycle-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .internal-app-body .calendar-week-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .internal-app-body .selection-cycle-panel,
    .internal-app-body .cycle-card {
        padding: 14px;
    }

    .internal-app-body .cycle-metric-grid,
    .internal-app-body .cycle-detail-grid {
        grid-template-columns: 1fr;
    }

    .internal-app-body .cycle-card-actions .button,
    .internal-app-body .cycle-card-actions button,
    .internal-app-body .cycle-card-actions form {
        width: 100%;
    }

    .internal-app-body .cycle-card-actions .button,
    .internal-app-body .cycle-card-actions button {
        justify-content: center;
    }

    .internal-app-body .calendar-toolbar {
        display: grid;
    }

    .internal-app-body .calendar-month-grid {
        display: grid;
        grid-template-columns: 1fr;
        border: 0;
        gap: 10px;
        background: transparent;
    }

    .internal-app-body .calendar-weekday {
        display: none;
    }

    .internal-app-body .calendar-day-cell {
        min-height: 0;
        border: 1px solid rgba(124, 45, 18, 0.14);
        border-radius: 8px;
    }

    .internal-app-body .calendar-day-cell.outside-month {
        display: none;
    }

    .internal-app-body .calendar-week-grid {
        grid-template-columns: 1fr;
    }

    .internal-app-body .calendar-week-column {
        min-height: 0;
    }

    .internal-app-body .calendar-day-slot-main,
    .internal-app-body .calendar-booking-list a {
        display: grid;
    }

    .internal-app-body .calendar-day-capacity {
        justify-items: start;
    }
}

.internal-app-body .alert {
    border-radius: 8px;
}

.internal-app-body .alert-success {
    background: #ecfdf3;
    border-color: #b9e8ca;
}

.internal-app-body .alert-danger {
    background: #fff0ed;
    border-color: #f2b8ac;
}

.internal-app-body .alert-info {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.internal-app-body .permission-group {
    border-color: rgba(124, 45, 18, 0.16);
    border-radius: 8px;
}

.internal-app-body .audit-json,
.internal-app-body .territorial-map {
    border-color: rgba(124, 45, 18, 0.16);
    border-radius: 8px;
    background: #f7efe6;
}

.internal-app-body .chart-panel {
    min-height: 330px;
}

.internal-app-body .pagination-row nav,
.internal-app-body .pagination-row div {
    color: #5f5147;
}

@media (max-width: 1100px) {
    .internal-app-body .app-frame {
        grid-template-columns: 248px minmax(0, 1fr);
    }

    .internal-app-body .content-frame {
        width: min(100% - 28px, 1180px);
    }
}

@media (max-width: 900px) {
    .internal-app-body,
    body.internal-app-body:has(.app-frame) {
        background: linear-gradient(180deg, #17110d 0%, #241812 740px, #d8cbbf 920px, #ece4dc 100%);
    }

    .internal-app-body .app-frame {
        grid-template-columns: 1fr;
    }

    .internal-app-body .sidebar {
        position: relative;
        height: auto;
        min-height: 0;
        padding: 14px;
    }

    .internal-app-body .sidebar-brand {
        min-height: 86px;
    }

    .internal-app-body .sidebar-brand-card {
        min-height: 82px;
    }

    .internal-app-body .sidebar-brand .brand-logo {
        height: 58px;
    }

    .internal-app-body .sidebar-nav {
        max-height: none;
    }

    .internal-app-body .sidebar-footer {
        grid-template-columns: minmax(0, 1fr);
    }

    .internal-app-body .content-frame {
        width: min(100% - 24px, 1180px);
        padding: 18px 0 42px;
    }

    .internal-app-body .hero,
    .internal-app-body .panel {
        padding: 18px;
    }

    .internal-app-body .hero {
        min-height: 0;
    }

    .internal-app-body .hero h1 {
        font-size: 1.55rem;
    }

    .internal-app-body .hero:has(.hero-actions) {
        grid-template-columns: 1fr;
        display: grid;
        align-items: start;
    }

    .internal-app-body .stats-grid,
    .internal-app-body .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* Internal app redesign v2: operational workspace */
.internal-app-body,
body.internal-app-body:has(.app-frame) {
    --app-bg: #f1f5f9;
    --app-bg-soft: #f8fafc;
    --app-sidebar: #0f172a;
    --app-sidebar-2: #1e293b;
    --app-panel: #ffffff;
    --app-panel-strong: #ffffff;
    --app-ink: #0f172a;
    --app-muted: #64748b;
    --app-line: #e2e8f0;
    --app-orange: #f97316;
    --app-orange-dark: #c2410c;
    --app-copper: #ea580c;
    --app-shadow: 0 1px 3px rgba(15, 23, 40, 0.06), 0 1px 2px rgba(15, 23, 40, 0.04);
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.internal-app-body .app-frame {
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(124, 45, 18, 0.08) 0 1px, transparent 1px),
        linear-gradient(180deg, #f6f1ea 0%, #ebe1d6 100%);
    background-size: 56px 56px, 100% 100%;
}

.internal-app-body .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    gap: 16px;
    padding: 18px 14px;
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.internal-app-body .sidebar::before {
    background: radial-gradient(ellipse at 0% 0%, rgba(249, 115, 22, 0.07) 0%, transparent 55%);
}

.internal-app-body .sidebar-brand {
    min-height: 106px;
}

.internal-app-body .sidebar-brand-card {
    min-height: 100px;
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
}

.internal-app-body .sidebar-brand .brand-logo {
    width: min(100%, 210px);
    height: 88px;
}

.internal-app-body .sidebar-nav {
    gap: 6px;
}

.internal-app-body .sidebar-nav details {
    padding: 4px;
    border-radius: 8px;
}

.internal-app-body .sidebar-nav details[open] {
    background: rgba(255, 250, 244, 0.05);
    border-color: rgba(251, 146, 60, 0.16);
}

.internal-app-body .sidebar-nav a,
.internal-app-body .sidebar-nav summary {
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 8px;
    color: rgba(255, 250, 244, 0.76);
    font-size: 0.92rem;
    font-weight: 400;
}

.internal-app-body .sidebar-nav summary {
    color: #fff7ed;
}

.internal-app-body .sidebar-nav summary::after {
    background: rgba(234, 88, 12, 0.18);
    color: #fed7aa;
}

.internal-app-body .sidebar-nav details[open] summary {
    background: transparent;
}

.internal-app-body .sidebar-nav a.active {
    background: transparent;
    color: #ea580c;
    box-shadow: none;
    font-weight: 400;
}

.internal-app-body .sidebar-footer {
    border-color: rgba(251, 146, 60, 0.18);
    background: rgba(255, 250, 244, 0.06);
}

.internal-app-body .sidebar-footer .button {
    background: rgba(255, 250, 244, 0.1);
}

.internal-app-body .app-workspace {
    min-width: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.internal-app-body .app-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 40, 0.06);
    backdrop-filter: blur(12px);
}

.internal-app-body .app-topbar-title {
    display: grid;
    gap: 2px;
}

.internal-app-body .app-topbar-title span {
    color: var(--app-orange-dark);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.internal-app-body .app-topbar-title strong {
    color: var(--app-ink);
    font-size: 1rem;
}

.internal-app-body .app-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.internal-app-body .app-topbar-actions a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid rgba(124, 45, 18, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.64);
    color: #5f3b25;
    font-size: 0.86rem;
    font-weight: 400;
}

.internal-app-body .app-topbar-actions a:hover,
.internal-app-body .app-topbar-actions a.active {
    border-color: rgba(234, 88, 12, 0.34);
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: var(--app-orange-dark);
}

.internal-app-body .content-frame {
    width: min(1360px, calc(100% - 48px));
    padding: 24px 0 56px;
}

.internal-app-body .hero,
.internal-app-body .panel,
.internal-app-body .stat-card,
.internal-app-body .metric-card,
.internal-app-body .subpanel {
    border-color: rgba(124, 45, 18, 0.13);
    border-radius: 8px;
    background: var(--app-panel-strong);
    box-shadow: var(--app-shadow);
}

.internal-app-body .hero {
    min-height: 136px;
    padding: 24px 28px;
    background:
        linear-gradient(135deg, #fffaf4 0%, #fff1e6 100%);
}

.internal-app-body .hero h1 {
    font-size: 1.65rem;
}

.internal-app-body .panel {
    padding: 20px;
}

.internal-app-body .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.internal-app-body .stat-card,
.internal-app-body .metric-card {
    min-height: 112px;
}

.internal-app-body .button,
.internal-app-body button,
.internal-app-body input[type="submit"] {
    border-radius: 8px;
    background: linear-gradient(135deg, #9a3412, #ea580c 65%, #f97316);
}

.internal-app-body .button-secondary {
    background: #fff7ed;
    color: var(--app-orange-dark);
}

.internal-app-body .table-wrap {
    border-color: rgba(124, 45, 18, 0.12);
    border-radius: 8px;
}

.internal-app-body th {
    background: #fff4e9;
    color: var(--app-orange-dark);
}

.internal-app-body tbody tr:hover td {
    background: #fff9f1;
}

.internal-app-body .dashboard-shell {
    display: grid;
    gap: 18px;
}

.internal-app-body .dashboard-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    min-height: 240px;
    overflow: hidden;
    border: 1px solid rgba(124, 45, 18, 0.18);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(18, 15, 13, 0.92), rgba(80, 37, 17, 0.9)),
        linear-gradient(135deg, #3b1f12, #ea580c);
    box-shadow: 0 24px 60px rgba(53, 26, 12, 0.2);
}

.internal-app-body .dashboard-command-copy {
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 34px 38px;
    color: #fffaf4;
}

.internal-app-body .dashboard-eyebrow {
    width: fit-content;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid rgba(251, 146, 60, 0.34);
    border-radius: 8px;
    background: rgba(255, 247, 237, 0.1);
    color: #fed7aa;
    font-size: 0.74rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.internal-app-body .dashboard-command h1 {
    max-width: 760px;
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 3.45rem);
    line-height: 1.02;
    letter-spacing: 0;
}

.internal-app-body .dashboard-command-copy p:not(.dashboard-eyebrow) {
    max-width: 720px;
    margin: 0;
    color: rgba(255, 247, 237, 0.76);
    font-size: 1rem;
    line-height: 1.55;
}

.internal-app-body .dashboard-command-status {
    display: grid;
    align-content: center;
    gap: 12px;
    margin: 18px;
    padding: 22px;
    border: 1px solid rgba(255, 237, 213, 0.18);
    border-radius: 8px;
    background: rgba(255, 250, 244, 0.1);
    color: #fff7ed;
    backdrop-filter: blur(14px);
}

.internal-app-body .dashboard-command-status span {
    color: #fed7aa;
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
}

.internal-app-body .dashboard-command-status strong {
    color: #fff;
    font-size: 4rem;
    line-height: 0.9;
}

.internal-app-body .dashboard-command-status p {
    margin: 0;
    color: rgba(255, 247, 237, 0.76);
}

.internal-app-body .dashboard-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.internal-app-body .dashboard-status-grid div {
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 250, 244, 0.12);
}

.internal-app-body .dashboard-status-grid small {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 237, 213, 0.72);
    font-weight: 400;
}

.internal-app-body .dashboard-status-grid b {
    color: #fff;
    font-size: 1.3rem;
}

.internal-app-body .dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.internal-app-body .dashboard-kpi {
    min-height: 122px;
    display: grid;
    align-content: space-between;
    gap: 18px;
    padding: 18px;
    border-top: 4px solid var(--app-orange);
}

.internal-app-body .dashboard-kpi span,
.internal-app-body .dashboard-mini-kpi span {
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.28;
}

.internal-app-body .dashboard-kpi strong,
.internal-app-body .dashboard-mini-kpi strong {
    order: -1;
    margin: 0;
    color: var(--app-ink);
    font-size: 2.15rem;
    letter-spacing: 0;
}

.internal-app-body .dashboard-secondary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.internal-app-body .dashboard-mini-kpi {
    min-height: 88px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px;
    background: #fff7ed;
}

.internal-app-body .dashboard-mini-kpi strong {
    font-size: 1.75rem;
}

.internal-app-body .dashboard-alert-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.internal-app-body .dashboard-insight-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.internal-app-body .dashboard-panel {
    display: grid;
    align-content: start;
    gap: 14px;
    margin: 0;
}

.internal-app-body .dashboard-panel > p {
    margin: 0;
    color: var(--app-muted);
}

.internal-app-body .dashboard-panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.internal-app-body .dashboard-panel-title span {
    display: block;
    margin-bottom: 5px;
    color: var(--app-orange-dark);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.internal-app-body .dashboard-panel-title h2 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1.12rem;
    line-height: 1.15;
}

.internal-app-body .dashboard-panel-title b {
    min-width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: var(--app-orange-dark);
    font-size: 1.1rem;
}

.internal-app-body .dashboard-list {
    box-shadow: none;
}

.internal-app-body .dashboard-list table {
    min-width: 0;
}

.internal-app-body .dashboard-list td {
    padding: 12px;
}

.internal-app-body .dashboard-recent {
    margin-bottom: 0;
}

@media (max-width: 1280px) {
    .internal-app-body .dashboard-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .internal-app-body .dashboard-insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .internal-app-body .app-frame {
        grid-template-columns: 1fr;
    }

    .internal-app-body .sidebar {
        position: relative;
        height: auto;
    }

    .internal-app-body .app-topbar {
        position: relative;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }

    .internal-app-body .app-topbar-actions {
        justify-content: flex-start;
    }

    .internal-app-body .content-frame {
        width: min(100% - 28px, 1180px);
        padding: 18px 0 44px;
    }

    .internal-app-body .dashboard-command,
    .internal-app-body .dashboard-alert-grid {
        grid-template-columns: 1fr;
    }

    .internal-app-body .dashboard-command-copy {
        padding: 26px 24px;
    }

    .internal-app-body .dashboard-command-status {
        margin-top: 0;
    }

    .internal-app-body .dashboard-kpi-grid,
    .internal-app-body .dashboard-secondary-strip,
    .internal-app-body .dashboard-insight-grid {
        grid-template-columns: 1fr;
    }
}

.internal-app-body .dashboard-executive {
    gap: 14px;
}

.internal-app-body .dashboard-command.dashboard-command-compact {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.internal-app-body .dashboard-command-compact .dashboard-command-copy {
    padding: 0;
}

.internal-app-body .dashboard-command-compact h1 {
    font-size: clamp(1.5rem, 2vw, 2.05rem);
}

.internal-app-body .dashboard-command-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.internal-app-body .dashboard-command-summary span {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.86rem;
    font-weight: 400;
}

.internal-app-body .dashboard-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.internal-app-body .dashboard-action-row .button {
    min-height: 38px;
    padding: 9px 12px;
    white-space: nowrap;
}

.internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.internal-app-body .dashboard-kpi-executive {
    min-height: 96px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px;
    border-left: 0;
    border-top: 3px solid #0f766e;
}

.internal-app-body .dashboard-kpi-executive:nth-child(2) {
    border-top-color: #b45309;
}

.internal-app-body .dashboard-kpi-executive:nth-child(3) {
    border-top-color: #2563eb;
}

.internal-app-body .dashboard-kpi-executive:nth-child(4) {
    border-top-color: #15803d;
}

.internal-app-body .dashboard-kpi-executive:nth-child(5) {
    border-top-color: #7c3aed;
}

.internal-app-body .dashboard-kpi-executive:nth-child(6) {
    border-top-color: #be123c;
}

.internal-app-body .dashboard-kpi-executive strong {
    order: 0;
    font-size: clamp(2rem, 3vw, 2.65rem);
    line-height: 0.95;
}

.internal-app-body .dashboard-kpi-executive span {
    max-width: 100%;
    color: #64748b;
    font-size: 0.82rem;
}

.internal-app-body .dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.internal-app-body .dashboard-chart-panel {
    min-height: 292px;
}

.internal-app-body .dashboard-bar-chart {
    display: grid;
    gap: 11px;
}

.internal-app-body .dashboard-bar-row {
    display: grid;
    grid-template-columns: minmax(108px, 0.72fr) minmax(120px, 1fr) 42px;
    align-items: center;
    gap: 10px;
}

.internal-app-body .dashboard-bar-row span {
    min-width: 0;
    overflow: hidden;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 400;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.internal-app-body .dashboard-bar-row strong {
    color: #111827;
    font-size: 0.95rem;
    text-align: right;
}

.internal-app-body .dashboard-bar-track {
    height: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.internal-app-body .dashboard-bar-track i {
    display: block;
    min-width: 4px;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #f59e0b);
}

.internal-app-body .dashboard-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 0.78fr);
    gap: 14px;
}

.internal-app-body .dashboard-alert-panel,
.internal-app-body .dashboard-navigation-panel {
    min-height: 286px;
}

.internal-app-body .dashboard-alert-list,
.internal-app-body .dashboard-navigation-links {
    display: grid;
    gap: 8px;
}

.internal-app-body .dashboard-alert-list a,
.internal-app-body .dashboard-navigation-links a {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #f8fafc;
    transition: border-color 160ms ease, background 160ms ease;
}

.internal-app-body .dashboard-alert-list a:hover,
.internal-app-body .dashboard-navigation-links a:hover {
    border-color: #94a3b8;
    background: #ffffff;
}

.internal-app-body .dashboard-alert-list strong,
.internal-app-body .dashboard-navigation-links strong {
    color: #111827;
    font-size: 0.92rem;
    line-height: 1.2;
}

.internal-app-body .dashboard-alert-list span,
.internal-app-body .dashboard-navigation-links span,
.internal-app-body .dashboard-alert-list em {
    min-width: 0;
    overflow: hidden;
    color: #64748b;
    font-size: 0.8rem;
    font-style: normal;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.internal-app-body .dashboard-alert-list em {
    color: #92400e;
    font-weight: 400;
}

.internal-app-body .dashboard-panel-link {
    width: fit-content;
    margin-top: 2px;
    color: #0f766e;
    font-size: 0.86rem;
    font-weight: 400;
}

.internal-app-body .dashboard-panel-link:hover {
    color: #0f5132;
}

@media (max-width: 1280px) {
    .internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive,
    .internal-app-body .dashboard-bottom-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .internal-app-body .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .internal-app-body .dashboard-command.dashboard-command-compact {
        align-items: stretch;
        flex-direction: column;
    }

    .internal-app-body .dashboard-action-row {
        justify-content: flex-start;
    }

    .internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive,
    .internal-app-body .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }

    .internal-app-body .dashboard-bar-row {
        grid-template-columns: minmax(96px, 0.82fr) minmax(90px, 1fr) 36px;
    }
}

/* Internal app redesign v3: clean modern system */
.internal-app-body,
body.internal-app-body:has(.app-frame) {
    --app-bg: #f1f5f9;
    --app-sidebar: #0f172a;
    --app-panel: #ffffff;
    --app-panel-soft: #f8fafc;
    --app-ink: #0f172a;
    --app-muted: #64748b;
    --app-line: #e2e8f0;
    --app-orange: #f97316;
    --app-orange-dark: #c2410c;
    --app-orange-soft: #fff7ed;
    --app-shadow: 0 1px 3px rgba(15, 23, 40, 0.06), 0 1px 2px rgba(15, 23, 40, 0.04);
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.internal-app-body .app-frame {
    grid-template-columns: 268px minmax(0, 1fr);
    background: var(--app-bg);
}

.internal-app-body .sidebar {
    gap: 18px;
    padding: 18px 14px;
    background: var(--app-sidebar);
    border-right: 1px solid var(--app-line);
    box-shadow: none;
}

.internal-app-body .sidebar::before {
    display: none;
}

.internal-app-body .sidebar-brand {
    min-height: 124px;
    padding: 4px 4px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0;
}

.internal-app-body .sidebar-brand-card {
    min-height: 102px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.internal-app-body .sidebar-brand-card::after {
    display: none;
}

.internal-app-body .sidebar-brand .brand-logo {
    width: min(100%, 220px);
    height: 98px;
    padding: 0;
    object-fit: contain;
    filter: none;
}

.internal-app-body .sidebar-nav {
    gap: 4px;
    padding: 0 0 8px;
    scrollbar-color: rgba(180, 83, 9, 0.35) transparent;
}

.internal-app-body .sidebar-nav details {
    gap: 2px;
    padding: 2px 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.internal-app-body .sidebar-nav details[open] {
    border: 0;
    background: transparent;
}

.internal-app-body .sidebar-nav a,
.internal-app-body .sidebar-nav summary {
    min-height: 38px;
    padding: 9px 10px;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 400;
    box-shadow: none;
    transition: color 120ms ease, background 120ms ease;
}

.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav summary:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.internal-app-body .sidebar-nav summary {
    color: #cbd5e1;
    font-weight: 400;
}

.internal-app-body .sidebar-nav summary::after {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
}

.internal-app-body .sidebar-nav details[open] summary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.internal-app-body .sidebar-nav details[open] summary::after {
    background: rgba(249, 115, 22, 0.15);
    color: var(--app-orange);
}

.internal-app-body .sidebar-nav details a {
    position: relative;
    min-height: 36px;
    margin-left: 8px;
    padding-left: 16px;
    color: #64748b;
    font-size: 0.85rem;
}

.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav summary:hover {
    transform: none;
    background: #f3f4f6;
    color: #111827;
}

.internal-app-body .sidebar-nav a.active {
    background: transparent;
    color: #ea580c;
    box-shadow: none;
    font-weight: 400;
}

.internal-app-body .sidebar-nav a.active::before {
    content: none;
}

.internal-app-body .sidebar-footer {
    gap: 8px;
    padding: 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.internal-app-body .sidebar-user {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.internal-app-body .sidebar-nav details {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
}

.internal-app-body .sidebar-nav details a {
    display: flex;
    width: calc(100% - 8px);
}

.internal-app-body .app-topbar {
    min-height: 64px;
    padding: 12px 28px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 40, 0.05);
    justify-content: flex-start;
}

.internal-app-body .app-topbar-title span {
    color: var(--app-orange-dark);
}

.internal-app-body .app-topbar-title strong {
    color: #111827;
}

.internal-app-body .app-topbar-actions a {
    min-height: 34px;
    border-color: var(--app-line);
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
}

.internal-app-body .app-topbar-actions a:hover,
.internal-app-body .app-topbar-actions a.active {
    border-color: #fed7aa;
    background: var(--app-orange-soft);
    color: var(--app-orange-dark);
}

.internal-app-body .content-frame {
    width: min(1280px, calc(100% - 48px));
    padding: 24px 0 56px;
}

.internal-app-body .hero,
.internal-app-body .panel,
.internal-app-body .stat-card,
.internal-app-body .metric-card,
.internal-app-body .subpanel,
.internal-app-body .dashboard-command,
.internal-app-body .dashboard-command-status {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: var(--app-panel);
    box-shadow: 0 1px 3px rgba(15, 23, 40, 0.05);
}

.internal-app-body .hero {
    min-height: auto;
    padding: 24px 28px;
    border-left: 4px solid var(--app-orange);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.internal-app-body .hero::before {
    display: none;
}

.internal-app-body .hero h1 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: -0.03em;
}

.internal-app-body .hero p,
.internal-app-body .panel-heading p,
.internal-app-body .stat-card p,
.internal-app-body .metric-card p,
.internal-app-body .meta,
.internal-app-body .empty-state {
    color: var(--app-muted);
}

.internal-app-body .panel {
    padding: 20px;
}

.internal-app-body .panel-heading h2 {
    color: #111827;
}

.internal-app-body .badge {
    border: 1px solid #e0f2fe;
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 400;
}

.internal-app-body .button,
.internal-app-body button,
.internal-app-body input[type="submit"] {
    min-height: 36px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    background: var(--app-orange);
    color: #ffffff;
    box-shadow: none;
    border: 1px solid transparent;
    transition: background 120ms ease, box-shadow 120ms ease;
}

.internal-app-body .button:hover,
.internal-app-body button:hover,
.internal-app-body input[type="submit"]:hover {
    transform: none;
    background: #ea6c0a;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.internal-app-body .button-secondary {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
}

.internal-app-body .button-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: none;
}

.internal-app-body input,
.internal-app-body select,
.internal-app-body textarea {
    border-color: #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
}

.internal-app-body input:focus,
.internal-app-body select:focus,
.internal-app-body textarea:focus {
    border-color: var(--app-orange);
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

.internal-app-body label {
    color: #475569;
}

.internal-app-body .table-wrap {
    border-color: var(--app-line);
    border-radius: 8px;
    background: #ffffff;
}

.internal-app-body th {
    background: #f8fafc;
    color: #475569;
}

.internal-app-body td {
    color: #334155;
}

.internal-app-body th,
.internal-app-body td {
    border-bottom-color: var(--app-line);
}

.internal-app-body tbody tr:hover td {
    background: #fafafa;
}

.internal-app-body .dashboard-shell {
    gap: 16px;
}

.internal-app-body .dashboard-command {
    grid-template-columns: minmax(0, 1fr) 280px;
    min-height: 190px;
    overflow: visible;
}

.internal-app-body .dashboard-command-copy {
    gap: 10px;
    padding: 26px 28px;
    color: #111827;
}

.internal-app-body .dashboard-eyebrow {
    border-color: #fed7aa;
    border-radius: 999px;
    background: var(--app-orange-soft);
    color: var(--app-orange-dark);
}

.internal-app-body .dashboard-command h1 {
    max-width: 700px;
    color: #111827;
    font-size: clamp(1.75rem, 2.4vw, 2.55rem);
    line-height: 1.08;
}

.internal-app-body .dashboard-command-copy p:not(.dashboard-eyebrow) {
    color: #64748b;
}

.internal-app-body .dashboard-command-status {
    margin: 18px;
    gap: 8px;
    padding: 18px;
    color: #111827;
    box-shadow: none;
}

.internal-app-body .dashboard-command-status span {
    color: var(--app-orange-dark);
}

.internal-app-body .dashboard-command-status strong {
    color: #111827;
    font-size: 3.2rem;
}

.internal-app-body .dashboard-command-status p {
    color: #64748b;
}

.internal-app-body .dashboard-status-grid div {
    border: 1px solid var(--app-line);
    background: #f8fafc;
}

.internal-app-body .dashboard-status-grid small {
    color: #64748b;
}

.internal-app-body .dashboard-status-grid b {
    color: #111827;
}

.internal-app-body .dashboard-kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.internal-app-body .dashboard-kpi {
    min-height: 104px;
    gap: 12px;
    padding: 16px;
    border-top: 0;
    border-left: 3px solid var(--app-orange);
}

.internal-app-body .dashboard-kpi span,
.internal-app-body .dashboard-mini-kpi span {
    color: #64748b;
}

.internal-app-body .dashboard-kpi strong,
.internal-app-body .dashboard-mini-kpi strong {
    color: #111827;
    font-size: 1.9rem;
}

.internal-app-body .dashboard-secondary-strip {
    gap: 10px;
}

.internal-app-body .dashboard-mini-kpi {
    min-height: 78px;
    border-color: var(--app-line);
    background: #ffffff;
}

.internal-app-body .dashboard-mini-kpi strong {
    font-size: 1.5rem;
}

.internal-app-body .dashboard-alert-grid,
.internal-app-body .dashboard-insight-grid {
    gap: 16px;
}

.internal-app-body .dashboard-panel-title span {
    color: var(--app-orange-dark);
}

.internal-app-body .dashboard-panel-title h2 {
    color: #111827;
}

.internal-app-body .dashboard-panel-title b {
    background: var(--app-orange-soft);
    color: var(--app-orange-dark);
}

.internal-app-body .dashboard-panel > p {
    color: #64748b;
}

.internal-app-body .dossier-tabs {
    border-color: #e5e7eb;
    background: #ffffff;
}

.internal-app-body .tab-list {
    gap: 8px;
    border-color: #e5e7eb;
    background: #f8fafc;
}

.internal-app-body .tab-button,
.internal-app-body button.tab-button {
    min-height: 38px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    box-shadow: none;
}

.internal-app-body .tab-button:hover,
.internal-app-body .tab-button:focus-visible,
.internal-app-body button.tab-button:hover,
.internal-app-body button.tab-button:focus-visible {
    border-color: #b45309;
    background: #fff7ed;
    color: #7c2d12;
    transform: none;
}

.internal-app-body .tab-button.active,
.internal-app-body button.tab-button.active {
    border-color: #92400e;
    background: #92400e;
    color: #ffffff;
}

.internal-app-body .tab-button.active:hover,
.internal-app-body button.tab-button.active:hover {
    background: #7c2d12;
    color: #ffffff;
}

.internal-app-body button:disabled,
.internal-app-body .button:disabled,
.internal-app-body button[disabled] {
    border-color: #d1d5db;
    background: #e5e7eb;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 1;
}

@media (max-width: 980px) {
    .internal-app-body .app-frame {
        grid-template-columns: 1fr;
    }

    .internal-app-body .sidebar {
        position: relative;
        height: auto;
    }

    .internal-app-body .app-topbar {
        position: relative;
        padding: 14px 16px;
    }

    .internal-app-body .content-frame {
        width: min(100% - 28px, 1180px);
    }

    .internal-app-body .dashboard-command {
        grid-template-columns: 1fr;
    }

    .internal-app-body .dashboard-command-status {
        margin-top: 0;
    }

    .internal-app-body .dashboard-kpi-grid,
    .internal-app-body .dashboard-secondary-strip,
    .internal-app-body .dashboard-alert-grid,
    .internal-app-body .dashboard-insight-grid {
        grid-template-columns: 1fr;
    }
}

/* Final sidebar corrections */
.internal-app-body .sidebar-brand {
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.internal-app-body .sidebar-brand-card {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.internal-app-body .sidebar-brand-card::before,
.internal-app-body .sidebar-brand-card::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

.internal-app-body .sidebar-brand .brand-logo {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}

.internal-app-body .sidebar-nav a,
.internal-app-body .sidebar-nav details a,
.internal-app-body .sidebar-nav summary {
    color: #ffffff !important;
}

.internal-app-body .sidebar-nav details a {
    opacity: 0.92;
}

.internal-app-body .sidebar-nav a.active,
.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav details a:hover,
.internal-app-body .sidebar-nav summary:hover {
    color: #ffffff !important;
    opacity: 1;
}

/* Absolute sidebar cleanup: keep this block last. */
html body.internal-app-body .sidebar .sidebar-brand,
html body.internal-app-body .sidebar .sidebar-brand:hover {
    border: 0 !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand::before,
html body.internal-app-body .sidebar .sidebar-brand::after,
html body.internal-app-body .sidebar .sidebar-brand-card::before,
html body.internal-app-body .sidebar .sidebar-brand-card::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand-card {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand-card *,
html body.internal-app-body .sidebar .sidebar-brand .brand-logo {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}

html body.internal-app-body .sidebar .sidebar-nav a,
html body.internal-app-body .sidebar .sidebar-nav details a,
html body.internal-app-body .sidebar .sidebar-nav summary,
html body.internal-app-body .sidebar .sidebar-nav details[open] a,
html body.internal-app-body .sidebar .sidebar-nav details[open] summary {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Institutional interface refinement */
.internal-app-body,
body.internal-app-body:has(.app-frame) {
    --app-bg: #eef2f5;
    --app-surface: #ffffff;
    --app-surface-soft: #f7f9fb;
    --app-surface-strong: #e7edf2;
    --app-line: #cfd8e3;
    --app-line-strong: #aebdca;
    --app-ink: #101820;
    --app-muted: #526170;
    --app-muted-strong: #344454;
    --app-primary: #d96a0b;
    --app-primary-dark: #9a4305;
    --app-primary-soft: #f8e7d7;
    --app-accent: #d96a0b;
    --app-accent-soft: #f5e7dc;
    --app-graphite: #15181c;
    --app-graphite-soft: #181c20;
    --app-danger: #9f2f2f;
    --app-success: #1f6b45;
    --app-shadow: 0 12px 30px rgba(16, 24, 32, 0.08);
    --app-shadow-soft: 0 8px 18px rgba(16, 24, 32, 0.06);
    background: linear-gradient(180deg, #f3f6f8 0%, #e9eff4 100%);
    color: var(--app-ink);
    font-family: Inter, "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.48;
}

.internal-app-body .app-frame {
    grid-template-columns: 276px minmax(0, 1fr);
}

.internal-app-body .app-workspace {
    background: #f1f5f9;
}

.internal-app-body .content-frame {
    width: min(100% - 42px, 1240px);
    padding: 22px 0 42px;
}

.internal-app-body .app-topbar {
    min-height: 74px;
    border-bottom: 1px solid var(--app-line);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 0 rgba(16, 24, 32, 0.02);
}

.internal-app-body .app-topbar-title span {
    color: var(--app-accent);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.internal-app-body .app-topbar-title strong {
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 400;
}

.internal-app-body h1,
.internal-app-body h2,
.internal-app-body h3,
.internal-app-body .panel-heading h2,
.internal-app-body .dashboard-panel-title h2 {
    color: var(--app-ink);
    font-weight: 400;
    letter-spacing: 0;
}

.internal-app-body .hero h1,
.internal-app-body .dashboard-command h1 {
    font-weight: 400;
}

.internal-app-body .hero p,
.internal-app-body .panel-heading p,
.internal-app-body .dashboard-command-copy p,
.internal-app-body .dashboard-panel > p,
.internal-app-body .meta,
.internal-app-body .empty-state {
    color: var(--app-muted);
    line-height: 1.5;
}

.internal-app-body .sidebar {
    padding: 18px 12px;
    border-right: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: none;
}

.internal-app-body .sidebar-brand {
    min-height: 104px;
    padding: 8px 8px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.internal-app-body .sidebar-brand-card {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 84px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
}

.internal-app-body .sidebar-brand .brand-logo {
    width: min(100%, 210px);
    height: 88px;
    filter: none;
}

.internal-app-body .sidebar-brand-card,
.internal-app-body .sidebar-brand-card::before,
.internal-app-body .sidebar-brand-card::after {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.internal-app-body .sidebar-brand-card::before,
.internal-app-body .sidebar-brand-card::after {
    content: none !important;
    display: none !important;
}

.internal-app-body .sidebar-brand .brand-logo {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}

.internal-app-body .sidebar-nav {
    gap: 6px;
    padding: 2px 0 10px;
}

.internal-app-body .sidebar-nav details {
    border-radius: 8px;
    padding: 0;
}

.internal-app-body .sidebar-nav details[open] {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.internal-app-body .sidebar-nav summary,
.internal-app-body .sidebar-nav a {
    min-height: 40px;
    border-radius: 7px;
    color: #374151;
    -webkit-text-fill-color: #374151;
    font-size: 0.875rem;
    font-weight: 400;
    transition: color 120ms ease, background 120ms ease;
}

.internal-app-body .sidebar-nav summary {
    color: #111827;
    -webkit-text-fill-color: #111827;
    font-weight: 400;
}

.internal-app-body .sidebar-nav details[open] summary {
    background: transparent;
    color: #111827;
    -webkit-text-fill-color: #111827;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 7px 7px 0 0;
    margin-bottom: 4px;
}

.internal-app-body .sidebar-nav a {
    color: #374151;
    -webkit-text-fill-color: #374151;
}

.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav summary:hover {
    background: #f3f4f6;
    color: #111827;
    -webkit-text-fill-color: #111827;
}

.internal-app-body .sidebar-nav a.active {
    background: transparent;
    color: #ea580c;
    -webkit-text-fill-color: #ea580c;
    font-weight: 400;
}

.internal-app-body .sidebar-nav details a {
    border-bottom: 1px solid #f3f4f6;
    border-radius: 0;
    padding-left: 44px;
}

.internal-app-body .sidebar-nav details a:last-child {
    border-bottom: none;
}

.internal-app-body .sidebar-nav summary::after {
    background: #f3f4f6;
    color: #6b7280;
}

.internal-app-body .sidebar-footer {
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    background: transparent;
    color: #374151;
}

.internal-app-body .sidebar-footer small,
.internal-app-body .sidebar-user span {
    color: #64748b;
}

.internal-app-body .sidebar-user strong,
.internal-app-body .sidebar-footer strong {
    color: #ffffff;
}

.internal-app-body .hero,
.internal-app-body .panel,
.internal-app-body .stat-card,
.internal-app-body .metric-card,
.internal-app-body .subpanel,
.internal-app-body .dashboard-command,
.internal-app-body .dashboard-command-status {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.internal-app-body .hero {
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f8fa 100%);
}

.internal-app-body .panel {
    padding: 22px;
}

.internal-app-body .panel-heading {
    margin-bottom: 16px;
}

.internal-app-body .panel-heading h2 {
    font-size: 1.18rem;
    line-height: 1.2;
}

.internal-app-body .stat-card,
.internal-app-body .metric-card {
    min-height: 118px;
    padding: 18px;
}

.internal-app-body .stat-card strong,
.internal-app-body .metric-card strong {
    color: var(--app-ink);
    font-size: clamp(2rem, 2.5vw, 2.6rem);
    font-weight: 400;
    letter-spacing: 0;
}

.internal-app-body .stat-card p,
.internal-app-body .metric-card p {
    color: var(--app-muted);
    font-size: 0.88rem;
    font-weight: 400;
}

.internal-app-body .dashboard-kpi-executive {
    border-top-color: var(--app-line-strong);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.internal-app-body .dashboard-kpi-executive:nth-child(2) {
    border-top-color: var(--app-line-strong);
}

.internal-app-body .dashboard-kpi-executive:nth-child(3) {
    border-top-color: var(--app-line-strong);
}

.internal-app-body .dashboard-kpi-executive:nth-child(n+4) {
    border-top-color: var(--app-line-strong);
}

.internal-app-body .button,
.internal-app-body button,
.internal-app-body input[type="submit"] {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 400;
    letter-spacing: 0;
}

.internal-app-body .button,
.internal-app-body button:not(.tab-button) {
    border: 1px solid #252a30;
    background: #15181c;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(21, 24, 28, 0.14);
}

.internal-app-body .button:hover,
.internal-app-body button:not(.tab-button):hover {
    border-color: var(--app-primary-dark);
    background: var(--app-primary);
    transform: none;
}

.internal-app-body .button-secondary,
.internal-app-body .sidebar-footer .button-secondary {
    border-color: var(--app-line-strong);
    background: #ffffff;
    color: var(--app-ink);
    box-shadow: none;
}

.internal-app-body .button-secondary:hover,
.internal-app-body .sidebar-footer .button-secondary:hover {
    border-color: var(--app-primary);
    background: var(--app-primary-soft);
    color: var(--app-primary-dark);
}

.internal-app-body .sidebar-footer .button-secondary {
    width: 100%;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.internal-app-body label span,
.internal-app-body .form-grid label > span {
    color: var(--app-muted-strong);
    font-size: 0.78rem;
    font-weight: 400;
}

.internal-app-body input,
.internal-app-body select,
.internal-app-body textarea {
    border: 1px solid var(--app-line-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--app-ink);
    font-weight: 400;
}

.internal-app-body input:focus,
.internal-app-body select:focus,
.internal-app-body textarea:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(217, 106, 11, 0.14);
}

.internal-app-body .badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid #d8e1e8;
    border-radius: 999px;
    background: #f5f8fa;
    color: #3f4d5a;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1;
}

.internal-app-body table {
    color: var(--app-ink);
}

.internal-app-body th {
    border-bottom: 1px solid var(--app-line);
    background: #eef3f6;
    color: var(--app-muted-strong);
    font-size: 0.74rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.internal-app-body td {
    color: #253241;
}

.internal-app-body tbody tr:hover td {
    background: #f3f7f9;
}

.internal-app-body .table-wrap {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
}

.internal-app-body .dashboard-home-top,
.internal-app-body .dashboard-compact-chart,
.internal-app-body .dashboard-alerts-home .dashboard-alert-panel,
.internal-app-body .bi-chart-panel {
    box-shadow: var(--app-shadow-soft);
}

.internal-app-body .dashboard-home-top p {
    color: var(--app-muted);
    font-weight: 400;
}

.internal-app-body .dashboard-panel-title span,
.internal-app-body .dashboard-eyebrow {
    color: var(--app-accent);
    font-weight: 400;
}

.internal-app-body .dashboard-panel-title b {
    background: var(--app-primary-soft);
    color: var(--app-primary-dark);
}

.internal-app-body .dashboard-alert-list a,
.internal-app-body .dashboard-navigation-links a {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
}

.internal-app-body .dashboard-alert-list a:hover,
.internal-app-body .dashboard-navigation-links a:hover {
    border-color: var(--app-primary);
    background: #ffffff;
}

.internal-app-body .dashboard-panel-link {
    color: var(--app-primary-dark);
}

.internal-app-body .bi-summary-grid .stat-card {
    min-height: 102px;
}

.internal-app-body .bi-chart-frame {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.internal-app-body .dashboard-kpi {
    border-top-color: var(--app-line-strong);
}

.internal-app-body .dashboard-bar-track i {
    background: linear-gradient(90deg, #6b7280, #c8cdd2);
}

.internal-app-body .dashboard-panel-link {
    color: var(--app-primary-dark);
}

@media (max-width: 980px) {
    .internal-app-body .app-frame {
        grid-template-columns: 1fr;
    }

    .internal-app-body .content-frame {
        width: min(100% - 28px, 1240px);
        padding-top: 18px;
    }

    .internal-app-body .sidebar {
        border-right: 0;
    }
}

/* B.I. page: stable chart sizing */
.internal-app-body .bi-page {
    display: grid;
    gap: 16px;
}

.internal-app-body .bi-hero {
    min-height: 116px;
    margin-bottom: 0;
    padding: 22px 24px;
}

.internal-app-body .bi-filter-panel {
    margin-bottom: 0;
}

.internal-app-body .bi-filter-actions {
    align-self: end;
}

.internal-app-body .bi-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 0;
}

.internal-app-body .bi-summary-grid .stat-card {
    min-height: 92px;
    padding: 14px 16px;
}

.internal-app-body .bi-summary-grid .stat-card strong {
    margin-bottom: 8px;
    font-size: 1.85rem;
}

.internal-app-body .bi-summary-grid .stat-card p {
    color: #64748b;
    font-size: 0.82rem;
}

.internal-app-body .bi-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 0;
}

.internal-app-body .bi-chart-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 0;
    padding: 16px;
}

.internal-app-body .bi-chart-panel .panel-heading {
    margin-bottom: 0;
}

.internal-app-body .bi-chart-panel .panel-heading h2 {
    font-size: 1rem;
}

.internal-app-body .bi-chart-frame {
    position: relative;
    width: 100%;
    height: 260px;
    min-height: 260px;
    overflow: hidden;
}

.internal-app-body .bi-chart-frame canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 260px;
}

.internal-app-body .bi-cross-panel {
    margin-bottom: 0;
}

@media (max-width: 1280px) {
    .internal-app-body .bi-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .internal-app-body .bi-chart-grid,
    .internal-app-body .bi-summary-grid {
        grid-template-columns: 1fr;
    }

    .internal-app-body .bi-chart-frame {
        height: 230px;
        min-height: 230px;
    }

    .internal-app-body .bi-chart-frame canvas {
        max-height: 230px;
    }
}

/* Dashboard home v2: compact executive view */
.internal-app-body .dashboard-home {
    gap: 12px;
}

.internal-app-body .dashboard-home-top {
    min-height: 88px;
    padding: 16px 18px;
}

.internal-app-body .dashboard-home-top .dashboard-command-copy {
    gap: 5px;
}

.internal-app-body .dashboard-home-top h1 {
    font-size: clamp(1.45rem, 1.8vw, 1.9rem);
}

.internal-app-body .dashboard-home-top p {
    max-width: 680px;
    margin: 0;
    color: #64748b;
    font-size: 0.94rem;
}

.internal-app-body .dashboard-home .dashboard-action-row .button {
    min-height: 36px;
    padding: 8px 11px;
}

.internal-app-body .dashboard-home .dashboard-kpi-grid-executive {
    gap: 8px;
}

.internal-app-body .dashboard-home .dashboard-kpi-executive {
    min-height: 82px;
    padding: 12px 14px;
}

.internal-app-body .dashboard-home .dashboard-kpi-executive strong {
    font-size: clamp(1.85rem, 2.35vw, 2.28rem);
}

.internal-app-body .dashboard-home .dashboard-kpi-executive span {
    font-size: 0.78rem;
}

.internal-app-body .dashboard-main-visual,
.internal-app-body .dashboard-alerts-home {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.internal-app-body .dashboard-compact-chart {
    min-height: 214px;
    gap: 12px;
    padding: 16px;
}

.internal-app-body .dashboard-home .dashboard-panel-title h2 {
    font-size: 1rem;
}

.internal-app-body .dashboard-home .dashboard-panel-title span {
    font-size: 0.68rem;
}

.internal-app-body .dashboard-status-strip {
    display: flex;
    height: 34px;
    overflow: hidden;
    border-radius: 8px;
    background: #e5e7eb;
}

.internal-app-body .dashboard-status-strip i {
    min-width: 3px;
    height: 100%;
    background: #343a40;
}

.internal-app-body .dashboard-status-strip i:nth-child(2) {
    background: #525a62;
}

.internal-app-body .dashboard-status-strip i:nth-child(3) {
    background: #6d747c;
}

.internal-app-body .dashboard-status-strip i:nth-child(4) {
    background: #89919a;
}

.internal-app-body .dashboard-status-strip i:nth-child(5) {
    background: #aeb5bd;
}

.internal-app-body .dashboard-status-strip i:nth-child(6) {
    background: #c8cdd2;
}

.internal-app-body .dashboard-status-strip i:nth-child(7) {
    background: #dde1e5;
}

.internal-app-body .dashboard-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.internal-app-body .dashboard-status-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 400;
}

.internal-app-body .dashboard-status-legend b {
    color: #111827;
    font-size: 0.86rem;
}

.internal-app-body .dashboard-territory-chart {
    display: grid;
    gap: 9px;
}

.internal-app-body .dashboard-territory-chart div {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(130px, 0.75fr) minmax(120px, 1fr) 34px;
    align-items: center;
    gap: 10px;
}

.internal-app-body .dashboard-territory-chart strong {
    color: #111827;
    font-size: 0.88rem;
    text-align: right;
}

.internal-app-body .dashboard-territory-chart i {
    width: 100%;
    height: 12px;
    display: block;
    border-radius: 999px;
    background: linear-gradient(90deg, #525a62, #c8cdd2);
}

.internal-app-body .dashboard-territory-chart span {
    min-width: 0;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.2;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-panel {
    min-height: 204px;
    gap: 10px;
    padding: 16px;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-list {
    gap: 6px;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-list a {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-list strong,
.internal-app-body .dashboard-alerts-home .dashboard-alert-list span,
.internal-app-body .dashboard-alerts-home .dashboard-alert-list em {
    white-space: nowrap;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-list strong {
    font-size: 0.84rem;
}

.internal-app-body .dashboard-alerts-home .dashboard-alert-list span,
.internal-app-body .dashboard-alerts-home .dashboard-alert-list em {
    font-size: 0.75rem;
}

@media (max-width: 1280px) {
    .internal-app-body .dashboard-home .dashboard-kpi-grid-executive {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .internal-app-body .dashboard-main-visual,
    .internal-app-body .dashboard-alerts-home {
        grid-template-columns: 1fr;
    }

    .internal-app-body .dashboard-territory-chart {
        gap: 8px;
    }

    .internal-app-body .dashboard-territory-chart div {
        grid-template-columns: minmax(104px, 0.8fr) minmax(80px, 1fr) 32px;
    }

    .internal-app-body .dashboard-alerts-home .dashboard-alert-list a {
        grid-template-columns: 1fr;
    }
}

/* Final executive dashboard layer */
.internal-app-body .dashboard-command.dashboard-command-compact {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.internal-app-body .dashboard-command-compact .dashboard-command-copy {
    padding: 0;
}

.internal-app-body .dashboard-command-compact h1 {
    font-size: clamp(1.5rem, 2vw, 2.05rem);
}

.internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.internal-app-body .dashboard-kpi.dashboard-kpi-executive {
    min-height: 96px;
    align-content: center;
    border-top-width: 3px;
    border-left: 0;
}

.internal-app-body .dashboard-kpi-executive strong {
    order: 0;
    font-size: clamp(2rem, 3vw, 2.65rem);
    line-height: 0.95;
}

.internal-app-body .dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.internal-app-body .dashboard-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 0.78fr);
    gap: 14px;
}

@media (max-width: 1280px) {
    .internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive,
    .internal-app-body .dashboard-bottom-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .internal-app-body .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .internal-app-body .dashboard-command.dashboard-command-compact {
        align-items: stretch;
        flex-direction: column;
    }

    .internal-app-body .dashboard-kpi-grid.dashboard-kpi-grid-executive,
    .internal-app-body .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* Hard final sidebar overrides */
.internal-app-body .sidebar-brand {
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.internal-app-body .sidebar-brand-card {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

.internal-app-body .sidebar-brand-card::before,
.internal-app-body .sidebar-brand-card::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

.internal-app-body .sidebar-brand .brand-logo {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}

.internal-app-body .sidebar-nav a,
.internal-app-body .sidebar-nav details a,
.internal-app-body .sidebar-nav summary {
    color: #ffffff !important;
}

.internal-app-body .sidebar-nav details a {
    opacity: 0.92;
}

.internal-app-body .sidebar-nav a.active,
.internal-app-body .sidebar-nav a:hover,
.internal-app-body .sidebar-nav details a:hover,
.internal-app-body .sidebar-nav summary:hover {
    color: #ffffff !important;
    opacity: 1;
}

/* Absolute sidebar cleanup: keep this block at the physical end of this file. */
html body.internal-app-body .sidebar .sidebar-brand,
html body.internal-app-body .sidebar .sidebar-brand:hover {
    border: 0 !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand::before,
html body.internal-app-body .sidebar .sidebar-brand::after,
html body.internal-app-body .sidebar .sidebar-brand-card::before,
html body.internal-app-body .sidebar .sidebar-brand-card::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand-card {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body.internal-app-body .sidebar .sidebar-brand-card *,
html body.internal-app-body .sidebar .sidebar-brand .brand-logo {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}

html body.internal-app-body .sidebar .sidebar-nav a,
html body.internal-app-body .sidebar .sidebar-nav details a,
html body.internal-app-body .sidebar .sidebar-nav summary,
html body.internal-app-body .sidebar .sidebar-nav details[open] a,
html body.internal-app-body .sidebar .sidebar-nav details[open] summary {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Social-system chrome: topbar, sidebar footer, accessibility and chat. */
html body.internal-app-body .app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 64px;
    padding: 8px 24px;
    border-bottom: 1px solid #dbe4ee;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

html body.internal-app-body .app-topbar-title {
    display: none !important;
}

html body.internal-app-body .system-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

html body.internal-app-body .system-icon-button,
html body.internal-app-body button.system-icon-button,
html body.internal-app-body a.system-icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0 !important;
    border: 1px solid rgba(203, 213, 225, 0.88) !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.86) !important;
    color: #0f4c81 !important;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12) !important;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

html body.internal-app-body .system-icon-button:hover,
html body.internal-app-body button.system-icon-button:hover,
html body.internal-app-body a.system-icon-button:hover {
    border-color: rgba(15, 76, 129, 0.28) !important;
    background: #ffffff !important;
    color: #0f4c81 !important;
    transform: translateY(-1px);
}

html body.internal-app-body .system-icon-button svg,
html body.internal-app-body .sidebar-footer-card svg,
html body.internal-app-body .a11y-launcher svg,
html body.internal-app-body .chat-launcher svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html body.internal-app-body .system-notification-button span {
    position: absolute;
    top: -7px;
    right: -5px;
    min-width: 24px;
    height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #0f4c81;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 400;
    line-height: 16px;
    text-align: center;
}

html body.internal-app-body .system-user-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 7px 16px 7px 10px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
}

html body.internal-app-body .system-user-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(15, 76, 129, 0.1);
    color: #0f4c81;
}

html body.internal-app-body .system-user-avatar svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

html body.internal-app-body .system-user-pill strong,
html body.internal-app-body .system-user-pill small {
    display: block;
    white-space: nowrap;
}

html body.internal-app-body .system-user-pill strong {
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.15;
}

html body.internal-app-body .system-user-pill small {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 400;
}

html body.internal-app-body .system-popover-wrap {
    position: relative;
}

html body.internal-app-body .system-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 80;
    width: 310px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

html body.internal-app-body .system-popover strong {
    color: #0f172a;
    font-size: 0.95rem;
}

html body.internal-app-body .system-popover p {
    margin: 6px 0 12px;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.4;
}

html body.internal-app-body .system-popover a {
    display: inline-flex;
    color: #0f4c81;
    font-size: 0.86rem;
    font-weight: 400;
}

html body.internal-app-body .sidebar-footer {
    display: grid;
    gap: 6px;
    padding: 10px 0 0;
    border: 0 !important;
    border-top: 1px solid rgba(249, 115, 22, 0.14) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar-footer-card,
html body.internal-app-body .sidebar-footer-card:visited,
html body.internal-app-body button.sidebar-footer-card {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 48px;
    padding: 9px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #374151 !important;
    text-align: left;
    box-shadow: none !important;
    transition: background 120ms ease, border-color 120ms ease;
}

html body.internal-app-body .sidebar-footer-card:hover {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
}

html body.internal-app-body .sidebar-footer-card svg {
    flex: 0 0 auto;
    color: #9ca3af;
}

html body.internal-app-body .sidebar-footer-card strong,
html body.internal-app-body .sidebar-footer-card small {
    display: block;
}

html body.internal-app-body .sidebar-footer-card strong {
    color: #1e293b !important;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.3;
}

html body.internal-app-body .sidebar-footer-card small {
    margin-top: 2px;
    color: rgba(255, 237, 213, 0.82) !important;
    font-size: 0.76rem;
    font-weight: 400;
}

html body.internal-app-body .sidebar-support-card {
    position: relative;
    display: block;
    min-height: 0;
    padding: 0 !important;
    background: rgba(249, 115, 22, 0.15) !important;
    color: #ffedd5 !important;
}

html body.internal-app-body .sidebar-support-card summary {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 52px;
    padding: 10px 13px;
    cursor: pointer;
    list-style: none;
}

html body.internal-app-body .sidebar-support-card summary::-webkit-details-marker {
    display: none;
}

html body.internal-app-body .sidebar-support-card strong {
    color: #ffedd5 !important;
}

html body.internal-app-body .sidebar-support-menu {
    display: grid;
    gap: 3px;
    padding: 0 8px 8px;
}

html body.internal-app-body .sidebar-support-menu a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255, 237, 213, 0.75) !important;
    font-size: 0.83rem;
    font-weight: 400;
}

html body.internal-app-body .sidebar-support-menu a:hover {
    background: rgba(255, 247, 237, 0.08);
    color: #fff7ed !important;
}

html body.internal-app-body .sidebar-logout-card,
html body.internal-app-body button.sidebar-logout-card {
    min-height: 44px;
    background: rgba(220, 38, 38, 0.16) !important;
    border-color: rgba(220, 38, 38, 0.35) !important;
    color: #fca5a5 !important;
    font-size: 0.88rem;
    font-weight: 400;
}

html body.internal-app-body .sidebar-logout-card:hover {
    background: rgba(220, 38, 38, 0.25) !important;
    border-color: rgba(220, 38, 38, 0.5) !important;
    color: #fecaca !important;
}

html body.internal-app-body .sidebar-logout-card svg {
    color: #fca5a5;
}

html body.internal-app-body .a11y-launcher,
html body.internal-app-body button.a11y-launcher {
    position: fixed;
    right: 0;
    top: 50%;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 14px 8px !important;
    border: 0 !important;
    border-radius: 16px 0 0 16px !important;
    background: linear-gradient(180deg, #0f4c81 0%, #2a7ab8 100%) !important;
    color: #ffffff !important;
    box-shadow: -4px 0 24px rgba(15, 76, 129, 0.36) !important;
    transform: translateY(-50%);
}

html body.internal-app-body .a11y-launcher span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: #ffffff;
    font-size: 0.52rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

html body.internal-app-body .a11y-panel,
html body.internal-app-body .chat-panel {
    position: fixed;
    right: 18px;
    z-index: 90;
    border: 1px solid rgba(226, 232, 240, 0.88);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(15, 76, 129, 0.2);
    backdrop-filter: blur(16px);
}

html body.internal-app-body .a11y-panel {
    top: 50%;
    width: min(92vw, 320px);
    border-radius: 24px 0 0 24px;
    transform: translateY(-50%);
}

html body.internal-app-body .a11y-panel-header,
html body.internal-app-body .chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

html body.internal-app-body .a11y-panel-header strong,
html body.internal-app-body .chat-panel-header strong {
    color: #0f172a;
    font-size: 0.95rem;
}

html body.internal-app-body .chat-panel-header small {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 0.78rem;
}

html body.internal-app-body .a11y-panel-header button,
html body.internal-app-body .chat-panel-header button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    box-shadow: none !important;
    font-size: 1.25rem;
}

html body.internal-app-body .a11y-panel-body {
    display: grid;
    gap: 9px;
    padding: 16px;
}

html body.internal-app-body .a11y-font-controls {
    display: grid;
    grid-template-columns: 42px 1fr 42px;
    align-items: center;
    gap: 10px;
}

html body.internal-app-body .a11y-font-controls strong {
    text-align: center;
}

html body.internal-app-body .a11y-panel-body button,
html body.internal-app-body .a11y-font-controls button {
    min-height: 40px;
    padding: 9px 12px !important;
    border: 1px solid #dbe4ee !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    color: #334155 !important;
    box-shadow: none !important;
    font-weight: 400;
}

html body.internal-app-body .a11y-panel-body button.active {
    border-color: rgba(15, 76, 129, 0.28) !important;
    background: rgba(15, 76, 129, 0.1) !important;
    color: #0f4c81 !important;
}

html body.internal-app-body .chat-launcher,
html body.internal-app-body button.chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 70;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    min-height: 58px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 22px !important;
    background: linear-gradient(135deg, #0f4c81 0%, #2a7ab8 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 22px 50px rgba(15, 76, 129, 0.34) !important;
}

html body.internal-app-body .chat-panel {
    bottom: 94px;
    display: flex;
    width: min(92vw, 430px);
    height: min(68vh, 620px);
    overflow: hidden;
    border-radius: 28px;
    flex-direction: column;
}

html body.internal-app-body .chat-panel[hidden],
html body.internal-app-body .a11y-panel[hidden],
html body.internal-app-body .system-popover[hidden] {
    display: none !important;
}

html body.internal-app-body .chat-panel-body {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    min-height: 0;
    flex: 1;
}

html body.internal-app-body .chat-contact-list {
    display: grid;
    align-content: start;
    gap: 7px;
    padding: 12px;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
}

html body.internal-app-body .chat-contact-list button {
    display: block;
    min-height: 0;
    padding: 10px !important;
    border: 1px solid transparent !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: #334155 !important;
    box-shadow: none !important;
    text-align: left;
    font-size: 0.82rem;
}

html body.internal-app-body .chat-contact-list button.active {
    border-color: rgba(15, 76, 129, 0.18) !important;
    background: #ffffff !important;
    color: #0f4c81 !important;
}

html body.internal-app-body .chat-contact-list small {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 0.72rem;
}

html body.internal-app-body .chat-thread {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
}

html body.internal-app-body .chat-empty {
    margin: 0;
    color: #64748b;
    font-size: 0.86rem;
}

html body.internal-app-body .chat-message {
    display: grid;
    gap: 3px;
    max-width: 86%;
    justify-self: start;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 16px 16px 16px 4px;
    background: #ffffff;
    color: #334155;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

html body.internal-app-body .chat-message.mine {
    justify-self: end;
    border-color: rgba(15, 76, 129, 0.22);
    border-radius: 16px 16px 4px 16px;
    background: #0f4c81;
    color: #ffffff;
}

html body.internal-app-body .chat-message strong {
    font-size: 0.74rem;
}

html body.internal-app-body .chat-message span {
    font-size: 0.86rem;
    line-height: 1.4;
}

html body.internal-app-body .chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

html body.internal-app-body .chat-compose input {
    min-height: 42px;
    border: 1px solid #dbe4ee;
    border-radius: 14px;
}

html body.internal-app-body .chat-compose button {
    min-height: 42px;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: #0f4c81 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html.a11y-high-contrast body {
    filter: contrast(1.22);
}

html.a11y-grayscale body {
    filter: grayscale(1);
}

html.a11y-high-contrast.a11y-grayscale body {
    filter: contrast(1.22) grayscale(1);
}

html.a11y-underline-links a {
    text-decoration: underline !important;
}

html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%230f4c81' stroke='white' stroke-width='2' d='M6 3l20 14-9 2 5 9-4 2-5-9-7 7z'/%3E%3C/svg%3E") 4 4, auto !important;
}

@media (max-width: 980px) {
    html body.internal-app-body .system-user-pill {
        display: none;
    }

    html body.internal-app-body .chat-panel {
        right: 10px;
        bottom: 86px;
        width: calc(100vw - 20px);
        height: min(76vh, 620px);
    }

    html body.internal-app-body .chat-panel-body {
        grid-template-columns: 1fr;
    }

    html body.internal-app-body .chat-contact-list {
        grid-auto-flow: column;
        grid-auto-columns: minmax(130px, 1fr);
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }
}

/* Skadyr brand harmonization for Social-system chrome. */
html body.internal-app-body {
    --skadyr-graphite: #15181c;
    --skadyr-graphite-2: #20242a;
    --skadyr-orange: #e46f0b;
    --skadyr-orange-dark: #b84f05;
    --skadyr-orange-soft: #fff4e8;
    --skadyr-line: #d9e1ea;
}

html body.internal-app-body .system-icon-button,
html body.internal-app-body button.system-icon-button,
html body.internal-app-body a.system-icon-button {
    border-color: var(--skadyr-line) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--skadyr-graphite) !important;
    box-shadow: 0 3px 10px rgba(21, 24, 28, 0.12) !important;
}

html body.internal-app-body .system-icon-button:hover,
html body.internal-app-body button.system-icon-button:hover,
html body.internal-app-body a.system-icon-button:hover {
    border-color: rgba(228, 111, 11, 0.34) !important;
    background: var(--skadyr-orange-soft) !important;
    color: var(--skadyr-orange-dark) !important;
}

html body.internal-app-body .system-notification-button span {
    background: var(--skadyr-graphite);
    color: #ffffff;
    box-shadow: 0 0 0 2px #ffffff, 0 8px 16px rgba(21, 24, 28, 0.16);
}

html body.internal-app-body .system-user-avatar {
    background: var(--skadyr-orange-soft);
    color: var(--skadyr-orange-dark);
}

html body.internal-app-body .system-user-pill {
    border-color: var(--skadyr-line);
    box-shadow: 0 3px 10px rgba(21, 24, 28, 0.1);
}

html body.internal-app-body .system-popover a,
html body.internal-app-body .sidebar-support-menu a:hover,
html body.internal-app-body .a11y-panel-body button.active {
    color: var(--skadyr-orange-dark) !important;
}

html body.internal-app-body .sidebar-footer-card,
html body.internal-app-body .sidebar-footer-card:visited,
html body.internal-app-body button.sidebar-footer-card {
    border-color: var(--skadyr-line) !important;
    box-shadow: 0 3px 10px rgba(21, 24, 28, 0.09) !important;
}

html body.internal-app-body .sidebar-account-card svg {
    color: var(--skadyr-graphite);
}

html body.internal-app-body .sidebar-support-card {
    border-color: #f3d4b8 !important;
    background: var(--skadyr-orange-soft) !important;
}

html body.internal-app-body .sidebar-support-card svg {
    color: var(--skadyr-orange-dark);
}

html body.internal-app-body .sidebar-support-menu a:hover {
    background: #ffffff;
}

html body.internal-app-body .a11y-launcher,
html body.internal-app-body button.a11y-launcher,
html body.internal-app-body .chat-launcher,
html body.internal-app-body button.chat-launcher {
    background: linear-gradient(180deg, var(--skadyr-graphite-2) 0%, var(--skadyr-graphite) 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 22px 50px rgba(21, 24, 28, 0.3) !important;
}

html body.internal-app-body .a11y-launcher::before,
html body.internal-app-body .chat-launcher::before {
    content: "";
    position: absolute;
    background: var(--skadyr-orange);
}

html body.internal-app-body .a11y-launcher::before {
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 3px;
    border-radius: 0 999px 999px 0;
}

html body.internal-app-body .chat-launcher::before {
    right: 10px;
    top: 10px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(228, 111, 11, 0.16);
}

html body.internal-app-body .a11y-panel,
html body.internal-app-body .chat-panel {
    border-color: var(--skadyr-line);
    box-shadow: 0 24px 70px rgba(21, 24, 28, 0.18);
}

html body.internal-app-body .chat-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

html body.internal-app-body .chat-thread {
    background: linear-gradient(180deg, #fbfcfd 0%, #f1f5f9 100%);
}

html body.internal-app-body .chat-contact-list button.active {
    border-color: rgba(228, 111, 11, 0.24) !important;
    background: #ffffff !important;
    color: var(--skadyr-orange-dark) !important;
}

html body.internal-app-body .chat-message.mine {
    border-color: rgba(228, 111, 11, 0.32);
    background: var(--skadyr-graphite);
}

html body.internal-app-body .chat-compose button {
    background: var(--skadyr-graphite) !important;
}

html body.internal-app-body .chat-compose button:hover {
    background: var(--skadyr-graphite-2) !important;
}

html body.internal-app-body .a11y-font-controls button:hover,
html body.internal-app-body .a11y-panel-body button:hover {
    border-color: rgba(228, 111, 11, 0.3) !important;
    background: var(--skadyr-orange-soft) !important;
    color: var(--skadyr-orange-dark) !important;
}

html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23e46f0b' stroke='white' stroke-width='2' d='M6 3l20 14-9 2 5 9-4 2-5-9-7 7z'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* Full light institutional refresh. Keep last. */
html body.internal-app-body {
    --light-bg: #f7fafc;
    --light-bg-warm: #fff9f3;
    --light-surface: #ffffff;
    --light-surface-soft: #fbfdff;
    --light-ink: #17202b;
    --light-ink-2: #27313f;
    --light-muted: #647084;
    --light-line: #dce4ed;
    --light-line-strong: #c9d5e1;
    --light-orange: #d95f08;
    --light-orange-dark: #8f3c04;
    --light-orange-soft: #fff3e6;
    --light-orange-glow: rgba(217, 95, 8, 0.16);
    --light-shadow: 0 14px 36px rgba(35, 45, 58, 0.08);
    --light-shadow-orange: 0 16px 38px rgba(143, 60, 4, 0.12);
    color: var(--light-ink);
}

html body.internal-app-body:has(.app-frame) {
    background: #f1f5f9 !important;
}

html body.internal-app-body .app-frame {
    background: transparent !important;
}

html body.internal-app-body .sidebar {
    border-right: 1px solid var(--light-line) !important;
    background: #ffffff !important;
    box-shadow: 12px 0 32px rgba(35, 45, 58, 0.06) !important;
}

html body.internal-app-body .sidebar::before {
    display: none !important;
}

html body.internal-app-body .sidebar-brand-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar-brand .brand-logo {
    filter: none !important;
}

html body.internal-app-body .sidebar-nav {
    scrollbar-color: rgba(217, 95, 8, 0.28) transparent;
}

html body.internal-app-body .sidebar-nav details {
    background: transparent !important;
    border: 0 !important;
}

html body.internal-app-body .sidebar-nav details[open] {
    background: transparent !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar .sidebar-nav summary,
html body.internal-app-body .sidebar .sidebar-nav a,
html body.internal-app-body .sidebar .sidebar-nav details a,
html body.internal-app-body .sidebar .sidebar-nav details[open] a,
html body.internal-app-body .sidebar .sidebar-nav details[open] summary {
    color: var(--light-ink-2) !important;
    -webkit-text-fill-color: var(--light-ink-2) !important;
    text-shadow: none !important;
}

html body.internal-app-body .sidebar-nav summary,
html body.internal-app-body .sidebar-nav > a {
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

html body.internal-app-body .sidebar-nav > a svg {
    flex-shrink: 0;
    opacity: 0.7;
}

html body.internal-app-body .sidebar-nav > a span {
    flex: 1;
    text-align: center;
    margin-right: 28px;
}

html body.internal-app-body .sidebar-nav > a:hover svg,
html body.internal-app-body .sidebar-nav > a.active svg {
    opacity: 1;
}

html body.internal-app-body .sidebar-nav summary svg {
    flex-shrink: 0;
    opacity: 0.7;
}

html body.internal-app-body .sidebar-nav summary:hover svg,
html body.internal-app-body .sidebar-nav details[open] > summary svg {
    opacity: 1;
}

html body.internal-app-body .sidebar-nav details a {
    color: #3c4959 !important;
    -webkit-text-fill-color: #3c4959 !important;
}

html body.internal-app-body .sidebar-nav summary::after {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar-nav a:hover,
html body.internal-app-body .sidebar-nav summary:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar-nav a.active {
    background: transparent !important;
    color: #ea580c !important;
    -webkit-text-fill-color: #ea580c !important;
    box-shadow: none !important;
    font-weight: 400 !important;
}

html body.internal-app-body .sidebar-footer {
    background: transparent !important;
    border-top-color: var(--light-line) !important;
}

html body.internal-app-body .sidebar-footer-card,
html body.internal-app-body .sidebar-footer-card:visited,
html body.internal-app-body button.sidebar-footer-card {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: var(--light-line) !important;
    color: var(--light-ink) !important;
    box-shadow: 0 10px 24px rgba(35, 45, 58, 0.08) !important;
}

html body.internal-app-body .sidebar-footer-card:hover {
    border-color: rgba(217, 95, 8, 0.24) !important;
    box-shadow: var(--light-shadow-orange) !important;
}

html body.internal-app-body .sidebar-support-card {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
}

html body.internal-app-body .sidebar-support-card svg,
html body.internal-app-body .sidebar-account-card svg {
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .sidebar-logout-card,
html body.internal-app-body button.sidebar-logout-card {
    background: #fff7f7 !important;
    color: #b42318 !important;
}

html body.internal-app-body .app-topbar {
    border-bottom-color: var(--light-line) !important;
    background: #ffffff !important;
    box-shadow: 0 1px 0 var(--light-line), 0 4px 16px rgba(35, 45, 58, 0.05) !important;
}

html body.internal-app-body .system-icon-button,
html body.internal-app-body button.system-icon-button,
html body.internal-app-body a.system-icon-button {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
    color: var(--light-ink-2) !important;
    box-shadow: 0 8px 18px rgba(35, 45, 58, 0.08) !important;
}

html body.internal-app-body .system-icon-button:hover,
html body.internal-app-body button.system-icon-button:hover,
html body.internal-app-body a.system-icon-button:hover {
    background: var(--light-orange-soft) !important;
    border-color: rgba(217, 95, 8, 0.28) !important;
    color: var(--light-orange-dark) !important;
    box-shadow: var(--light-shadow-orange) !important;
}

html body.internal-app-body .system-notification-button span {
    background: var(--light-orange-dark) !important;
    box-shadow: 0 0 0 2px #ffffff, 0 8px 16px rgba(143, 60, 4, 0.22) !important;
}

html body.internal-app-body .system-user-pill {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
    box-shadow: 0 8px 18px rgba(35, 45, 58, 0.08) !important;
}

html body.internal-app-body .system-user-avatar {
    background: var(--light-orange-soft) !important;
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .system-user-pill strong,
html body.internal-app-body .dashboard-command h1,
html body.internal-app-body .hero h1,
html body.internal-app-body .panel-heading h2,
html body.internal-app-body .dashboard-panel h2,
html body.internal-app-body h1,
html body.internal-app-body h2,
html body.internal-app-body h3 {
    color: var(--light-ink) !important;
}

html body.internal-app-body .system-user-pill small,
html body.internal-app-body .dashboard-command-copy p,
html body.internal-app-body .meta,
html body.internal-app-body .dashboard-panel p,
html body.internal-app-body .metric-card p,
html body.internal-app-body .stat-card p {
    color: var(--light-muted) !important;
}

html body.internal-app-body .content-frame {
    color: var(--light-ink);
}

html body.internal-app-body .dashboard-command,
html body.internal-app-body .dashboard-kpi-executive,
html body.internal-app-body .dashboard-panel,
html body.internal-app-body .panel,
html body.internal-app-body .metric-card,
html body.internal-app-body .stat-card,
html body.internal-app-body .subpanel,
html body.internal-app-body .hero {
    border-color: var(--light-line) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 253, 250, 0.96) 100%) !important;
    box-shadow: var(--light-shadow) !important;
}

html body.internal-app-body .dashboard-command {
    box-shadow: 0 16px 42px rgba(35, 45, 58, 0.08), inset 4px 0 0 rgba(217, 95, 8, 0.36) !important;
}

html body.internal-app-body .dashboard-kpi-executive {
    border-top-color: rgba(217, 95, 8, 0.28) !important;
}

html body.internal-app-body .dashboard-kpi-executive strong,
html body.internal-app-body .stat-card strong,
html body.internal-app-body .metric-card strong {
    color: var(--light-ink) !important;
}

html body.internal-app-body .dashboard-panel-eyebrow,
html body.internal-app-body .badge,
html body.internal-app-body .alert-operational-label {
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .button,
html body.internal-app-body button:not(.tab-button):not(.system-icon-button):not(.sidebar-footer-card):not(.a11y-launcher):not(.chat-launcher):not([data-a11y-close]):not([data-chat-close]) {
    border-color: rgba(217, 95, 8, 0.28) !important;
    background: #ffffff !important;
    color: var(--light-orange-dark) !important;
    box-shadow: 0 1px 3px rgba(35, 45, 58, 0.1), inset 0 0 0 1px rgba(217, 95, 8, 0.22) !important;
}

html body.internal-app-body .button:hover,
html body.internal-app-body button:not(.tab-button):not(.system-icon-button):not(.sidebar-footer-card):not(.a11y-launcher):not(.chat-launcher):not([data-a11y-close]):not([data-chat-close]):hover {
    background: var(--light-orange-dark) !important;
    color: #ffffff !important;
}

html body.internal-app-body .button-primary,
html body.internal-app-body .dashboard-command-actions .button:first-child {
    background: var(--light-orange-dark) !important;
    border-color: var(--light-orange-dark) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(143, 60, 4, 0.18) !important;
}

html body.internal-app-body .button-secondary,
html body.internal-app-body .dashboard-command-actions .button-secondary {
    background: #ffffff !important;
    border-color: var(--light-line-strong) !important;
    color: var(--light-ink-2) !important;
    box-shadow: none !important;
}

html body.internal-app-body .status-flow-strip span,
html body.internal-app-body .neighborhood-bar-fill {
    background: linear-gradient(90deg, #7f8892 0%, #d1d7de 100%) !important;
}

html body.internal-app-body .status-flow-strip span:first-child,
html body.internal-app-body .neighborhood-bar-fill:first-child {
    background: linear-gradient(90deg, var(--light-orange-dark), var(--light-orange)) !important;
}

html body.internal-app-body .status-chip,
html body.internal-app-body .dashboard-status-chip {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
    color: var(--light-ink-2) !important;
}

html body.internal-app-body .dashboard-alert-count,
html body.internal-app-body .alert-count {
    background: var(--light-orange-soft) !important;
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .system-popover,
html body.internal-app-body .a11y-panel,
html body.internal-app-body .chat-panel {
    background: rgba(255, 255, 255, 0.97) !important;
    border-color: var(--light-line) !important;
    box-shadow: 0 24px 70px rgba(35, 45, 58, 0.14), 0 0 0 1px rgba(217, 95, 8, 0.04) !important;
}

html body.internal-app-body .a11y-launcher,
html body.internal-app-body button.a11y-launcher,
html body.internal-app-body .chat-launcher,
html body.internal-app-body button.chat-launcher {
    background: #ffffff !important;
    border: 1px solid rgba(217, 95, 8, 0.26) !important;
    color: var(--light-orange-dark) !important;
    box-shadow: 0 4px 16px rgba(35, 45, 58, 0.12) !important;
}

html body.internal-app-body .a11y-launcher span {
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .a11y-launcher::before {
    background: var(--light-orange-dark) !important;
}

html body.internal-app-body .chat-launcher::before {
    background: var(--light-orange) !important;
    box-shadow: 0 0 0 4px rgba(217, 95, 8, 0.14) !important;
}

html body.internal-app-body .a11y-panel-header,
html body.internal-app-body .chat-panel-header,
html body.internal-app-body .chat-compose {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
}

html body.internal-app-body .a11y-panel-body button,
html body.internal-app-body .a11y-font-controls button,
html body.internal-app-body .chat-contact-list button {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
    color: var(--light-ink-2) !important;
}

html body.internal-app-body .a11y-panel-body button.active,
html body.internal-app-body .chat-contact-list button.active {
    background: var(--light-orange-soft) !important;
    border-color: rgba(217, 95, 8, 0.24) !important;
    color: var(--light-orange-dark) !important;
}

html body.internal-app-body .chat-thread {
    background:
        radial-gradient(circle at 100% 0%, rgba(217, 95, 8, 0.08), transparent 15rem),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

html body.internal-app-body .chat-message {
    background: #ffffff !important;
    color: var(--light-ink-2) !important;
}

html body.internal-app-body .chat-message.mine {
    background: var(--light-orange-dark) !important;
    color: #ffffff !important;
}

html body.internal-app-body .chat-compose button {
    background: var(--light-orange-dark) !important;
    color: #ffffff !important;
}

html body.internal-app-body input,
html body.internal-app-body select,
html body.internal-app-body textarea {
    color: var(--light-ink) !important;
    border-color: var(--light-line) !important;
}

html body.internal-app-body input:focus,
html body.internal-app-body select:focus,
html body.internal-app-body textarea:focus {
    border-color: rgba(217, 95, 8, 0.46) !important;
    box-shadow: 0 0 0 4px rgba(217, 95, 8, 0.11) !important;
}

html body.internal-app-body .sidebar-nav {
    scrollbar-color: rgba(145, 155, 168, 0.36) transparent !important;
}

html body.internal-app-body .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(145, 155, 168, 0.26) !important;
}

html body.internal-app-body .dashboard-action-row .button:first-child {
    background: var(--light-orange-dark) !important;
    border-color: var(--light-orange-dark) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(143, 60, 4, 0.18) !important;
}

html body.internal-app-body .dashboard-status-strip {
    background: #eef3f7 !important;
    box-shadow: inset 0 0 0 1px rgba(201, 213, 225, 0.88) !important;
}

html body.internal-app-body .dashboard-status-strip i {
    background: linear-gradient(90deg, #a9b2bd, #d8dee5) !important;
}

html body.internal-app-body .dashboard-status-strip i:nth-child(1) {
    background: linear-gradient(90deg, var(--light-orange-dark), var(--light-orange)) !important;
}

html body.internal-app-body .dashboard-status-strip i:nth-child(2) {
    background: linear-gradient(90deg, #c5864b, #e5b37f) !important;
}

html body.internal-app-body .dashboard-status-strip i:nth-child(n+3) {
    background: linear-gradient(90deg, #b8c0c9, #dce2e8) !important;
}

html body.internal-app-body .dashboard-territory-chart i {
    background: linear-gradient(90deg, rgba(143, 60, 4, 0.62), rgba(217, 95, 8, 0.22), rgba(186, 196, 207, 0.48)) !important;
}

html body.internal-app-body .dashboard-status-legend span {
    background: #ffffff !important;
    border-color: var(--light-line) !important;
    color: var(--light-ink-2) !important;
}

/* ── Sidebar nav: separador entre módulos no tema claro ── */
html body.internal-app-body .sidebar-nav details + details {
    border-top: 1px solid #dde3ea !important;
    padding-top: 8px !important;
    margin-top: 8px !important;
}

html body.internal-app-body .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

html body.internal-app-body .sidebar-nav details {
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

html body.internal-app-body .sidebar-nav details:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

/* ── Sidebar collapse ── */
html body.internal-app-body .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

html body.internal-app-body .sidebar-header .sidebar-brand {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

html body.internal-app-body .sidebar-collapse-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #8f3c04 !important;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 150ms, background 150ms, transform 200ms;
}

html body.internal-app-body .sidebar-collapse-btn svg {
    stroke: currentColor !important;
    display: block;
}

html body.internal-app-body .sidebar-collapse-btn:hover {
    opacity: 1;
    background: rgba(143, 60, 4, 0.08);
}

html body.internal-app-body .sidebar-collapse-label {
    display: none;
}

/* estado recolhido */
html body.internal-app-body .app-frame:has(.sidebar-collapsed),
html body.internal-app-body .app-frame.sidebar-is-collapsed {
    grid-template-columns: 60px minmax(0, 1fr);
}

html body.internal-app-body .sidebar.sidebar-collapsed {
    padding: 14px 8px;
    overflow: hidden;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-brand {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-collapse-label {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-footer {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav details {
    overflow: visible;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav details > a {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    position: relative;
    background: transparent;
    transition: background 150ms, color 150ms;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary::-webkit-details-marker {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary svg {
    display: block;
    flex-shrink: 0;
    color: #64748b;
    stroke: currentColor;
    transition: color 150ms;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary span {
    display: none;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary::after {
    display: none !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary:hover {
    background: rgba(143, 60, 4, 0.08) !important;
    box-shadow: none !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary:hover svg {
    color: #8f3c04;
}

/* Tooltip */
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary[data-label] {
    position: relative;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary[data-label]:hover::before {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── Form grid helpers ── */
.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-grid .span-2,
.form-grid-4 .span-2 {
    grid-column: span 2;
}

.form-section-label {
    margin: 20px 0 4px;
    padding: 0 0 6px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

@media (max-width: 860px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-grid-4 .span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 540px) {
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
    .form-grid-4 .span-2 {
        grid-column: span 1;
    }
}

/* ── Sidebar footer cards: tema claro ── */
html body.internal-app-body .sidebar-footer-card,
html body.internal-app-body .sidebar-footer-card:visited,
html body.internal-app-body button.sidebar-footer-card {
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #1e293b !important;
}

html body.internal-app-body .sidebar-footer-card:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

html body.internal-app-body .sidebar-footer-card svg {
    color: #64748b;
}

html body.internal-app-body .sidebar-footer-card strong {
    color: #111827 !important;
}

html body.internal-app-body .sidebar-footer-card small {
    color: #64748b !important;
}

html body.internal-app-body .sidebar-support-card {
    background: #ffffff !important;
    color: var(--light-ink-2) !important;
    border: 1px solid var(--light-line) !important;
}

html body.internal-app-body .sidebar-support-card strong {
    color: var(--light-ink-2) !important;
}

html body.internal-app-body .sidebar-support-card summary {
    color: var(--light-ink-2);
}

html body.internal-app-body .sidebar-support-card svg {
    color: var(--light-orange-dark);
}

html body.internal-app-body .sidebar-support-menu a {
    color: #7c3aed !important;
}

html body.internal-app-body .sidebar-logout-card,
html body.internal-app-body button.sidebar-logout-card {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

html body.internal-app-body .sidebar-logout-card:hover,
html body.internal-app-body button.sidebar-logout-card:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
}

html body.internal-app-body .sidebar-logout-card svg {
    color: #dc2626;
}

/* Dossier protocol preview contains labels, not dashboard KPIs. */
html body.internal-app-body .protocol-preview .protocol-preview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 0;
}

html body.internal-app-body .protocol-preview-grid .stat-card {
    min-width: 0;
    min-height: 94px;
    padding: 14px 16px;
}

html body.internal-app-body .protocol-preview-grid .stat-card strong {
    margin-bottom: 8px;
    font-size: clamp(1rem, 1.35vw, 1.25rem);
    line-height: 1.25;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

html body.internal-app-body .protocol-preview-grid .stat-card p {
    font-size: 0.78rem;
    line-height: 1.3;
}

.cadunico-block {
    min-width: 0;
    margin: 0 0 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.72);
}

.cadunico-block legend {
    padding: 0 8px;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 400;
}

.cadunico-supplement {
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.cadunico-supplement summary {
    color: var(--ink);
    font-weight: 400;
    cursor: pointer;
}

.cadunico-supplement[open] summary {
    margin-bottom: 16px;
}

.section-divider {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.field-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 400;
}

@media (max-width: 1100px) {
    html body.internal-app-body .protocol-preview .protocol-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    html body.internal-app-body .protocol-preview .protocol-preview-grid {
        grid-template-columns: 1fr;
    }
}

/* Final collapsed sidebar fix. Keep at the end so older sidebar overrides cannot leak text into icon mode. */
html body.internal-app-body .app-frame.sidebar-is-collapsed {
    grid-template-columns: 72px minmax(0, 1fr) !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed {
    width: 72px !important;
    min-width: 72px !important;
    padding: 14px 10px !important;
    overflow: visible !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-header {
    justify-content: center !important;
    min-height: 42px;
    margin-bottom: 8px;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-collapse-btn {
    position: relative;
    z-index: 20;
    width: 40px !important;
    height: 40px !important;
    border: 1px solid #fed7aa !important;
    border-radius: 8px !important;
    background: #fff7ed !important;
    color: #9a3412 !important;
    opacity: 1 !important;
    box-shadow: 0 6px 16px rgba(154, 52, 18, 0.14) !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-collapse-btn:hover {
    background: #ffedd5 !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav {
    align-items: center !important;
    gap: 4px !important;
    overflow: visible !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav hr {
    width: 32px !important;
    margin: 8px auto !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav > a,
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: visible !important;
    gap: 0 !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav > a span,
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary span,
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-footer {
    display: none !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav > a svg,
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary svg {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav details {
    width: 44px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible !important;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav details > a,
html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-nav summary::after {
    display: none !important;
}

html body.internal-app-body .sidebar-collapse-btn {
    position: relative !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid #fed7aa !important;
    background: #fffaf5 !important;
    color: #9a3412 !important;
    opacity: 1 !important;
}

html body.internal-app-body .sidebar-collapse-btn svg {
    display: block;
    width: 18px !important;
    height: 18px !important;
    stroke: currentColor !important;
    opacity: 1 !important;
    transition: transform 180ms ease;
}

html body.internal-app-body .sidebar.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

html body.internal-app-body .metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

html body.internal-app-body .metrics-grid .metric {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    min-height: 88px;
}

html body.internal-app-body .metric-value {
    display: block;
    color: #111827;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
}

html body.internal-app-body .metric-label {
    display: block;
    color: #64748b;
    font-size: .76rem;
    margin-top: 6px;
    text-transform: uppercase;
}

html body.internal-app-body .grid.two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

html body.internal-app-body .section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

html body.internal-app-body .definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

html body.internal-app-body .definition-grid dt {
    color: #64748b;
    font-size: .76rem;
    text-transform: uppercase;
}

html body.internal-app-body .definition-grid dd {
    color: #111827;
    margin: 4px 0 0;
}

html body.internal-app-body .stack {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 920px) {
    html body.internal-app-body .grid.two-columns {
        grid-template-columns: 1fr;
    }
}

/* Sidebar text alignment polish. Keep after older sidebar overrides. */
html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav > a,
html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav summary {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr) 22px !important;
    align-items: center !important;
    justify-content: initial !important;
    column-gap: 10px !important;
    min-height: 44px !important;
    padding: 10px 10px !important;
}

html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav > a svg,
html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav summary svg {
    grid-column: 1 !important;
    justify-self: center !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
}

html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav > a span,
html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav summary span {
    grid-column: 2 !important;
    min-width: 0 !important;
    margin: 0 !important;
    text-align: left !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav summary::after {
    grid-column: 3 !important;
    justify-self: end !important;
    position: static !important;
    margin: 0 !important;
}

html body.internal-app-body .sidebar:not(.sidebar-collapsed) .sidebar-nav details a {
    text-align: left !important;
}
