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

:root {
    --bg: #f4f7fb;
    --bg-accent: #eef4ff;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-strong: #e9eef6;
    --sidebar-bg: #0f172a;
    --sidebar-border: rgba(148, 163, 184, 0.16);
    --text: #0f172a;
    --text-soft: #5b6678;
    --text-inverse: #f8fafc;
    --accent: #0f6fff;
    --accent-strong: #0057d9;
    --accent-soft: #dbeafe;
    --success: #0f9f6e;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #ffedd5;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);
    --shadow-soft: 0 18px 48px rgba(15, 23, 42, 0.08);
    --shadow-large: 0 30px 70px rgba(15, 23, 42, 0.12);
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --sidebar-width: 272px;
    --transition: 0.2s ease-in-out;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(15, 111, 255, 0.08), transparent 28%),
        linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 32%, #f8fafc 100%);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: inherit;
}

a,
button,
input,
select,
textarea {
    transition:
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition),
        box-shadow var(--transition),
        transform var(--transition),
        opacity var(--transition);
}

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

a:hover {
    color: var(--accent-strong);
}

img {
    max-width: 100%;
    display: block;
}

code,
pre {
    font-family: 'Consolas', 'SFMono-Regular', Consolas, monospace;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.82rem 0.82rem;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(15, 23, 42, 0.92) 100%);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 18px 0 46px rgba(15, 23, 42, 0.12);
    z-index: 1050;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
    padding: 0 0.38rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.88) 100%);
    box-shadow: 0 18px 34px rgba(15, 111, 255, 0.32);
    color: #fff;
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-inverse);
}

.brand-title span {
    color: #8dc2ff;
}

.brand-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.71rem;
    color: rgba(226, 232, 240, 0.7);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.7rem;
    min-height: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.34rem;
    overflow-y: auto;
    padding-right: 0.14rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.22) transparent;
}

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

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.34);
    background-clip: padding-box;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.62rem;
    border-radius: 12px !important;
    padding: 0.58rem 0.72rem !important;
    font-size: 0.83rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.72);
}

.sidebar .nav-link i {
    width: 1rem;
    min-width: 1rem;
    display: inline-flex;
    justify-content: center;
    font-size: 0.96rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus-visible {
    color: #fff;
    background: rgba(148, 163, 184, 0.12);
}

.sidebar .nav-link.active,
.sidebar .nav-link.active:hover {
    color: #fff;
    background: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.92) 100%);
    box-shadow: 0 12px 30px rgba(15, 111, 255, 0.3);
}

.sidebar-note {
    padding: 0.6rem 0.68rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-note-label {
    margin: 0 0 0.22rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(226, 232, 240, 0.52);
}

.sidebar-note-value {
    margin: 0;
    font-weight: 600;
    font-size: 0.82rem;
    color: #fff;
}

.sidebar-footer {
    display: grid;
    gap: 0.5rem;
    flex: 0 0 auto;
    padding-top: 0.18rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar .nav-link-logout {
    margin-top: 0 !important;
    color: rgba(248, 113, 113, 0.92) !important;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.12);
}

.sidebar .nav-link-logout:hover,
.sidebar .nav-link-logout:focus-visible {
    color: #fff !important;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.22);
}

.sidebar-footer-meta {
    margin-top: auto;
    padding-top: 0.72rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-storage {
    padding: 0.54rem 0.62rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-storage-top,
.sidebar-storage-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.sidebar-storage-top {
    margin-bottom: 0.32rem;
}

.sidebar-storage-title,
.sidebar-storage-bottom {
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.68rem;
    font-weight: 600;
}

.sidebar-storage-value {
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
}

.sidebar-storage .progress {
    height: 6px;
    background: rgba(148, 163, 184, 0.18);
    margin-bottom: 0.32rem !important;
}

.sidebar-storage .progress-bar {
    background: linear-gradient(90deg, rgba(15, 159, 110, 0.95) 0%, rgba(15, 111, 255, 0.95) 100%);
}

.sidebar-storage .progress-bar.is-warning {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
}

.sidebar-storage .progress-bar.is-danger {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
}

.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: 1.2rem;
}

.mobile-topbar {
    display: none;
}

.mobile-topbar-copy {
    min-width: 0;
}

.mobile-topbar-title {
    margin: 0;
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.mobile-topbar-title span {
    color: var(--accent);
}

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.92) 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.22);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.78rem;
}

.page-title {
    margin: 0;
    font-size: clamp(1.08rem, 1.35vw, 1.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.page-subtitle {
    max-width: 760px;
    margin: 0.16rem 0 0;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.panel-card,
.metric-card,
.data-card,
.auth-card,
.auth-aside {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--radius-md);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(12px);
}

.panel-card,
.data-card {
    padding: 0.82rem;
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 0.95rem 1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(17, 24, 39, 0.96) 100%);
    color: #fff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
}

.hero-panel::after {
    display: none;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.95rem;
}

.metric-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    padding: 1.08rem;
}

.metric-card.metric-primary {
    background: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.92) 100%);
    color: #fff;
}

.metric-card.metric-dark {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.94) 100%);
    color: #fff;
}

.metric-label {
    margin: 0 0 0.55rem;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.76;
}

.metric-value {
    margin: 0;
    font-size: clamp(1.45rem, 2.2vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.metric-meta {
    margin: 0.55rem 0 0;
    font-size: 0.83rem;
    opacity: 0.84;
}

.metric-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.pill,
.chip,
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.32rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.pill-primary,
.badge-soft-primary {
    background: var(--accent-soft);
    color: #0b4fb9;
    border-color: rgba(15, 111, 255, 0.14);
}

.pill-success,
.badge-soft-success {
    background: var(--success-soft);
    color: #0f7a56;
    border-color: rgba(15, 159, 110, 0.14);
}

.pill-warning,
.badge-soft-warning {
    background: var(--warning-soft);
    color: #a75b07;
    border-color: rgba(217, 119, 6, 0.12);
}

.pill-danger,
.badge-soft-danger {
    background: var(--danger-soft);
    color: #b42318;
    border-color: rgba(220, 38, 38, 0.12);
}

.toolbar-row,
.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
}

.toolbar-search i {
    color: var(--accent);
}

.toolbar-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    outline: 0;
}

.toolbar-search input::placeholder {
    color: #8a94a6;
}

.form-label,
.form-check-label {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.83rem;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus,
textarea.form-control {
    border-radius: 16px;
}

.form-control,
.form-select,
textarea.form-control {
    min-height: 44px;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.96);
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-size: 0.92rem;
    box-shadow: none;
}

textarea.form-control {
    min-height: 118px;
}

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
    color: #8a94a6;
}

.form-control:hover,
.form-select:hover,
textarea.form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(15, 111, 255, 0.4);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 111, 255, 0.12);
}

.form-control[aria-invalid='true'],
.form-select[aria-invalid='true'],
textarea[aria-invalid='true'] {
    border-color: rgba(220, 38, 38, 0.45);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 2.7rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--accent-strong);
    background: rgba(15, 111, 255, 0.08);
}

.input-note {
    margin-top: 0.45rem;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.input-error {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
    color: #b42318;
    font-size: 0.76rem;
    font-weight: 600;
}

.btn {
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 0.68rem 1rem;
    border-width: 1px;
    font-size: 0.88rem;
}

.btn-sm {
    border-radius: 11px;
    padding: 0.46rem 0.82rem;
    font-size: 0.8rem;
}

.btn-primary,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.95) 100%);
    border-color: transparent;
    box-shadow: 0 14px 28px rgba(15, 111, 255, 0.22);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: linear-gradient(135deg, rgba(0, 87, 217, 0.98) 0%, rgba(0, 73, 183, 0.95) 100%);
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(15, 111, 255, 0.24);
}

.btn-dark,
.btn-outline-secondary,
.btn-light,
.btn-warning,
.btn-danger {
    box-shadow: none;
}

.btn-dark {
    background: var(--sidebar-bg);
    border-color: transparent;
}

.btn-dark:hover,
.btn-dark:focus-visible {
    background: #1b2b4b;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    color: var(--text-soft);
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.76);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    color: var(--text);
    border-color: rgba(15, 111, 255, 0.24);
    background: #fff;
    transform: translateY(-1px);
}

.btn-light {
    color: var(--text);
    background: rgba(248, 250, 252, 0.96);
    border-color: var(--border);
}

.btn-light:hover,
.btn-light:focus-visible {
    background: #fff;
    border-color: rgba(15, 111, 255, 0.2);
}

.btn-warning {
    color: #7a4314;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: transparent;
}

.btn-warning:hover,
.btn-warning:focus-visible {
    color: #5d3310;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: transparent;
}

.btn-danger:hover,
.btn-danger:focus-visible {
    transform: translateY(-1px);
}

.btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 111, 255, 0.14);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.table-card {
    overflow: hidden;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-soft);
}

.table-responsive {
    border-radius: inherit;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: rgba(248, 250, 252, 0.96);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0.82rem 0.8rem;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.82rem 0.8rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    vertical-align: middle;
    color: var(--text);
    font-size: 0.88rem;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: rgba(15, 111, 255, 0.025);
}

.study-locked {
    background: rgba(220, 38, 38, 0.045) !important;
    border-left: 4px solid rgba(220, 38, 38, 0.48) !important;
}

.compact-code {
    display: inline-block;
    max-width: 100%;
    padding: 0.22rem 0.48rem;
    border-radius: 9px;
    background: rgba(15, 111, 255, 0.08);
    color: #0b4fb9;
    font-size: 0.76rem;
    word-break: break-all;
}

.truncate-text {
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 999px;
    flex: 0 0 auto;
}

.status-dot.success {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(15, 159, 110, 0.12);
}

.status-dot.warning {
    background: var(--warning);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.12);
}

.status-dot.danger {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.action-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
}

.action-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.action-icon:hover,
.action-icon:focus-visible {
    border-color: rgba(15, 111, 255, 0.22);
    background: #fff;
    color: var(--accent-strong);
    transform: translateY(-1px);
}

.alert {
    border: 0;
    border-radius: 16px;
    padding: 0.88rem 1rem;
    box-shadow: var(--shadow-soft);
    font-size: 0.88rem;
}

.alert-info {
    background: rgba(219, 234, 254, 0.88);
    color: #114a9b;
}

.alert-success {
    background: rgba(220, 252, 231, 0.88);
    color: #0f7a56;
}

.alert-warning {
    background: rgba(255, 237, 213, 0.92);
    color: #9a4e09;
}

.alert-danger {
    background: rgba(254, 226, 226, 0.92);
    color: #b42318;
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-large);
}

.modal-header,
.modal-footer {
    border: 0;
}

.modal-body {
    padding: 1.15rem;
}

.empty-state {
    padding: 2.2rem 1rem;
    text-align: center;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.settings-accordion {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.94);
    overflow: hidden;
}

.settings-accordion + .settings-accordion {
    margin-top: 0.72rem;
}

.settings-accordion summary {
    list-style: none;
    cursor: pointer;
    padding: 0.82rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.settings-accordion summary::-webkit-details-marker {
    display: none;
}

.settings-accordion-copy {
    min-width: 0;
}

.settings-accordion-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
}

.settings-accordion-meta {
    margin: 0.18rem 0 0;
    color: var(--text-soft);
    font-size: 0.75rem;
}

.settings-accordion-state {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-accordion-arrow {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    flex: 0 0 auto;
}

.settings-accordion[open] .settings-accordion-arrow i {
    transform: rotate(180deg);
}

.settings-accordion .settings-accordion-arrow i {
    transition: transform var(--transition);
}

.settings-accordion-body {
    padding: 0 0.9rem 0.9rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.settings-accordion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    padding-top: 0.72rem;
}

.settings-help {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.77rem;
}

.permission-row {
    display: grid;
    gap: 0.46rem;
    padding: 0.68rem 0.72rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: #fff;
}

.permission-row-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.permission-row-title {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.permission-row-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

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

.permission-row-personalize {
    font-size: 0.75rem;
    color: #475569;
}

.permission-row-toggle {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    justify-content: flex-end;
}

.permission-simple-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.68rem 0.72rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: #fff;
}

.permission-simple-label {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.permission-simple-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    justify-content: flex-end;
}

.company-config-page .main-content {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.company-config-shell {
    width: min(1280px, calc(100% - 1rem));
    margin: 0 auto;
    padding: 0.9rem 0 1.1rem;
    display: grid;
    gap: 0.9rem;
}

.company-config-header,
.company-config-card,
.company-config-actions-bar {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.company-config-header {
    padding: 1rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.company-config-kicker {
    margin: 0 0 0.18rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.company-config-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
}

.company-config-subtitle {
    margin: 0.3rem 0 0;
    max-width: 720px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-soft);
}

.company-config-header-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.company-config-card-body {
    padding: 1rem;
}

.company-config-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.company-config-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.company-config-card-copy {
    margin: 0.22rem 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-soft);
}

.company-config-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.company-summary-card {
    padding: 0.88rem 0.92rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.company-summary-label {
    margin: 0 0 0.24rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.company-summary-value {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.28;
}

.company-summary-note {
    margin: 0.26rem 0 0;
    font-size: 0.76rem;
    color: var(--text-soft);
    line-height: 1.45;
}

.company-config-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
    gap: 0.9rem;
    align-items: start;
}

.company-config-main,
.company-config-aside {
    display: grid;
    gap: 0.9rem;
}

.company-field-help {
    margin: 0.42rem 0 0;
    font-size: 0.76rem;
    color: var(--text-soft);
}

.commercial-config-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(244, 247, 251, 0.98) 100%);
    overflow: hidden;
}

.commercial-config-list {
    display: grid;
}

.commercial-config-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(190px, 0.78fr) minmax(280px, 0.95fr);
    gap: 0.85rem;
    align-items: center;
    padding: 0.88rem 1rem;
}

.commercial-config-row + .commercial-config-row {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.commercial-config-info {
    min-width: 0;
}

.commercial-config-title {
    margin: 0;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.commercial-config-description {
    margin: 0.16rem 0 0;
    color: var(--text-soft);
    font-size: 0.78rem;
    line-height: 1.45;
}

.commercial-config-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.42rem;
}

.limit-status-badge {
    white-space: nowrap;
}

.limit-current-value {
    color: var(--text);
    font-weight: 700;
}

.commercial-config-control {
    display: grid;
    grid-template-columns: auto minmax(160px, 1fr);
    gap: 0.6rem;
    align-items: center;
}

.commercial-config-control.is-disabled .config-inline-control {
    opacity: 0.72;
}

.config-inline-control {
    min-width: 0;
}

.settings-row-list {
    display: grid;
    gap: 0.65rem;
}

.settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.72fr) minmax(220px, 1fr);
    gap: 0.8rem;
    align-items: center;
    padding: 0.8rem 0.88rem;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.96);
}

.settings-row-main {
    min-width: 0;
}

.settings-row-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.settings-row-copy {
    margin: 0.18rem 0 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-soft);
}

.settings-row-meta {
    display: flex;
    gap: 0.36rem;
    flex-wrap: wrap;
    align-items: center;
}

.settings-row-actions {
    display: grid;
    grid-template-columns: auto minmax(140px, 1fr);
    gap: 0.5rem;
    align-items: center;
}

.company-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-soft);
}

.dashboard-columns-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.dashboard-columns-picker .column-chip {
    min-height: 44px;
}

.module-accordion + .module-accordion {
    margin-top: 0.72rem;
}

.company-config-actions-bar {
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.compact-settings-panel {
    display: grid;
    gap: 0.72rem;
}

.compact-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.62rem;
}

.compact-setting-field {
    display: grid;
    gap: 0.42rem;
    padding: 0.72rem 0.76rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.94);
}

.compact-setting-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.compact-setting-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    text-transform: uppercase;
}

.compact-setting-value {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--text);
}

.compact-setting-control .form-control,
.compact-setting-control .form-select {
    min-height: 40px;
}

.commercial-limits-panel {
    display: grid;
    gap: 0.65rem;
    padding: 0.78rem 0.82rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.94);
}

.commercial-limits-list {
    display: grid;
    gap: 0.58rem;
}

.commercial-limits-head,
.commercial-limit-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(86px, 0.42fr) minmax(110px, 0.55fr) minmax(120px, 0.62fr) minmax(150px, 0.72fr);
    gap: 0.6rem;
    align-items: center;
}

.commercial-limits-head {
    display: none;
}

.commercial-limit-row {
    padding: 0.72rem 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: #fff;
}

.commercial-limit-main {
    min-width: 0;
}

.commercial-limit-name {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.commercial-limit-note {
    margin: 0.14rem 0 0;
    font-size: 0.74rem;
    color: var(--text-soft);
}

.commercial-limit-current,
.commercial-limit-origin,
.commercial-limit-personalize,
.commercial-limit-input {
    min-width: 0;
}

.commercial-limit-current {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    color: var(--text);
    flex-wrap: wrap;
}

.commercial-limit-current .badge,
.commercial-limit-origin .badge,
.commercial-limit-personalize .badge {
    white-space: nowrap;
}

.commercial-limit-origin,
.commercial-limit-personalize,
.commercial-limit-input {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.commercial-limit-personalize .form-check {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

.commercial-limit-input .form-control,
.commercial-limit-input .form-select {
    min-height: 40px;
    max-width: 220px;
}

.commercial-limit-input .form-control:disabled,
.commercial-limit-input .form-select:disabled {
    background: rgba(226, 232, 240, 0.52);
    color: var(--text-soft);
}

.detail-grid,
.viewer-grid,
.summary-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.detail-card {
    padding: 0.95rem;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid var(--border);
}

.detail-label {
    margin: 0 0 0.35rem;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.detail-value {
    margin: 0;
    font-weight: 700;
    word-break: break-word;
    font-size: 0.9rem;
}

.instance-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.88rem 1rem;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid var(--border);
}

.search-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.search-item {
    padding: 0.78rem 0.92rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    cursor: pointer;
    font-size: 0.86rem;
}

.search-item:last-child {
    border-bottom: 0;
}

.search-item:hover,
.search-item:focus-visible {
    background: rgba(15, 111, 255, 0.05);
    color: var(--accent-strong);
}

.instance-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-layout {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

.auth-aside {
    position: relative;
    overflow: hidden;
    padding: 0.98rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.96) 100%);
    color: #fff;
    min-height: 0;
}

.auth-aside::after {
    display: none;
}

.auth-aside > * {
    position: relative;
    z-index: 1;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.56rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0.72rem 0 0.46rem;
    font-size: clamp(1.08rem, 1.8vw, 1.42rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.auth-copy {
    max-width: 46ch;
    margin: 0 0 0.68rem;
    color: rgba(241, 245, 249, 0.82);
    font-size: 0.76rem;
}

.auth-points {
    display: grid;
    gap: 0.52rem;
}

.auth-point {
    display: flex;
    gap: 0.68rem;
    align-items: flex-start;
    padding: 0.62rem 0.68rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-point i {
    color: #c6e0ff;
}

.auth-card {
    padding: 0.98rem;
}

.auth-card--login {
    align-self: center;
}

.auth-card h1,
.auth-card h2 {
    margin: 0;
}

.auth-card p {
    color: var(--text-soft);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-lockup .brand-mark {
    width: 42px;
    height: 42px;
}

.auth-form {
    margin-top: 0.82rem;
}

.auth-login-title {
    font-size: clamp(1.16rem, 1.7vw, 1.42rem);
}

.alert-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.alert-inline i {
    margin-top: 0.1rem;
}

.list-inline-soft {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.muted-value {
    color: var(--text-soft);
}

.small-note {
    color: var(--text-soft);
    font-size: 0.76rem;
}

.soft-section-title {
    margin: 0 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.soft-section-copy {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.82rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.kpi-tile {
    padding: 0.72rem 0.8rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.82);
}

.kpi-tile-label {
    margin: 0 0 0.35rem;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-tile-value {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.kpi-tile-meta {
    margin: 0.3rem 0 0;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.ops-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
    gap: 0.95rem;
}

.signal-list {
    display: grid;
    gap: 0.75rem;
}

.signal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.68rem 0.78rem;
    border-radius: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.signal-item-copy {
    min-width: 0;
}

.signal-item-title {
    margin: 0;
    font-size: 0.87rem;
    font-weight: 700;
}

.signal-item-meta {
    margin: 0.12rem 0 0;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.signal-item-value {
    text-align: right;
    font-size: 0.83rem;
    font-weight: 700;
}

.super-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
    gap: 0.8rem;
}

.ops-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.8rem 0.9rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-soft);
}

.ops-strip-copy {
    min-width: 0;
}

.ops-strip-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.ops-strip-note {
    margin: 0.12rem 0 0;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.ops-strip-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

@media (max-width: 768px) {
    .ops-strip {
        grid-template-columns: 1fr;
    }

    .ops-strip-meta {
        justify-content: flex-start;
    }
}

.ops-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-height: 30px;
    padding: 0.3rem 0.58rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 700;
}

.super-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.72fr);
    gap: 1rem;
    align-items: stretch;
}

.super-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.super-hero-title {
    margin: 0;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    line-height: 1.08;
    letter-spacing: -0.05em;
    font-weight: 800;
    max-width: 18ch;
}

.super-hero-copytext {
    max-width: 60ch;
    margin: 0;
    color: rgba(241, 245, 249, 0.78);
    font-size: 0.88rem;
}

.super-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.super-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 34px;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.super-hero-side {
    display: grid;
    gap: 0.8rem;
}

.super-hero-side-card {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.super-hero-side-label {
    margin: 0 0 0.35rem;
    color: rgba(191, 219, 254, 0.8);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.super-hero-side-value {
    color: #fff;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.micro-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.micro-stat {
    padding: 0.9rem;
    border-radius: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.micro-stat-label {
    margin: 0 0 0.35rem;
    color: var(--text-soft);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.micro-stat-value {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
}

.progress {
    background: rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 999px;
}

@media (max-width: 1199px) {
    .main-content {
        padding: 1.2rem;
    }

    .truncate-text {
        max-width: 220px;
    }

    .super-grid,
    .ops-layout {
        grid-template-columns: 1fr;
    }

    .super-hero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-102%);
        transition: transform 0.26s ease-in-out;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 0.78rem;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.58rem 0.72rem;
        margin-bottom: 0.82rem;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(15, 23, 42, 0.06);
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.07);
    }

    .auth-layout {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .detail-grid,
    .viewer-grid,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .super-hero-title {
        max-width: none;
    }

    .kpi-row,
    .micro-stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767.98px) {
    .page-header {
        margin-bottom: 0.9rem;
    }

    .panel-card,
    .data-card,
    .auth-card,
    .auth-aside,
    .hero-panel {
        padding: 0.82rem;
    }

    .super-chip-row {
        gap: 0.45rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.62rem 0.62rem;
    }

    .action-group {
        justify-content: flex-start;
    }

    .truncate-text {
        max-width: 170px;
    }

    .instance-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .mobile-topbar .small-note {
        font-size: 0.72rem;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .auth-page {
        padding: 0.72rem;
    }

    .auth-layout {
        gap: 0.72rem;
    }

    .auth-aside {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .auth-page,
    .main-content {
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }

    .auth-page {
        align-items: stretch;
    }

    .page-title {
        font-size: 1.32rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header > .btn {
        width: 100%;
    }

    .btn,
    .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .action-group .btn,
    .action-group .btn-sm,
    .action-group .action-icon {
        width: auto;
    }

    .toolbar-row,
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .truncate-text {
        max-width: 135px;
    }

    .kpi-row,
    .micro-stat-grid {
        grid-template-columns: 1fr;
    }
}

/* Global premium compact layer */

.btn {
    --bs-btn-padding-y: 0.62rem;
    --bs-btn-padding-x: 0.92rem;
    --bs-btn-font-size: 0.87rem;
    --bs-btn-font-weight: 700;
    --bs-btn-border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

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

.btn-primary {
    --bs-btn-bg: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.92) 100%);
    --bs-btn-border-color: rgba(15, 111, 255, 0.94);
    --bs-btn-hover-border-color: rgba(0, 87, 217, 0.98);
    --bs-btn-active-border-color: rgba(0, 87, 217, 0.98);
    background-image: var(--bs-btn-bg);
}

.btn-outline-secondary,
.btn-light {
    border-color: var(--border) !important;
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.92) !important;
}

.btn-sm {
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 0.78rem;
    --bs-btn-font-size: 0.8rem;
    --bs-btn-border-radius: 12px;
}

.form-control,
.form-select {
    min-height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 111, 255, 0.42);
    box-shadow: 0 0 0 0.22rem rgba(15, 111, 255, 0.12);
}

.form-label {
    margin-bottom: 0.42rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-soft);
    letter-spacing: 0.01em;
}

.form-check-input {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 0.35rem;
    border-color: rgba(15, 23, 42, 0.18);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-label {
    font-size: 0.87rem;
    color: var(--text);
}

.table-card,
.panel-card,
.data-card,
.auth-card,
.hero-panel,
.table-responsive {
    backdrop-filter: blur(10px);
}

.table {
    --bs-table-color: var(--text);
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(15, 23, 42, 0.08);
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    background: rgba(248, 250, 252, 0.92);
    border-bottom-width: 1px;
}

.table tbody td {
    font-size: 0.88rem;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(15, 111, 255, 0.045);
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 18px;
    box-shadow: 0 20px 54px rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.98);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    padding-left: 1rem;
    padding-right: 1rem;
}

.modal-body {
    padding: 0.95rem 1rem 1rem;
}

.modal-header {
    padding-top: 0.82rem;
    padding-bottom: 0.72rem;
}

.modal-footer {
    padding-top: 0.72rem;
    padding-bottom: 0.82rem;
    gap: 0.55rem;
}

.modal-title {
    font-size: 0.96rem;
    letter-spacing: -0.03em;
}

.modal .btn-close {
    transform: scale(0.92);
}

.modal-kicker {
    margin: 0 0 0.16rem;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-subnote {
    margin: 0.1rem 0 0;
    color: var(--text-soft);
    font-size: 0.74rem;
    line-height: 1.45;
}

.modal-body-tight {
    padding-top: 0.88rem;
}

.modal-section-card {
    padding: 0.82rem 0.88rem;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(248, 250, 252, 0.92);
}

.modal-info-strip {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.82rem 0.88rem;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(242, 246, 251, 0.98) 100%);
}

.modal-info-copy {
    min-width: 0;
}

.modal-info-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.modal-info-note {
    margin: 0.16rem 0 0;
    color: var(--text-soft);
    font-size: 0.75rem;
    line-height: 1.45;
}

.modal-inline-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.modal-inline-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-height: 28px;
    padding: 0.16rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.modal-inline-meta-item i {
    color: var(--accent);
}

.modal-actions-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    width: 100%;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .modal-info-strip,
    .modal-actions-split {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .company-config-shell {
        width: min(100%, calc(100% - 0.75rem));
        padding-top: 0.75rem;
    }

    .company-config-header,
    .company-config-card-body,
    .company-config-actions-bar {
        padding: 0.9rem;
    }

    .company-config-summary,
    .company-config-grid,
    .dashboard-columns-picker {
        grid-template-columns: 1fr;
    }

    .commercial-config-row {
        grid-template-columns: 1fr;
        gap: 0.72rem;
        padding: 0.82rem 0.88rem;
    }

    .commercial-config-control {
        grid-template-columns: 1fr;
    }

    .settings-row {
        grid-template-columns: 1fr;
    }

    .settings-row-actions {
        grid-template-columns: 1fr;
    }

    .settings-accordion summary {
        align-items: flex-start;
    }

    .settings-accordion-grid {
        grid-template-columns: 1fr;
    }

    .compact-settings-grid {
        grid-template-columns: 1fr;
    }

    .permission-row-controls,
    .permission-simple-row {
        grid-template-columns: 1fr;
    }

    .permission-row-toggle,
    .permission-simple-switch,
    .settings-accordion-state {
        justify-content: flex-start;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .company-config-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .company-config-grid {
        grid-template-columns: 1fr;
    }

    .commercial-config-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .commercial-config-info {
        grid-column: 1 / -1;
    }

    .settings-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .settings-row-main {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .commercial-limit-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem 0.9rem;
        padding: 0.82rem;
    }

    .commercial-limit-main {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .commercial-limits-panel {
        padding: 0.8rem;
    }

    .commercial-limit-row {
        grid-template-columns: 1fr;
    }

    .commercial-limit-input .form-control,
    .commercial-limit-input .form-select {
        max-width: 100%;
    }
}

.compact-toolbar-panel {
    padding: 0.78rem 0.88rem;
}

.compact-search-input {
    min-height: 42px;
}

.compact-stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.compact-stat {
    padding: 0.72rem 0.78rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.compact-stat-label {
    margin: 0 0 0.26rem;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    overflow-wrap: break-word;
}

.compact-stat-value {
    margin: 0;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.compact-stat-note {
    margin: 0.2rem 0 0;
    color: var(--text-soft);
    font-size: 0.75rem;
}

.inline-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem 1rem;
}

@media (max-width: 575.98px) {
    .compact-stats-row {
        grid-template-columns: 1fr;
    }

    .inline-check-grid {
        grid-template-columns: 1fr;
    }
}

.inline-check-card {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0.68rem 0.76rem;
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.inline-check-card .form-check {
    margin: 0;
}

.table-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.88rem 1rem 0.7rem;
}

.table-section-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.table-section-note {
    margin: 0.14rem 0 0;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.alert {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.alert-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.toolbar-search {
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.toolbar-search input {
    font-size: 0.9rem;
}

.nexus-confirm-modal .modal-dialog {
    max-width: 420px;
}

.nexus-toast-stack {
    gap: 0.7rem;
}

.nexus-toast {
    min-width: min(360px, calc(100vw - 2rem));
    border-radius: 18px;
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96) !important;
}

.nexus-toast .toast-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(255, 255, 255, 0.98);
    padding: 0.7rem 0.85rem;
}

.nexus-toast .toast-body {
    padding: 0.82rem 0.9rem 0.9rem;
    color: var(--text);
    font-size: 0.88rem;
}

.nexus-toast-dot {
    width: 10px;
    height: 10px;
    margin-right: 0.55rem;
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    background: var(--accent);
}

.nexus-toast-dot.is-success {
    background: var(--success);
}

.nexus-toast-dot.is-danger {
    background: var(--danger);
}

.nexus-toast-dot.is-warning {
    background: var(--warning);
}

.page-header,
.dashboard-shell,
.patient-portal-shell,
.patient-shell {
    gap: 0.95rem;
}

.audit-page .main-content {
    gap: 1rem;
}

.audit-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.95rem;
}

.audit-filter-card {
    overflow: hidden;
}

.audit-filters {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.85rem;
}

.audit-filter-field {
    grid-column: span 2;
}

.audit-filter-field--wide {
    grid-column: span 3;
}

.audit-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.audit-table .small-note {
    display: block;
}

.audit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.audit-badge--neutral {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

.audit-badge--security {
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.audit-badge--config {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.audit-badge--report {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.audit-badge--audio {
    background: rgba(168, 85, 247, 0.12);
    color: #7c3aed;
}

.audit-badge--warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.audit-context {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.audit-context-item {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--text-soft);
    font-size: 0.74rem;
}

.audit-detail {
    border-radius: 12px;
}

.audit-detail > summary {
    cursor: pointer;
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 600;
    list-style: none;
}

.audit-detail > summary::-webkit-details-marker {
    display: none;
}

.audit-detail > summary::after {
    content: 'Ver detalle';
    display: inline-block;
    margin-left: 0.45rem;
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 600;
}

.audit-detail[open] > summary::after {
    content: 'Ocultar';
}

.audit-detail-body {
    margin-top: 0.55rem;
    padding: 0.72rem 0.82rem;
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.audit-detail-body p:last-child {
    margin-bottom: 0;
}

.audit-detail--nested {
    margin-top: 0.65rem;
}

.audit-detail--nested pre {
    margin: 0.55rem 0 0;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    font-size: 0.74rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-mobile-list {
    display: grid;
    gap: 0.8rem;
    padding: 0 1rem 1rem;
}

.audit-mobile-card {
    padding: 0.95rem;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.audit-mobile-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.audit-mobile-time {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.audit-mobile-card-title {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.audit-mobile-card-title h3 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.35;
}

.audit-mobile-meta {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-soft);
}

.audit-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
    padding: 2.2rem 1.25rem;
}

.audit-empty-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(15, 111, 255, 0.08);
    color: #0f6fff;
    font-size: 1.35rem;
}

.audit-empty h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.audit-empty p {
    max-width: 520px;
    margin: 0;
    color: var(--text-soft);
    font-size: 0.86rem;
}

.audit-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding: 1rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.75rem;
    }

    .form-control,
    .form-select {
        min-height: 42px;
    }

    .nexus-toast {
        min-width: calc(100vw - 1.5rem);
    }
}

@media (max-width: 1199.98px) {
    .audit-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .audit-filter-field,
    .audit-filter-field--wide {
        grid-column: auto;
    }
}

@media (max-width: 767.98px) {
    .audit-stats-grid {
        grid-template-columns: 1fr;
    }

    .audit-filters {
        grid-template-columns: 1fr;
    }

    .audit-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .audit-filter-actions .btn {
        width: 100%;
    }

    .audit-mobile-list {
        padding: 0 0.85rem 0.85rem;
    }
}
.patient-footer-stack {
    display: grid;
    gap: 0.42rem;
}

.patient-footer-brand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.22rem;
    margin: 0;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
    text-align: center;
}

.patient-footer-brand a {
    color: var(--portal-brand-primary, #0f6fff);
    font-weight: 700;
    text-decoration: none;
}

.patient-footer-brand a:hover,
.patient-footer-brand a:focus {
    text-decoration: underline;
}

@media (max-width: 576px) {
    .patient-footer-brand {
        font-size: 0.74rem;
    }
}

/* ==========================================================================
   Modo oscuro
   ========================================================================== */

:root[data-theme="dark"] {
    --bg: #0b1220;
    --bg-accent: #0d1526;
    --surface: #131c2e;
    --surface-muted: #16202f;
    --surface-strong: #22304a;
    --sidebar-bg: #070c17;
    --sidebar-border: rgba(148, 163, 184, 0.14);
    --text: #e8edf5;
    --text-soft: #93a1b8;
    --text-inverse: #0f172a;
    --accent: #3b8bff;
    --accent-strong: #5c9fff;
    --accent-soft: rgba(59, 139, 255, 0.18);
    --success: #22c586;
    --success-soft: rgba(16, 185, 129, 0.18);
    --warning: #f2a93c;
    --warning-soft: rgba(245, 158, 11, 0.18);
    --danger: #f36565;
    --danger-soft: rgba(239, 68, 68, 0.18);
    --border: rgba(226, 232, 240, 0.1);
    --border-strong: rgba(226, 232, 240, 0.18);
    --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.42);
    --shadow-large: 0 30px 70px rgba(0, 0, 0, 0.52);
}

[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(59, 139, 255, 0.12), transparent 28%),
        linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 32%, #080d18 100%);
}

[data-theme="dark"] .panel-card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .data-card,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .table-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .mobile-topbar,
[data-theme="dark"] .ops-strip,
[data-theme="dark"] .kpi-tile {
    background: rgba(19, 28, 46, 0.92);
    border-color: rgba(226, 232, 240, 0.08);
}

[data-theme="dark"] .modal-content {
    background: rgba(15, 22, 36, 0.98);
}

[data-theme="dark"] .modal-section-card,
[data-theme="dark"] .modal-info-strip,
[data-theme="dark"] .modal-inline-meta-item,
[data-theme="dark"] .settings-accordion,
[data-theme="dark"] .permission-row,
[data-theme="dark"] .permission-simple-row,
[data-theme="dark"] .company-config-header,
[data-theme="dark"] .company-config-card,
[data-theme="dark"] .company-config-actions-bar,
[data-theme="dark"] .company-summary-card,
[data-theme="dark"] .commercial-config-card,
[data-theme="dark"] .commercial-limit-row,
[data-theme="dark"] .compact-setting-field,
[data-theme="dark"] .commercial-limits-panel,
[data-theme="dark"] .inline-check-card,
[data-theme="dark"] .compact-stat,
[data-theme="dark"] .audit-context-item,
[data-theme="dark"] .audit-detail-body,
[data-theme="dark"] .audit-mobile-card,
[data-theme="dark"] .instance-card,
[data-theme="dark"] .detail-card,
[data-theme="dark"] .toolbar-search,
[data-theme="dark"] .search-results,
[data-theme="dark"] .action-icon {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(226, 232, 240, 0.08);
}

[data-theme="dark"] .action-icon {
    color: var(--text-soft);
}

[data-theme="dark"] .action-icon:hover,
[data-theme="dark"] .action-icon:focus-visible {
    background: rgba(59, 139, 255, 0.14);
    color: var(--accent-strong);
}

[data-theme="dark"] .search-item:hover,
[data-theme="dark"] .search-item:focus-visible {
    background: rgba(59, 139, 255, 0.12);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-control {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(226, 232, 240, 0.14);
    color: var(--text);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder,
[data-theme="dark"] textarea.form-control::placeholder {
    color: #64748b;
}

[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .btn-light {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text) !important;
    border-color: rgba(226, 232, 240, 0.14) !important;
}

[data-theme="dark"] .table thead th {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .table tbody td {
    border-bottom-color: rgba(226, 232, 240, 0.07);
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background: rgba(59, 139, 255, 0.08);
}

[data-theme="dark"] .nexus-toast,
[data-theme="dark"] .nexus-toast .toast-header {
    background: rgba(15, 22, 36, 0.98) !important;
    color: var(--text);
    border-color: rgba(226, 232, 240, 0.08);
}

[data-theme="dark"] .alert-info { background: rgba(59, 139, 255, 0.16); color: #b7d4ff; }
[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, 0.16); color: #8fefcd; }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.18); color: #ffd28a; }
[data-theme="dark"] .alert-danger { background: rgba(239, 68, 68, 0.18); color: #ffb3b3; }

[data-theme="dark"] .pill-primary,
[data-theme="dark"] .badge-soft-primary { background: rgba(59, 139, 255, 0.16); color: #b7d4ff; border-color: rgba(59, 139, 255, 0.22); }
[data-theme="dark"] .pill-success,
[data-theme="dark"] .badge-soft-success { background: rgba(16, 185, 129, 0.16); color: #8fefcd; border-color: rgba(16, 185, 129, 0.22); }
[data-theme="dark"] .pill-warning,
[data-theme="dark"] .badge-soft-warning { background: rgba(245, 158, 11, 0.18); color: #ffd28a; border-color: rgba(245, 158, 11, 0.24); }
[data-theme="dark"] .pill-danger,
[data-theme="dark"] .badge-soft-danger { background: rgba(239, 68, 68, 0.18); color: #ffb3b3; border-color: rgba(239, 68, 68, 0.24); }

[data-theme="dark"] .audit-empty-icon {
    background: rgba(59, 139, 255, 0.14);
    color: #a9c8ff;
}

.theme-toggle-fab {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 1080;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 1.05rem;
    box-shadow: var(--shadow-soft);
}

.theme-toggle-fab:hover,
.theme-toggle-fab:focus-visible {
    color: var(--accent-strong);
    transform: translateY(-2px);
}

@media (max-width: 575.98px) {
    .theme-toggle-fab {
        right: 0.75rem;
        bottom: 0.75rem;
        width: 42px;
        height: 42px;
    }
}

.nexus-lite-toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    display: grid;
    gap: 0.6rem;
    max-width: min(360px, calc(100vw - 2rem));
}

.nexus-lite-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.82rem 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 220ms ease, transform 220ms ease;
}

[data-theme="dark"] .nexus-lite-toast {
    background: rgba(15, 22, 36, 0.98);
}

.nexus-lite-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.nexus-lite-toast-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.94rem;
}

.nexus-lite-toast-body {
    min-width: 0;
}

.nexus-lite-toast-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text);
}

.nexus-lite-toast-text {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--text-soft);
    line-height: 1.4;
}

.nexus-lite-toast-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1;
}

.nexus-lite-toast-close:hover,
.nexus-lite-toast-close:focus-visible {
    color: var(--text);
    background: rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .nexus-lite-toast-close:hover,
[data-theme="dark"] .nexus-lite-toast-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 575.98px) {
    .nexus-lite-toast-stack {
        top: 0.7rem;
        right: 0.7rem;
        left: 0.7rem;
        max-width: none;
    }
}

/* Isotipo Nexus Node dentro del recuadro de marca (2026-11-11) */
.brand-mark img.nn-isotipo {
    width: 74%;
    height: 74%;
    object-fit: contain;
    border-radius: 0;
}

/* ==========================================================================
   Fase 10 (2026-11-13): menu lateral unico (includes/app_sidebar.php)
   Marca Nexus arriba · menu con scroll propio por secciones · pie fijo con
   logo de la institucion, almacenamiento y cerrar sesion (sin solaparse).
   ========================================================================== */
.sidebar .brand-mark.brand-mark-nexus {
    background: linear-gradient(135deg, rgba(15, 111, 255, 0.98) 0%, rgba(0, 87, 217, 0.88) 100%) !important;
    box-shadow: 0 14px 28px rgba(15, 111, 255, 0.32) !important;
}

.sidebar .sidebar-brand .brand-copy {
    display: flex;
    align-items: center;
}

.sidebar .sidebar-menu {
    gap: 0.22rem;
    margin: 0 -0.2rem;
    padding: 0 0.2rem 0.6rem;
}

.sidebar-section {
    margin: 0.7rem 0 0.15rem;
    padding: 0 0.72rem;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.42);
}

.sidebar-section:first-child {
    margin-top: 0.1rem;
}

.sidebar .sidebar-footer {
    gap: 0.55rem;
    padding-top: 0.7rem;
}

.sidebar-institution {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

a.sidebar-institution:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #fff;
}

.sidebar-institution-logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 40px;
    padding: 4px 6px;
    border-radius: 8px;
    background: #fff;
}

.sidebar-institution-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-institution-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.16);
}

.sidebar-institution-name {
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 700;
}

.sidebar .nav-link.nav-link-logout {
    justify-content: center;
}

/* Fase 10: logo institucional completo (sin recorte) en "Centro de monitoreo" */
.ops-strip-company-logo.has-logo {
    width: auto !important;
    height: 36px !important;
    flex: 0 0 auto !important;
    padding: 3px 8px;
    border-radius: 8px !important;
}

.ops-strip-company-logo.has-logo img {
    width: auto !important;
    height: 100% !important;
    max-width: 170px;
    object-fit: contain !important;
}

/* Fase 10: en celular/tablet el menu lateral se abre encima del contenido: fondo solido */
@media (max-width: 991.98px) {
    .sidebar {
        background: #0f172a;
    }
}
