body {
    background: #f5f7fb;
    color: #1f2937;
}

.fts-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.fts-sidebar {
    background: linear-gradient(180deg, #0b1220, #111827);
    color: #fff;
    padding: 1.25rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.fts-brand {
    margin-bottom: 1.2rem;
    justify-content: center;
}

.fts-logo {
    width: 48px;
    max-width: 100%;
    display: block;
    height: auto;
    object-fit: contain;
}

.fts-sidebar .nav-link {
    color: #d1d5db;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 500;
}

.fts-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.fts-sidebar .nav-link.active {
    color: #fff;
    background: rgba(37, 99, 235, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.fts-main {
    padding: 1.5rem 1.8rem;
}

.login-page {
    position: relative;
    overflow: hidden;
    background: url('/project_theme/img/sfondo.png?v=login05') center center / cover no-repeat fixed !important;
}

.login-page::before,
.login-page::after {
    content: none;
    position: fixed;
    border-radius: 999px;
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

.login-page::before {
    width: 420px;
    height: 420px;
    left: -120px;
    top: -90px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.35) 0%, rgba(34, 211, 238, 0.02) 72%);
    animation: login-float-1 14s ease-in-out infinite;
}

.login-page::after {
    width: 360px;
    height: 360px;
    right: -90px;
    bottom: -80px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.28) 0%, rgba(59, 130, 246, 0.03) 74%);
    animation: login-float-2 16s ease-in-out infinite;
}

@keyframes login-float-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(28px, 22px) scale(1.05); }
}

@keyframes login-float-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-24px, -20px) scale(1.06); }
}

.login-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    flex-direction: column;
    gap: 1.1rem;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-logo {
    width: 260px;
    max-width: 80vw;
    filter: drop-shadow(0 8px 18px rgba(2, 6, 23, 0.6));
}

.login-inline-logo {
    width: 72px;
    height: auto;
    display: block;
    margin: 0 auto 0.55rem;
    filter: brightness(0) contrast(1.05);
}

.auth-wrap {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    border-radius: 20px;
    box-shadow: 0 20px 52px rgba(2, 6, 23, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(7px);
}

.kpi-card {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.dashboard-hero {
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem 1.1rem;
}

.dashboard-kpi .display-6 {
    font-size: 2rem;
    font-weight: 700;
}

.dashboard-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #e5e7eb;
    padding: 0.45rem 0;
}

.dashboard-stat-row:last-child {
    border-bottom: 0;
}

.dashboard-list-row {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
    border-bottom: 1px solid #eef2f7;
    padding: 0.42rem 0;
    font-size: 0.93rem;
}

.dashboard-list-row:last-child {
    border-bottom: 0;
}

.dashboard-list-row small {
    color: #64748b;
    white-space: nowrap;
}

.ag-theme-quartz {
    --ag-border-color: #e5e7eb;
    --ag-header-background-color: #f9fafb;
    --ag-row-hover-color: #eff6ff;
    --ag-odd-row-background-color: #fcfdff;
    --ag-selected-row-background-color: #dbeafe;
    --ag-input-focus-border-color: #3b82f6;
    --ag-font-size: 13px;
    --ag-border-radius: 12px;
    --ag-font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.fts-grid {
    border: 1px solid #e6e9ef;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.modern-grid .ag-header {
    border-bottom: 1px solid #e6e9ef;
}

.modern-grid .ag-header-cell-label {
    font-weight: 600;
    color: #334155;
}

.modern-grid .ag-floating-filter,
.modern-grid .ag-filter-body-wrapper {
    background: #f8fafc;
}

.template-help {
    border: 1px dashed #bfdbfe;
    background: #eff6ff;
    border-radius: 10px;
    padding: 0.75rem;
}

.simple-rich-editor {
    min-height: 160px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.75rem;
    background: #fff;
    line-height: 1.5;
}

.simple-rich-editor:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.18);
}

.fts-card {
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.07);
    border: 0;
}

.fts-form-card {
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.fp-page-card .card-body {
    padding: 1.25rem;
}

.fp-page-title {
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #e7edf6;
}

.fp-section {
    border: 1px solid #dbe5f0;
    border-radius: 12px;
    background: #f8fbff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    padding: 0.9rem;
}

.fp-section-head {
    background: linear-gradient(180deg, #f5f9ff, #f8fbff);
}

.fp-section-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1d4ed8;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.2rem 0.58rem;
    margin-bottom: 0.75rem;
}

.fp-section-header {
    border-bottom: 1px dashed #cfdced;
    padding-bottom: 0.5rem;
    margin-bottom: 0.85rem;
}

.fp-section-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #1e3a8a;
}

.fp-section .table-responsive {
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    background: #ffffff;
    padding: 0.35rem;
}

.ts-wrapper.form-select,
.ts-wrapper.single.input-active {
    padding: 0;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    min-height: 38px;
    background: #ffffff;
}

.ts-wrapper .ts-control {
    border: 0;
    box-shadow: none;
    padding: 0.35rem 0.6rem;
    min-height: 36px;
    background: #ffffff;
}

.ts-wrapper .ts-dropdown {
    border-color: #d1d9e6;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    background: #ffffff;
    z-index: 3200;
}

.ts-dropdown {
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    background: #ffffff;
    z-index: 4000 !important;
}

.ts-wrapper.dropdown-active {
    z-index: 3200;
}

.ts-dropdown .dropdown-input {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.45rem 0.55rem;
    background: #ffffff;
}

.ts-dropdown .dropdown-input > input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
}

.ts-dropdown .ts-dropdown-content {
    background: #ffffff;
}

.compact-form .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: #475569;
}

.compact-form .form-control,
.compact-form .form-select {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    min-height: 34px;
}

.fts-flash {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 0.85rem 1rem;
}

.fts-flash-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.fts-flash-content {
    min-width: 0;
}

.fts-flash-title {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.fts-flash-message {
    font-size: 0.92rem;
}

.fts-flash-error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.fts-flash-error .fts-flash-icon {
    background: #fee2e2;
    color: #b91c1c;
}

.fts-flash-success {
    color: #0c4a6e;
    background: #e0f2fe;
    border-color: #bae6fd;
}

.fts-flash-success .fts-flash-icon {
    background: #bae6fd;
    color: #0369a1;
}

.fts-flash-guard {
    border-left: 5px solid #dc2626;
}

.fts-grid-menu {
    position: fixed;
    z-index: 9999;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #dbe4f1;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
    padding: 0.35rem;
}

.fts-grid-menu-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    color: #1f2937;
    font-size: 0.88rem;
}

.fts-grid-menu-item:hover:not(:disabled) {
    background: #eef2ff;
}

.fts-grid-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body[data-bs-theme="dark"] {
    background: #0b1220;
    color: #dbe4f1;
}

body[data-bs-theme="dark"] .fts-main {
    background: #0b1220;
}

body[data-bs-theme="dark"] .dashboard-hero {
    background: linear-gradient(135deg, #111827, #1f2937);
    border-color: #334155;
}

body[data-bs-theme="dark"] .dashboard-stat-row {
    border-bottom-color: #334155;
}

body[data-bs-theme="dark"] .dashboard-list-row {
    border-bottom-color: #263447;
}

body[data-bs-theme="dark"] .dashboard-list-row small {
    color: #94a3b8;
}

body[data-bs-theme="dark"] .card,
body[data-bs-theme="dark"] .auth-card {
    background: #111827;
    color: #e5e7eb;
}

body[data-bs-theme="dark"] .text-muted,
body[data-bs-theme="dark"] .text-secondary {
    color: #9ca3af !important;
}

body[data-bs-theme="dark"] .breadcrumb-item a {
    color: #93c5fd;
}

body[data-bs-theme="dark"] .fts-grid {
    border-color: #253043;
    background: #111827;
}

body[data-bs-theme="dark"] .fts-form-card {
    border-color: #334155;
}

body[data-bs-theme="dark"] .fp-page-title {
    border-bottom-color: #334155;
}

body[data-bs-theme="dark"] .fp-section {
    border-color: #334155;
    background: #0f172a;
    box-shadow: none;
}

body[data-bs-theme="dark"] .fp-section-head {
    background: linear-gradient(180deg, #0f172a, #111827);
}

body[data-bs-theme="dark"] .fp-section-label {
    color: #bfdbfe;
    background: #1e3a8a;
    border-color: #1d4ed8;
}

body[data-bs-theme="dark"] .fp-section-header {
    border-bottom-color: #334155;
}

body[data-bs-theme="dark"] .fp-section-heading {
    color: #bfdbfe;
}

body[data-bs-theme="dark"] .fp-section .table-responsive {
    border-color: #334155;
    background: #111827;
}

body[data-bs-theme="dark"] .ts-wrapper.form-select,
body[data-bs-theme="dark"] .ts-wrapper.single.input-active {
    border-color: #334155;
    background: #0f172a;
}

body[data-bs-theme="dark"] .ts-wrapper .ts-control,
body[data-bs-theme="dark"] .ts-wrapper.single .ts-control {
    color: #e5e7eb;
    background: #0f172a;
}

body[data-bs-theme="dark"] .ts-wrapper .ts-dropdown {
    background: #0f172a;
    border-color: #334155;
}

body[data-bs-theme="dark"] .ts-dropdown {
    background: #0f172a;
    border-color: #334155;
}

body[data-bs-theme="dark"] .ts-dropdown .dropdown-input {
    border-bottom-color: #334155;
    background: #0f172a;
    color: #e5e7eb;
}

body[data-bs-theme="dark"] .ts-dropdown .ts-dropdown-content {
    background: #0f172a;
}

body[data-bs-theme="dark"] .modern-grid .ag-header,
body[data-bs-theme="dark"] .modern-grid .ag-floating-filter,
body[data-bs-theme="dark"] .modern-grid .ag-filter-body-wrapper {
    background: #1f2937;
}

body[data-bs-theme="dark"] .template-help {
    border-color: #334155;
    background: #1f2937;
}

body[data-bs-theme="dark"] .simple-rich-editor {
    border-color: #334155;
    background: #111827;
    color: #e5e7eb;
}

body[data-bs-theme="dark"] .fts-flash-error {
    color: #fecaca;
    background: #3f1d1d;
    border-color: #7f1d1d;
}

body[data-bs-theme="dark"] .fts-flash-error .fts-flash-icon {
    background: #7f1d1d;
    color: #fecaca;
}

body[data-bs-theme="dark"] .fts-flash-success {
    color: #bae6fd;
    background: #082f49;
    border-color: #0c4a6e;
}

body[data-bs-theme="dark"] .fts-flash-success .fts-flash-icon {
    background: #0c4a6e;
    color: #7dd3fc;
}

body[data-bs-theme="dark"] .fts-grid-menu {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 10px 26px rgba(2, 6, 23, 0.5);
}

body[data-bs-theme="dark"] .fts-grid-menu-item {
    color: #e5e7eb;
}

body[data-bs-theme="dark"] .fts-grid-menu-item:hover:not(:disabled) {
    background: #1f2937;
}
