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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb !important; /* gray-50 */
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
    font-size: 0.85rem;
}

:root {
    /* Bilanciare brand palette, extracted from the production logo. */
    --brand-navy: #0a2f4d;
    --brand-navy-rgb: 10, 47, 77;
    --brand-teal: #5bc3bd;
    --brand-teal-rgb: 91, 195, 189;
    --brand-teal-mid: #49abb3;
    --brand-action: #0f7478;
    --brand-action-rgb: 15, 116, 120;
    --brand-action-hover: #0b6266;
    --brand-slate: #51657c;
    --brand-light: #9cc3c9;
    --brand-soft: #d2e5e7;
    --brand-surface: #f3f9f9;
    --app-topbar-height: 62px;

    --brand-secondary-action: var(--brand-teal);
    --brand-secondary-action-hover: var(--brand-teal);
    --brand-secondary-action-rgb: var(--brand-teal-rgb);

    /* Bootstrap semantic primary follows the accessible brand action color. */
    --bs-primary: var(--brand-action);
    --bs-primary-rgb: var(--brand-action-rgb);
    --bs-link-color: var(--brand-action);
    --bs-link-color-rgb: var(--brand-action-rgb);
    --bs-link-hover-color: var(--brand-navy);
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.card-title {
    color: var(--brand-navy);
}

/* ================================
   BOTTONI
================================ */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem; /* rounded-md */
    transition: all 0.15s ease;
}
.btn-primary { background-color: var(--brand-action); border-color: var(--brand-action); color: white; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.btn-primary:hover { background-color: var(--brand-action-hover); border-color: var(--brand-action-hover); }

.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    background-color: var(--brand-action-hover) !important;
    border-color: var(--brand-action-hover) !important;
    box-shadow: 0 0 0 .22rem rgba(var(--brand-action-rgb), .18) !important;
}

.btn-secondary {
    background-color: var(--brand-secondary-action);
    border-color: var(--brand-secondary-action);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background-color: var(--brand-secondary-action-hover);
    border-color: var(--brand-secondary-action-hover);
    color: white;
}

.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary.active,
.show > .btn-secondary.dropdown-toggle {
    background-color: var(--brand-secondary-action-hover) !important;
    border-color: var(--brand-secondary-action-hover) !important;
    color: white !important;
    box-shadow: 0 0 0 .22rem rgba(var(--brand-secondary-action-rgb), .18) !important;
}

.btn-outline-primary {
    color: var(--brand-action);
    border-color: var(--brand-action);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
    color: #fff;
    background-color: var(--brand-action);
    border-color: var(--brand-action);
}
.text-primary { color: var(--brand-action) !important; }
.bg-primary { background-color: var(--brand-action) !important; }
.border-primary { border-color: var(--brand-action) !important; }
a { color: var(--brand-action); }
a:hover { color: var(--brand-navy); }

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-action-rgb), .13);
}
.form-check-input:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-action-rgb), .13);
}
.form-check-input:checked {
    background-color: var(--brand-action);
    border-color: var(--brand-action);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--brand-action);
}
.dropdown-item.active,
.dropdown-item:active,
.list-group-item.active {
    background-color: var(--brand-action);
    border-color: var(--brand-action);
}
.progress-bar { background-color: var(--brand-action); }
.active > .page-link,
.page-link.active {
    background-color: var(--brand-action);
    border-color: var(--brand-action);
}
.accordion-button:not(.collapsed) {
    color: var(--brand-navy);
    background-color: var(--brand-surface);
    box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--brand-soft);
}
::selection { background: rgba(var(--brand-teal-rgb), .35); color: var(--brand-navy); }
.page-link { color: var(--brand-action); }
.page-link:hover { color: var(--brand-navy); }
.page-link:focus { box-shadow: 0 0 0 .2rem rgba(var(--brand-action-rgb), .13); }
.btn-white { background-color: #ffffff; border: 1px solid #d1d5db; color: #374151; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.btn-white:hover { background-color: #f9fafb; color: #111827; }

/* ================================
   CARDS E CONTENITORI
================================ */
.card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb !important; /* gray-200 */
    border-radius: 0.5rem !important; /* rounded-lg */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1) !important;
}
.card-body { padding: 1.25rem; }
.card-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0.75rem 1.25rem;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
/* ================================
   APP UX SYSTEM
================================ */
body.app-shell {
    margin: 0;
    background: #f4f6fb !important;
    color: #111827;
    overflow: hidden;
}

.app-frame { background: #f4f6fb; }
.app-sidebar {
    width: 286px;
    min-width: 286px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
}
.app-mobile-sidebar { width: 286px !important; }
.app-sidebar-inner { background: #ffffff; }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: var(--app-topbar-height);
    padding: .5rem 1.1rem;
    border-bottom: 1px solid #edf0f5;
    color: #111827;
    text-decoration: none;
}
.sidebar-brand:hover { color: #111827; background: #f8fafc; }
.brand-icon {
    width: 50px;
    height: 38px;
    border-radius: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #dbe7e8;
    box-shadow: 0 8px 20px rgba(7, 47, 67, .1);
    padding: .2rem;
    flex: 0 0 auto;
}
.brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { display: block; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.brand-subtitle { display: block; color: #6b7280; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-top: .15rem; }
.tenant-switcher {
    padding: .95rem 1.05rem;
    border-bottom: 1px solid #edf0f5;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.sidebar-nav { padding: .8rem .8rem 1rem; }
.sidebar-section-label {
    color: #94a3b8;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .105em;
    font-weight: 800;
    margin: 1.05rem .55rem .35rem;
}
.sidebar-nav .sidebar-section-label:first-child { margin-top: .25rem; }
.sidebar-section { margin: 0; }
.sidebar-section > .sidebar-section-label {
    cursor: default;
    user-select: none;
}
.sidebar-nav > .sidebar-section:first-child > .sidebar-section-label { margin-top: .25rem; }
.sidebar-link {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .56rem .65rem;
    margin-bottom: .16rem;
    color: #334155;
    text-decoration: none;
    border-radius: .65rem;
    font-weight: 600;
    line-height: 1.15;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.sidebar-link i { width: 20px; text-align: center; color: #64748b; font-size: 1rem; flex: 0 0 auto; }
.sidebar-link span:not(.sidebar-badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link:hover { background: #f1f5f9; color: #111827; transform: translateX(1px); }
.sidebar-link:hover i { color: var(--brand-action); }
.sidebar-link.active {
    background: var(--brand-action);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(var(--brand-action-rgb), .16);
}
.sidebar-link.active i { color: #ffffff; }
.sidebar-link.important:not(.active) {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.sidebar-link.important:not(.active) i { color: #ea580c; }
.sidebar-link.sub-link {
    margin-left: 1rem;
    min-height: 34px;
    padding-top: .45rem;
    padding-bottom: .45rem;
    font-size: .8rem;
    font-weight: 600;
}
.sidebar-badge {
    margin-left: auto;
    min-width: 1.45rem;
    height: 1.45rem;
    padding: 0 .4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #334155;
    font-size: .72rem;
    font-weight: 800;
}
.sidebar-badge.warning { background: #f59e0b; color: #111827; }
.sidebar-footer { border-top: 1px solid #edf0f5; padding: .75rem .9rem; background: #fbfdff; }
.sidebar-help-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #475569;
    text-decoration: none;
    font-weight: 700;
    border-radius: .65rem;
    padding: .55rem .65rem;
}
.sidebar-help-link:hover { background: #f1f5f9; color: #111827; }

.app-main { background: #f4f6fb; }
.app-topbar {
    min-height: var(--app-topbar-height);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .42rem 1.35rem;
    z-index: 10;
}
.app-breadcrumb { font-size: .78rem; margin-top: .15rem; }
.app-breadcrumb a { color: #64748b; text-decoration: none; font-weight: 600; }
.app-breadcrumb a:hover { color: var(--brand-action); }
.app-content { padding: 1.35rem; }
.app-icon-button { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: .75rem; }
.min-w-0 { min-width: 0; }


.app-topbar-year {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 40px;
}
.app-topbar-year-label {
    margin: 0;
    color: #334155;
    font-size: .88rem;
    font-weight: 800;
}
.app-topbar-year-select {
    width: 86px;
    min-height: 38px;
    border: 0;
    border-radius: .7rem;
    background-color: #f1f5f9;
    color: #0f172a;
    font-weight: 800;
    box-shadow: none !important;
}
.app-topbar-year-select:focus {
    background-color: #ffffff;
    box-shadow: 0 0 0 .2rem rgba(var(--brand-action-rgb), .13) !important;
}
.app-topbar-actions { margin-left: auto; }
.app-topbar-icon-button {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    padding: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.app-topbar-icon-button:hover,
.app-topbar-icon-button:focus {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: var(--brand-action);
}
.app-topbar-icon-button::after { display: none !important; }
.app-topbar-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .28rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #f59e0b;
    color: #111827;
    font-size: .66rem;
    font-weight: 900;
    line-height: 1;
}
.app-notification-menu {
    width: min(420px, calc(100vw - 24px));
    margin-top: .7rem !important;
    overflow: hidden;
    border-radius: .9rem;
}
.app-notification-header,
.app-notification-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    background: #ffffff;
}
.app-notification-header { border-bottom: 1px solid #e5e7eb; }
.app-notification-footer {
    justify-content: center;
    border-top: 1px solid #e5e7eb;
    font-size: .84rem;
}
.app-notification-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 .8rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}
.app-notification-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .7rem .5rem .62rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: #64748b;
    font-size: .8rem;
    font-weight: 750;
}
.app-notification-tabs .nav-link:hover { color: var(--brand-action); }
.app-notification-tabs .nav-link.active {
    border-bottom-color: var(--brand-action);
    background: transparent;
    color: var(--brand-action);
}
.app-notification-tab-count {
    min-width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .28rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: .66rem;
    font-weight: 900;
}
.app-notification-tab-count.warning { background: #ffedd5; color: #c2410c; }
.app-notification-list {
    max-height: min(510px, calc(100vh - 180px));
    overflow-y: auto;
    background: #ffffff;
}
.app-notification-item {
    width: 100%;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 18px;
    gap: .7rem;
    align-items: start;
    padding: .8rem 1rem;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    color: #0f172a;
    text-align: left;
}
.app-notification-item:hover { background: #f8fafc; }
.app-notification-item.is-unread { background: var(--brand-surface); }
.app-notification-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--brand-surface);
    color: var(--brand-action);
    font-size: .95rem;
}
.app-notification-icon.warning { background: #fff7ed; color: #ea580c; }
.app-notification-icon.danger { background: #fef2f2; color: #dc2626; }
.app-notification-copy { min-width: 0; display: block; }
.app-notification-title,
.app-notification-message,
.app-notification-date { display: block; }
.app-notification-title { font-size: .86rem; font-weight: 800; line-height: 1.25; }
.app-notification-context {
    display: block;
    margin-top: .12rem;
    color: #334155;
    font-size: .73rem;
    font-weight: 700;
    line-height: 1.3;
}
.app-notification-message {
    margin-top: .16rem;
    color: #64748b;
    font-size: .78rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.app-notification-date { margin-top: .28rem; color: #94a3b8; font-size: .7rem; font-weight: 650; }
.app-notification-chevron {
    align-self: center;
    color: #94a3b8;
    font-size: .8rem;
}
.app-studio-request-item { cursor: pointer; }
.app-studio-request-item:hover { color: #0f172a; }
.app-notification-unread-dot {
    width: 7px;
    height: 7px;
    margin-top: .35rem;
    border-radius: 999px;
    background: var(--brand-action);
}
.app-notification-empty {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: #94a3b8;
    font-size: .84rem;
}
.app-notification-empty i { font-size: 1.4rem; }

.page-hero {
    border: 0;
    border-radius: 1.2rem;
    background: radial-gradient(circle at top left, rgba(var(--brand-teal-rgb), .26), transparent 38%), linear-gradient(135deg, #071f34 0%, var(--brand-navy) 56%, var(--brand-action) 100%);
    color: #ffffff;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .18);
    overflow: hidden;
}
.page-hero .card-body { padding: 1.35rem; }
.page-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: rgba(255,255,255,.78);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .72rem;
    font-weight: 800;
    margin-bottom: .45rem;
}
.page-hero h1 { color: #ffffff; letter-spacing: -.035em; }
.page-hero p { color: rgba(255,255,255,.72); }
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .75rem;
}
.quick-action-card {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: .95rem;
    background: #ffffff;
    text-decoration: none;
    color: #111827;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.quick-action-card:hover { color: #111827; border-color: var(--brand-light); box-shadow: 0 12px 28px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.quick-action-card i {
    width: 38px;
    height: 38px;
    border-radius: .8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-surface);
    color: var(--brand-action);
    font-size: 1.1rem;
    flex: 0 0 auto;
}
.quick-action-title { display: block; font-weight: 800; }
.quick-action-subtitle { display: block; color: #64748b; font-size: .78rem; margin-top: .12rem; }
.metric-card { border: 0 !important; border-radius: 1rem !important; box-shadow: 0 8px 24px rgba(15, 23, 42, .07) !important; }
.metric-card .metric-label { color: #64748b; text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; font-weight: 800; }
.metric-card .metric-value { font-size: 1.9rem; font-weight: 850; letter-spacing: -.035em; }
.workflow-step {
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: #ffffff;
    padding: 1rem;
    height: 100%;
}
.workflow-step-number {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-surface);
    color: var(--brand-action);
    font-weight: 900;
    margin-bottom: .65rem;
}
.empty-state {
    border: 1px dashed #cbd5e1;
    border-radius: 1rem;
    background: #f8fafc;
    padding: 2rem;
    text-align: center;
    color: #64748b;
}
.table thead th { font-size: .72rem; letter-spacing: .045em; font-weight: 800; }
.table td, .table th { vertical-align: middle; }
.table thead th {
    color: #526173;
    text-transform: uppercase;
    background: #f7fafb;
    border-bottom-color: #dfe7ea;
    white-space: nowrap;
}
.table tbody td { border-color: #edf1f3; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f2f9f9; }
.table .btn-sm {
    min-height: 34px;
    border-radius: .58rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    font-weight: 700;
}
.table .btn-group, .table td .d-flex { flex-wrap: wrap; }
.app-data-table { margin-bottom: 0; }
.app-data-table tbody tr[hidden] { display: none !important; }
.app-table-scroll {
    border: 1px solid #e4ebee;
    border-radius: .8rem;
    background: #fff;
}
.app-table-toolbar,
.app-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .85rem 0;
}
.app-table-toolbar { border-bottom: 1px solid #edf1f3; margin-bottom: .35rem; }
.app-table-footer { border-top: 1px solid #edf1f3; margin-top: .35rem; }
.app-table-page-size {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: #64748b;
    font-size: .78rem;
    font-weight: 700;
}
.app-table-page-size .form-select {
    width: 82px;
    min-width: 82px;
}
.app-table-search {
    position: relative;
    display: block;
    width: min(100%, 330px);
}
.app-table-search .bi-search {
    position: absolute;
    left: .75rem;
    top: 50%;
    color: #718096;
    transform: translateY(-50%);
    pointer-events: none;
}
.app-table-search .form-control {
    min-height: 38px;
    padding-left: 2.15rem;
    border-radius: .7rem;
    border-color: #d8e1e5;
}
.app-table-info { color: #64748b; font-size: .78rem; font-weight: 650; }
.app-table-pagination { display: inline-flex; align-items: center; gap: .3rem; }
.app-table-pagination .btn { min-width: 34px; min-height: 34px; padding: .3rem .55rem; }
.table-pager-arrow {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.table-pager-arrow .bi { margin: 0; }
.app-table-sortable { cursor: pointer; padding-right: 1.6rem !important; position: relative; }
.app-table-sortable::after {
    content: "\2195";
    position: absolute;
    right: .55rem;
    color: #94a3b8;
    font-size: .78rem;
}
.app-table-sortable[aria-sort="ascending"]::after { content: "\2191"; color: var(--brand-action); }
.app-table-sortable[aria-sort="descending"]::after { content: "\2193"; color: var(--brand-action); }
.app-table-sortable:focus-visible { outline: 3px solid rgba(var(--brand-action-rgb), .2); outline-offset: -2px; }

/* Shared skin for pages already using DataTables. */
div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid #d8e1e5;
    border-radius: .7rem;
    min-height: 38px;
    padding: .4rem .75rem;
}

/*
 * Table page-size selects.
 * Keep the disclosure arrow clearly separated from the numeric value on every
 * table implementation (our AppTable helper and DataTables/Bootstrap pages).
 */
.app-table-page-size select.form-select,
div.dataTables_wrapper div.dataTables_length select,
div.dt-container div.dt-length select {
    -webkit-appearance: none !important;
    appearance: none !important;
    min-width: 82px;
    padding-right: 2.35rem !important;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m4 6 4 4 4-4'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right .72rem center !important;
    background-size: 16px 16px !important;
    color: #1e293b;
    font-weight: 700;
    cursor: pointer;
}
.app-table-page-size select.form-select:hover,
div.dataTables_wrapper div.dataTables_length select:hover,
div.dt-container div.dt-length select:hover {
    border-color: #b8c5cc;
}
.app-table-page-size select.form-select:focus,
div.dataTables_wrapper div.dataTables_length select:focus,
div.dt-container div.dt-length select:focus {
    border-color: var(--brand-action);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-action-rgb), .13);
    outline: 0;
}
div.dataTables_wrapper div.dataTables_filter input { margin-left: .55rem; }
div.dataTables_wrapper div.dataTables_info { color: #64748b; font-size: .78rem; font-weight: 650; }
div.dataTables_wrapper .pagination { gap: .25rem; }

/* Global table pagination: compact arrow-only previous/next controls. */
div.dataTables_wrapper .dataTables_paginate .pagination .page-item.previous .page-link,
div.dataTables_wrapper .dataTables_paginate .pagination .page-item.next .page-link,
div.dataTables_wrapper .dataTables_paginate a.paginate_button.previous,
div.dataTables_wrapper .dataTables_paginate a.paginate_button.next,
div.dataTables_wrapper .dataTables_paginate button.paginate_button.previous,
div.dataTables_wrapper .dataTables_paginate button.paginate_button.next {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

div.dataTables_wrapper .dataTables_paginate .page-link .bi,
div.dataTables_wrapper .dataTables_paginate .paginate_button .bi {
    margin: 0;
    font-size: 1rem;
}
div.dataTables_wrapper .page-link { border-radius: .55rem !important; color: #334155; }
div.dataTables_wrapper .page-item.active .page-link { background: var(--brand-action); border-color: var(--brand-action); color: #fff; }
.dt-buttons .btn {
    min-height: 38px;
    border: 1px solid #d8e1e5 !important;
    border-radius: .65rem !important;
    background: #fff !important;
    color: #334155 !important;
    font-size: .82rem !important;
    font-weight: 700 !important;
}
.form-label { font-weight: 650; }

@media (max-width: 991.98px) {
    body.app-shell { overflow: auto; }
    .app-content { padding: 1rem; }
    .app-topbar { padding: .45rem 1rem; min-height: 58px; }
    .page-hero .card-body { padding: 1.05rem; }
    .app-table-toolbar, .app-table-footer { align-items: stretch; flex-direction: column; }
    .app-table-search { width: 100%; max-width: none; }
    .app-table-page-size { justify-content: space-between; }
    .app-table-pagination { justify-content: center; flex-wrap: wrap; }
    .table .btn-sm { min-height: 40px; }
}

/* ================================
   FLOATING AI ASSISTANT
================================ */
.ai-floating-assistant {
    --ai-floating-base-bottom: 20px;
    --ai-bottom-dock-offset: 0px;
    position: fixed;
    right: 20px;
    bottom: calc(var(--ai-floating-base-bottom) + var(--ai-bottom-dock-offset));
    z-index: 1040;
    transition: bottom .16s ease;
}
.ai-floating-launcher {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--brand-action);
    color: #ffffff;
    font-size: 1.2rem;
    box-shadow: 0 14px 34px rgba(var(--brand-action-rgb), .3);
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.ai-floating-launcher:hover,
.ai-floating-launcher:focus {
    background: var(--brand-action-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(var(--brand-action-rgb), .34);
}
.ai-floating-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: min(390px, calc(100vw - 326px));
    min-width: 320px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px) scale(.985);
    transform-origin: bottom right;
    pointer-events: none;
    overflow: hidden;
    border: 1px solid #dbe4e7;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 22px 55px rgba(15, 23, 42, .2);
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.ai-floating-assistant.is-open .ai-floating-panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.ai-floating-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .85rem .9rem;
    border-bottom: 1px solid #eef2f4;
}
.ai-floating-panel-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--brand-surface);
    color: var(--brand-action);
}
.ai-floating-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    color: #64748b;
}
.ai-floating-close:hover { background: #f1f5f9; color: #0f172a; }
.ai-floating-form { padding: .9rem; }
.ai-floating-input-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem;
    border: 1px solid #dbe4e7;
    border-radius: .85rem;
    background: #f8fafc;
}
.ai-floating-input-row:focus-within {
    border-color: var(--brand-teal);
    background: #ffffff;
    box-shadow: 0 0 0 .22rem rgba(var(--brand-action-rgb), .1);
}
.ai-floating-input {
    min-width: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: .9rem;
}
.ai-floating-voice,
.ai-floating-submit {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border-radius: 999px;
}
.ai-floating-voice { border: 1px solid #e2e8f0; background: #ffffff; color: #475569; }
.ai-floating-voice:hover { background: #f1f5f9; color: var(--brand-action); }
.ai-floating-submit { border: 0; background: var(--brand-action); color: #ffffff; }
.ai-floating-submit:hover { background: var(--brand-action-hover); color: #ffffff; }
.ai-floating-form.listening .ai-floating-input-row {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 .22rem rgba(var(--brand-teal-rgb), .18);
}
.ai-floating-status {
    margin-top: .55rem;
    color: #64748b;
    font-size: .76rem;
    line-height: 1.35;
}

@media (max-width: 991.98px) {
    .app-topbar-actions { gap: .35rem !important; }
    .app-topbar-icon-button { width: 38px; height: 38px; }
    .app-topbar-year { gap: .35rem; }
    .app-topbar-year-label { display: none; }
    .ai-floating-assistant { --ai-floating-base-bottom: 16px; right: 16px; }
    .ai-floating-panel {
        width: min(390px, calc(100vw - 32px));
        min-width: 0;
    }
}

@media (max-width: 575.98px) {
    .app-topbar { gap: .5rem; padding: .42rem .75rem; }
    .app-topbar-year-select { width: 78px; }
    .app-topbar-actions .btn-primary.dropdown-toggle span { display: none !important; }
    .app-notification-menu { position: fixed !important; top: 58px !important; right: 12px !important; left: 12px !important; width: auto; transform: none !important; }
}

