:root {
    --app-bg: #f8fafc;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-500: #2563eb;
    --brand-600: #1d4ed8;
    --brand-700: #1e40af;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --sidebar-width: 244px;
    --topbar-height: 64px;
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, .05);
    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body.admin-app {
    min-height: 100vh;
    margin: 0;
    background: var(--app-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
}

.admin-app :where(a),
.auth-app :where(a) {
    color: var(--brand-600);
    text-decoration: none;
}

.admin-app :where(a:hover),
.auth-app :where(a:hover) {
    color: var(--brand-700);
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    background: var(--app-bg);
}

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
}

.app-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    color: var(--text-primary);
    font-weight: 700;
}

.app-brand-mark {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--brand-600);
    color: #fff;
    font-weight: 800;
}

.app-brand-logo {
    width: auto;
    height: 34px;
    max-width: 132px;
    object-fit: contain;
}

.app-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 18px;
}

.app-nav-section {
    margin-top: 26px;
}

.app-nav-section:first-child {
    margin-top: 0;
}

.app-nav-label {
    padding: 0 8px 10px;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.app-nav-item {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.2;
}

.app-nav-item:hover {
    border-color: var(--border);
    background: var(--surface-hover);
    color: var(--text-primary);
}

.app-nav-item.is-active {
    border-color: var(--brand-100);
    background: linear-gradient(90deg, var(--brand-100), var(--brand-50));
    color: var(--brand-700);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--brand-600), 0 1px 2px rgba(37, 99, 235, .08);
}

.app-nav-item.is-active .app-nav-icon {
    color: var(--brand-600);
}

.app-nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.app-sidebar-footer {
    margin: 0 14px 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.app-search {
    width: min(370px, 100%);
    position: relative;
}

.app-search input {
    width: 100%;
    height: 40px;
    padding: 0 42px 0 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.app-search input:focus,
.form-control:focus,
.custom-select:focus,
.page-link:focus,
.btn:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.app-search .app-nav-icon {
    position: absolute;
    left: 12px;
    top: 10px;
    color: var(--text-muted);
}

.app-search-kbd {
    position: absolute;
    right: 8px;
    top: 9px;
    min-width: 24px;
    height: 20px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.app-icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.app-icon-btn:hover,
.app-icon-btn[aria-expanded="true"] {
    border-color: var(--border);
    background: var(--surface-hover);
    color: var(--text-primary);
}

.app-user {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.app-user:hover,
.app-user[aria-expanded="true"] {
    background: var(--surface-hover);
}

.app-avatar {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 12px;
    font-weight: 700;
}

.app-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.app-user-name {
    max-width: 126px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user-role {
    color: var(--text-secondary);
    font-size: 12px;
}

.app-user .app-nav-icon {
    margin-left: auto;
    width: 16px;
    height: 16px;
    flex-basis: 16px;
}

.app-content {
    width: 100%;
    padding: 32px 36px;
}

.app-content-inner {
    width: 100%;
}

.site-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: auto;
    padding: 18px 36px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .72);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.site-footer-financing {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.site-footer-financing img {
    display: block;
    max-width: min(360px, 42vw);
    max-height: 44px;
    object-fit: contain;
}

.app-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.app-page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--brand-600);
    font-size: 13px;
    font-weight: 600;
}

.app-page-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
}

.app-page-description {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.app-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.app-flashes {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.alert {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
}

.alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.alert-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.alert-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.card,
.app-card,
.metric-card,
.resource-table,
.form-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.card {
    margin-bottom: 18px;
}

.card-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.card-title,
.section-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 650;
}

.card-body {
    padding: 20px;
}

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    box-shadow: none;
    text-decoration: none;
    cursor: pointer;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
}

.btn .app-nav-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
}

.btn-primary {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

body.admin-app a.btn-primary,
body.auth-app a.btn-primary {
    color: #fff;
}

.btn-primary:hover {
    border-color: var(--brand-700);
    background: var(--brand-700);
    color: #fff;
}

body.admin-app a.btn-primary:hover,
body.auth-app a.btn-primary:hover {
    color: #fff;
}

.btn-secondary,
.btn-outline-secondary,
.btn-info,
.btn-warning,
.btn-success {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
}

body.admin-app a.btn-secondary,
body.admin-app a.btn-outline-secondary,
body.admin-app a.btn-info,
body.admin-app a.btn-warning,
body.admin-app a.btn-success,
body.auth-app a.btn-secondary,
body.auth-app a.btn-outline-secondary,
body.auth-app a.btn-info,
body.auth-app a.btn-warning,
body.auth-app a.btn-success {
    color: var(--text-primary);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-success:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    border-color: #b91c1c;
    background: #b91c1c;
    color: #fff;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.action-icon {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    position: relative;
    padding: 0;
}

.action-icon .app-nav-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
}

.action-icon-edit {
    border-color: var(--brand-100);
    background: var(--brand-50);
    color: var(--brand-700);
}

.action-icon-edit:hover {
    border-color: var(--brand-500);
    background: var(--brand-100);
    color: var(--brand-700);
}

.action-icon[data-tooltip]::after,
.action-icon[data-tooltip]::before {
    position: absolute;
    left: 50%;
    z-index: 1200;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity .12s ease, transform .12s ease;
}

.action-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
}

.action-icon[data-tooltip]::before {
    content: "";
    bottom: calc(100% + 3px);
    border: 5px solid transparent;
    border-top-color: #0f172a;
}

.action-icon[data-tooltip]:hover::after,
.action-icon[data-tooltip]:hover::before,
.action-icon[data-tooltip]:focus-visible::after,
.action-icon[data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

.table-responsive,
.resource-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.table,
table.dataTable {
    width: 100% !important;
    min-width: 780px;
    margin: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    color: var(--text-primary);
    table-layout: auto;
}

.table th,
.table td,
table.dataTable th,
table.dataTable td {
    text-align: left;
}

.table thead th,
table.dataTable thead th {
    height: 48px;
    padding: 0 18px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: none;
    white-space: nowrap;
}

.table tbody td,
table.dataTable tbody td {
    height: 56px;
    padding: 0 18px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table thead th:first-child,
.table tbody td:first-child,
table.dataTable thead th:first-child,
table.dataTable tbody td:first-child {
    padding-left: 20px;
}

.table thead th:last-child,
.table tbody td:last-child,
table.dataTable thead th:last-child,
table.dataTable tbody td:last-child {
    width: 1%;
    padding-right: 20px;
    text-align: right;
    white-space: nowrap;
}

.table tbody tr:hover,
table.dataTable tbody tr:hover {
    background: #fbfdff;
}

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

.table strong,
.resource-name {
    color: var(--text-primary);
    font-weight: 650;
}

.document-status-cell {
    min-width: 360px;
    white-space: normal;
}

.document-ingestion-error {
    display: inline-block;
    max-width: 420px;
    margin-left: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    vertical-align: middle;
}

.widget-history-table th:first-child,
.widget-history-table th:nth-child(2) {
    width: 30%;
}

.widget-history-table td:first-child,
.widget-history-table td:nth-child(2) {
    min-width: 260px;
    max-width: 460px;
    padding-top: 14px;
    padding-bottom: 14px;
    white-space: normal;
    vertical-align: top;
}

.expandable-copy {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.expandable-copy-text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.expandable-copy.is-expanded .expandable-copy-text {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.expandable-copy-toggle {
    display: inline-flex;
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand-600);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.expandable-copy-toggle:hover {
    color: var(--brand-700);
}

.text-right {
    text-align: right !important;
}

.badge,
.status-pill {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
}

.badge::before,
.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.badge-success,
.status-active {
    background: var(--success-bg);
    color: #15803d;
}

.badge-secondary,
.status-inactive,
.status-pending {
    border-color: var(--border);
    background: #f8fafc;
    color: #64748b;
}

.badge-info,
.status-processing {
    background: var(--brand-50);
    color: var(--brand-700);
}

.badge-warning,
.status-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger,
.status-failed,
.status-blocked {
    background: var(--danger-bg);
    color: var(--danger);
}

.form-shell {
    width: 100%;
}

.form-panel {
    padding: 20px;
}

.form-panel + .form-panel {
    margin-top: 16px;
}

.settings-group {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.settings-group:first-of-type {
    margin-top: 0;
}

.settings-group-summary {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
}

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

.settings-group-summary:hover {
    background: var(--surface-hover);
}

.settings-group-summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: -3px;
}

.settings-group-summary .app-nav-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: transform .16s ease;
}

.settings-group[open] .settings-group-summary {
    border-bottom: 1px solid var(--border);
}

.settings-group[open] .settings-group-summary .app-nav-icon {
    transform: rotate(180deg);
}

.settings-group-title,
.settings-group-description {
    display: block;
}

.settings-group-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.settings-group-description {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.settings-group-body {
    padding: 16px;
    background: var(--surface-subtle);
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.form-grid + .form-grid,
.form-grid + .form-group,
.form-group + .form-grid {
    margin-top: 18px;
}

.form-section-header {
    margin-bottom: 18px;
}

.form-section-header p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-group label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 650;
}

.form-control,
.custom-select {
    min-height: 42px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.35;
    box-shadow: none;
}

select.form-control,
select.custom-select {
    padding-right: 38px;
}

input[type="file"].form-control {
    min-height: 42px;
    padding: 8px 12px;
}

.color-field {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
}

.color-field input[type="color"] {
    width: 52px;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
}

.color-hex-input:invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

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

.logo-upload-card {
    display: grid;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.logo-upload-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.logo-upload-card p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.logo-preview {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.logo-preview img {
    max-width: 220px;
    max-height: 64px;
    object-fit: contain;
}

.logo-preview-login img {
    max-width: 260px;
    max-height: 76px;
}

.logo-preview-favicon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-preview-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 650;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.form-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-600);
}

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

.form-control:hover,
.custom-select:hover {
    border-color: #94a3b8;
}

.form-control:disabled,
.form-control[readonly],
.custom-select:disabled {
    background: var(--surface-subtle);
    color: var(--text-secondary);
}

.form-text,
.helper-text {
    margin-top: 6px;
    color: var(--text-secondary) !important;
    font-size: 12px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.settings-save-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.upload-preview-meta {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.form-preview,
.form-current-file {
    margin-bottom: 10px;
}

.app-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.app-table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-table-search {
    width: min(330px, 100%);
    flex: 0 1 330px;
}

.app-table-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.app-table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.app-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.page-link {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: var(--border);
    border-style: solid;
    border-width: 1px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius-md);
}

button.page-link {
    background: var(--surface);
}

.page-link:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text-primary);
}

button.page-link:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.page-link.is-current {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

.page-item.active .page-link {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

.page-item.disabled .page-link {
    color: var(--text-muted);
}

.resource-table {
    overflow: visible;
}

.selection-table {
    overflow: hidden;
}

.resource-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.resource-toolbar-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.resource-toolbar form,
.resource-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.resource-filters > * {
    flex: 0 0 auto;
}

.resource-toolbar .form-control,
.resource-toolbar .custom-select {
    min-height: 40px;
    width: auto;
    min-width: 250px;
}

.resource-toolbar .app-search,
.resource-toolbar [data-table-search] {
    width: min(340px, 100%);
    flex: 0 0 340px;
}

.resource-toolbar .app-table-actions {
    flex: 0 0 auto;
}

.check-cell {
    width: 1%;
    text-align: center;
    white-space: nowrap;
}

.check-cell input[type="checkbox"],
.check-cell input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    vertical-align: middle;
    accent-color: var(--brand-600);
    cursor: pointer;
}

.empty-cell {
    padding: 32px 20px !important;
    color: var(--text-secondary);
    text-align: center;
}

.actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: max-content;
}

.actions-cell form {
    display: inline-flex;
    margin: 0;
}

.actions-cell .btn-secondary,
.actions-cell .btn-outline-secondary {
    min-height: 34px;
    padding-inline: 11px;
    border-color: var(--border);
    background: transparent;
    color: var(--text-primary);
    font-weight: 650;
}

.actions-cell .btn-secondary:hover,
.actions-cell .btn-outline-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.actions-cell .btn-tint-blue,
.actions-cell .btn-tint-green,
.actions-cell .btn-tint-purple {
    min-height: 34px;
    padding-inline: 11px;
    font-weight: 650;
}

.btn-tint-blue {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.btn-tint-blue:hover {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e40af;
}

.btn-tint-green {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.btn-tint-green:hover {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.btn-tint-purple {
    border-color: #ddd6fe;
    background: #f5f3ff;
    color: #6d28d9;
}

.btn-tint-purple:hover {
    border-color: #c4b5fd;
    background: #ede9fe;
    color: #5b21b6;
}

/* Widget test */
.widget-test-panel {
    position: relative;
    overflow: hidden;
}

.widget-test-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.widget-test-kicker {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--brand-700);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.widget-test-hero h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1.2;
}

.widget-test-hero p {
    max-width: 620px;
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.widget-test-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.widget-test-card {
    min-height: 86px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.widget-test-card span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
}

.widget-test-card strong {
    color: var(--text-primary);
    font-size: 15px;
}

body.admin-app a.btn-tint-blue,
body.admin-app a.btn-tint-blue:hover,
body.admin-app a.btn-tint-green,
body.admin-app a.btn-tint-green:hover,
body.admin-app a.btn-tint-purple,
body.admin-app a.btn-tint-purple:hover {
    text-decoration: none;
}

.actions-cell .btn-danger {
    min-height: 34px;
    padding-inline: 11px;
}

.actions-cell .btn .app-nav-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
}

.app-dropdown {
    position: relative;
    display: inline-flex;
}

.app-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1060;
    min-width: 180px;
    display: none;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 12px 26px rgba(15, 23, 42, .12);
}

.app-user-dropdown {
    width: 100%;
}

.app-user-dropdown .app-dropdown-menu {
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 100%;
}

.app-column-dropdown .btn {
    min-height: 38px;
}

.app-dropdown.is-open .app-dropdown-menu {
    display: block;
}

.app-menu-item {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.app-menu-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.app-menu-item.is-danger {
    color: var(--danger);
}

.app-menu-item.is-danger:hover {
    background: var(--danger-bg);
}

.app-empty {
    padding: 42px 18px;
    text-align: center;
}

.dashboard-grid .app-card {
    min-width: 0;
}

.dashboard-grid .card-body {
    padding: 6px 20px;
}

.app-empty-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 12px;
    background: var(--brand-50);
    color: var(--brand-700);
}

.app-empty-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.app-empty-text {
    max-width: 420px;
    margin: 6px auto 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 16px;
}

.metric-card {
    min-height: 128px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px;
    color: var(--text-primary);
}

.metric-card:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 650;
}

.metric-value {
    margin-top: 12px;
    color: var(--text-primary);
    font-size: 31px;
    font-weight: 700;
    line-height: 1;
}

.metric-note {
    margin-top: 12px;
    color: var(--brand-600);
    font-size: 13px;
    font-weight: 650;
}

.metric-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--brand-50);
    color: var(--brand-700);
}

.metric-icon .app-nav-icon {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
}

.analytics-card {
    margin-top: 18px;
    margin-bottom: 22px;
}

.analytics-header {
    align-items: flex-start;
}

.analytics-subtitle {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.analytics-filters {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.analytics-filters label {
    min-width: 138px;
    display: grid;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
}

.analytics-filters .form-control {
    min-height: 38px;
}

.analytics-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
}

.analytics-kpi {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.analytics-kpi span,
.analytics-panel h3,
.feedback-breakdown span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.analytics-kpi strong {
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
}

.analytics-kpi small {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.analytics-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
    align-items: start;
    gap: 14px;
    margin-top: 16px;
}

.analytics-panel {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.analytics-panel-header {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.analytics-panel h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
}

.analytics-category-search {
    width: min(220px, 48%);
    position: relative;
    flex: 0 1 220px;
}

.analytics-category-search .app-nav-icon {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.analytics-category-search input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.analytics-category-search input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.analytics-ranking {
    height: 232px;
    display: grid;
    align-content: start;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.analytics-ranking-row,
.feedback-breakdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.analytics-ranking-row {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-secondary);
    font-size: 13px;
}

.analytics-ranking-row strong,
.feedback-breakdown strong {
    color: var(--text-primary);
}

.feedback-breakdown {
    align-items: stretch;
}

.feedback-breakdown > div {
    flex: 1;
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}

.feedback-breakdown strong {
    font-size: 22px;
}

.analytics-empty {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr);
    align-items: start;
    gap: 18px;
    margin-top: 18px;
}

.platform-status-card {
    align-self: start;
}

.platform-status-card .card-body {
    padding: 16px;
}

.activity-list,
.status-list {
    display: grid;
}

.activity-list {
    gap: 6px;
}

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

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.status-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.activity-list .activity-item {
    min-height: 64px;
    padding: 12px 10px;
    border-bottom: 0;
    border-radius: var(--radius-md);
}

a.activity-item {
    color: var(--text-primary);
}

a.activity-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

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

.activity-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.activity-copy {
    display: grid;
    gap: 3px;
}

.status-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-item-meta {
    margin-top: 12px;
}

.activity-title,
.status-name {
    display: block;
    color: var(--text-primary);
    font-weight: 650;
    font-size: 14px;
}

.activity-meta,
.status-meta,
.status-checked,
.status-value {
    color: var(--text-secondary);
    font-size: 13px;
}

.status-value {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-weight: 650;
    line-height: 1;
}

.status-meta,
.status-checked {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.status-checked {
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 7px;
    border-radius: 999px;
    background: currentColor;
}

.status-value.status-ok {
    color: var(--success);
}

.status-value.status-down {
    color: var(--danger);
}

@media (max-width: 640px) {
    .status-list {
        grid-template-columns: 1fr;
    }
}

.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 22px 48px rgba(15, 23, 42, .22);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .42);
}

.modal.show {
    display: flex !important;
}

.modal-dialog {
    width: min(100%, 760px);
    margin: 0;
}

.modal-lg {
    width: min(100%, 860px);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid;
    border-color: var(--border);
}

.modal-footer {
    border-top: 1px solid var(--border);
    border-bottom: 0;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    padding: 18px;
}

.close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

body.modal-open {
    overflow: hidden;
}

.modal-body textarea.form-control {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.d-inline {
    display: inline;
}

.d-flex {
    display: flex;
}

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

.justify-content-between {
    justify-content: space-between;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-2 {
    margin-bottom: 8px !important;
}

.mb-3 {
    margin-bottom: 12px !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

.mt-2 {
    margin-top: 8px !important;
}

.ml-2 {
    margin-left: 8px !important;
}

.mr-2 {
    margin-right: 8px !important;
}

.m-3 {
    margin: 12px !important;
}

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

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

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

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

    .app-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        transform: none;
    }

    .app-content {
        padding: 22px 16px;
    }

    .site-footer-bar {
        padding: 16px;
    }

    .app-page-header {
        flex-direction: column;
    }

    .app-page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .app-search-kbd {
        display: none;
    }

    .form-grid-2,
    .logo-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .app-table-toolbar,
    .app-table-footer,
    .resource-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .app-table-pagination {
        justify-content: flex-start;
    }

    .resource-toolbar-main,
    .resource-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .resource-toolbar .form-control,
    .resource-toolbar .custom-select,
    .resource-toolbar .app-search,
    .resource-toolbar [data-table-search] {
        width: 100%;
        min-width: 0;
        flex-basis: auto;
    }

    .site-footer-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-footer-financing {
        justify-content: flex-start;
        width: 100%;
    }

    .site-footer-financing img {
        max-width: 100%;
    }
}

.auth-app {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: min(100%, 420px);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.auth-logo {
    width: min(360px, 64vw);
    height: auto;
    max-height: 96px;
    object-fit: contain;
    margin-bottom: 28px;
}

.auth-header {
    margin-bottom: 22px;
    text-align: center;
}

.auth-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
}

.auth-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
}

.auth-form {
    display: grid;
    gap: 2px;
    margin-top: 18px;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 2px 0 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.auth-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-600);
}

.btn-block {
    width: 100%;
}

.auth-alt {
    margin: 18px 0 0;
    color: var(--text-secondary);
    text-align: center;
}

.auth-alt a {
    font-weight: 650;
}

.auth-financing {
    width: min(100%, 520px);
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.auth-financing img {
    max-width: 100%;
    max-height: 86px;
    object-fit: contain;
}

.auth-app .login-box,
.auth-app .register-box {
    width: min(100%, 420px);
    margin: 0 auto;
    padding: 96px 24px 32px;
}

.auth-app .login-logo {
    margin-bottom: 20px;
    text-align: center;
}

.auth-app .login-logo img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.auth-app .card-outline,
.auth-app .card-primary {
    border-top: 1px solid var(--border);
}

.auth-app .login-box-msg {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.auth-app .input-group {
    display: flex;
    align-items: stretch;
}

.auth-app .input-group .form-control {
    min-width: 0;
    border-radius: var(--radius-md);
}

.auth-app .input-group-append,
.auth-app .input-group-text {
    display: none;
}

.auth-app .row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-app .col-4,
.auth-app .col-8,
.auth-app .col-12 {
    flex: 1 1 100%;
}

.auth-app .icheck-primary {
    display: flex;
    align-items: center;
    min-height: 38px;
}

.auth-app .icheck-primary label {
    margin-left: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.auth-app .social-auth-links {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.auth-app .card-body p:last-child {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .auth-shell {
        padding: 24px 16px;
    }

    .auth-card {
        padding: 24px;
    }
}
