/* HelpDesk Audit - Premium Light UI */
:root {
    --container-max: 1600px;
    --gutter: 24px;

    --bg-app: #f5f3ef;
    --bg-surface: #ffffff;
    --bg-subtle: #f0eee9;
    --bg-muted: #f7f6f3;

    --text-primary: #14161f;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;

    --primary: #2f5bff;
    --primary-hover: #2449d8;
    --primary-bg: #e7edff;
    --primary-text: #1d2d6b;

    --success: #12b981;
    --success-bg: #ecfdf5;
    --success-text: #0f8a65;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #b45309;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;

    --info: #0ea5e9;
    --info-bg: #eef8ff;
    --info-text: #0284c7;

    --border-light: #ece7e1;
    --border: #e1ddd7;
    --border-strong: #d1cdc7;

    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
    --shadow: 0 6px 16px rgba(17, 24, 39, 0.08);
    --shadow-md: 0 12px 24px rgba(17, 24, 39, 0.1);
    --shadow-lg: 0 20px 32px rgba(17, 24, 39, 0.12);
    --shadow-focus: 0 0 0 4px rgba(47, 91, 255, 0.18);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --font-sans: "Sora", "Segoe UI", Tahoma, Arial, sans-serif;
    --font-display: "Sora", "Segoe UI", Tahoma, Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    --topbar-height: 56px;
    --input-height: 44px;
    --btn-height: 44px;
    --btn-height-sm: 32px;

    --duration-fast: 140ms;
    --duration: 180ms;
    --duration-slow: 240ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.55;
    background-color: var(--bg-app);
    background-image:
        radial-gradient(900px 420px at 10% -10%, rgba(229, 236, 255, 0.85), transparent 60%),
        radial-gradient(800px 420px at 100% 0%, rgba(255, 236, 223, 0.7), transparent 55%);
    -webkit-font-smoothing: antialiased;
}

/* --- Global Modern Scrollbar (Hidden but functional) --- */
* {
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE/Edge */
}

::-webkit-scrollbar {
    display: none !important;
    /* Chrome/Safari */
}

:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-family: var(--font-display);
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.2rem;
    line-height: 1.4;
}

h4 {
    font-size: 1rem;
}

p {
    margin: 0 0 var(--space-4);
    color: var(--text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--duration-fast) ease;
}

a:hover {
    color: var(--primary-hover);
}

button {
    font-family: inherit;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-muted {
    color: var(--text-tertiary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning-text);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-wrap {
    display: block;
    white-space: normal;
    word-break: break-word;
}

.font-medium {
    font-weight: 500;
}

.font-normal {
    font-weight: 400;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-4 {
    margin-bottom: var(--space-4) !important;
}

.mb-5 {
    margin-bottom: var(--space-5) !important;
}

.mt-4 {
    margin-top: var(--space-4) !important;
}

.py-4 {
    padding-top: var(--space-4) !important;
    padding-bottom: var(--space-4) !important;
}

.d-none {
    display: none !important;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.brand a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary) 0%, #7ea0ff 100%);
    color: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    white-space: nowrap;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    position: relative;
}

/* Fade indicators for scroll - applied via JS */
.nav-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.nav-wrapper::before,
.nav-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-wrapper::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.nav-wrapper::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.nav-wrapper.can-scroll-left::before {
    opacity: 1;
}

.nav-wrapper.can-scroll-right::after {
    opacity: 1;
}

.nav-link {
    height: 38px;
    padding: 0 var(--space-3);
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--duration-fast) ease;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 var(--space-2);
    flex-shrink: 0;
}

.inline-form {
    margin: 0;
    display: inline-flex;
}

.main {
    flex: 1;
    padding: var(--space-8) 0 var(--space-12);
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 0%, rgba(226, 235, 255, 0.9), rgba(248, 245, 239, 0.95));
}

.auth-shell::before,
.auth-shell::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(47, 91, 255, 0.15), transparent 70%);
    opacity: 0.6;
    z-index: 0;
}

.auth-shell::before {
    top: -200px;
    left: -120px;
}

.auth-shell::after {
    bottom: -220px;
    right: -120px;
}

.auth-stack {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    display: grid;
    gap: var(--space-5);
    justify-items: center;
}

.auth-card {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 44px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, #7ea0ff 100%);
    color: white;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    margin: 0 auto 24px;
    box-shadow: 0 12px 24px rgba(47, 91, 255, 0.35);
}

.auth-title {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-meta {
    text-align: center;
}

.page-header {
    margin-bottom: var(--space-8);
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.status-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.status-card-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    font-weight: 600;
}

.status-meta {
    font-size: 0.75rem;
}

.dashboard-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: var(--space-8);
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(47, 91, 255, 0.08), rgba(255, 255, 255, 0.95)),
        radial-gradient(420px 240px at 0% 0%, rgba(255, 255, 255, 0.8), transparent 60%);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-8);
}

.dashboard-intro-main {
    display: grid;
    gap: var(--space-4);
}

.dashboard-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-tertiary);
    font-weight: 600;
}

.dashboard-lead {
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
    display: grid;
    gap: 8px;
}

.dashboard-intro-aside {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    align-items: stretch;
    justify-content: space-between;
}

.dashboard-intro-actions {
    display: grid;
    gap: var(--space-3);
}

.dashboard-section {
    display: grid;
    gap: var(--space-5);
}

.dashboard-section-head h3 {
    margin-bottom: 6px;
}

.card,
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out), border-color var(--duration-fast) ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.card-header,
.panel-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    gap: var(--space-4);
}

.card-header-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.card-body,
.panel-body {
    padding: var(--space-6);
    flex: 1;
}

.card-body-stretch {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    background: var(--bg-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-5);
}

.dashboard-card {
    position: relative;
    background: var(--bg-surface);
    padding: var(--space-6) var(--space-6) var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out), border-color var(--duration-fast) ease;
    display: flex;
    flex-direction: column;
    color: inherit;
    box-shadow: 0 12px 20px rgba(17, 24, 39, 0.08);
    gap: var(--space-3);
    min-height: 220px;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(47, 91, 255, 0.4);
}

.dashboard-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(47, 91, 255, 0.8), rgba(126, 160, 255, 0.6));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--duration-fast) ease;
}

.dashboard-card:hover::before {
    opacity: 1;
}

.dashboard-card-icon {
    width: 46px;
    height: 46px;
    background: rgba(47, 91, 255, 0.12);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(47, 91, 255, 0.2);
}

.dashboard-card-icon svg {
    width: 24px;
    height: 24px;
}

/* === NESTED MODALS (TEST CHECKS) === */
.modal-top {
    z-index: 2060 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    padding: 20px;
}

.modal-top.is-hidden {
    display: none !important;
}

#testChecksBackdrop {
    z-index: 2055 !important;
    background: rgba(15, 23, 42, .35);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    position: fixed;
    inset: 0;
}

.is-hidden {
    display: none !important;
}

.body-lock {
    overflow: hidden !important;
}

.modal.is-under {
    pointer-events: none !important;
    filter: saturate(.9) blur(.2px) !important;
    opacity: 0.8;
}

.dashboard-card-body h3 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.dashboard-card-cta {
    margin-top: auto;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.field {
    margin-bottom: var(--space-5);
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.input,
textarea.input,
select.input {
    display: block;
    width: 100%;
    height: var(--input-height);
    padding: 0 14px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
    font-family: inherit;
    appearance: none;
}

textarea.input {
    min-height: 120px;
    height: auto;
    padding: 12px 14px;
    resize: vertical;
}

.input:hover {
    border-color: var(--border-strong);
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(47, 91, 255, 0.15);
    outline: none;
}

.input.is-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input.is-success {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(18, 185, 129, 0.15);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.field-error {
    font-size: 0.8rem;
    color: var(--danger-text);
    margin-top: 6px;
}

.input-addon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-addon .input {
    padding-right: 110px;
}

.input-addon-text {
    position: absolute;
    right: 12px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
}

.inline-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--danger);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--btn-height);
    padding: 0 22px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease, background var(--duration-fast) ease, border-color var(--duration-fast) ease;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    --spinner-color: var(--text-primary);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 16px rgba(47, 91, 255, 0.2);
    border-color: transparent;
    --spinner-color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 12px 20px rgba(47, 91, 255, 0.25);
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    --spinner-color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    --spinner-color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-sm {
    height: var(--btn-height-sm);
    padding: 0 12px;
    font-size: 0.8rem;
}

.btn-lg {
    height: 48px;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.is-loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.btn.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--spinner-color);
    border-top-color: transparent;
    position: absolute;
    animation: spin 0.7s linear infinite;
}

.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.95rem;
    border: 1px solid transparent;
    display: flex;
    gap: 8px;
    align-items: center;
}

.alert-danger {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-text);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: rgba(14, 165, 233, 0.2);
}

.alert-success {
    background: #f0fdf4;
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-text);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-text);
}

.flash-stack {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.flash-success {
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-text);
    background: var(--success-bg);
}

.flash-error {
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-text);
    background: var(--danger-bg);
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
}

.table-wrap-flat-top {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-muted);
    padding: 12px 20px;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

.table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.875rem;
    vertical-align: middle;
}

.title-cell {
    max-width: 420px;
}

.table tbody tr:nth-child(even) {
    background: #fbfaf8;
}

.table tbody tr:hover {
    background: rgba(47, 91, 255, 0.05);
}

.action-col {
    text-align: right;
}

.audit-table .col-id {
    width: 110px;
}

.audit-table .col-status {
    width: 140px;
}

.audit-table .col-date {
    width: 170px;
}

.audit-table .col-actions {
    width: 140px;
}

.empty-cell {
    text-align: center;
    color: var(--text-tertiary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary-text);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-secondary {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.status-badges {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
    align-self: flex-start;
    justify-self: start;
}

.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-compact {
    gap: var(--space-4);
}

.profile-grid .card {
    height: 100%;
}

.profile-grid .card-body {
    display: grid;
    gap: var(--space-4);
    align-items: start;
    align-content: start;
}

.profile-grid .status-badges {
    margin-bottom: 0;
}

.profile-card .card-body {
    padding-top: var(--space-5);
}

.profile-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-surface);
    overflow: hidden;
}

.profile-section+.profile-section {
    margin-top: var(--space-4);
}

.profile-section summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
}

.profile-section summary::-webkit-details-marker {
    display: none;
}

.profile-section[open] summary {
    background: var(--bg-muted);
}

.profile-section-summary {
    display: grid;
    gap: 6px;
}

.profile-section-title {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-section-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-section-body {
    padding: var(--space-5);
    border-top: 1px solid var(--border-light);
    background: var(--bg-muted);
}

.profile-section summary .btn {
    flex-shrink: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.filter-grid .field {
    margin-bottom: 0;
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.actions-center {
    justify-content: center;
}

.actions-inline {
    margin-top: 0;
    align-self: end;
}

.filter-actions {
    align-self: end;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    width: 100%;
    margin-top: 0;
}

.filter-actions .btn {
    width: 100%;
}

.actions-split {
    justify-content: space-between;
}

.form-stretch {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.form-stretch .actions {
    margin-top: auto;
}

.empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--text-secondary);
    display: grid;
    gap: var(--space-3);
    justify-items: center;
}

.empty-state-visual {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 91, 255, 0.15), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(47, 91, 255, 0.2);
}

.option-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease, border-color var(--duration-fast) ease;
    background: var(--bg-surface);
    position: relative;
    display: block;
}

.option-card:hover {
    border-color: rgba(47, 91, 255, 0.5);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.option-card.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    box-shadow: 0 0 0 2px rgba(47, 91, 255, 0.12);
}

.option-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-card.disabled:hover {
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.option-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 12px;
}

.option-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-card-title input[type="radio"] {
    accent-color: var(--primary);
}

.option-card-badges {
    display: flex;
    gap: 6px;
}

.option-active {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    background: rgba(47, 91, 255, 0.15);
    padding: 4px 8px;
    border-radius: 999px;
    opacity: 0;
    transition: opacity var(--duration-fast) ease;
}

.option-card.active .option-active {
    opacity: 1;
}

.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
}

.pagination-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--duration-fast) ease;
}

.page-link:hover {
    border-color: var(--border-strong);
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    pointer-events: none;
}

.page-link-static {
    pointer-events: none;
    border-color: transparent;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
}

.page-link-ellipsis {
    pointer-events: none;
    border-color: transparent;
    background: transparent;
    color: var(--text-tertiary);
    min-width: 24px;
}

.pagination-meta {
    text-align: center;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration) ease;
}

.modal.is-open {
    opacity: 1;
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 28, 0.35);
}

.modal-dialog {
    position: relative;
    background: var(--bg-surface);
    width: min(840px, 95vw);
    max-height: 88vh;
    border-radius: 18px;
    box-shadow: 0 28px 60px rgba(17, 24, 39, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateY(8px) scale(0.98);
    transition: transform var(--duration) var(--ease-out);
    z-index: 1;
}

.modal.is-open .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 2;
}

.modal-header-main {
    min-width: 0;
    flex: 1;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: 4px;
    min-width: 0;
}

.modal-title {
    font-size: 1.1rem;
    min-width: 0;
}

.modal-body {
    padding: var(--gutter);
    overflow-y: auto;
    max-height: 80vh;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 18, 28, 0.2) transparent;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-muted);
    text-align: right;
}

.modal-section {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.modal-section:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.modal-state {
    display: none;
}

.modal-state.is-active {
    display: block;
}

.modal-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.modal-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.detail-item {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--bg-muted);
    border: 1px solid var(--border-light);
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 600;
}

.detail-value {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.detail-list {
    display: grid;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-light);
}

.detail-row-value {
    color: var(--text-primary);
    font-weight: 500;
}

.richtext {
    line-height: 1.6;
}

.richtext-surface {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg-muted);
    border: 1px solid var(--border-light);
}

.richtext p {
    margin-bottom: 1em;
}

.richtext ul,
.richtext ol {
    margin: 0 0 1em 1.5em;
    padding: 0;
    color: var(--text-secondary);
}

.richtext li {
    margin-bottom: 0.5em;
}

.timeline {
    position: relative;
    padding-left: 24px;
    border-left: 2px solid var(--border-light);
    margin: 8px 0;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -29px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--primary);
}

.timeline-content {
    background: var(--bg-muted);
    padding: 12px 16px;
    border-radius: var(--radius);
}

.timeline-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.timeline-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.timeline-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-word;
}

/* Skeleton & Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-line {
    height: 12px;
    background: #cbd5e1;
    /* Darker base for visibility */
    background: linear-gradient(110deg, #cbd5e1 30%, #ffffff 50%, #cbd5e1 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    border-radius: var(--radius-sm, 4px);
    animation: shimmer 1.5s infinite linear !important;
    margin-bottom: 12px;
}

.skeleton-stack {
    margin-bottom: var(--space-5);
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: var(--space-5);
}

.skeleton-card {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--bg-muted);
}

.w-40 {
    width: 40%;
}

.w-60 {
    width: 60%;
}

.w-70 {
    width: 70%;
}

.w-80 {
    width: 80%;
}

.page-enter {
    animation: pageEnter var(--duration) var(--ease-out) both;
}

.fade-in {
    animation: pageEnter var(--duration) var(--ease-out) both;
}

.delay-1 {
    animation-delay: 60ms;
}

.delay-2 {
    animation-delay: 120ms;
}

.delay-3 {
    animation-delay: 180ms;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Executive Test Results */
.result-header h4 {
    font-size: 1.2rem;
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.summary-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.charges-section {
    margin-bottom: var(--space-4);
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.action-item {
    padding: var(--space-4);
    background: var(--bg-subtle);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    transition: transform var(--duration-fast) var(--ease-out);
}

.action-item:hover {
    transform: translateX(4px);
}

.chip {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chip-more {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

/* Tabs */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--space-3);
}

.tab {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    top: 2px;
}

.tab:hover {
    color: var(--text);
    background: var(--bg-subtle);
}

.tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-panel {
    animation: fadeIn var(--duration) var(--ease-out);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.acc-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--duration-fast) var(--ease-out);
}

.acc-item:hover {
    border-color: var(--primary-light);
}

.acc-head {
    padding: var(--space-3);
    background: var(--bg-subtle);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--duration-fast) var(--ease-out);
    -webkit-user-select: none;
    user-select: none;
}

.acc-head:hover {
    background: var(--bg-muted);
}

.acc-body {
    padding: var(--space-4);
    background: var(--bg);
    border-top: 1px solid var(--border-color);
}

.acc-body p {
    margin: 0 0 var(--space-3) 0;
}

.acc-body p:last-child {
    margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
    .action-item:hover {
        transform: none;
    }

    .tab-panel {
        animation: none;
    }
}

/* Check Testing UI */
.toggle-icon {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: transform var(--duration-fast) var(--ease-out);
    -webkit-user-select: none;
    user-select: none;
}

/* Result Header Polish */
.result-header {
    background: linear-gradient(to right, var(--bg-surface), var(--bg-muted));
    border-bottom: 2px solid var(--primary-light);
    padding: var(--space-4) var(--space-5);
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* Result Tabs Layout */
.result-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-subtle);
}

.result-tab {
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--duration-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-tab:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.result-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-surface);
}

.result-tab-content {
    padding: var(--space-5);
    background: var(--bg-surface);
    min-height: 200px;
}

/* Scrollbar Refinement */
.result-tab-content,
.report-module {
    overflow-y: auto;
    max-height: 600px;
}

/* Modular Report Container */
.report-modular-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.report-module {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-fast) ease;
    overflow-x: auto;
}

.report-module:hover {
    border-color: var(--primary-light);
}

.report-h1 {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
    border-bottom: 2px solid var(--primary-bg);
    padding-bottom: var(--space-2);
}

.report-h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-h2::before {
    content: "•";
    color: var(--primary);
    font-size: 1.5rem;
}

.report-h3 {
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.report-module li {
    margin-bottom: var(--space-1);
    color: var(--text-secondary);
}

.report-module strong {
    color: var(--text-primary);
    font-weight: 600;
}

.skeleton {
    padding: var(--space-4);
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 16px;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
}

.skeleton-line:nth-child(1) {
    width: 80%;
}

.skeleton-line:nth-child(2) {
    width: 60%;
}

.skeleton-line:nth-child(3) {
    width: 90%;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.test-result-card {
    animation: slideUp var(--duration) var(--ease-out);
}

.test-check-result {
    transition: transform var(--duration-fast) var(--ease-out);
}

.test-check-result:hover {
    transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }

    .test-result-card {
        animation: none;
    }

    .test-check-result:hover {
        transform: none;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: -200% 0%;
    }
}

@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal-dialog {
        width: min(720px, 94vw);
    }
}

@media (max-width: 900px) {
    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-intro {
        grid-template-columns: 1fr;
        padding: var(--space-6);
    }
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .modal-section-grid,
    .detail-grid,
    .skeleton-grid {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        padding: 0 16px;
    }

    .nav {
        gap: 4px;
    }

    .nav-link {
        padding: 0 10px;
        font-size: 0.8rem;
    }

    .auth-card {
        padding: 28px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-intro {
        padding: var(--space-5);
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: 20px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-inline {
        align-self: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .btn.is-loading::after {
        animation: none;
    }
}

/* Microcopy & Help Utilities */
.help-guide {
    background: linear-gradient(135deg, rgba(47, 91, 255, 0.05), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(47, 91, 255, 0.15);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-6);
}

.help-guide h4 {
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.help-guide h4::after {
    content: "▼";
    position: absolute;
    right: 0;
    font-size: 0.7rem;
    transition: transform var(--duration) ease;
}

.help-guide.collapsed h4::after {
    transform: rotate(-90deg);
}

.help-guide-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height var(--duration-slow) ease, opacity var(--duration) ease;
}

.help-guide.collapsed .help-guide-content {
    max-height: 0;
    opacity: 0;
}

.help-guide ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.help-guide li {
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 4px;
}

.help-guide li::before {
    content: "→";
    position: absolute;
    left: -16px;
    color: var(--primary);
    font-weight: 600;
}

.help-guide .guide-example {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(47, 91, 255, 0.1);
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-style: italic;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.field-legend {
    background: var(--bg-muted);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    margin-top: 8px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-item-icon {
    font-size: 1rem;
    line-height: 1;
}

.legend-item-text {
    color: var(--text-secondary);
}

.legend-item-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.category-examples {
    background: var(--info-bg);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--info-text);
}

.empty-state-primary {
    padding: var(--space-8);
    text-align: center;
}

.empty-state-primary h3 {
    margin-bottom: var(--space-2);
}

.empty-state-primary p {
    margin-bottom: var(--space-4);
}

/* Template Selection Cards */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.template-card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    text-align: left;
}

.template-card:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.template-card:active {
    transform: translateY(0);
}

.template-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.template-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.template-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.template-badge.is-required {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.template-badge.is-recommended {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.template-clear {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.template-clear:hover {
    background: var(--bg-subtle);
    border-color: var(--text-tertiary);
}

@media (prefers-reduced-motion: reduce) {
    .template-card {
        transition: none;
    }

    .template-card:hover {
        transform: none;
    }
}

/* Custom Confirmation Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--duration-fast) ease;
}

.confirm-modal-overlay.active {
    display: flex;
}

.confirm-modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    width: 90%;
    padding: var(--space-6);
    animation: slideUp var(--duration) var(--ease-out);
}

.confirm-modal-icon {
    width: 48px;
    height: 48px;
    background: var(--warning-bg);
    color: var(--warning-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto var(--space-4);
}

.confirm-modal-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.confirm-modal-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-6);
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: var(--space-3);
}

.confirm-modal-actions .btn {
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === BATCH BAR === */
.batch-bar {
    position: fixed;
    bottom: var(--space-8);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    width: auto;
    min-width: 400px;
    display: flex;
    align-items: center;
    transition: all var(--duration) var(--ease-out);
    opacity: 1;
}

.batch-bar.is-hidden {
    bottom: -100px;
    opacity: 0;
    pointer-events: none;
}

.batch-bar-inner {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    width: 100%;
}

.batch-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.batch-count {
    background: var(--primary);
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

.batch-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.batch-actions .input-sm {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: 32px;
    font-size: 0.85rem;
    padding: 0 8px;
    border-radius: 6px;
}

.batch-actions option {
    background: var(--text-primary);
    color: white;
}

.col-check {
    width: 48px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

@media (max-width: 900px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}


/* Profile Layout Enhancements */
.profile-section-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.profile-section-icon {
    font-size: 1.1rem;
}

.profile-section-static {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
}

.profile-section summary .btn,
.profile-section-static .btn {
    flex-shrink: 0;
    min-width: 90px;
    text-align: center;
}

/* Fix header height for large logo */
.topbar {
    height: auto !important;
    min-height: 100px;
    padding: 12px 0;
}

.topbar-inner {
    height: auto !important;
    min-height: 100px;
}

/* === BI V2 - PREMIUM DASHBOARD === */
.bi-header {
    margin-bottom: var(--space-8);
    background: var(--bg-surface);
    padding: var(--space-6) var(--space-8);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bi-title-group h1 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.bi-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bi-meta {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Metric Cards */
.bi-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.bi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease-out);
    position: relative;
    cursor: pointer;
}

.bi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.bi-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

.bi-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bi-tooltip-trigger {
    color: var(--text-tertiary);
    cursor: help;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.bi-tooltip-trigger:hover {
    color: var(--primary);
}

.bi-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.bi-card-sub {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: #1e293b;
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: pre-wrap;
    width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    line-height: 1.4;
    text-align: center;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Filter Drawer */
.bi-drawer {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100vh;
    background: var(--bg-surface);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: right var(--duration-slow) var(--ease-out);
    display: flex;
    flex-direction: column;
}

.bi-drawer.open {
    right: 0;
}

.bi-drawer-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bi-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.bi-drawer-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.bi-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.bi-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Side Panel (Drill-down) */
.bi-side-panel {
    position: fixed;
    top: 0;
    right: -800px;
    width: 800px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-surface);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.15);
    z-index: 1200;
    transition: right var(--duration-slow) var(--ease-out);
    display: flex;
    flex-direction: column;
}

.bi-side-panel.open {
    right: 0;
}

/* Skeleton Loaders */
@keyframes bi-skeleton {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: bi-skeleton 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1.25rem;
    width: 60%;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 1rem;
    width: 40%;
    margin-bottom: 15px;
}

.skeleton-value {
    height: 2.5rem;
    width: 80%;
}

/* Chips */
.bi-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-6);
}

.bi-chip {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bi-chip-remove {
    cursor: pointer;
    color: var(--text-tertiary);
}

.bi-chip-remove:hover {
    color: var(--danger);
}

/* ===================== PAGINATION ===================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--duration-fast) ease;
    cursor: pointer;
}

.pagination-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-bg);
}

.pagination-link.is-active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
    cursor: default;
}

.pagination-link.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* ===================== SORTABLE TABLE HEADERS ===================== */
.th-sortable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--duration-fast) ease;
    white-space: nowrap;
}

.th-sortable:hover {
    color: var(--primary);
}

.sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: color var(--duration-fast) ease;
}

.sort-icon.active {
    color: var(--primary);
    font-weight: 600;
}

.th-sortable:hover .sort-icon {
    color: var(--primary);
}