/* ============================================================
   Notary Management System — Admin Portal Styles
   Brand: Primary #3aafa9 | Secondary #00182c | Accent #000
   Font: Montserrat
   ============================================================ */

:root {
    --primary: #3aafa9;
    --primary-dark: color-mix(in srgb, var(--primary) 52%, black);
    --primary-deep: color-mix(in srgb, var(--primary) 28%, black);
    --primary-bright: color-mix(in srgb, var(--primary) 86%, white);
    --primary-pale: color-mix(in srgb, var(--primary) 46%, white);
    --primary-light: color-mix(in srgb, var(--primary) 12%, transparent);
    --primary-glow: color-mix(in srgb, var(--primary) 8%, transparent);
    /* Legacy insights header: 135deg, stops 0/42/78/100 (#0e7490 → #5eead4), remapped from --primary */
    --primary-gradient-hero: linear-gradient(
        135deg,
        color-mix(in srgb, var(--primary) 28%, black) 0%,
        color-mix(in srgb, var(--primary) 52%, black) 42%,
        color-mix(in srgb, var(--primary) 86%, white) 78%,
        color-mix(in srgb, var(--primary) 46%, white) 100%
    );
    --primary-gradient-accent: linear-gradient(90deg, color-mix(in srgb, var(--primary) 52%, black), var(--primary-bright));
    --secondary: #00182c;
    --dark-accent: #000000;
    --white: #ffffff;
    --gray-50: #f8fafb;
    --gray-100: #f1f5f7;
    --gray-200: #e2e8ed;
    --gray-300: #cbd5e0;
    --gray-400: #64748b;
    --gray-500: #475569;
    --gray-600: #334155;
    --gray-700: #1e293b;
    --gray-800: #0f172a;
    --text-body: #0f172a;
    --text-muted: #475569;
    --text-label: #1e293b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --layout-gutter: 1.5rem;
    --layout-canvas: #cfd8e0;
    --topbar-height: 72px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 24, 44, 0.06), 0 4px 16px rgba(0, 24, 44, 0.04);
    --shadow-lg: 0 8px 30px rgba(0, 24, 44, 0.1);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    font-size: 0.875rem;
    color: var(--text-body);
    background: var(--layout-canvas);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars: brand primary (app-wide) ── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary) 65%, transparent);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ── Readability: stronger text contrast app-wide ── */
.text-muted {
    --bs-secondary-color: var(--text-muted);
    color: var(--text-muted) !important;
}

small,
.small {
    color: var(--gray-600);
}

.form-label {
    color: var(--text-label);
    font-weight: 600;
}

.form-control,
.form-select,
textarea.form-control {
    color: var(--text-body);
}

.form-control::placeholder {
    color: var(--gray-500);
    opacity: 1;
}

.form-floating > label {
    color: var(--gray-600);
}

.saas-table thead th {
    color: var(--gray-600);
    font-weight: 600;
}

.saas-table tbody td {
    color: var(--text-body);
}

.table-secondary {
    color: var(--gray-600);
}

.empty-state {
    color: var(--gray-600);
}

a { text-decoration: none; color: var(--primary); transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
    min-height: 100vh;
    background: var(--gray-50);
}

.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

.auth-visual {
    flex: 1;
    background: linear-gradient(135deg, var(--secondary) 0%, #002d4d 50%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-visual-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
    color: var(--white);
}

.auth-brand .auth-logo {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.auth-brand h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.auth-brand p {
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1.7;
}

.auth-features {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.auth-feature i {
    width: 36px;
    height: 36px;
    background: rgba(58, 175, 169, 0.25);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 520px;
}

.auth-wrapper-single .auth-form-panel-full {
    max-width: 100%;
}

.auth-form-container {
    width: 100%;
    max-width: 400px;
}

.auth-form-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.auth-form-header p {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.auth-logo-sm {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.auth-form .form-control {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 1rem 0.875rem;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    transition: var(--transition);
}

.auth-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-form .form-floating > label {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    color: var(--gray-500);
}

.login-pw-field {
    display: block;
    position: relative;
}

.login-pw-input-wrap {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
}

.login-pw-input-wrap .login-pw-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 1rem 0.875rem;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.login-pw-input-wrap .login-pw-input:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.saas-card .login-pw-input-wrap .login-pw-input,
.case-form-page .login-pw-input-wrap .login-pw-input {
    padding: 0.5625rem 0.75rem;
    min-height: 42px;
    font-size: 0.875rem;
    line-height: 1.4;
    border-width: 1px;
    border-color: var(--gray-200);
    border-radius: 8px;
}

.saas-card .login-pw-input-wrap .login-pw-input:not(:last-child),
.case-form-page .login-pw-input-wrap .login-pw-input:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.login-pw-reveal {
    flex: 0 0 2.75rem;
    width: 2.75rem;
    margin: 0;
    border: 2px solid var(--gray-200);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--gray-50);
    color: var(--gray-600);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.15s ease, background 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.saas-card .login-pw-reveal,
.case-form-page .login-pw-reveal {
    border-width: 1px;
    border-color: var(--gray-200);
    border-radius: 0 8px 8px 0;
}

.login-pw-reveal i {
    font-size: 1.125rem;
    line-height: 1;
    pointer-events: none;
}

.login-pw-icon-hide {
    display: none;
}

.login-pw-field:not(.login-pw-field--revealed) .login-pw-masked {
    -webkit-text-security: disc;
}

.login-pw-field.login-pw-field--revealed .login-pw-masked {
    -webkit-text-security: none;
}

.login-pw-field.login-pw-field--revealed .login-pw-icon-show {
    display: none;
}

.login-pw-field.login-pw-field--revealed .login-pw-icon-hide {
    display: inline;
}

.login-pw-reveal[disabled],
.login-pw-field:has(input:disabled) .login-pw-reveal,
.login-pw-field:has(input[readonly]) .login-pw-reveal {
    opacity: 0.45;
    cursor: not-allowed;
}

.login-pw-reveal:hover {
    color: var(--primary);
}

.login-pw-field:focus-within .login-pw-input {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.login-pw-field:focus-within .login-pw-reveal {
    border-color: var(--primary);
    color: var(--primary);
}

.account-password-grid > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.account-password-grid .form-label {
    margin-bottom: 0.375rem;
}

.account-password-grid .login-pw-field {
    width: 100%;
}

.login-pw-field--static .login-pw-input:disabled {
    background-color: var(--bs-secondary-bg, #e9ecef);
    opacity: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.login-pw-reveal--spacer {
    visibility: hidden;
    pointer-events: none;
}

.login-pw-field .login-pw-input::-ms-reveal,
.login-pw-field .login-pw-input::-ms-clear {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

.login-pw-field input::-webkit-credentials-auto-fill-button,
.login-pw-field input::-webkit-textfield-decoration-container {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

.auth-field-label {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    z-index: 5;
    padding: 4px 8px;
}

.password-toggle:hover { color: var(--primary); }

/* Hide browser/password-manager default reveal icons (avoid duplicate eyes). */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

.auth-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
}

.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(58, 175, 169, 0.35);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
}

.auth-footer p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ============================================================
   APP LAYOUT — Modern SaaS
   ============================================================ */
.app-wrapper {
    min-height: 100vh;
    background: var(--gray-100);
}

.sidebar {
    width: var(--sidebar-width);
    background: #00182c;
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    padding: 1.125rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 64px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.brand-name {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-tag {
    display: block;
    font-size: 0.65rem;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0.625rem;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    margin-bottom: 0.125rem;
    font-weight: 500;
    font-size: 0.8125rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.07);
}

.nav-link.active {
    color: var(--white);
    background: var(--primary);
}

.sidebar-company-switch {
    padding: 0.75rem 0.875rem 0;
    margin-top: auto;
}

.sidebar-company-switch__label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.35rem;
}

.sidebar-company-switch__select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(58, 175, 169, 0.45);
    background: rgba(0, 24, 44, 0.55);
    color: var(--white);
    font-size: 0.8125rem;
    color-scheme: dark;
    cursor: pointer;
}

.sidebar-company-switch__select option {
    background: #0a2438;
    color: #f8fafc;
}

.sidebar-company-switch__select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(58, 175, 169, 0.25);
    outline: none;
}

body.sidebar-collapsed .sidebar-company-switch {
    display: none;
}

.company-actions .btn {
    white-space: nowrap;
}

.table tbody tr.company-row-current > td {
    background-color: var(--primary-light) !important;
    border-color: color-mix(in srgb, var(--primary) 24%, transparent);
}

.table-hover tbody tr.company-row-current:hover > td {
    background-color: color-mix(in srgb, var(--primary) 18%, white) !important;
}

.company-delete-modal__alert {
    background-color: var(--primary-light);
    border: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
    color: var(--primary-deep);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.9375rem;
}

.company-delete-modal__alert strong {
    color: var(--primary-dark);
}

.sidebar-footer {
    padding: 0.875rem 0.625rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.22);
    color: var(--white);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    min-height: auto;
}

body.sidebar-collapsed .sidebar-brand {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
}

body.sidebar-collapsed .brand-text {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-inline: 0.5rem;
}

body.sidebar-collapsed .sidebar-logout {
    padding-inline: 0.5rem;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    overflow-x: hidden;
    transition: margin-left 0.25s ease, width 0.25s ease;
    background: var(--gray-100);
}

.page-content {
    padding: 1.75rem 1.5rem 2.5rem;
    width: 100%;
    max-width: none;
    margin: 0;
}

.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
    width: 100%;
    max-width: none;
    margin: 0;
    flex-shrink: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1.25rem;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    overflow: visible;
    box-sizing: border-box;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.topbar-title {
    min-width: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.topbar-title-text {
    min-width: 0;
    min-height: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.topbar-page-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--secondary);
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(48vw, 560px);
}

.topbar-page-subtitle {
    font-size: 0.6875rem;
    color: var(--gray-600);
    margin: 0.125rem 0 0;
    font-weight: 500;
    line-height: 1.2;
    min-height: 0.825rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(48vw, 560px);
}

.topbar-page-subtitle--placeholder {
    visibility: hidden;
}

.sidebar-toggle {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    border-color: transparent;
    color: var(--primary);
}

.topbar-search {
    flex: 1;
    max-width: 320px;
    position: relative;
}

.topbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
    font-size: 0.9rem;
    pointer-events: none;
}

.topbar-search .form-control {
    padding: 0.5rem 0.875rem 0.5rem 2.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    font-size: 0.8125rem;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    height: 38px;
}

.topbar-search .form-control:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    position: relative;
    z-index: 2;
}

.trial-days {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.25rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.topbar-actions .dropdown-menu {
    z-index: 1060;
}

.topbar-actions .dropdown-menu.show {
    display: block;
}

#notificationDropdownList {
    max-height: min(50vh, 320px);
    overflow-x: hidden;
    overflow-y: auto;
}

.topbar-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
}

a.topbar-btn {
    text-decoration: none;
}

.topbar-btn.is-active,
.topbar-btn.is-active:hover {
    background: var(--primary-light);
    border-color: transparent;
    color: var(--primary);
}

.topbar-btn:hover {
    background: var(--primary-light);
    border-color: transparent;
    color: var(--primary);
}

.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    pointer-events: none;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    padding: 0.25rem 0.625rem 0.25rem 0.25rem;
    border-radius: 10px;
    transition: var(--transition);
}

.topbar-profile:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
}

.profile-info { text-align: left; line-height: 1.25; }
.profile-name { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--secondary); }
.profile-role { display: block; font-size: 0.6875rem; color: var(--gray-600); font-weight: 500; }
.profile-chevron { font-size: 0.7rem; color: var(--gray-600); }

.notification-dropdown,
.profile-dropdown {
    width: 320px;
    padding: 0;
    border: 1px solid var(--gray-200);
    box-shadow: 0 12px 40px rgba(0, 24, 44, 0.12);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.5rem !important;
}

.notification-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.notification-dropdown__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.notification-dropdown__mark-all {
    flex-shrink: 0;
    padding: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--primary);
    white-space: nowrap;
}

.notification-dropdown__mark-all:hover {
    color: var(--primary-dark, #2d9d96);
    text-decoration: underline;
}

.notification-dropdown .dropdown-header,
.profile-dropdown-header {
    padding: 0.875rem 1rem;
    background: var(--gray-50);
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-dropdown-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.profile-dropdown-header strong { font-size: 0.875rem; font-weight: 600; }
.profile-dropdown-header small { font-size: 0.75rem; color: var(--gray-600); font-weight: 500; }

.notification-item {
    display: flex !important;
    gap: 0.75rem;
    padding: 0.75rem 1rem !important;
    white-space: normal;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: rgba(58, 175, 169, 0.04); }

.notification-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.notification-content strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--secondary);
}

.notification-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0.125rem 0 0;
    line-height: 1.4;
}

.notification-content small { font-size: 0.6875rem; color: var(--gray-600); font-weight: 500; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.125rem;
}

.page-subtitle {
    color: var(--gray-600);
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 24, 44, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* ============================================================
   DASHBOARD — Reference SaaS Style
   ============================================================ */
.dashboard-page {
    padding: 0;
}

.dashboard-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem !important;
}

.dashboard-kpi-row > .dash-stat-card,
.dashboard-kpi-row > .kpi-card {
    min-width: 0;
    min-height: 118px;
}

.dashboard-panels-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.dashboard-panels-row > .dash-chart-card {
    min-width: 0;
    min-height: 0;
}

.dash-chart-card .table-responsive {
    flex: 1;
    min-width: 0;
}

.dash-chart-body.dash-chart-body--flush {
    min-height: 0;
    padding: 0;
}

.dash-chart-body.dash-chart-body--empty {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-stat-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    width: 100%;
    min-width: 0;
    padding: 1.125rem 1.25rem;
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.04);
    height: 100%;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.dash-stat-card:hover {
    box-shadow: 0 6px 18px rgba(0, 24, 44, 0.07);
    transform: translateY(-1px);
    color: inherit;
}

.dash-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(58, 175, 169, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.dash-stat-content {
    min-width: 0;
    flex: 1;
}

.dash-stat-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.2rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dash-stat-value {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.dash-stat-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
    min-width: 0;
}

.dash-stat-value-row .kpi-trend {
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.dash-stat-foot {
    display: block;
    font-size: 0.625rem;
    color: #94a3b8;
    line-height: 1.35;
}

.dash-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-stat-trend.up { color: #10b981; }
.dash-stat-trend.down { color: #3b82f6; }

.dash-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 10px 10px 0 0;
    background: var(--primary-gradient-accent);
    opacity: 0.85;
}
.dash-stat-card--blue::before    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.dash-stat-card--green::before   { background: linear-gradient(90deg, #34d399, #10b981); }
.dash-stat-card--amber::before   { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.dash-stat-card--indigo::before  { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.dash-stat-card--blue .dash-stat-icon    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.dash-stat-card--green .dash-stat-icon   { background: rgba(16, 185, 129, 0.12); color: #059669; }
.dash-stat-card--amber .dash-stat-icon   { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.dash-stat-card--indigo .dash-stat-icon  { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }

.home-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    padding: 1.35rem 1.4rem;
    border-radius: 12px;
    color: #fff;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 62%, white) 0%, transparent 42%),
        linear-gradient(135deg, var(--dark-accent) 0%, color-mix(in srgb, var(--primary) 46%, #0b1f33) 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.home-hero-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.home-hero-title {
    margin: 0 0 0.4rem;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.home-hero-lead {
    margin: 0;
    max-width: 38rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.86);
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    max-width: 22rem;
}

.home-hero-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.home-hero-action:hover {
    background: #fff;
    color: var(--dark-accent);
}

.home-dash .dash-stat-value {
    font-size: 1.45rem;
    font-weight: 600;
}

.home-dash .dash-stat-card {
    align-items: center;
}

.home-stat-go {
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
}

.home-status-card {
    margin-bottom: 1.25rem;
}

.home-status-card .dash-chart-body {
    min-height: 0;
    padding: 0.25rem 1.35rem 1.15rem;
}

.home-status-bar {
    display: flex;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.home-status-seg {
    display: block;
    height: 100%;
    min-width: 4px;
}

.home-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    margin: 0.85rem 0 0;
    padding: 0;
    list-style: none;
}

.home-status-legend a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}

.home-status-legend a:hover {
    color: var(--dark-accent);
}

.home-status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.home-panel-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    color: inherit;
    text-decoration: none;
}

.home-panel-link:last-child {
    border-bottom: none;
}

.home-panel-link:hover {
    background: var(--gray-50);
    color: inherit;
}

.home-panel-copy {
    min-width: 0;
    flex: 1;
}

.home-panel-title {
    display: block;
    font-weight: 600;
    color: #1e293b;
}

.home-panel-meta {
    display: block;
    margin-top: 0.15rem;
    color: #64748b;
    font-size: 0.75rem;
}

.home-due {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
}

.home-due--late {
    color: #dc2626;
}

.home-case-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

a.schedule-item {
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.schedule-list > li:last-child > a.schedule-item {
    border-bottom: none;
}

@media (max-width: 767.98px) {
    .home-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-hero-actions {
        justify-content: flex-start;
        max-width: none;
    }

    .home-hero-title {
        font-size: 1.25rem;
    }
}

/* KPI cards — solid white (matches chart cards below) */
.kpi-card {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 132px;
    padding: 1rem 1rem 0.875rem;
    background-color: #ffffff !important;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.04);
    color: var(--gray-600);
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.kpi-card:hover,
.kpi-card:focus,
.kpi-card:active,
.kpi-card:visited {
    background-color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    color: var(--gray-600);
}

.kpi-card .stat-card-footer {
    padding: 0;
    padding-top: 0.375rem;
    background: transparent !important;
    border-top: none;
}

.kpi-card .stat-card-body {
    padding: 0;
    background: transparent !important;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 10px 10px 0 0;
    background: var(--primary-gradient-accent);
    opacity: 0.9;
}
.kpi-card--primary::before { background: var(--primary-gradient-accent); }
.kpi-card--amber::before   { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.kpi-card--indigo::before  { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.kpi-card--blue::before    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.kpi-card--primary .stat-card-icon { background: rgba(58, 175, 169, 0.14); color: var(--primary); }
.kpi-card--amber .stat-card-icon   { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.kpi-card--indigo .stat-card-icon  { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.kpi-card--blue .stat-card-icon    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }

/* Stat cards — compact reference style (legacy) */
.dashboard-kpi-row a.stat-card {
    background-color: #ffffff;
}

.stat-card {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 132px;
    padding: 1rem 1rem 0.875rem;
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--gray-600);
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    height: 100%;
    width: 100%;
}

.stat-card:hover {
    background: var(--white);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    color: var(--gray-600);
}

.stat-card:visited {
    color: var(--gray-600);
}

.stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin-bottom: 0.625rem;
    flex-shrink: 0;
}

.stat-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0.25rem;
}

.stat-card-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--gray-600);
    line-height: 1.35;
    margin: 0;
}

.stat-card-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.02em;
    min-width: 0;
    word-break: break-word;
}

.stat-card-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.125rem;
}

.stat-card-footer {
    margin-top: auto;
    padding-top: 0.375rem;
}

.dashboard-kpi-row .stat-card-footer {
    padding: 0;
    padding-top: 0.375rem;
    background: transparent;
    border-top: none;
}

.dashboard-kpi-row .stat-card-body {
    padding: 0;
}

.stat-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.375rem;
}

.stat-card-sub {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--gray-600);
    line-height: 1.35;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.kpi-trend-inline {
    font-size: 0.75rem;
}

.kpi-trend.up { color: #16a34a; }
.kpi-trend.down { color: #2563eb; }
.kpi-trend.neutral { color: #ca8a04; }

.dash-chart-card {
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.04);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dash-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 0.75rem;
    flex-wrap: wrap;
}

.dash-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.dash-chart-subtitle {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
}

.dash-chart-body {
    padding: 0.5rem 1rem 1.25rem;
    flex: 1;
    min-height: 220px;
    position: relative;
}

.dash-chart-body-lg {
    min-height: 260px;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 220px;
}

.chart-canvas-wrap-sm {
    height: 200px;
}

.chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.dash-chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-empty-state,
.empty-state-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: inherit;
    padding: 2rem 1.25rem;
    color: var(--gray-600);
}

.chart-empty-state i,
.empty-state-panel i {
    font-size: 2rem;
    margin-bottom: 0.625rem;
    color: #cbd5e1;
}

.chart-empty-state p,
.empty-state-panel p {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.25rem;
}

.chart-empty-hint,
.empty-state-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-600);
    max-width: 260px;
    line-height: 1.45;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.chart-legend-inline {
    gap: 1rem;
}

.chart-legend-item,
.chart-legend-item-static {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
    font-weight: 500;
    margin: 0;
    cursor: default;
}

.chart-legend-item input[type="radio"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot-dark { background: var(--secondary); }
.legend-dot-primary { background: var(--primary); }

.chart-period-toggle {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    border: none;
}

.btn-period {
    background: transparent;
    border: none;
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    transition: var(--transition);
}

.btn-period:hover {
    color: var(--secondary);
}

.btn-period.active {
    background: var(--white);
    color: var(--secondary);
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.08);
}

.schedule-list-compact .schedule-item {
    padding: 0.875rem 1.5rem;
}

.topbar {
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.04);
    border-bottom: 1px solid #e2e8f0;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
}

.topbar-search .form-control {
    background: #f1f5f9;
    border-color: #e2e8f0;
    min-width: 280px;
}

/* ============================================================
   METRIC CARDS & SAAS COMPONENTS
   ============================================================ */
.metric-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    height: 100%;
    min-height: 88px;
    color: inherit;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0, 24, 44, 0.04);
}

.metric-card:hover {
    border-color: rgba(58, 175, 169, 0.35);
    box-shadow: 0 4px 16px rgba(0, 24, 44, 0.06);
    transform: translateY(-2px);
    color: inherit;
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.metric-icon-primary { background: var(--primary-light); color: var(--primary); }
.metric-icon-secondary { background: rgba(0, 24, 44, 0.06); color: var(--secondary); }
.metric-icon-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.metric-icon-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.metric-body { min-width: 0; }

.metric-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-600);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.125rem;
}

.metric-value {
    display: block;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--secondary);
    line-height: 1.2;
}

.metric-value-sm { font-size: 1.125rem; }

.saas-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 24, 44, 0.04);
    overflow: hidden;
}

.saas-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.saas-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--secondary);
    margin: 0;
}

.saas-card-subtitle {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin: 0.125rem 0 0;
    font-weight: 400;
}

.saas-card-body {
    padding: 1.25rem;
}

.chart-body {
    padding: 0.5rem 1.25rem 1.25rem;
    height: 260px;
}

.chart-body canvas { width: 100% !important; }

/* Schedule list */
.schedule-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.schedule-item:last-child { border-bottom: none; }
.schedule-item:hover { background: var(--gray-50); }

.schedule-date {
    width: 40px;
    text-align: center;
    background: var(--primary-light);
    border-radius: 8px;
    padding: 0.375rem 0.25rem;
    flex-shrink: 0;
}

.schedule-date span {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1;
}

.schedule-date small {
    font-size: 0.625rem;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-weight: 600;
}

.schedule-info {
    flex: 1;
    min-width: 0;
}

.schedule-title {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--secondary);
    line-height: 1.35;
    word-break: break-word;
}

.schedule-list-compact .schedule-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.schedule-meta {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-600);
    margin-top: 0.125rem;
    line-height: 1.35;
    word-break: break-word;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 220px;
}

.table-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
    font-size: 0.8rem;
}

.table-search .form-control {
    padding-left: 2rem;
    border-radius: 8px;
    border-color: var(--gray-200);
    font-size: 0.8125rem;
    font-family: var(--font-family, 'Montserrat', sans-serif);
}

.table-filter {
    width: auto;
    min-width: 140px;
    border-radius: 8px;
    border-color: var(--gray-200);
    font-size: 0.8125rem;
    font-family: var(--font-family, 'Montserrat', sans-serif);
}

.table-filter-month {
    min-width: 130px;
}

.table-row-actions {
    position: relative;
    z-index: 2;
    flex-wrap: nowrap;
}

.table-row-actions .btn {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.saas-table thead th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    font-weight: 600;
    border-bottom: 1px solid var(--gray-100);
    padding: 0.75rem 1.25rem;
    background: var(--white);
}

.saas-table tbody td {
    padding: 0.875rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.8125rem;
    color: var(--text-body);
}

.saas-table tbody tr {
    transition: var(--transition);
}

.saas-table tbody tr:hover {
    background: var(--gray-50);
}

.saas-table tbody tr:last-child td {
    border-bottom: none;
}

.table-primary {
    font-weight: 500;
    color: var(--secondary);
    font-size: 0.8125rem;
}

.table-secondary {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Activity feed */
.activity-feed {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-feed-item {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    position: relative;
}

.activity-feed-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 14px;
    bottom: 0;
    width: 1px;
    background: var(--gray-200);
}

.activity-feed-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-feed-text {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin: 0 0 0.125rem;
    line-height: 1.4;
}

.activity-feed-text span {
    color: var(--gray-600);
    font-weight: 400;
}

.activity-feed-item time {
    font-size: 0.6875rem;
    color: var(--gray-600);
}

.activity-feed-horizontal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0 1.5rem;
}

.activity-feed-horizontal .activity-feed-item {
    padding-bottom: 0;
}

.activity-feed-horizontal .activity-feed-item:not(:last-child)::before {
    display: none;
}

/* Business activity stream (compact scroll card) */
.activity-card {
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.activity-card .dash-chart-header {
    flex-shrink: 0;
    padding-bottom: 0.5rem;
}

.activity-scroll {
    flex: 1;
    min-height: 0;
    padding: 0 1rem 0.75rem;
}

.activity-pagination {
    flex-shrink: 0;
}

.activity-stream {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-stream-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 0.5rem 0.625rem;
    align-items: start;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-stream-item:last-child {
    border-bottom: none;
}

.activity-stream-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.activity-stream-icon.act-teal {
    background: rgba(58, 175, 169, 0.12);
    color: var(--primary);
}

.activity-stream-icon.act-green {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.activity-stream-icon.act-blue {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.activity-stream-icon.act-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.activity-stream-icon.act-orange {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.activity-stream-body {
    min-width: 0;
}

.activity-stream-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.125rem;
    line-height: 1.3;
}

.activity-stream-title a {
    color: inherit;
    text-decoration: none;
}

.activity-stream-title a:hover {
    color: var(--primary);
}

.activity-stream-detail {
    font-size: 0.6875rem;
    color: var(--gray-600);
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.activity-stream-time {
    font-size: 0.625rem;
    color: var(--gray-600);
    font-weight: 500;
    white-space: nowrap;
    padding-top: 0.125rem;
    flex-shrink: 0;
}

@media (max-width: 1199.98px) {
    .activity-card {
        min-height: 320px;
        max-height: none;
    }
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 500;
    border-radius: 10px;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary,
.btn-outline-secondary {
    background: var(--secondary);
    border-color: var(--secondary);
    color: var(--white);
    font-weight: 500;
    border-radius: 10px;
}

.btn-soft,
.btn-soft-danger {
    border: none;
    font-weight: 500;
    border-radius: 8px;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    transition: var(--transition);
    line-height: 1.5;
}

.btn-soft {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-soft:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-soft-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-soft-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.8125rem;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Forms */
.form-control,
.form-select {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    border-radius: 10px;
    border-color: var(--gray-200);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-floating > .form-control,
.form-floating > .form-select {
    border-radius: 10px;
}

.form-floating > label {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    color: var(--gray-500);
}

/* ============================================================
   STAT CARDS (legacy pages)
   ============================================================ */
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card-secondary .stat-icon { background: rgba(0, 24, 44, 0.08); color: var(--secondary); }
.stat-card-warning .stat-icon { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.stat-card-success .stat-icon { background: rgba(16, 185, 129, 0.12); color: var(--success); }

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
    line-height: 1.2;
}

.stat-trend {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-trend.positive { color: var(--success); }
.stat-trend.warning { color: var(--warning); }

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dashboard-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-card .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.125rem;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin: 0;
}

.revenue-summary {
    display: flex;
    gap: 1.5rem;
}

.revenue-stat span {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.revenue-stat strong {
    font-size: 1rem;
    color: var(--secondary);
}

.dashboard-card .card-body {
    padding: 1.5rem;
}

#revenueChart { min-height: 280px; }

/* Interactive cash-flow explorer */
.dash-explorer-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.chart-view-toggle {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    border: none;
}

.btn-chart-view {
    background: transparent;
    border: none;
    color: var(--gray-600);
    width: 32px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-chart-view:hover {
    color: var(--secondary);
}

.btn-chart-view.active {
    background: var(--white);
    color: var(--secondary);
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.08);
}

.dash-explorer-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.625rem;
    padding: 0 1.5rem 1.35rem;
}

.dash-explorer-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem 0.75rem 0.55rem;
    min-width: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dash-explorer-stats.is-updating .dash-explorer-stat {
    animation: dashStatPulse 0.45s ease;
}

.dash-explorer-stats.is-pinned .dash-explorer-stat[data-stat="period"] {
    border-color: rgba(58, 175, 169, 0.45);
    box-shadow: 0 0 0 1px rgba(58, 175, 169, 0.18);
}

.dash-explorer-stat-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.dash-explorer-stat-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-explorer-stat--collected .dash-explorer-stat-value {
    color: var(--primary-dark, #0d9488);
}

.dash-explorer-stat-hint,
.dash-explorer-stat-delta {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--gray-600);
    min-height: 1rem;
}

.dash-explorer-stat-delta.is-up { color: #16a34a; }
.dash-explorer-stat-delta.is-down { color: #2563eb; }
.dash-explorer-stat-delta.is-flat { color: #ca8a04; }

.dash-explorer-rate-track {
    display: block;
    height: 4px;
    margin-top: 0.45rem;
    border-radius: 99px;
    background: #e2e8f0;
    overflow: hidden;
}

.dash-explorer-rate-fill {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: var(--primary);
    transition: width 0.35s ease;
}

.chart-canvas-wrap-explorer {
    height: 248px;
}

.dash-explorer-card .dash-chart-body {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.dash-explorer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.5rem 1.25rem;
}

#revenueChart:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
    outline-offset: 4px;
    border-radius: 8px;
}

.dash-explorer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-legend-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chart-legend-toggle:hover {
    border-color: rgba(58, 175, 169, 0.4);
}

.chart-legend-toggle.is-off {
    opacity: 0.42;
}

.dash-explorer-hint {
    font-size: 0.6875rem;
    color: var(--gray-600);
}

.dash-invoice-body {
    display: flex;
    flex-direction: column;
    padding: 0.25rem 1.25rem 1.15rem;
    flex: 1;
}

.dash-donut-wrap {
    position: relative;
    width: 188px;
    height: 188px;
    margin: 0 auto 0.75rem;
}

.dash-donut-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.dash-donut-center {
    position: absolute;
    inset: 22%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.dash-donut-kicker {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.dash-donut-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.dash-donut-sub {
    font-size: 0.6875rem;
    color: var(--gray-600);
    max-width: 9rem;
    line-height: 1.3;
}

.dash-donut-legend {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dash-donut-legend-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: #f8fafc;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.dash-donut-legend-item:hover,
.dash-donut-legend-item.is-active {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 24, 44, 0.06);
    transform: translateY(-1px);
}

.dash-donut-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
}

.dash-donut-legend-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
}

.dash-donut-legend-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

.dash-donut-legend-amount {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dash-invoice-foot {
    margin-top: auto;
    padding-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-invoice-foot a {
    color: var(--gray-600);
    text-decoration: none;
}

.dash-invoice-foot a:hover {
    color: var(--primary-dark, #0d9488);
}

@keyframes dashStatPulse {
    0% { transform: translateY(0); }
    40% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .dash-explorer-stats.is-updating .dash-explorer-stat,
    .dash-explorer-rate-fill,
    .dash-donut-legend-item {
        animation: none;
        transition: none;
    }
}

/* Dashboard responsive */
@media (max-width: 991.98px) {
    .dash-chart-header {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-legend {
        width: 100%;
    }

    .chart-period-toggle {
        align-self: flex-start;
    }

    .dash-chart-body-lg {
        min-height: 280px;
    }

    .chart-canvas-wrap {
        height: 240px;
    }

    .dash-explorer-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 1199.98px) {
    .dashboard-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-panels-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .dashboard-kpi-row .kpi-card {
        min-height: 120px;
    }

    .stat-card-value {
        font-size: 1rem;
    }

    .dash-chart-header {
        padding: 1rem 1rem 0.625rem;
        gap: 0.75rem;
    }

    .dash-chart-body,
    .dash-chart-body-lg {
        padding: 0.375rem 0.75rem 1rem;
        min-height: 200px;
    }

    .chart-canvas-wrap {
        height: 220px;
    }

    .chart-canvas-wrap-sm {
        height: 200px;
    }

    .dash-explorer-footer {
        padding: 0.75rem 1rem 1rem;
    }

    .chart-canvas-wrap-explorer {
        height: 220px;
    }

    .dash-donut-wrap {
        width: 168px;
        height: 168px;
    }

    .schedule-item {
        flex-wrap: wrap;
        gap: 0.625rem;
    }

    .schedule-item .status-badge {
        margin-left: auto;
    }

    .activity-stream-item {
        grid-template-columns: 32px 1fr;
        grid-template-rows: auto auto;
    }

    .activity-stream-time {
        grid-column: 2;
        padding-top: 0;
    }
}

@media (max-width: 575.98px) {
    .dashboard-kpi-row {
        grid-template-columns: 1fr;
    }

    .chart-legend {
        gap: 0.75rem;
    }

    .chart-period-toggle {
        width: 100%;
        display: flex;
    }

    .chart-period-toggle .btn-period {
        flex: 1;
        text-align: center;
    }

    .dash-explorer-controls {
        width: 100%;
    }

    .chart-view-toggle {
        flex-shrink: 0;
    }

    .dash-explorer-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .dash-explorer-stat-value {
        font-size: 0.875rem;
    }

    .dash-donut-legend-item {
        grid-template-columns: 10px minmax(0, 1fr) auto;
        gap: 0.4rem;
    }

    .dash-donut-legend-amount {
        grid-column: 2;
        justify-self: start;
    }
}

/* Appointments */
.appointment-list { padding: 0.5rem 0; }

.appointment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.appointment-item:last-child { border-bottom: none; }
.appointment-item:hover { background: var(--gray-50); }

.appointment-date {
    width: 48px;
    text-align: center;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    flex-shrink: 0;
}

.appointment-date .day {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.appointment-date .month {
    display: block;
    font-size: 0.7rem;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-weight: 600;
}

.appointment-details { flex: 1; min-width: 0; }
.appointment-details h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.125rem;
}

.appointment-details p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
}

/* Tables */
.dashboard-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    font-weight: 600;
    border-bottom: 1px solid var(--gray-100);
    padding: 0.875rem 1.25rem;
    background: var(--gray-50);
}

.dashboard-table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.dashboard-table tbody tr:hover { background: var(--gray-50); }

.case-cell strong {
    display: block;
    color: var(--secondary);
    font-size: 0.85rem;
}

.case-cell small {
    color: var(--gray-600);
    font-size: 0.75rem;
}

.client-address-cell {
    min-width: 11rem;
    max-width: 18rem;
    vertical-align: top;
}

.client-address-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.4;
}

.client-address-line {
    display: block;
    color: var(--gray-600);
    font-size: 0.75rem;
    word-break: break-word;
}

.client-address-line-primary {
    color: var(--secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.saas-table .col-location {
    min-width: 11rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-pending { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.badge-progress { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.badge-waiting { background: rgba(168, 85, 247, 0.12); color: #7c3aed; }
.badge-completed { background: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-closed { background: rgba(100, 116, 139, 0.12); color: #475569; }
.badge-paid { background: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-partial { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.badge-overdue { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.badge-scheduled { background: rgba(58, 175, 169, 0.12); color: var(--primary-dark); }
.badge-requested { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
.badge-confirmed { background: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-rescheduled { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
.badge-default { background: var(--gray-100); color: var(--gray-600); }

/* Notifications List */
.notification-list { padding: 0.5rem 0; }

.notification-list-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.notification-list-item:hover { background: var(--gray-50); }
.notification-list-item.unread {
    background: rgba(58, 175, 169, 0.06);
}
.notification-list-item.unread:hover {
    background: rgba(58, 175, 169, 0.1);
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.notif-icon.type-payment { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.notif-icon.type-invoice { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.notif-icon.type-appointment { background: rgba(58, 175, 169, 0.12); color: var(--primary); }
.notif-icon.type-case { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.notif-icon.type-account { background: rgba(168, 85, 247, 0.12); color: #7c3aed; }
.notif-icon.type-system { background: var(--gray-100); color: var(--gray-500); }

.notif-body strong {
    display: block;
    font-size: 0.825rem;
    color: var(--secondary);
}

.notif-body p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0.125rem 0;
}

.notif-body small { font-size: 0.7rem; color: var(--gray-600); font-weight: 500; }

/* Activity Timeline */
.activity-timeline { position: relative; padding-left: 1.25rem; }

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--gray-200);
}

.activity-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.activity-item:last-child { padding-bottom: 0; }

.activity-dot {
    position: absolute;
    left: -1.25rem;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.activity-content p {
    font-size: 0.85rem;
    margin-bottom: 0.125rem;
    color: var(--gray-600);
}

.activity-content small { font-size: 0.75rem; color: var(--gray-600); font-weight: 500; }

.empty-state {
    text-align: center;
    color: var(--gray-600);
}

.empty-state i { font-size: 2rem; margin-bottom: 0.5rem; display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
        padding-inline: 0;
        box-sizing: border-box;
    }

    .topbar-search {
        display: none !important;
    }

    .auth-visual {
        display: none;
    }

    .auth-form-panel {
        max-width: 100%;
    }
}

@media (max-width: 767.98px) {
    .page-content { padding: 1rem; }

    .metric-value { font-size: 1.125rem; }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-search { max-width: none; }

    .topbar-page-subtitle {
        max-width: min(36vw, 320px);
    }

    .topbar-page-title {
        max-width: min(36vw, 320px);
    }
}

@media (max-width: 575.98px) {
    .topbar { padding: 0 1rem; }
    .dashboard-card .card-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

/* ============================================================
   MODULE CARDS (Dashboard Quick Access)
   ============================================================ */
.module-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--gray-700);
    transition: var(--transition);
    height: 100%;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--secondary);
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.module-icon-primary { background: var(--primary-light); color: var(--primary); }
.module-icon-secondary { background: rgba(0, 24, 44, 0.08); color: var(--secondary); }
.module-icon-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.module-icon-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.module-icon-ai { background: linear-gradient(135deg, var(--primary-light), rgba(0, 24, 44, 0.08)); color: var(--primary); }

.module-info {
    flex: 1;
    min-width: 0;
}

.module-info strong {
    display: block;
    font-size: 0.925rem;
    color: var(--secondary);
}

.module-info span {
    font-size: 0.78rem;
    color: var(--gray-600);
}

.module-arrow {
    color: var(--gray-300);
    font-size: 1rem;
}

.module-card:hover .module-arrow { color: var(--primary); }

.module-card-ai {
    border: 1px solid rgba(58, 175, 169, 0.25);
}
/* ── AI Assistant ── */
body.page-assistant {
    height: 100vh;
    overflow: hidden;
}

body.page-assistant .main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
}

body.page-assistant .page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

body.page-assistant .assistant-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.assistant-card,
.assistant-prompts-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: none;
    min-width: 0;
    overflow: hidden;
}

.assistant-card .saas-card-header,
.assistant-prompts-card .saas-card-header {
    flex-shrink: 0;
}

.assistant-card .saas-card-body,
.assistant-prompts-card .saas-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.assistant-bot-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-top: 0.1rem;
}

.assistant-message.assistant-welcome {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
    max-width: min(88%, 44rem);
}

.assistant-welcome .assistant-bubble {
    flex: 1;
    min-width: 0;
    max-width: none;
}

.assistant-welcome__title,
.assistant-welcome__text {
    text-align: justify;
    text-justify: inter-word;
    line-height: 1.6;
    color: var(--secondary);
}

.assistant-welcome__title {
    margin-bottom: 0;
}

.assistant-welcome__text {
    margin-bottom: 0;
}

.assistant-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
}

.assistant-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.assistant-message-user { align-items: flex-end; width: 100%; }
.assistant-message-bot { align-items: flex-start; }

.assistant-message__content {
    display: flex;
    flex-direction: column;
    max-width: min(80%, 42rem);
}

.assistant-message-user .assistant-message__content {
    display: block;
    width: auto;
    max-width: min(80%, 42rem);
    margin-left: auto;
    text-align: right;
}

.assistant-message-bot .assistant-message__content {
    align-items: flex-start;
}

.assistant-message__actions {
    display: flex;
    gap: 0.15rem;
    margin-top: 0;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.assistant-message:hover .assistant-message__actions,
.assistant-message:focus-within .assistant-message__actions {
    opacity: 1;
    visibility: visible;
    margin-top: 0.2rem;
    max-height: 2rem;
    pointer-events: auto;
}

.assistant-message-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--gray-500);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.assistant-message-action:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.assistant-message-action .bi-check2 {
    color: var(--success, #198754);
}

@media (hover: none) {
    .assistant-message__actions {
        opacity: 1;
        visibility: visible;
        margin-top: 0.2rem;
        max-height: 2rem;
        pointer-events: auto;
    }
}

.assistant-bubble {
    max-width: min(80%, 42rem);
    padding: 0.75rem 1rem;
    border-radius: 14px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: normal;
}

.assistant-message-user .assistant-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
    display: inline-block;
    width: auto;
    max-width: 100%;
    text-align: left;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: break-word;
}

.assistant-message-user .assistant-message__actions {
    justify-content: flex-end;
}

.assistant-message-bot .assistant-bubble {
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--secondary);
    border-bottom-left-radius: 4px;
}

.assistant-bubble--form {
    max-width: min(100%, 34rem);
    padding: 0.9rem 1rem 1rem;
}

.assistant-schedule-form__title {
    margin: 0;
    font-weight: 650;
}

.assistant-schedule-form__hint,
.assistant-schedule-form__field span {
    color: var(--gray-500);
    font-size: 0.78rem;
}

.assistant-schedule-form__hint {
    margin: 0.15rem 0 0.75rem;
}

.assistant-schedule-form__error {
    margin-bottom: 0.75rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    font-size: 0.82rem;
}

.assistant-schedule-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 0.75rem;
}

.assistant-schedule-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.assistant-schedule-form__full {
    grid-column: 1 / -1;
}

.assistant-schedule-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

@media (max-width: 640px) {
    .assistant-schedule-form__grid {
        grid-template-columns: 1fr;
    }
}

.assistant-message-thinking .assistant-message__content {
    max-width: none;
    width: auto;
}

.assistant-bubble-thinking {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: auto;
    max-width: none;
    flex-shrink: 0;
    word-break: normal;
    overflow-wrap: normal;
    white-space: nowrap;
}

.assistant-thinking__label {
    display: inline-block;
    white-space: nowrap;
}

.assistant-thinking__dots {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.assistant-thinking__dots i {
    display: block;
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: assistant-thinking-dot 1.2s ease-in-out infinite;
}

.assistant-thinking__dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.assistant-thinking__dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes assistant-thinking-dot {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.assistant-input-area {
    flex-shrink: 0;
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.25rem 1.25rem;
    background: var(--white);
    width: 100%;
    min-width: 0;
}

.assistant-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    width: 100%;
    --assistant-input-height: 48px;
}

.assistant-form__row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    width: 100%;
    min-width: 0;
}

.assistant-form .form-control {
    flex: 1;
    min-width: 0;
    width: 100%;
    resize: none;
    min-height: var(--assistant-input-height);
    max-height: 8rem;
    height: var(--assistant-input-height);
    padding: 0.7rem 0.9rem;
    line-height: 1.35;
    overflow-y: auto;
}

.assistant-attach-btn,
.assistant-form__row .assistant-attach-btn,
.assistant-form #assistantSendBtn {
    width: var(--assistant-input-height);
    height: var(--assistant-input-height);
    min-width: var(--assistant-input-height);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
}

.assistant-attach-preview {
    width: 100%;
    min-width: 0;
}

.assistant-attach-preview__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.assistant-attach-preview__card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    min-width: 0;
}

.assistant-attach-preview__card--reading {
    opacity: 0.8;
}

.assistant-attach-preview__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.assistant-attach-preview__icon--pdf {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.assistant-attach-preview__icon--image {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.assistant-attach-preview__icon--html {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.assistant-attach-preview__icon--text,
.assistant-attach-preview__icon--file {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.assistant-attach-preview__meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1;
}

.assistant-attach-preview__name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assistant-attach-preview__type {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.assistant-attach-preview__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin-left: 0.15rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.assistant-attach-preview__remove:hover {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
}

.assistant-form--has-attachment .assistant-form__row {
    margin-top: 0.15rem;
}

.assistant-input-hint {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.assistant-attach-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.assistant-attach-bar .assistant-input-hint {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assistant-attach-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.assistant-attach-clear:hover {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
}

.assistant-status-badge {
    font-weight: 600;
}

.assistant-status-badge--online {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.assistant-status-badge--offline {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.assistant-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.assistant-layout.assistant-layout--library-open {
    grid-template-columns: 260px minmax(0, 1fr) 300px;
    grid-template-rows: minmax(0, 1fr);
}

/* Library sidebar */
.assistant-library-sidebar {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
}

.assistant-layout.assistant-layout--library-open .assistant-library-sidebar {
    display: flex;
}

.assistant-library-sidebar[hidden] {
    display: none !important;
}

.assistant-layout.assistant-layout--library-open .assistant-library-sidebar[hidden] {
    display: none !important;
}

.assistant-library-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.assistant-library-close {
    border: 0;
    background: transparent;
    color: var(--gray-500);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.assistant-library-close:hover {
    background: var(--gray-100);
    color: var(--secondary);
}

.assistant-library-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.assistant-chat-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.assistant-chat-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.assistant-library-toggle.is-active {
    background: rgba(58, 175, 169, 0.12);
    color: var(--primary);
    border-color: rgba(58, 175, 169, 0.25);
}

/* Chat header actions */

.assistant-library-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.assistant-library-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex-shrink: 0;
    padding: 0.65rem 0.75rem 0.85rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.assistant-library-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.assistant-library-page-btn:hover:not(:disabled) {
    border-color: rgba(58, 175, 169, 0.45);
    color: var(--primary);
    background: rgba(58, 175, 169, 0.06);
}

.assistant-library-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.assistant-library-page-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 3.5rem;
    text-align: center;
}

.assistant-library-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.35);
    border: 0;
    padding: 0;
    cursor: pointer;
}

.assistant-library-empty {
    line-height: 1.5;
}

.assistant-library-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

.assistant-library-item:hover {
    background: var(--gray-50);
}

.assistant-library-item.is-active {
    background: rgba(58, 175, 169, 0.08);
    border-left: 3px solid var(--primary);
}

.assistant-library-item__main {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.75rem 0.5rem 0.75rem 0.85rem;
    cursor: pointer;
    display: grid;
    gap: 0.2rem;
}

.assistant-library-item.is-active .assistant-library-item__main {
    padding-left: calc(0.85rem - 3px);
}

.assistant-library-item__title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assistant-library-item__preview {
    font-size: 0.78rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assistant-library-item__time {
    font-size: 0.72rem;
    color: var(--gray-400);
}

.assistant-library-item__actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    padding-right: 0.35rem;
}

.assistant-library-action {
    border: 0;
    background: transparent;
    color: var(--gray-500);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.assistant-library-action:hover {
    background: var(--gray-100);
    color: var(--secondary);
}

.assistant-library-action--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* Quick prompts */
.assistant-prompts-card .saas-card-body {
    overflow: hidden;
}

.assistant-prompts-subtitle {
    color: var(--gray-500);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.assistant-prompt-grid {
    display: grid;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
}

.assistant-prompt-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    padding: 0.75rem 0 0.15rem;
    margin-top: 0;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.assistant-prompt-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.assistant-prompt-page-btn:hover:not(:disabled) {
    border-color: rgba(58, 175, 169, 0.45);
    color: var(--primary);
    background: rgba(58, 175, 169, 0.06);
}

.assistant-prompt-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.assistant-prompt-page-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 3.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.assistant-prompt-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    padding: 0.65rem 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.assistant-prompt-btn:hover {
    border-color: rgba(58, 175, 169, 0.45);
    box-shadow: 0 4px 14px rgba(58, 175, 169, 0.12);
    transform: translateY(-1px);
}

.assistant-prompt-btn:active {
    transform: translateY(0);
}

.assistant-prompt-btn__icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(58, 175, 169, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.assistant-prompt-btn__text {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--secondary);
    line-height: 1.3;
}

.assistant-prompt-btn__arrow {
    color: var(--gray-400);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}

.assistant-prompt-btn:hover .assistant-prompt-btn__arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.assistant-attach-btn {
    flex: 0 0 auto;
}

.assistant-form #assistantSendBtn i {
    font-size: 1rem;
    line-height: 1;
}

.assistant-bubble-rich a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.assistant-message__content--wide {
    max-width: min(100%, 52rem);
    width: 100%;
}

.assistant-bubble--table {
    width: 100%;
    max-width: 100%;
}

.assistant-bubble--table > strong {
    display: inline-block;
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.assistant-table-wrap {
    margin: 0.65rem 0 0.7rem;
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: transparent;
}

.assistant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.assistant-table th,
.assistant-table td {
    padding: 0.5rem 0.7rem;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.assistant-table .is-client {
    white-space: normal;
    min-width: 6.5rem;
}

.assistant-table th {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-600);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.assistant-table td {
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.assistant-table tbody tr:last-child td {
    border-bottom: 0;
}

.assistant-table tbody tr:hover td {
    background: var(--primary-light);
}

.assistant-table .is-right {
    text-align: right;
}

.assistant-table .is-center {
    text-align: center;
}

.assistant-table .is-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.assistant-table td.is-id {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.assistant-table .status-badge {
    padding: 0.15rem 0.5rem;
    font-size: 0.68rem;
}

.assistant-table__empty {
    color: var(--gray-400);
}

.assistant-doc-card {
    margin-top: 0.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: var(--gray-50, #f8f9fa);
    overflow: hidden;
}

.assistant-doc-card__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
}

.assistant-doc-card__title {
    font-weight: 700;
    color: var(--secondary);
}

.assistant-doc-card__badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-600);
    background: var(--gray-100);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.assistant-doc-card__section {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--gray-200);
}

.assistant-doc-card__section:first-of-type {
    border-top: 0;
}

.assistant-doc-card__section-title {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
}

.assistant-doc-summary {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--secondary);
}

.assistant-doc-summary li + li {
    margin-top: 0.25rem;
}

.assistant-doc-card__fields {
    margin: 0;
}

.assistant-doc-row {
    display: grid;
    grid-template-columns: minmax(7rem, 9rem) 1fr;
    gap: 0.65rem 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.assistant-doc-row:last-child {
    border-bottom: 0;
}

.assistant-doc-row dt {
    margin: 0;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.assistant-doc-row dd {
    margin: 0;
    color: var(--secondary);
    line-height: 1.45;
}

.assistant-doc-line-items {
    margin: 0;
    padding-left: 1.1rem;
}

.assistant-doc-line-items li + li {
    margin-top: 0.35rem;
}

.assistant-draft-card {
    margin-top: 0.75rem;
    border: 1px solid rgba(58, 175, 169, 0.35);
    border-radius: 12px;
    background: var(--white);
    padding: 1rem;
    max-width: min(100%, 34rem);
}

.assistant-draft-card--confirmed {
    opacity: 0.7;
    border-style: dashed;
}

.assistant-draft-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.assistant-draft-card__badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
}

.assistant-draft-card__action {
    font-size: 0.85rem;
    color: var(--gray-600);
    text-transform: capitalize;
}

.assistant-draft-card__fields {
    margin: 0 0 0.75rem;
}

.assistant-draft-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.assistant-draft-row:last-child {
    border-bottom: 0;
}

.assistant-draft-row dt {
    margin: 0;
    font-weight: 600;
    color: var(--gray-600);
}

.assistant-draft-row dd {
    margin: 0;
}

.assistant-draft-row--editable dd {
    min-width: 0;
}

.assistant-draft-input {
    width: 100%;
}

.assistant-draft-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.assistant-alerts {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.5rem;
    max-width: min(100%, 34rem);
}

.assistant-alert {
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.92rem;
    display: grid;
    gap: 0.25rem;
}

.assistant-alert--critical {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.assistant-alert--warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #92400e;
}

@media (max-width: 1199.98px) {
    .assistant-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .assistant-layout.assistant-layout--library-open {
        grid-template-columns: 220px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }

    .assistant-prompts-card {
        grid-column: 1 / -1;
        position: static;
        height: auto;
        max-height: min(360px, 42vh);
    }

    .assistant-prompt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .assistant-layout {
        grid-template-columns: 1fr;
    }

    .assistant-layout.assistant-layout--library-open {
        grid-template-columns: 1fr;
    }

    .assistant-library-sidebar {
        position: fixed;
        top: 4.5rem;
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
        max-width: 22rem;
        margin: 0 auto;
        z-index: 1050;
        height: min(520px, calc(100vh - 6rem));
        box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    }

    .assistant-library-backdrop:not([hidden]) {
        display: block;
    }

    .assistant-layout--library-open .assistant-library-backdrop {
        display: block;
    }

    .assistant-chat-header__actions {
        width: 100%;
        margin-left: 0;
    }

    .assistant-prompt-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Appointments calendar ── */
.appointment-calendar-header,
.appointment-list-header {
    background: var(--primary);
    border-bottom: none;
}

.appointment-calendar-header .saas-card-title,
.appointment-calendar-header .saas-card-subtitle,
.appointment-list-header .saas-card-title,
.appointment-list-header .saas-card-subtitle {
    color: #fff;
}

.appt-readonly-field {
    background-color: var(--gray-50);
    border-color: var(--gray-200);
    color: var(--secondary);
    cursor: default;
}

.appt-readonly-field:focus {
    box-shadow: none;
    border-color: var(--gray-200);
}

.appointment-list-table thead th {
    background: var(--primary);
    color: #fff;
    border-bottom: none;
}

.appointment-list-table .appointment-cell-calendar,
.appointment-list-table .appointment-cell-actions {
    white-space: nowrap;
    width: 1%;
    vertical-align: middle;
}

.appointment-list-table .appointment-inline-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
}

.appointment-list-table .appointment-inline-actions form {
    display: inline-flex;
    margin: 0;
}

.appointment-list-table .appointment-inline-actions .btn {
    flex-shrink: 0;
}

.table-row-requested {
    background: rgba(99, 102, 241, 0.04);
}

.appointment-calendar-wrap {
    padding: 1rem 1.25rem 1.25rem;
}

#appointmentCalendar {
    min-height: 620px;
}

.appt-conflict-alert {
    background: var(--primary-light);
    color: var(--secondary);
    border-left: 3px solid var(--primary);
}

.appt-conflict-alert .bi-exclamation-triangle-fill {
    color: var(--primary);
}

.appt-conflict-alert strong {
    color: var(--primary-dark);
}

.appt-conflict-alert ul {
    color: var(--secondary);
}

.appointment-calendar-wrap .fc {
    font-family: var(--font-family, 'Montserrat', sans-serif);
    font-size: 0.8125rem;
}

.appointment-calendar-wrap .fc-toolbar-title {
    font-size: 1.125rem !important;
    font-weight: 600;
    color: var(--secondary);
}

.appointment-calendar-wrap .fc-button {
    background: var(--white) !important;
    border: 1px solid var(--gray-200) !important;
    color: var(--secondary) !important;
    font-weight: 600;
    text-transform: capitalize;
    box-shadow: none !important;
    padding: 0.35rem 0.75rem !important;
}

.appointment-calendar-wrap .fc-button:hover,
.appointment-calendar-wrap .fc-button:focus {
    background: var(--gray-50) !important;
    border-color: var(--gray-300) !important;
    color: var(--secondary) !important;
}

.appointment-calendar-wrap .fc-button-primary:not(:disabled).fc-button-active,
.appointment-calendar-wrap .fc-button-primary:not(:disabled):active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;
}

.appointment-calendar-wrap .fc-col-header-cell-cushion,
.appointment-calendar-wrap .fc-daygrid-day-number {
    color: var(--text-label);
    font-weight: 600;
}

.appointment-calendar-wrap .fc {
    --fc-today-bg-color: var(--primary-light);
}

.appointment-calendar-wrap .fc .fc-day-today {
    background: var(--primary-light) !important;
}

.appointment-calendar-wrap .fc-daygrid-day.fc-day-today {
    background: var(--primary-light);
}

.appointment-calendar-wrap .fc-event {
    border: none;
    border-radius: 6px;
    padding: 2px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.appointment-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.appointment-calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.appointment-calendar-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.appointment-calendar-wrap .fc-event.fc-event-past {
    opacity: 0.92;
}

.appointment-calendar-wrap .fc-event.fc-appt-linked {
    position: relative;
}

.appointment-calendar-wrap .fc-event.fc-appt-segment-past {
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}

.appointment-calendar-wrap .fc-event.fc-appt-segment-active {
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
    box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.75);
}

.appointment-calendar-wrap .fc-event .fc-appt-split-past .fc-event-time,
.appointment-calendar-wrap .fc-event .fc-appt-split-active .fc-event-title {
    font-weight: 600;
}

.appointment-calendar-wrap .fc-event.fc-appt-segment-active .fc-event-time {
    display: none !important;
}

.appointment-calendar-wrap .fc-event .fc-appt-continuation-bar {
    min-height: 0.85rem;
}

.appointment-calendar-wrap .fc-daygrid-event[data-appt-split="true"] {
    margin-bottom: 1px;
}

.sidebar-logo,
.brand-logo-mark--image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-position: center;
}

.brand-icon:has(.brand-logo-mark--image) {
    padding: 0;
    overflow: hidden;
}

.brand-icon:has(.brand-logo-mark--image):not(:has(.brand-logo-mark--sidebar)) {
    background: rgba(255, 255, 255, 0.96);
}

.brand-icon:has(.brand-logo-mark--sidebar.brand-logo-mark--image) {
    background: rgba(255, 255, 255, 0.96);
}

.brand-logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo-mark--sidebar {
    width: 100%;
    height: 100%;
}

.brand-logo-mark--sidebar.brand-logo-mark--image {
    object-fit: cover;
    object-position: center;
}

.brand-logo-mark--sidebar.brand-logo-mark--placeholder {
    color: var(--white);
    font-size: 1.1rem;
}

.brand-logo-mark--auth {
    width: 100%;
    height: 100%;
}

.brand-logo-mark--auth.brand-logo-mark--image {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
}

.brand-logo-mark--auth.brand-logo-mark--placeholder {
    font-size: 1.75rem;
    color: var(--white);
}

.auth-brand .auth-logo {
    width: 64px;
    height: 64px;
    min-width: 64px;
    max-width: 64px;
    padding: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.auth-brand .auth-logo:has(.brand-logo-mark--image) {
    background: rgba(255, 255, 255, 0.96);
}

.auth-logo-sm {
    width: 56px;
    height: 56px;
    min-width: 56px;
    max-width: 56px;
    padding: 0;
    overflow: hidden;
}

.brand-logo-mark--auth-sm.brand-logo-mark--image {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
}

.brand-logo-mark--auth-sm.brand-logo-mark--placeholder {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 14px;
    font-size: 1.35rem;
}

.brand-logo-mark--topbar.brand-logo-mark--image {
    width: auto;
    height: 32px;
    max-width: 120px;
    object-fit: contain;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.topbar-brand-logo-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.topbar-title-text {
    min-width: 0;
    min-height: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-logo-mark--settings.brand-logo-mark--image {
    max-height: 56px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-logo-mark--settings.brand-logo-mark--placeholder {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 1.25rem;
}

.settings-logo-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px dashed var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
}

.settings-logo-preview-img {
    max-height: 56px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.settings-logo-preview--empty {
    flex-wrap: wrap;
}

.logo-branding-panel {
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    background: var(--white);
}

.logo-branding-panel .logo-upload-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.logo-branding-panel .logo-upload-toolbar .form-control {
    flex: 1 1 200px;
    max-width: none;
    margin: 0;
}

.logo-placement-preview {
    padding: 1.25rem 1.25rem 1rem;
}

.logo-placement-preview-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0 0 1rem;
}

.logo-placement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.logo-placement-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.logo-placement-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    margin: 0 0 0.75rem;
}

.logo-placement-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.625rem;
}

.logo-placement-stage--sidebar {
    background: #00182c;
}

.logo-placement-stage--auth {
    background: linear-gradient(145deg, var(--secondary) 0%, #00182c 100%);
}

.logo-placement-mock-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
}

.logo-placement-mock-copy {
    min-width: 0;
    text-align: left;
}

.logo-placement-mock-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--white);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-placement-mock-tag {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.1rem;
}

.logo-placement-meta {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.logo-placement-footnote {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.favicon-preview-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
}

.favicon-preview-empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.favicon-tab-mock {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem 0.35rem 0.4rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px 8px 0 0;
    max-width: 220px;
}

.favicon-tab-mock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 2px;
}

.favicon-tab-mock-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favicon-tab-mock-title {
    font-size: 0.6875rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favicon-preview-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    padding: 2px;
}

.logo-frame-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.logo-frame-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.logo-frame-preview--sidebar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.logo-frame-preview--auth {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
}

.logo-frame-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--gray-400);
    font-size: 1.25rem;
}

.logo-crop-previews-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.65rem;
}

.logo-crop-preview-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.logo-crop-live-stage {
    min-height: auto;
    padding: 0.65rem 0.75rem;
}

.logo-crop-live-stage.logo-placement-stage--auth {
    justify-content: center;
}

.logo-crop-workspace {
    display: grid;
    grid-template-columns: 1fr minmax(160px, 220px);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 575.98px) {
    .logo-placement-grid {
        grid-template-columns: 1fr;
    }
}

.logo-crop-stage {
    min-height: 320px;
    max-height: 420px;
    background: var(--gray-100);
    border-radius: 10px;
    overflow: hidden;
}

.logo-crop-stage .cropper-container {
    max-height: 420px;
}

.logo-crop-image {
    display: block;
    max-width: 100%;
}

.logo-crop-aspect-btns .btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

@media (max-width: 767.98px) {
    .logo-crop-workspace {
        grid-template-columns: 1fr;
    }
}

.settings-branding-form {
    --settings-section-label-size: 0.8125rem;
}

.settings-form-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.settings-form-section__header {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
}

.settings-form-section__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.settings-form-section__desc {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
    line-height: 1.45;
}

.settings-form-section__body {
    padding: 1.25rem;
}

.settings-form-section__body .form-label {
    font-size: var(--settings-section-label-size);
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    letter-spacing: 0;
}

.settings-tabs .nav-link {
    font-weight: 600;
    color: var(--text-muted);
}

.settings-tabs .nav-link.active {
    color: var(--primary);
}

.smtp-provider-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--gray-100, #f1f5f9);
    border-radius: 10px;
}

.smtp-provider-switch__option {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.smtp-provider-switch__option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.smtp-provider-switch__option span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2rem;
    padding: 0.35rem 0.9rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    line-height: 1.2;
}

.smtp-provider-switch__option input:checked + span {
    background: var(--white);
    color: var(--secondary);
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.08);
}

.smtp-provider-switch__option input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.smtp-lock-field[readonly] {
    background: var(--gray-50);
    color: var(--gray-600);
    cursor: default;
}

/* Role access page */
body.page-settings-roles .saas-card,
body.page-settings-roles .settings-roles-card,
body.page-settings-roles .card-body,
body.page-settings-roles .settings-roles-form,
body.page-settings-roles .settings-roles-table-wrap {
    overflow: visible !important;
}

.settings-roles-add-panel {
    margin: 1.25rem 1.25rem 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 55%);
    border: 1px solid rgba(58, 175, 169, 0.25);
    border-radius: 14px;
}

.settings-roles-add-panel__intro {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.settings-roles-add-panel__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(58, 175, 169, 0.35);
}

.settings-roles-add-panel__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0 0 0.35rem;
}

.settings-roles-add-panel__desc {
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: 1.5;
    max-width: 52rem;
}

.settings-roles-form {
    padding: 1.25rem;
}

.settings-roles-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.settings-roles-toolbar__copy,
.settings-roles-toolbar__hint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: 10px;
    border: 1px solid var(--gray-200);
}

.settings-roles-toolbar__copy i,
.settings-roles-toolbar__hint i {
    color: var(--primary);
    font-size: 1rem;
}

.settings-roles-matrix-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 24, 44, 0.04);
    overflow: hidden;
}

.settings-roles-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-roles-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.settings-roles-matrix__corner {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 12.5rem;
    padding: 1rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-600);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    vertical-align: bottom;
}

.settings-roles-matrix__role-head {
    min-width: 8.5rem;
    width: 8.5rem;
    padding: 1rem 0.65rem 0.85rem;
    text-align: center;
    vertical-align: top;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    border-left: 1px solid var(--gray-100);
}

.settings-roles-role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 7.75rem;
    margin: 0 auto;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0, 24, 44, 0.05);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-roles-role-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 14px rgba(0, 24, 44, 0.08);
}

.settings-roles-role-card__accent {
    height: 4px;
    flex-shrink: 0;
    background: var(--gray-300);
}

.settings-roles-matrix__role-head[data-role="admin"] .settings-roles-role-card__accent {
    background: linear-gradient(90deg, var(--secondary) 0%, #2d4a6a 100%);
}

.settings-roles-matrix__role-head[data-role="manager"] .settings-roles-role-card__accent {
    background: linear-gradient(90deg, #2b6cb0 0%, #4299e1 100%);
}

.settings-roles-matrix__role-head[data-role="staff"] .settings-roles-role-card__accent {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-bright) 100%);
}

.settings-roles-matrix__role-head[data-role="viewer"] .settings-roles-role-card__accent {
    background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%);
}

.settings-roles-matrix__role-head:not([data-role="admin"]):not([data-role="manager"]):not([data-role="staff"]):not([data-role="viewer"]) .settings-roles-role-card__accent {
    background: linear-gradient(90deg, #7c5cbf 0%, #9f7aea 100%);
}

.settings-roles-role-card__body {
    padding: 0.75rem 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.settings-roles-role-card__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-500);
    box-shadow: 0 2px 6px rgba(0, 24, 44, 0.12);
    line-height: 1;
}

.settings-roles-matrix__role-head[data-role="admin"] .settings-roles-role-card__avatar {
    background: linear-gradient(145deg, var(--secondary) 0%, #1a365d 100%);
}

.settings-roles-matrix__role-head[data-role="manager"] .settings-roles-role-card__avatar {
    background: linear-gradient(145deg, #2b6cb0 0%, #3182ce 100%);
}

.settings-roles-matrix__role-head[data-role="staff"] .settings-roles-role-card__avatar {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.settings-roles-matrix__role-head[data-role="viewer"] .settings-roles-role-card__avatar {
    background: linear-gradient(145deg, #64748b 0%, #475569 100%);
}

.settings-roles-matrix__role-head:not([data-role="admin"]):not([data-role="manager"]):not([data-role="staff"]):not([data-role="viewer"]) .settings-roles-role-card__avatar {
    background: linear-gradient(145deg, #7c5cbf 0%, #6b46c1 100%);
}

.settings-roles-role-card__name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    line-height: 1.25;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

.settings-roles-role-card__badge {
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.settings-roles-role-card__badge--custom {
    background: #f5f0ff;
    color: #6b46c1;
    border-color: rgba(124, 92, 191, 0.25);
}

.settings-roles-role-card__edit,
.settings-roles-role-card__delete {
    position: absolute;
    top: 0.35rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 24, 44, 0.12);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.settings-roles-role-card__edit {
    left: 0.35rem;
    color: var(--secondary, #1a365d);
}

.settings-roles-role-card__edit:hover {
    background: var(--secondary, #1a365d);
    color: #fff;
}

.settings-roles-role-card__delete {
    right: 0.35rem;
    color: var(--danger, #c0392b);
}

.settings-roles-role-card__delete:hover {
    background: var(--danger, #c0392b);
    color: #fff;
}

.settings-roles-role-card__edit:active,
.settings-roles-role-card__delete:active {
    transform: scale(0.94);
}

.settings-roles-role-card__users {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--gray-600);
    line-height: 1.2;
}

.settings-roles-role-card__sort {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.35rem 0.25rem 0.45rem;
    border-top: 1px solid var(--gray-100);
    background: #fafbfc;
}

.settings-roles-role-card__sort-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.settings-roles-role-card__sort-btn:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: transparent;
    color: var(--primary);
}

.settings-roles-role-card__sort-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.settings-roles-role-card__sort-btn--duplicate {
    margin-right: 0.15rem;
}

.settings-roles-legend-card__users {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
}

.notification-preferences-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-600);
}

.notification-preferences-table .form-check-input {
    cursor: pointer;
}

.notification-preferences-table .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.notification-preferences-table .form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem var(--primary-light);
}

.notification-pref-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary);
}

.settings-roles-matrix__perm-row:nth-child(even) .settings-roles-matrix__perm-label {
    background: #fafbfc;
}

.settings-roles-matrix__perm-label {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 12.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.settings-roles-perm-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.settings-roles-perm-icon--scope {
    background: #eef2f7;
    color: var(--gray-600);
}

.settings-roles-matrix__cell {
    text-align: center;
    vertical-align: middle;
    padding: 0.35rem;
    border-bottom: 1px solid var(--gray-100);
    border-left: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s ease;
    background: var(--white);
}

.settings-roles-matrix__perm-row:nth-child(even) .settings-roles-matrix__cell {
    background: #fafbfc;
}

.settings-roles-matrix__cell.is-on {
    background: var(--white);
}

.settings-roles-matrix__perm-row:nth-child(even) .settings-roles-matrix__cell.is-on {
    background: #fafbfc;
}

.settings-roles-matrix__cell--scope {
    background: #f4f6f8 !important;
}

.settings-roles-matrix__cell--scope.is-on {
    background: #f4f6f8 !important;
}

.settings-roles-matrix__cell.is-locked {
    cursor: default;
}

.settings-roles-matrix__cell.is-locked .settings-roles-toggle {
    pointer-events: none;
}

.settings-roles-matrix__divider td {
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    background: var(--gray-100);
    border-top: 2px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
}

.settings-roles-matrix__scope-row .settings-roles-matrix__perm-label {
    background: #f4f6f8;
}

.settings-roles-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
}

.settings-roles-matrix__checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.settings-roles-toggle__ui {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.settings-roles-toggle:hover .settings-roles-toggle__ui {
    border-color: var(--primary);
}

.settings-roles-matrix__checkbox:checked + .settings-roles-toggle__ui {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(58, 175, 169, 0.35);
}

.settings-roles-toggle:active .settings-roles-toggle__ui {
    transform: scale(0.94);
}

.settings-roles-legend {
    margin-top: 1.75rem;
}

.settings-roles-legend__title {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.settings-roles-legend-card {
    height: 100%;
    padding: 1rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.settings-roles-legend-card:hover {
    border-color: rgba(58, 175, 169, 0.35);
    box-shadow: 0 4px 16px rgba(0, 24, 44, 0.06);
}

.settings-roles-legend-card[data-role="admin"] .settings-roles-legend-card__avatar { background: var(--secondary); }
.settings-roles-legend-card[data-role="manager"] .settings-roles-legend-card__avatar { background: #2b6cb0; }
.settings-roles-legend-card[data-role="staff"] .settings-roles-legend-card__avatar { background: var(--primary); }
.settings-roles-legend-card[data-role="viewer"] .settings-roles-legend-card__avatar { background: var(--gray-600); }
.settings-roles-legend-card:not([data-role="admin"]):not([data-role="manager"]):not([data-role="staff"]):not([data-role="viewer"]) .settings-roles-legend-card__avatar {
    background: #7c5cbf;
}

.settings-roles-legend-card__head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.settings-roles-legend-card__avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-roles-legend-card__desc {
    font-size: 0.75rem;
    color: var(--gray-600);
    line-height: 1.45;
    margin-bottom: 0.65rem;
}

.settings-roles-legend-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.settings-roles-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-600);
}

.settings-roles-tag--ok {
    background: rgba(58, 175, 169, 0.15);
    color: #1a7a74;
}

.settings-roles-tag--muted {
    background: #eef2f7;
    color: var(--gray-600);
}

.settings-roles-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
}

@media (max-width: 767.98px) {
    .settings-roles-add-panel {
        margin-inline: 1rem;
    }

    .settings-roles-form {
        padding: 1rem;
    }

    .settings-roles-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Legacy role tab styles (settings.php?tab=roles redirects away) */
.settings-role-accordion {
    --bs-accordion-border-color: var(--gray-200);
    --bs-accordion-btn-bg: var(--gray-50);
    --bs-accordion-active-bg: var(--gray-50);
    --bs-accordion-active-color: var(--secondary);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 3px var(--primary-light);
}

.settings-role-accordion .accordion-button {
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--secondary);
}

.settings-role-accordion .accordion-button:not(.collapsed) {
    border-bottom: 1px solid var(--gray-200);
}

.settings-role-accordion-title {
    flex: 0 0 auto;
    font-size: 1.0625rem;
}

.settings-role-accordion-desc {
    flex: 1 1 100%;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.45;
    text-align: left;
}

.settings-role-accordion .accordion-body {
    padding: 1.25rem;
}

.settings-role-permissions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.65rem 1rem;
}

.settings-role-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.25rem;
}

.settings-role-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.settings-role-check--block {
    align-items: flex-start;
}

.settings-role-check__input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.settings-role-check__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary);
    line-height: 1.35;
}

.settings-role-help {
    margin: 0.5rem 0 0 calc(1.125rem + 0.5rem);
    line-height: 1.45;
    pointer-events: none;
}

.notification-list-body { flex: 1; min-width: 0; }

.notification-list-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-list-item.unread .notification-list-icon::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(58, 175, 169, 0.35);
}

.notification-list-actions {
    flex-shrink: 0;
    align-items: center;
}

.auth-form-container-wide {
    max-width: 440px;
}

.portal-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    padding: 0.35rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.portal-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: var(--font-family, 'Montserrat', sans-serif);
    color: var(--gray-600);
    width: 100%;
}

.portal-option small {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.portal-option:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--secondary);
}

.portal-option.active {
    background: var(--white);
    border-color: var(--primary);
    color: var(--secondary);
    box-shadow: var(--shadow);
}

.portal-option i {
    font-size: 1.25rem;
    color: var(--primary);
}

.auth-form .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-family, 'Montserrat', sans-serif);
    color: var(--secondary);
    background-color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.auth-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-form .form-floating > .form-select {
    min-height: 3.6rem;
    padding-top: 1.35rem;
}

/* Admin table pagination */
.saas-pagination-nav .page-link {
    color: var(--primary);
    border-color: rgba(58, 175, 169, 0.28);
    background: #fff;
}

.saas-pagination-nav .page-link:hover,
.saas-pagination-nav .page-link:focus {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem var(--primary-light);
}

.saas-pagination-nav .page-item.active .page-link {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.saas-pagination-nav .page-item.disabled .page-link {
    color: rgba(58, 175, 169, 0.55);
    border-color: rgba(58, 175, 169, 0.2);
}

/* ── Client contact page ── */
.contact-page {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.contact-page-top {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

.contact-page-top .saas-card,
.contact-panel {
    height: 100%;
    border-radius: 14px;
}

.contact-info-body,
.contact-form-body {
    padding: 2rem 2.5rem 2.25rem !important;
}

.contact-panel-header,
.contact-form-header {
    padding: 1.25rem 2.5rem !important;
}

.contact-quick-links-card {
    width: 100%;
    margin-top: 0.75rem;
}

.contact-quick-links-body {
    padding: 1.75rem 2.5rem 2.25rem !important;
}

.contact-quick-tile {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 148px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0, 24, 44, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-quick-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 24, 44, 0.1);
    color: inherit;
}

.contact-quick-tile-accent {
    height: 10px;
    background: var(--primary);
    flex-shrink: 0;
}

.contact-quick-tile-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.125rem 1rem 1rem;
    flex: 1;
}

.contact-quick-tile-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.contact-quick-tile-title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--secondary);
    line-height: 1.3;
}

.contact-quick-tile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.875rem 1rem 1.125rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-600);
}

.contact-quick-tile-footer i {
    color: var(--primary);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.contact-form-header {
    align-items: center;
}

.contact-response-note {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.45;
}

.contact-form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.4375rem;
}

.contact-message-form .form-control {
    border-color: var(--gray-200);
    border-radius: 8px;
    padding: 0.6875rem 0.875rem;
    font-size: 0.875rem;
    background: #fff;
}

.contact-message-form textarea.form-control {
    min-height: 168px;
    resize: vertical;
}

.contact-message-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.contact-message-form .btn-primary {
    padding: 0.5625rem 1.125rem;
    font-weight: 600;
}

.message-thread-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-thread-item {
    max-width: 92%;
}

.message-thread-item--inbound {
    align-self: flex-start;
}

.message-thread-item--outbound {
    align-self: flex-end;
}

.message-thread-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.message-thread-meta-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.message-thread-edited {
    font-size: 0.6875rem;
    font-style: italic;
    color: var(--gray-400);
}

.message-thread-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.message-thread-actions .btn-link {
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.message-thread-actions .btn-link:hover {
    color: var(--primary-dark, var(--primary));
    text-decoration: underline;
}

.message-edit-form textarea {
    font-size: 0.875rem;
}

.message-thread-meta strong {
    color: var(--secondary);
    font-size: 0.8125rem;
}

.message-thread-bubble {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-thread-item--inbound .message-thread-bubble {
    background: var(--gray-100);
    color: var(--text-body);
    border: 1px solid var(--gray-200);
}

.message-thread-item--outbound .message-thread-bubble {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--text-body);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}

.message-view-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-view-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.message-view-back {
    margin-right: auto;
}

.message-view-top-actions {
    margin-left: auto;
}

.message-view-header {
    align-items: flex-start;
    padding: 1rem 1.25rem;
}

.message-view-header--brand {
    background: var(--primary);
    border-bottom: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.message-view-header--brand .saas-card-title,
.message-view-header--brand .saas-card-subtitle {
    color: #fff;
}

.message-view-header-main {
    min-width: 0;
    flex: 1;
}

.message-view-header-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.message-thread-status,
.message-thread-count {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    white-space: nowrap;
}

.message-thread-status--blocked {
    background: rgba(220, 53, 69, 0.92);
    color: #fff;
}

.message-thread-body--panel {
    padding: 1.25rem 1.5rem 1.5rem;
    background: var(--gray-50);
    min-height: 10rem;
}

.message-thread-body--panel .message-thread-item {
    max-width: min(36rem, 88%);
}

.message-thread-body--panel .message-thread-item + .message-thread-item {
    margin-top: 0.25rem;
}

.message-view-card {
    overflow: hidden;
}

.message-reply-body {
    padding: 1.25rem 1.5rem;
}

.contact-thread-card {
    overflow: hidden;
}

.contact-thread-header {
    padding: 1.25rem 1.5rem !important;
}

.contact-thread-header-actions .btn-light {
    background: rgba(255, 255, 255, 0.92);
    border: none;
    color: var(--primary);
    font-weight: 600;
}

.contact-thread-body {
    padding: 1.25rem 1.5rem !important;
}

.contact-thread-reply {
    border-top: 1px solid var(--gray-100);
}

.contact-thread-reply-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.contact-thread-reply-actions .contact-reply-form {
    margin-left: auto;
}

.contact-thread-reply-actions .contact-thread-action-btn {
    min-width: 7.5rem;
    min-height: 2rem;
    padding: 0.375rem 0.875rem !important;
    font-size: 0.75rem !important;
    font-weight: 600;
    border-radius: 8px;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.contact-thread-back {
    align-self: flex-start;
}

.contact-thread-reply-header {
    padding: 0.875rem 1.5rem;
}

.contact-thread-reply-header .saas-card-title {
    font-size: 0.9375rem;
}

.contact-thread-reply-body {
    padding: 1rem 1.5rem 1.25rem;
    background: var(--white);
}

.contact-reply-card .message-reply-body {
    padding: 1.25rem 1.5rem;
}

.contact-thread-footer-card .contact-thread-footer {
    padding: 1rem 1.5rem 1.25rem;
}

.contact-thread-footer {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.contact-clear-form {
    margin: 0;
}

.contact-chat-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-page .contact-page-top {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.message-inbox-list .notification-list-body strong {
    font-size: 0.825rem;
    color: var(--secondary);
}

.message-inbox-list .notification-list-body p {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

@media (max-width: 991.98px) {
    .contact-form-header {
        flex-wrap: wrap;
        gap: 0.375rem 1rem;
    }

    .contact-response-note {
        margin-left: auto;
        text-align: right;
    }

    .contact-quick-links-card {
        margin-top: 0.5rem;
    }
}

/* ============================================================
   Loading spinners & skeleton screens
   ============================================================ */

.page-content {
    position: relative;
}

.page-loading-skeleton {
    position: absolute;
    inset: 0;
    z-index: 20;
    padding: 0.25rem 0 1.5rem;
    background: var(--layout-canvas, var(--gray-50));
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    animation: page-skeleton-failsafe 1.5s ease forwards;
}

body.page-ready .page-loading-skeleton {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    animation: none;
    display: none !important;
}

/* CSS fallback if loading.js is blocked or cached stale */
@keyframes page-skeleton-failsafe {
    0%, 70% {
        opacity: 1;
        visibility: visible;
    }
    100% {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        display: none;
    }
}

.skeleton-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skeleton-grid--stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--gray-100);
    border-radius: 8px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    100% { transform: translateX(100%); }
}

.skeleton-block--title {
    width: 38%;
    max-width: 280px;
    height: 1.35rem;
}

.skeleton-block--subtitle {
    width: 52%;
    max-width: 420px;
    height: 0.85rem;
}

.skeleton-block--stat {
    height: 5.5rem;
    border-radius: 12px;
}

.skeleton-block--toolbar {
    height: 2.75rem;
}

.skeleton-block--panel {
    height: 18rem;
    border-radius: 12px;
}

.skeleton-list-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.skeleton-list-item:last-child {
    border-bottom: none;
}

.skeleton-list-item--chat {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: var(--white);
}

.skeleton-line {
    height: 0.75rem;
    margin-bottom: 0.45rem;
    border-radius: 6px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line--lg { width: 72%; }
.skeleton-line--md { width: 58%; }
.skeleton-line--sm { width: 42%; }
.skeleton-line--xs { width: 24%; }

.skeleton-table {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.skeleton-table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 0.75fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.35rem 0;
}

.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
}

.global-loading-overlay[hidden] {
    display: none !important;
}

.global-loading-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    min-width: 200px;
    padding: 1.35rem 1.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.global-loading-spinner {
    width: 2rem;
    height: 2rem;
    border-width: 0.2rem;
    color: var(--primary) !important;
}

.global-loading-overlay__message {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    text-align: center;
}

.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.is-btn-loading {
    pointer-events: none;
}

.is-skeleton-host {
    min-height: 4rem;
}

body.is-global-loading {
    cursor: progress;
}

@media (max-width: 991.98px) {
    .skeleton-grid--stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .skeleton-grid--stats {
        grid-template-columns: 1fr;
    }

    .skeleton-table-row {
        grid-template-columns: 1fr;
    }
}

.bank-transfer-details .fdoc-bank-line,
.bank-preview-block .fdoc-bank-line {
    margin: 0 0 0.35rem;
    line-height: 1.5;
}

.bank-transfer-details .fdoc-bank-label,
.bank-preview-block .fdoc-bank-label {
    font-weight: 600;
    color: var(--bs-body-color);
}

/* ---- Bank accounts (settings, invoices, client portal) ---- */
.bank-accounts-block {
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--gray-200));
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 6%, #fff) 0%, var(--white) 55%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bank-accounts-block__header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.bank-accounts-block__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 14%, #fff);
    color: var(--primary);
    font-size: 1.25rem;
}

.bank-accounts-block__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary);
}

.bank-accounts-block__desc {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.bank-format-tip {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
}

.bank-format-tip__label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.bank-format-tip__sample {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}

.bank-format-tip__line {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bank-format-tip__line em {
    font-style: normal;
    font-weight: 600;
    color: var(--gray-600);
}

.bank-account-tabs {
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bank-account-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bank-account-tabs .nav-link:hover {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--gray-200));
    color: var(--secondary);
}

.bank-account-tabs .nav-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}

.bank-account-tabs__num {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.22);
}

.bank-account-tabs .nav-link:not(.active) .bank-account-tabs__num {
    background: var(--gray-100);
    color: var(--gray-600);
}

.bank-account-tabs__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.bank-account-tabs .nav-link:not(.active) .bank-account-tabs__dot {
    background: #22c55e;
}

.bank-account-card {
    padding: 1.1rem 1.15rem;
    border-radius: 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
}

.bank-account-card__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--gray-100);
}

.bank-account-card__badge {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, #fff);
}

.bank-field-input .input-group-text {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, #fff);
    border-color: var(--gray-200);
}

.bank-accounts-default {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--gray-200));
}

.bank-accounts-default__icon {
    color: var(--primary);
}

.bank-accounts-default .form-label {
    color: var(--secondary);
    font-weight: 600;
}

.bank-details-panel {
    display: grid;
    gap: 0.55rem;
}

.bank-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 4%, var(--white));
    border: 1px solid color-mix(in srgb, var(--primary) 10%, var(--gray-200));
}

.bank-detail-row__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 12%, #fff);
    color: var(--primary);
    font-size: 0.9rem;
}

.bank-detail-row__content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.bank-detail-row__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.bank-detail-row__value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    word-break: break-word;
}

.bank-detail-row__value--account {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9375rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.bank-preview-card {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--gray-200));
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, #fff), var(--white));
}

.invoice-paynow-toggle .form-check-label {
    font-weight: 600;
}

.invoice-paynow-preview {
    display: flex;
    justify-content: flex-end;
}

.invoice-paynow-preview__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.01em;
    pointer-events: none;
    user-select: none;
}

.invoice-paynow-preview__amount {
    margin-left: 0.1rem;
    padding-left: 0.45rem;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-weight: 700;
}

.bank-preview-card__label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
}

.bank-transfer-card {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--gray-200));
}

.bank-transfer-card__banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 12%, #fff), color-mix(in srgb, var(--secondary) 6%, #fff));
    border-bottom: 1px solid var(--gray-200);
}

.bank-transfer-card__icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--white);
    color: var(--primary);
    font-size: 1.35rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.bank-transfer-card__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--secondary);
}

.bank-transfer-card__subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.bank-transfer-card__body {
    padding: 1rem 1.25rem 1.15rem;
}

.bank-transfer-card__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.bank-transfer-inline {
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 4%, #fff), var(--gray-50));
    border-top: 1px solid var(--gray-200);
}

.bank-transfer-inline__head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px dashed var(--gray-300);
}

.bank-transfer-inline__head > i {
    font-size: 1.1rem;
    color: var(--primary);
}

.bank-transfer-inline__head strong {
    display: block;
    font-size: 0.875rem;
    color: var(--secondary);
}

.bank-transfer-inline__head span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   Business Insights Panel
   ============================================================ */

.insights-page {
    padding: 0 0 1.5rem;
}

.biz-insights-panel {
    background: var(--white);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.biz-insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.6rem;
    background: var(--primary-gradient-hero);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.biz-insights-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 100% at 100% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 50% 80% at 0% 100%, color-mix(in srgb, var(--primary) 20%, transparent) 0%, transparent 50%);
    pointer-events: none;
}

.biz-insights-header-left,
.biz-insights-header-right {
    position: relative;
    z-index: 1;
}

.biz-insights-header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.biz-insights-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.biz-insights-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.biz-insights-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
}

.biz-insights-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.biz-tab-group {
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.2);
    padding: 4px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
}

.biz-tab {
    padding: 0.4rem 0.95rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    font-family: inherit;
}

.biz-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.biz-tab.active {
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.biz-tab-panel {
    display: none;
    padding: 1.5rem 1.6rem 1.65rem;
    animation: bizFadeIn 0.25s ease;
    background:
        radial-gradient(ellipse 100% 60% at 100% 0%, var(--primary-glow) 0%, transparent 50%),
        radial-gradient(ellipse 80% 50% at 0% 100%, color-mix(in srgb, var(--secondary) 6%, transparent) 0%, transparent 45%),
        linear-gradient(180deg, #f1f5f9 0%, #f8fafc 80px, var(--white) 200px);
}

.biz-tab-panel.active {
    display: block;
}

@keyframes bizFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.biz-section-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 0.75rem;
}

.biz-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(100, 116, 139, 0.25) 0%, transparent 100%);
}

.biz-section-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    flex-shrink: 0;
}

.biz-section-label:not(:first-child) {
    margin-top: 1.35rem;
}

.biz-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.875rem;
}

.biz-kpi-row--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.biz-kpi-row--2col {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.biz-kpi {
    position: relative;
    background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 14px;
    padding: 1.05rem 1.15rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow: hidden;
    min-height: 116px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}

.biz-kpi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
    background: var(--primary-gradient-accent);
    opacity: 0.9;
}

.biz-kpi::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 55%;
    height: 80%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(58, 175, 169, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.biz-kpi--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.biz-kpi--link:hover {
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
    transform: translateY(-3px);
    color: inherit;
    border-color: color-mix(in srgb, var(--primary) 25%, rgba(15, 23, 42, 0.07));
}

.biz-kpi--link:hover .biz-kpi-arrow {
    transform: translateX(3px);
    opacity: 1;
}

.biz-kpi--emphasis {
    background: linear-gradient(155deg, #f5f7ff 0%, #ffffff 55%);
    border-color: color-mix(in srgb, #6366f1 22%, rgba(15, 23, 42, 0.07));
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
}

.biz-kpi--teal::before    { background: linear-gradient(90deg, var(--primary-bright), var(--primary)); }
.biz-kpi--blue::before    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.biz-kpi--primary::before { background: var(--primary-gradient-accent); }
.biz-kpi--green::before   { background: linear-gradient(90deg, #34d399, #10b981); }
.biz-kpi--indigo::before  { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.biz-kpi--slate::before   { background: linear-gradient(90deg, #94a3b8, #475569); }
.biz-kpi--rose::before    { background: linear-gradient(90deg, #fb7185, #e11d48); }
.biz-kpi--red::before     { background: linear-gradient(90deg, #f87171, #dc2626); }
.biz-kpi--violet::before  { background: linear-gradient(90deg, #a78bfa, #6366f1); }
.biz-kpi--amber::before   { background: linear-gradient(90deg, #fcd34d, #f59e0b); }

.biz-kpi-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.1rem;
    position: relative;
    z-index: 1;
}

.biz-kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    background: rgba(58, 175, 169, 0.1);
    color: var(--primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.biz-kpi--teal    .biz-kpi-icon { background: linear-gradient(145deg, rgba(45, 212, 191, 0.28), rgba(20, 184, 166, 0.12)); color: #0d9488; }
.biz-kpi--blue    .biz-kpi-icon { background: linear-gradient(145deg, rgba(56, 189, 248, 0.18), rgba(59, 130, 246, 0.1)); color: #2563eb; }
.biz-kpi--primary .biz-kpi-icon { background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 20%, transparent), color-mix(in srgb, var(--primary-bright) 8%, transparent)); color: var(--primary); }
.biz-kpi--green   .biz-kpi-icon { background: linear-gradient(145deg, rgba(52, 211, 153, 0.18), rgba(16, 185, 129, 0.1)); color: #059669; }
.biz-kpi--indigo  .biz-kpi-icon { background: linear-gradient(145deg, rgba(129, 140, 248, 0.2), rgba(99, 102, 241, 0.1)); color: #4f46e5; }
.biz-kpi--slate   .biz-kpi-icon { background: linear-gradient(145deg, rgba(148, 163, 184, 0.2), rgba(71, 85, 105, 0.08)); color: #475569; }
.biz-kpi--rose    .biz-kpi-icon { background: linear-gradient(145deg, rgba(251, 113, 133, 0.18), rgba(225, 29, 72, 0.08)); color: #e11d48; }
.biz-kpi--red     .biz-kpi-icon { background: linear-gradient(145deg, rgba(248, 113, 113, 0.18), rgba(239, 68, 68, 0.1)); color: #dc2626; }
.biz-kpi--violet  .biz-kpi-icon { background: linear-gradient(145deg, rgba(167, 139, 250, 0.2), rgba(99, 102, 241, 0.1)); color: #4f46e5; }
.biz-kpi--amber   .biz-kpi-icon { background: linear-gradient(145deg, rgba(251, 191, 36, 0.22), rgba(245, 158, 11, 0.1)); color: #d97706; }

.biz-kpi-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #64748b;
    position: relative;
    z-index: 1;
}

.biz-kpi-value-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.biz-kpi-value-row .kpi-trend {
    font-size: 0.65rem;
    max-width: 100%;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.1);
}

.biz-kpi-value-row .kpi-trend.down {
    background: rgba(59, 130, 246, 0.1);
}

.biz-kpi-value-row .kpi-trend.neutral {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.biz-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    position: relative;
    z-index: 1;
}

.biz-kpi-value--money {
    font-size: clamp(1rem, 1.35vw, 1.35rem);
    white-space: nowrap;
}

.biz-kpi-sub {
    font-size: 0.6875rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: auto;
    padding-top: 0.2rem;
}

.biz-kpi--export { min-height: 108px; }
.biz-kpi--export .biz-kpi-label { color: #334155; font-size: 0.7rem; letter-spacing: 0.05em; }
.biz-kpi-export-action {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: auto;
    padding-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    position: relative;
    z-index: 1;
}
.biz-kpi--teal.biz-kpi--export .biz-kpi-export-action { color: #0d9488; }
.biz-kpi--blue.biz-kpi--export .biz-kpi-export-action { color: #2563eb; }
.biz-kpi--green.biz-kpi--export .biz-kpi-export-action { color: #059669; }
.biz-kpi--violet.biz-kpi--export .biz-kpi-export-action { color: #4f46e5; }
.biz-kpi--export .biz-kpi-arrow { opacity: 1; font-size: 1.1rem; }
.biz-kpi--export:hover .biz-kpi-export-action { text-decoration: underline; text-underline-offset: 2px; }

[data-theme="dark"] .biz-kpi--export .biz-kpi-label { color: #f1f5f9; }
[data-theme="dark"] .biz-kpi--teal.biz-kpi--export .biz-kpi-export-action { color: var(--primary-bright); }
[data-theme="dark"] .biz-kpi--blue.biz-kpi--export .biz-kpi-export-action { color: #93c5fd; }
[data-theme="dark"] .biz-kpi--green.biz-kpi--export .biz-kpi-export-action { color: #6ee7b7; }
[data-theme="dark"] .biz-kpi--violet.biz-kpi--export .biz-kpi-export-action { color: #c4b5fd; }

.biz-kpi-arrow {
    font-size: 1rem;
    vertical-align: middle;
    opacity: 0.65;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.biz-kpi--collection {
    min-height: 112px;
}

.biz-kpi-collection-inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    height: 100%;
}

.biz-kpi-collection-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.biz-kpi-ring {
    --pct: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    background: conic-gradient(var(--primary) calc(var(--pct) * 1%), #e2e8f0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.25);
}

.biz-kpi-ring::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: linear-gradient(160deg, #ffffff, #f8fafc);
}

.biz-kpi-ring-value {
    position: relative;
    z-index: 1;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Revenue chart card */
.biz-chart-card {
    margin: 1.15rem 0 0.35rem;
    padding: 1.1rem 1.2rem 1rem;
    background: linear-gradient(160deg, #ffffff 0%, color-mix(in srgb, var(--primary) 6%, #fff) 55%, #f8fafc 100%);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, rgba(15, 23, 42, 0.08));
    border-radius: 14px;
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.04),
        0 8px 24px color-mix(in srgb, var(--primary) 8%, transparent);
}

.biz-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.biz-chart-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.2rem;
    letter-spacing: -0.01em;
}

.biz-chart-desc {
    font-size: 0.6875rem;
    color: #64748b;
    margin: 0;
}

.biz-chart-legend {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.biz-chart-legend-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    background: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.biz-chart-legend-btn:hover {
    border-color: color-mix(in srgb, var(--primary) 30%, rgba(15, 23, 42, 0.1));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 10%, transparent);
}

.biz-chart-legend-btn:not(.active) {
    opacity: 0.45;
}

.biz-chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.biz-chart-legend-dot--pay { background: var(--primary); }
.biz-chart-legend-dot--inv { background: #6366f1; }

.biz-chart-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.biz-chart-stat {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    min-width: 0;
    overflow: hidden;
}

.biz-chart-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.9;
}

.biz-chart-stat--teal::before   { background: var(--primary-gradient-accent); }
.biz-chart-stat--indigo::before { background: linear-gradient(90deg, #818cf8, #6366f1); }
.biz-chart-stat--amber::before  { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.biz-chart-stat--blue::before   { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.biz-chart-stat--teal   .biz-chart-stat-value { color: #0d9488; }
.biz-chart-stat--indigo .biz-chart-stat-value { color: #4f46e5; }
.biz-chart-stat--amber  .biz-chart-stat-value { color: #d97706; }
.biz-chart-stat--blue   .biz-chart-stat-value { color: #2563eb; }

.biz-chart-stat-label {
    display: block;
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.biz-chart-stat-value {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biz-chart-canvas-wrap {
    height: 160px;
    position: relative;
    padding: 0.25rem 0.15rem 0;
}

.biz-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 160px !important;
}

.biz-sparkline-card {
    margin: 1.15rem 0 0.35rem;
    padding: 0;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.biz-sparkline-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.35rem;
}

.biz-sparkline-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
}

.biz-sparkline-hint {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
}

.biz-sparkline-canvas-wrap {
    height: 72px;
    position: relative;
    padding: 0 0.5rem 0.5rem;
}

.biz-sparkline-canvas-wrap canvas {
    width: 100% !important;
    height: 72px !important;
}

.biz-progress-bar-wrap {
    height: 5px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.biz-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.biz-progress-bar--green  { background: linear-gradient(90deg, var(--primary), #34d399); }
.biz-progress-bar--red    { background: linear-gradient(90deg, #fb7185, #e11d48); }
.biz-progress-bar--teal   { background: linear-gradient(90deg, var(--primary), var(--primary-bright)); }

.biz-cases-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.25rem;
    align-items: start;
}

.biz-kpi-col { min-width: 0; }

.biz-cases-charts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 280px;
    max-width: 340px;
}

.biz-mini-chart-card {
    background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.biz-mini-chart-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 0.75rem;
}

.biz-donut-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 0.75rem;
}

.biz-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.biz-donut-total {
    font-size: 1.375rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.biz-donut-sub {
    font-size: 0.625rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.biz-donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.biz-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.7rem;
}

.biz-donut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.biz-donut-legend-label {
    flex: 1;
    color: #475569;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.biz-donut-legend-val {
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.biz-donut-legend-pct {
    font-weight: 500;
    color: #94a3b8;
}

.biz-bar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.biz-bar-item {
    display: grid;
    grid-template-columns: 120px 1fr 28px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
}

.biz-bar-name {
    color: #334155;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.biz-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.biz-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, var(--primary));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.biz-bar-count {
    font-weight: 700;
    color: #475569;
    text-align: right;
}

.biz-empty-note {
    color: #94a3b8;
    font-size: 0.8125rem;
    margin: 0.5rem 0 0;
}

[data-theme="dark"] .biz-insights-panel {
    background: var(--surface) !important;
    background-image: none !important;
    border-color: var(--border-default);
}

[data-theme="dark"] .biz-mini-chart-card,
[data-theme="dark"] .biz-sparkline-card {
    background: var(--surface-sunken) !important;
    background-image: none !important;
    border-color: var(--border-default);
    box-shadow: none;
}

[data-theme="dark"] .biz-tab-panel {
    background: var(--surface) !important;
    background-image: none !important;
}

[data-theme="dark"] .biz-kpi {
    background: var(--surface-sunken);
    border-color: var(--border-default);
}

[data-theme="dark"] .biz-kpi--emphasis {
    background: color-mix(in srgb, #6366f1 10%, var(--surface-sunken));
    border-color: color-mix(in srgb, #6366f1 28%, var(--border-default));
}

[data-theme="dark"] .biz-kpi-ring::before {
    background: var(--surface-sunken);
}

[data-theme="dark"] .biz-chart-card {
    background: var(--surface-sunken) !important;
    background-image: none !important;
    border-color: var(--border-default);
}

[data-theme="dark"] .biz-chart-stat {
    background: var(--surface-raised);
    border-color: var(--border-default);
}

[data-theme="dark"] .biz-chart-title,
[data-theme="dark"] .biz-chart-stat-value,
[data-theme="dark"] .biz-kpi-value,
[data-theme="dark"] .biz-donut-total,
[data-theme="dark"] .biz-donut-legend-val,
[data-theme="dark"] .biz-bar-count {
    color: var(--text-body);
}

[data-theme="dark"] .biz-chart-stat--teal .biz-chart-stat-value   { color: var(--primary-bright) !important; }
[data-theme="dark"] .biz-chart-stat--indigo .biz-chart-stat-value { color: #c4b5fd !important; }
[data-theme="dark"] .biz-chart-stat--amber .biz-chart-stat-value  { color: #fcd34d !important; }
[data-theme="dark"] .biz-chart-stat--blue .biz-chart-stat-value   { color: #93c5fd !important; }

[data-theme="dark"] .biz-mini-chart-label,
[data-theme="dark"] .biz-donut-legend-label,
[data-theme="dark"] .biz-bar-name {
    color: var(--text-muted);
}

[data-theme="dark"] .biz-donut-sub,
[data-theme="dark"] .biz-donut-legend-pct,
[data-theme="dark"] .biz-kpi-sub,
[data-theme="dark"] .biz-empty-note,
[data-theme="dark"] .biz-chart-desc {
    color: var(--text-muted);
    opacity: 0.85;
}

[data-theme="dark"] .biz-kpi-label,
[data-theme="dark"] .biz-section-label {
    color: var(--text-muted);
}

[data-theme="dark"] .biz-section-label::after {
    background: var(--border-default);
}

[data-theme="dark"] .biz-chart-legend-btn {
    background: var(--surface-raised);
    border-color: var(--border-default);
    color: var(--text-muted);
}

[data-theme="dark"] .biz-insights-header {
    background: var(--primary-gradient-hero) !important;
    border-bottom: 3px solid color-mix(in srgb, var(--primary) 70%, white);
}

[data-theme="dark"] .biz-insights-header::before {
    display: block;
    background:
        radial-gradient(ellipse 70% 100% at 100% 0%, rgba(255, 255, 255, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse 50% 80% at 0% 100%, color-mix(in srgb, var(--primary) 16%, transparent) 0%, transparent 50%);
}

[data-theme="dark"] .biz-tab.active {
    background: var(--surface-raised);
    color: var(--text-body);
}

[data-theme="dark"] .biz-progress-bar-wrap,
[data-theme="dark"] .biz-bar-track {
    background: var(--border-default);
}

[data-theme="dark"] .biz-bar-fill {
    background: var(--primary);
    background-image: none;
}

[data-theme="dark"] .biz-kpi-icon {
    box-shadow: none;
}

[data-theme="dark"] .biz-admin-badge {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 1199px) {
    .biz-kpi-row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .biz-chart-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .biz-cases-grid { grid-template-columns: 1fr; }
    .biz-cases-charts { max-width: 100%; flex-direction: row; flex-wrap: wrap; }
    .biz-mini-chart-card { flex: 1; min-width: 240px; }
}

@media (max-width: 575px) {
    .biz-tab-group { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .biz-insights-header-right { width: 100%; }
    .biz-kpi-row,
    .biz-kpi-row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .biz-insights-header { flex-direction: column; align-items: flex-start; }
    .biz-kpi-value { font-size: 1.2rem; }
    .biz-kpi-value--money { font-size: 0.95rem; }
    .biz-bar-item { grid-template-columns: 90px 1fr 24px; }
    .biz-kpi-collection-inner { flex-direction: column; align-items: flex-start; }
    .biz-chart-stats { grid-template-columns: 1fr 1fr; }
    .biz-chart-head { flex-direction: column; }
}

/* Backup settings */
.backup-settings-page {
    background: var(--gray-50);
}

.backup-settings-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backup-settings-card--wide {
    grid-column: 1 / -1;
}

.backup-settings-card__header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    border-left-width: 4px;
}

.backup-settings-card__header--download { border-left-color: #0ea5e9; }
.backup-settings-card__header--restore { border-left-color: #8b5cf6; }
.backup-settings-card__header--schedule { border-left-color: var(--primary); }

.backup-settings-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.backup-settings-card__header--restore .backup-settings-card__icon {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.backup-settings-card__header--schedule .backup-settings-card__icon {
    background: rgba(58, 175, 169, 0.12);
    color: var(--primary);
}

.backup-settings-card__hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.45;
}

.backup-schedule-info {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1.15rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
}

.backup-schedule-info__item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: 1.4;
}

.backup-schedule-info__item i {
    color: var(--primary);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.backup-last-run {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin: 0;
    min-height: 38px;
}

.backup-last-run i {
    color: #16a34a;
}

.backup-last-run--empty i {
    color: #94a3b8;
}

@media (max-width: 991.98px) {
    .backup-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Prototype payment gateway */
.payment-gateway-page { max-width: 560px; margin: 0 auto 2rem; padding: 0 0.5rem; }
.payment-gateway-demo-banner { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1rem; margin-bottom: 1rem; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; color: #1e40af; font-size: 0.875rem; }
.payment-gateway-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow); color: #0f172a; }
.payment-gateway-card--error { text-align: center; padding: 2.5rem 1.5rem; }
.payment-gateway-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.payment-gateway-card__eyebrow { margin: 0 0 0.2rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.payment-gateway-card__title { font-size: 1.35rem; font-weight: 800; margin: 0; color: #0f172a; }
.payment-gateway-details { display: grid; gap: 0.85rem; margin-bottom: 1.25rem; padding: 1rem; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; }
.payment-gateway-detail__label { display: block; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #64748b; }
.payment-gateway-detail__value { color: #0f172a; }
.payment-gateway-detail__sub { display: block; font-size: 0.75rem; color: #64748b; margin-top: 0.15rem; }
.payment-gateway-detail__value--lg { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); }
.payment-gateway-actions { display: flex; flex-direction: column; gap: 0.65rem; }
.payment-gateway-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.payment-gateway-success, .payment-gateway-failed { display: flex; gap: 0.75rem; padding: 0.85rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.payment-gateway-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.payment-gateway-success strong { color: #047857; }
.payment-gateway-success p { margin: 0.2rem 0 0; color: #065f46; }
.payment-gateway-ref code { font-size: 0.8rem; padding: 0.1rem 0.35rem; border-radius: 4px; background: rgba(15, 23, 42, 0.06); color: #0f172a; }
.payment-gateway-failed { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.payment-gateway-footnote { font-size: 0.75rem; color: #64748b; margin: 0.75rem 0 0; }
.payment-gateway-invoice-link { margin-top: 1rem; }
.payment-pay-now-btn { white-space: nowrap; }

.invoice-row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.invoice-row-actions form {
    display: inline-flex;
    margin: 0;
}

.invoice-row-actions .btn,
.invoice-row-actions .btn.btn-sm,
.invoice-row-actions .btn.btn-primary,
.invoice-row-actions .btn.btn-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-sizing: border-box;
    min-width: 8.5rem;
    min-height: 2.125rem;
    height: 2.125rem;
    padding: 0 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 8px;
    border-width: 1px;
    border-style: solid;
    white-space: nowrap;
    vertical-align: middle;
}

.invoice-row-actions .btn-soft {
    border-color: transparent;
}

.invoice-row-actions .btn i {
    font-size: 0.875rem;
    line-height: 1;
}

[data-theme="dark"] .payment-gateway-card {
    background: var(--surface-raised);
    border-color: var(--border-default);
    color: #ffffff;
    box-shadow: var(--shadow);
}
[data-theme="dark"] .payment-gateway-card__eyebrow { color: #cbd5e1; }
[data-theme="dark"] .payment-gateway-card__title { color: #ffffff; }
[data-theme="dark"] .payment-gateway-demo-banner {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.35);
    color: #dbeafe;
}
[data-theme="dark"] .payment-gateway-details {
    background: var(--surface-sunken);
    border-color: var(--border-default);
}
[data-theme="dark"] .payment-gateway-detail__label { color: #e2e8f0; }
[data-theme="dark"] .payment-gateway-detail__value,
[data-theme="dark"] .payment-gateway-detail__value strong { color: #ffffff; }
[data-theme="dark"] .payment-gateway-detail__sub { color: #94a3b8; }
[data-theme="dark"] .payment-gateway-detail__value--lg { color: #5eead4; }
[data-theme="dark"] .payment-gateway-success {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(52, 211, 153, 0.35);
    color: #d1fae5;
}
[data-theme="dark"] .payment-gateway-success strong,
[data-theme="dark"] .payment-gateway-success p { color: #ecfdf5; }
[data-theme="dark"] .payment-gateway-ref code {
    background: rgba(0, 0, 0, 0.28);
    color: #ffffff;
}
[data-theme="dark"] .payment-gateway-failed {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}
[data-theme="dark"] .payment-gateway-footnote { color: #cbd5e1; }
[data-theme="dark"] .payment-gateway-page .alert-success {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(52, 211, 153, 0.35);
    color: #d1fae5;
}
[data-theme="dark"] .payment-gateway-page .alert-danger {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

/* Insights hub extended */
.biz-tab-group--scroll { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.biz-hub-top { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 1rem; margin-bottom: 1.25rem; align-items: stretch; }
.biz-health-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1.35rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}
.biz-health-ring { --health: 50; position: relative; width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--health) * 1%), #e2e8f0 0); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-bottom: 0.25rem; }
.biz-health-ring::before { content: ''; position: absolute; width: 74px; height: 74px; border-radius: 50%; background: #fff; }
.biz-health-value { position: relative; z-index: 1; font-size: 1.65rem; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.biz-health-title { font-size: 1.05rem; font-weight: 800; margin: 0; color: #0f172a; }
.biz-health-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(58, 175, 169, 0.12); color: var(--primary-dark); }
.biz-health-desc { font-size: 0.75rem; color: #64748b; margin: 0; max-width: 200px; line-height: 1.45; }

.biz-ai-live-card {
    position: relative;
    padding: 1.1rem 1.2rem 1rem;
    background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 55%);
    border: 1px solid #b8e8e3;
    border-radius: 16px;
    color: #0f172a;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(58, 175, 169, 0.1);
}
.biz-ai-live-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-bright), var(--primary)); opacity: 0.85; }
.biz-ai-live-card--pulse { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(58, 175, 169, 0.2), 0 4px 24px rgba(58, 175, 169, 0.12); }
.biz-ai-live-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.65rem; z-index: 1; }
.biz-ai-live-kicker { margin: 0; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #0d9488; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.biz-ai-live-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 4px rgba(34, 197, 94, 0.5); animation: bizAiPulse 2s ease-out infinite; }
@keyframes bizAiPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.biz-ai-live-title { margin: 0.15rem 0 0; font-size: 1.1rem; font-weight: 800; color: #0f172a; letter-spacing: -0.01em; }
.biz-ai-live-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex-shrink: 0; }
.biz-ai-confidence { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.22rem 0.5rem; border-radius: 6px; background: #fef3c7; color: #b45309; }
.biz-ai-confidence--medium { background: #dbeafe; color: #1d4ed8; }
.biz-ai-confidence--high { background: #d1fae5; color: #047857; }
.biz-ai-updated { font-size: 0.65rem; color: #64748b; }
.biz-ai-chart-wrap { position: relative; height: 140px; margin-bottom: 0.7rem; z-index: 1; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.4rem 0.5rem 0.2rem; }
.biz-ai-stats-grid { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.45rem; margin-bottom: 0.6rem; z-index: 1; }
.biz-ai-stat { position: relative; padding: 0.5rem 0.55rem; border-radius: 10px; background: #ffffff; border: 1px solid #e2e8f0; min-width: 0; overflow: hidden; }
.biz-ai-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.9;
}
.biz-ai-stat--base::before   { background: var(--primary-gradient-accent); }
.biz-ai-stat--best::before   { background: linear-gradient(90deg, #34d399, #10b981); }
.biz-ai-stat--worst::before  { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.biz-ai-stat--indigo::before { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.biz-ai-stat--blue::before   { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.biz-ai-stat--green::before  { background: linear-gradient(90deg, #34d399, #10b981); }
.biz-ai-stat--base   { background: linear-gradient(180deg, var(--primary-glow) 0%, #fff 55%); }
.biz-ai-stat--indigo { background: linear-gradient(180deg, rgba(99, 102, 241, 0.06) 0%, #fff 55%); }
.biz-ai-stat--blue   { background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, #fff 55%); }
.biz-ai-stat--green  { background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, #fff 55%); }
.biz-ai-stat-label { display: block; font-size: 0.58rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-ai-stat-value { display: block; font-size: 0.82rem; margin-top: 0.2rem; color: #0f172a; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-ai-stat--base .biz-ai-stat-value   { color: var(--primary); }
.biz-ai-stat--best .biz-ai-stat-value { color: #059669; }
.biz-ai-stat--worst .biz-ai-stat-value { color: #d97706; }
.biz-ai-stat--indigo .biz-ai-stat-value { color: #4f46e5; }
.biz-ai-stat--blue .biz-ai-stat-value   { color: #2563eb; }
.biz-ai-stat--green .biz-ai-stat-value  { color: #059669; }
.biz-ai-signals { position: relative; display: flex; flex-wrap: wrap; gap: 0.4rem; z-index: 1; min-height: 0; }
.biz-ai-signal-pill { display: inline-block; font-size: 0.68rem; line-height: 1.35; color: #334155; padding: 0.35rem 0.6rem; border-radius: 999px; background: #f1f5f9; border: 1px solid #e2e8f0; max-width: 100%; }
.biz-ai-signal-pill--success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.biz-ai-signal-pill--warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.biz-ai-signal-pill--danger { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

[data-theme="dark"] .biz-ai-live-card {
    background: linear-gradient(180deg, #0a1420 0%, #0f172a 100%);
    border-color: rgba(58, 175, 169, 0.22);
    color: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .biz-ai-live-card--pulse { border-color: rgba(45, 212, 191, 0.55); box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.42); }
[data-theme="dark"] .biz-ai-live-kicker { color: var(--primary-bright); }
[data-theme="dark"] .biz-ai-live-title { color: #ffffff; }
[data-theme="dark"] .biz-ai-updated { color: #ffffff; opacity: 0.75; }
[data-theme="dark"] .biz-ai-confidence { background: rgba(245, 158, 11, 0.25); color: #fde68a; }
[data-theme="dark"] .biz-ai-confidence--medium { background: rgba(59, 130, 246, 0.3); color: #bfdbfe; }
[data-theme="dark"] .biz-ai-confidence--high { background: rgba(16, 185, 129, 0.3); color: #a7f3d0; }
[data-theme="dark"] .biz-ai-chart-wrap { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .biz-ai-stat { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .biz-ai-live-card .biz-ai-stat-label,
[data-theme="dark"] .biz-ai-live-card .biz-ai-stat-value,
[data-theme="dark"] .biz-ai-live-card .biz-ai-updated,
[data-theme="dark"] .biz-ai-live-card .biz-ai-live-kicker,
[data-theme="dark"] .biz-ai-live-card .biz-ai-live-title { color: #ffffff !important; }
[data-theme="dark"] .biz-ai-stat--best .biz-ai-stat-value { color: #6ee7b7 !important; }
[data-theme="dark"] .biz-ai-stat--worst .biz-ai-stat-value { color: #fcd34d !important; }
[data-theme="dark"] .biz-ai-stat--base .biz-ai-stat-value { color: var(--primary-bright) !important; }
[data-theme="dark"] .biz-ai-stat--indigo .biz-ai-stat-value { color: #c4b5fd !important; }
[data-theme="dark"] .biz-ai-stat--blue .biz-ai-stat-value { color: #93c5fd !important; }
[data-theme="dark"] .biz-ai-stat--green .biz-ai-stat-value { color: #6ee7b7 !important; }
[data-theme="dark"] .biz-ai-stat--base,
[data-theme="dark"] .biz-ai-stat--indigo,
[data-theme="dark"] .biz-ai-stat--blue,
[data-theme="dark"] .biz-ai-stat--green { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .biz-ai-signal-pill { color: #ffffff; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .biz-ai-signal-pill--success { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.12); }
[data-theme="dark"] .biz-ai-signal-pill--warning { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.12); }
[data-theme="dark"] .biz-ai-signal-pill--danger { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.12); }

.biz-ai-prediction-card { padding: 1rem 1.15rem; background: var(--white); border: 1px solid var(--gray-200); border-radius: 14px; }
.biz-ai-prediction-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.65rem; }
.biz-ai-prediction-kicker { margin: 0; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.biz-ai-prediction-title { margin: 0.15rem 0 0; font-size: 1rem; font-weight: 700; }
.biz-ai-prediction-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 0.5rem; }
.biz-ai-prediction-grid div { border: 1px solid var(--gray-200); border-radius: 10px; padding: 0.5rem 0.6rem; background: var(--gray-50); }
.biz-ai-prediction-grid span { display: block; font-size: 0.625rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.biz-ai-prediction-grid strong { display: block; font-size: 0.9rem; margin-top: 0.2rem; }
.biz-ai-prediction-note { margin: 0; font-size: 0.72rem; color: var(--text-muted); }
.biz-alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
.biz-alert-card { display: flex; gap: 0.65rem; padding: 0.75rem 0.9rem; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; font-size: 0.8125rem; border-left-width: 4px; }
.biz-alert-card i { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.biz-alert-card p { margin: 0.2rem 0 0; color: #64748b; font-size: 0.75rem; }
.biz-alert-card strong { color: #0f172a; }
.biz-alert-card--danger { border-color: #fecaca; }
.biz-alert-card--danger i { color: #dc2626; }
.biz-alert-card--warning { border-color: #fde68a; }
.biz-alert-card--warning i { color: #d97706; }
.biz-alert-card--success { border-color: #a7f3d0; }
.biz-alert-card--success i { color: #059669; }
.biz-alert-card--info { border-color: #bfdbfe; }
.biz-alert-card--info i { color: #2563eb; }
.biz-alert-link { font-size: 0.6875rem; font-weight: 600; }
.biz-source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.biz-source-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.65rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; font-size: 0.6875rem; text-align: center; overflow: hidden; }
.biz-source-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.9;
}
.biz-source-card--teal::before   { background: var(--primary-gradient-accent); }
.biz-source-card--blue::before   { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.biz-source-card--indigo::before { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.biz-source-card--violet::before { background: linear-gradient(90deg, #a78bfa, #6366f1); }
.biz-source-card--amber::before  { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.biz-source-card--green::before  { background: linear-gradient(90deg, #34d399, #10b981); }
.biz-source-card--teal i   { color: #0d9488; }
.biz-source-card--blue i   { color: #2563eb; }
.biz-source-card--indigo i { color: #4f46e5; }
.biz-source-card--violet i { color: #6366f1; }
.biz-source-card--amber i  { color: #d97706; }
.biz-source-card--green i  { color: #059669; }
.biz-source-badge { font-size: 0.5625rem; font-weight: 700; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 4px; }
.biz-source-badge--live { background: #d1fae5; color: #065f46; }
.biz-source-badge--connect { background: var(--gray-100); color: var(--text-muted); }
.biz-chart-canvas-wrap--tall { height: 200px; }
.biz-chart-canvas-wrap--md { height: 180px; }
.biz-rec-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.biz-rec-item { display: flex; gap: 0.65rem; padding: 0.75rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.biz-rec-priority { font-size: 0.5625rem; font-weight: 800; text-transform: uppercase; padding: 0.15rem 0.4rem; border-radius: 4px; height: fit-content; }
.biz-rec-item--high .biz-rec-priority { background: #fee2e2; color: #b91c1c; }
.biz-rec-item--medium .biz-rec-priority { background: #fef3c7; color: #b45309; }
.biz-rec-item--low .biz-rec-priority { background: var(--gray-100); color: var(--text-muted); }
.biz-rec-item p { margin: 0.15rem 0 0; font-size: 0.75rem; color: #64748b; }
.biz-rec-item strong { color: #0f172a; }
.biz-driver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.biz-driver-card { position: relative; border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.65rem 0.75rem; background: #fff; overflow: hidden; }
.biz-driver-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.9;
}
.biz-driver-card--primary::before { background: var(--primary-gradient-accent); }
.biz-driver-card--blue::before    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.biz-driver-card--teal::before    { background: var(--primary-gradient-accent); }
.biz-driver-card--indigo::before  { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.biz-driver-card--violet::before  { background: linear-gradient(90deg, #a78bfa, #6366f1); }
.biz-driver-card--amber::before   { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.biz-driver-card--primary i { color: var(--primary); }
.biz-driver-card--blue i    { color: #2563eb; }
.biz-driver-card--teal i    { color: var(--primary-dark); }
.biz-driver-card--indigo i  { color: #4f46e5; }
.biz-driver-card--violet i  { color: #6366f1; }
.biz-driver-card--amber i   { color: #d97706; }
.biz-driver-card span { font-size: 0.65rem; color: #64748b; display: block; text-transform: uppercase; letter-spacing: 0.06em; }
.biz-driver-card strong { display: block; margin-top: 0.2rem; font-size: 0.95rem; }
.biz-driver-card i { position: absolute; right: 0.5rem; top: 0.55rem; font-size: 0.95rem; color: var(--primary); }
.biz-funnel { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1rem; }
.biz-funnel-step { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0.15rem 0.5rem; align-items: center; }
.biz-funnel-bar { grid-column: 1 / -1; height: 8px; background: var(--primary); border-radius: 99px; min-width: 8px; opacity: 0.85; }
.biz-funnel-label { font-size: 0.75rem; font-weight: 600; }
.biz-funnel-val { font-size: 0.6875rem; color: var(--text-muted); }
.biz-segment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
.biz-segment-card { padding: 0.85rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; position: relative; padding-left: 1.5rem; }
.biz-segment-dot { position: absolute; left: 0.65rem; top: 1rem; width: 8px; height: 8px; border-radius: 50%; }
.biz-segment-count { font-size: 1.25rem; font-weight: 800; display: block; }
.biz-segment-card p { font-size: 0.6875rem; color: #64748b; margin: 0.25rem 0 0; }
.biz-report-card { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--gray-200); border-radius: 12px; background: var(--gray-50); margin-bottom: 1rem; }
.biz-report-card__icon { font-size: 2rem; color: var(--primary); }
.biz-insight-list { list-style: none; margin: 0; padding: 0; font-size: 0.75rem; }
.biz-insight-list li { display: flex; gap: 0.4rem; padding: 0.35rem 0; border-bottom: 1px solid var(--gray-100); }
.biz-table-wrap { margin-bottom: 1rem; }

[data-theme="dark"] .insights-page .biz-health-card,
[data-theme="dark"] .insights-page .biz-alert-card,
[data-theme="dark"] .insights-page .biz-source-card,
[data-theme="dark"] .insights-page .biz-rec-item,
[data-theme="dark"] .insights-page .biz-driver-card,
[data-theme="dark"] .insights-page .biz-segment-card {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: none;
}
[data-theme="dark"] .insights-page .biz-health-ring { background: conic-gradient(var(--primary) calc(var(--health) * 1%), #334155 0); }
[data-theme="dark"] .insights-page .biz-health-ring::before { background: #0f172a; }
[data-theme="dark"] .insights-page .biz-health-value,
[data-theme="dark"] .insights-page .biz-health-title,
[data-theme="dark"] .insights-page .biz-alert-card strong,
[data-theme="dark"] .insights-page .biz-rec-item strong,
[data-theme="dark"] .insights-page .biz-driver-card strong,
[data-theme="dark"] .insights-page .biz-segment-count {
    color: #f8fafc;
}
[data-theme="dark"] .insights-page .biz-health-desc,
[data-theme="dark"] .insights-page .biz-alert-card p,
[data-theme="dark"] .insights-page .biz-rec-item p,
[data-theme="dark"] .insights-page .biz-driver-card span,
[data-theme="dark"] .insights-page .biz-segment-card p {
    color: #ffffff !important;
    opacity: 0.88;
}
[data-theme="dark"] .insights-page .biz-health-badge {
    background: rgba(58, 175, 169, 0.22);
    color: #ffffff !important;
}
[data-theme="dark"] .insights-page .biz-source-badge--connect {
    background: #1e293b;
    color: #94a3b8;
}
[data-theme="dark"] .insights-page .biz-source-badge--live {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

/* Force bright text across Insights in dark mode */
[data-theme="dark"] .insights-page,
[data-theme="dark"] .insights-page h1,
[data-theme="dark"] .insights-page h2,
[data-theme="dark"] .insights-page h3,
[data-theme="dark"] .insights-page h4,
[data-theme="dark"] .insights-page h5,
[data-theme="dark"] .insights-page h6,
[data-theme="dark"] .insights-page p,
[data-theme="dark"] .insights-page span,
[data-theme="dark"] .insights-page strong,
[data-theme="dark"] .insights-page small,
[data-theme="dark"] .insights-page li,
[data-theme="dark"] .insights-page a,
[data-theme="dark"] .insights-page td,
[data-theme="dark"] .insights-page th,
[data-theme="dark"] .insights-page label {
    color: #ffffff !important;
}
[data-theme="dark"] .insights-page .biz-kpi--teal .biz-kpi-export-action { color: var(--primary-bright) !important; }
[data-theme="dark"] .insights-page .biz-kpi--blue .biz-kpi-export-action { color: #93c5fd !important; }
[data-theme="dark"] .insights-page .biz-kpi--green .biz-kpi-export-action { color: #6ee7b7 !important; }
[data-theme="dark"] .insights-page .biz-kpi--violet .biz-kpi-export-action { color: #c4b5fd !important; }
@media (max-width: 991px) {
    .biz-hub-top { grid-template-columns: 1fr; }
    .biz-ai-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
    .biz-ai-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

