:root {
    --sidebar-width: 300px;
    --sidebar-collapsed-width: 132px;
    --ink: #17202b;
    --muted: #6f7782;
    --line: #e5e8ed;
    --page: #f4f6f8;
    --panel: #ffffff;
    --brand: #1f3145;
    --brand-soft: #38516c;
    --accent: #b99148;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Arial, sans-serif;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        var(--brand);
    color: #ffffff;
    box-shadow: 10px 0 28px rgba(23, 32, 43, 0.16);
    transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-header {
    min-height: 106px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.sidebar-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon,
.client-logo {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(8, 17, 28, 0.18);
}

.logo-icon img,
.client-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-text strong {
    color: #ffffff;
    font-size: 28px;
    font-weight: 800;
}

.brand-text span {
    margin-top: 5px;
    color: #b8c5d2;
    font-size: 13px;
    font-weight: 600;
}

.sidebar-collapse,
.sidebar-close,
.sidebar-toggle,
.topbar-icon,
.user-dropdown {
    border: 0;
    background: transparent;
}

.sidebar-collapse,
.sidebar-close {
    width: 40px;
    height: 40px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #dce4eb;
}

.sidebar-collapse:hover,
.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-close {
    display: none;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    scrollbar-color: rgba(185, 145, 72, 0.85) rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
}

.sidebar-menu::-webkit-scrollbar {
    width: 7px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(185, 145, 72, 0.9);
    border-radius: 999px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #d0aa61;
}

.menu-label {
    padding: 14px 12px 9px;
    color: #b5c3d1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
}

.menu-item {
    position: relative;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 7px;
    border-radius: 10px;
    color: #d9e2eb;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.menu-attention-badge {
    min-width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0 6px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    background: #dc3545;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.35);
}

.menu-item i {
    width: 26px;
    flex: 0 0 26px;
    text-align: center;
    font-size: 24px;
}

.menu-item span {
    font-size: 18px;
    font-weight: 600;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.client-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-brand .client-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    border-radius: 10px;
}

.client-brand .client-logo img {
    padding: 3px;
}

.client-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.client-info strong,
.client-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-info span {
    color: #b9c5d0;
    font-size: 13px;
}

.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-left {
    flex: 1 1 auto;
    min-width: 0;
}

.topbar-left > div {
    min-width: 0;
}

.topbar-left h5 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.topbar-right {
    flex: 0 0 auto;
}

.topbar-left h5 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-toggle,
.topbar-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f4f6f8;
    color: var(--ink);
}

.sidebar-toggle {
    display: none;
}

.sidebar-toggle:hover,
.topbar-icon:hover {
    background: #e9edf2;
}

.notification-dropdown {
    position: relative;
}

.notification-dot {
    width: 9px;
    height: 9px;
    position: absolute;
    top: 10px;
    right: 10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #dc3545;
}

.notification-menu {
    width: min(360px, calc(100vw - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(23, 32, 43, 0.14);
}

.notification-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.notification-menu-actions {
    display: flex;
    gap: 6px;
}

.notification-menu-actions form {
    margin: 0;
}

.notification-menu-actions button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--muted);
}

.notification-menu-actions button:hover:not(:disabled) {
    color: var(--brand);
    background: #f4f7fb;
}

.notification-menu-actions button:disabled {
    opacity: 0.4;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-left: 3px solid transparent;
    color: var(--ink);
    text-decoration: none;
}

.notification-item.is-unread {
    border-left-color: var(--brand);
    background: #f1f7ff;
}

.notification-item.is-read {
    background: #ffffff;
    opacity: 0.72;
}

.notification-item.is-important.is-unread {
    border-left-color: #e0a800;
    background: #fff9df;
}

.notification-item:hover {
    background: #eef2f6;
    color: var(--ink);
}

.notification-item small {
    display: block;
    color: var(--muted);
}

.notification-item em {
    display: block;
    margin-top: 4px;
    color: #946200;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 700;
}

#modifica-password {
    scroll-margin-top: 100px;
}

.notification-empty {
    padding: 18px 16px;
    color: var(--muted);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: 8px;
    color: var(--ink);
}

.user-dropdown:hover {
    background: #f4f6f8;
}

.user-dropdown strong,
.user-dropdown small {
    display: block;
    line-height: 1.2;
}

.user-dropdown small {
    color: var(--muted);
}

.top-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    font-weight: 700;
}

.page-content {
    flex: 1;
    padding: 28px;
}

.page-title {
    margin-bottom: 5px;
    font-size: 28px;
    font-weight: 700;
}

.page-subtitle {
    margin-bottom: 25px;
    color: var(--muted);
}

.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 25px;
}

.page-heading-row > div:first-child {
    min-width: 0;
}

.page-heading-row .page-title,
.page-heading-row .page-subtitle {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-heading-row .page-subtitle {
    margin-bottom: 0;
}

.page-heading-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-card,
.dashboard-box {
    background: var(--panel);
    border: 1px solid rgba(229, 232, 237, 0.7);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(23, 32, 43, 0.04);
}

.stat-card {
    padding: 22px;
}

.dashboard-stat-link {
    display: flex;
    min-height: 104px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-stat-link:hover {
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(23, 32, 43, 0.1);
}

.dashboard-money-value {
    font-size: clamp(20px, 2vw, 28px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 22px;
}

.stat-icon-link {
    color: inherit;
    text-decoration: none;
}

.stat-icon-link:hover {
    filter: brightness(0.96);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    font-size: 14px;
}

.dashboard-box {
    padding: 22px;
}

.dashboard-box,
.dashboard-box-header > *,
.dashboard-stat-link > div:first-child,
.deadline-item > *,
.dashboard-empty-state span {
    min-width: 0;
}

.stat-label,
.stat-number,
.box-title,
.dashboard-deadline-link,
.dashboard-document-link,
.dashboard-empty-state span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.generated-id-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    border: 1px solid rgba(185, 145, 72, 0.28);
    border-radius: 8px;
    background: #fffaf0;
}

.generated-id-panel span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.generated-id-panel strong {
    color: var(--brand);
    font-size: 26px;
    line-height: 1.1;
}

.fascicolo-form .form-label,
.entity-form .form-label {
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.fascicolo-form textarea.form-control {
    min-height: 112px;
    border-color: var(--line);
    border-radius: 8px;
    resize: vertical;
}

.fascicolo-form textarea.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(185, 145, 72, 0.16);
}

.subject-panel {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.subject-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.subject-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.4fr) minmax(120px, 0.8fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(200px, 1.4fr) 40px;
    gap: 10px;
    align-items: end;
    padding: 12px 0;
    border-top: 1px solid #e9edf2;
}

.subject-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.subject-row:last-child {
    padding-bottom: 0;
}

.subject-remove {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.form-section {
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.form-section:first-child {
    padding-top: 0;
    border-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.form-grid-wide {
    grid-column: span 2;
}

.entity-form .form-control,
.entity-form .form-select,
.fascicolo-form .form-control,
.fascicolo-form .form-select {
    min-height: 42px;
    border-color: var(--line);
    border-radius: 8px;
}

.table-actions,
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.fascicoli-search {
    display: grid;
    gap: 14px;
}

.fascicoli-table {
    width: 100%;
    table-layout: fixed;
}

.fascicoli-table th,
.fascicoli-table td {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fascicoli-table th:nth-child(1) {
    width: 105px;
}

.fascicoli-table th:nth-child(2) {
    width: 115px;
}

.fascicoli-table th:nth-child(3) {
    width: 155px;
}

.fascicoli-table th:nth-child(4) {
    width: 80px;
}

.fascicoli-table th:nth-child(6) {
    width: 140px;
}

.fascicoli-table th:nth-child(7) {
    width: 85px;
}

.fascicoli-table th:nth-child(8) {
    width: 124px;
}

.fascicoli-table td:nth-child(1),
.fascicoli-table td:nth-child(2),
.fascicoli-table td:nth-child(4) {
    white-space: nowrap;
}

.fascicoli-table .badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.fascicoli-table .table-actions {
    flex-wrap: wrap;
}

.search-main {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 8px;
}

.search-main .btn {
    width: 44px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.search-fields .form-label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.search-fields .form-control {
    min-height: 42px;
    border-color: var(--line);
    border-radius: 8px;
}

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

.table-actions form {
    margin: 0;
}

.table-actions .btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.form-actions {
    flex-wrap: wrap;
}

.dashboard-box-header {
    gap: 12px;
}

.box-title {
    margin-bottom: 20px;
    font-size: 17px;
    font-weight: 700;
}

.table thead th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

.deadline-item {
    padding: 13px 0;
    border-bottom: 1px solid #edf0f3;
}

.deadline-item:last-child {
    border-bottom: none;
}

.deadline-date {
    color: #b34444;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-deadline-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
}

.dashboard-deadline-link:hover {
    color: var(--ink);
    background: #f8fafc;
}

.deadline-date.is-overdue {
    color: #dc2626;
}

.dashboard-row-link,
.dashboard-document-link {
    color: var(--ink);
    text-decoration: none;
}

.dashboard-row-link:hover,
.dashboard-document-link:hover {
    color: var(--brand-soft);
    text-decoration: underline;
}

.dashboard-recent-cases {
    width: 100%;
    table-layout: fixed;
}

.dashboard-recent-cases th,
.dashboard-recent-cases td,
.dashboard-recent-cases .dashboard-row-link {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dashboard-recent-cases th:first-child {
    width: 72px;
}

.dashboard-recent-cases th:nth-child(2) {
    width: 105px;
}

.dashboard-recent-cases th:nth-last-child(2) {
    width: 125px;
}

.dashboard-recent-cases th:last-child {
    width: 48px;
}

.dashboard-recent-cases .badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dashboard-documents-table {
    width: 100%;
    table-layout: fixed;
}

.dashboard-documents-table td,
.dashboard-documents-table .dashboard-document-link {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dashboard-documents-table td:last-child {
    width: 125px;
}

.dashboard-activity-item {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 6px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.dashboard-activity-item > div:last-child {
    min-width: 0;
}

.dashboard-activity-item > div:last-child > div,
.dashboard-activity-item > div:last-child > small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dashboard-activity-item:hover {
    color: var(--ink);
    background: #f8fafc;
}

.dashboard-empty-state {
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
}

.dashboard-empty-state i {
    font-size: 22px;
}

.app-footer {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    color: var(--muted);
    background: var(--panel);
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.sidebar-overlay {
    display: none;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .menu-label,
body.sidebar-collapsed .menu-item span,
body.sidebar-collapsed .client-info,
body.sidebar-collapsed .brand-text {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse i {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-header,
body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-header {
    gap: 22px;
    padding: 14px 12px;
}

body.sidebar-collapsed .logo-icon {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
}

body.sidebar-collapsed .sidebar-collapse {
    margin-left: auto;
    margin-right: 0;
    flex: 0 0 40px;
    background: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .menu-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .menu-attention-badge {
    position: absolute;
    top: 5px;
    right: 24px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 10px;
}

@media (max-width: 991px) {
    .sidebar {
        width: min(300px, 88vw);
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(23, 32, 43, 0.45);
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-close {
        display: inline-flex;
    }

    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .topbar,
    .app-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .topbar {
        min-height: 68px;
    }

    .topbar-left {
        min-width: 0;
    }

    .topbar-left h5 {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .page-content {
        padding: 20px 16px;
    }

    .page-heading-row {
        flex-direction: column;
    }

    .app-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@media (max-width: 575px) {
    .sidebar-header {
        min-height: 92px;
        padding: 14px 16px;
    }

    .logo-icon {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .brand-text strong {
        font-size: 24px;
    }

    .menu-item {
        min-height: 52px;
        gap: 14px;
        padding: 11px 14px;
    }

    .menu-item i {
        font-size: 22px;
    }

    .menu-item span {
        font-size: 17px;
    }

    .topbar {
        gap: 10px;
    }

    .topbar-right {
        gap: 8px;
    }

    .topbar-icon,
    .sidebar-toggle {
        width: 38px;
        height: 38px;
    }

    .user-dropdown {
        padding: 2px;
    }

    .user-dropdown .bi-chevron-down {
        display: none;
    }

    .top-avatar {
        width: 38px;
        height: 38px;
    }

    .page-title {
        font-size: 24px;
    }

    .page-subtitle {
        margin-bottom: 18px;
        font-size: 14px;
    }

    .stat-card,
    .dashboard-box {
        padding: 16px;
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        font-size: 20px;
    }

    .dashboard-box-header {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .dashboard-box .btn {
        width: 100%;
    }

    .dashboard-box .table-actions .btn {
        width: 36px;
    }

    .search-main {
        grid-template-columns: minmax(0, 1fr) 44px 44px;
    }

    .search-fields {
        grid-template-columns: 1fr;
    }

    .subject-row {
        grid-template-columns: 1fr;
    }

    .form-grid-wide {
        grid-column: auto;
    }

    .subject-remove {
        width: 100%;
    }

    .table-responsive {
        margin-right: -16px;
        padding-right: 16px;
    }

    .table {
        min-width: 620px;
        font-size: 14px;
    }

    .table-responsive:has(.fascicoli-table) {
        margin-right: 0;
        padding-right: 0;
        overflow: visible;
    }

    .fascicoli-table {
        min-width: 0;
        table-layout: auto;
    }

    .fascicoli-table thead {
        display: none;
    }

    .fascicoli-table,
    .fascicoli-table tbody,
    .fascicoli-table tr,
    .fascicoli-table td {
        display: block;
        width: 100%;
    }

    .fascicoli-table tbody {
        display: grid;
        gap: 14px;
    }

    .fascicoli-table tbody tr {
        padding: 8px 14px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 4px 14px rgba(31, 49, 69, .05);
    }

    .fascicoli-table tbody td {
        display: grid;
        grid-template-columns: minmax(120px, 36%) minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        padding: 9px 0;
        border: 0;
        border-bottom: 1px solid #edf0f3;
        text-align: left !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .fascicoli-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

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

    .fascicoli-table tbody td[colspan] {
        display: block;
        padding: 18px 0;
    }

    .fascicoli-table tbody td[colspan]::before {
        display: none;
    }

    .fascicoli-table .table-actions {
        justify-content: flex-start;
    }

    .table-responsive:has(.dashboard-mobile-table) {
        margin-right: 0;
        padding-right: 0;
        overflow: visible;
    }

    .dashboard-mobile-table {
        min-width: 0;
        table-layout: auto;
    }

    .dashboard-mobile-table thead {
        display: none;
    }

    .dashboard-mobile-table,
    .dashboard-mobile-table tbody,
    .dashboard-mobile-table tr,
    .dashboard-mobile-table td {
        display: block;
        width: 100%;
    }

    .dashboard-mobile-table tbody {
        display: grid;
        gap: 12px;
    }

    .dashboard-mobile-table tbody tr {
        padding: 8px 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 4px 14px rgba(31, 49, 69, .05);
    }

    .dashboard-mobile-table tbody td,
    .dashboard-documents-table tbody td:last-child {
        display: grid;
        width: 100%;
        grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 9px 0;
        border: 0;
        border-bottom: 1px solid #edf0f3;
        text-align: left !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .dashboard-mobile-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

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

    .dashboard-mobile-table tbody td[colspan] {
        display: block;
        padding: 18px 0;
    }

    .dashboard-mobile-table tbody td[colspan]::before {
        display: none;
    }

    .dashboard-mobile-table tbody td .btn {
        width: auto;
        justify-self: start;
    }

    .dashboard-activity-item {
        align-items: flex-start;
    }

    .dashboard-empty-state {
        align-items: flex-start;
        min-height: 0;
        padding: 24px 0;
    }

    .page-heading-actions {
        width: 100%;
        justify-content: stretch;
    }

    .page-heading-actions .btn {
        min-width: 0;
        flex: 1 1 140px;
    }

    .app-footer {
        font-size: 13px;
    }
}

.login-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(31, 49, 69, 0.96), rgba(31, 49, 69, 0.82)),
        #f4f6f8;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
}

.login-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    color: #ffffff;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-brand img {
    width: 150px;
    height: 112px;
    padding: 6px;
    border-radius: 18px;
    background: #ffffff;
    object-fit: contain;
    box-shadow: 0 18px 40px rgba(8, 17, 28, 0.22);
}

.login-brand strong,
.login-brand span {
    display: block;
}

.login-brand strong {
    font-size: 34px;
    line-height: 1;
    font-weight: 800;
}

.login-brand span {
    color: #cbd6e0;
    font-size: 28px;
    font-weight: 600;
}

.login-copy {
    max-width: 620px;
    padding-bottom: 48px;
}

.login-kicker {
    margin-bottom: 12px;
    color: #d8b66d;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-copy h1 {
    max-width: 680px;
    margin-bottom: 18px;
    font-size: 48px;
    line-height: 1.08;
    font-weight: 800;
}

.login-copy p:last-child {
    max-width: 560px;
    margin: 0;
    color: #d5dee8;
    font-size: 18px;
    line-height: 1.6;
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: #f7f8fa;
}

.login-card {
    width: min(100%, 420px);
    padding: 34px;
    border: 1px solid rgba(229, 232, 237, 0.8);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(23, 32, 43, 0.12);
}

.login-card-header {
    margin-bottom: 28px;
}

.login-card-header h2 {
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 30px;
    font-weight: 800;
}

.login-card-header p {
    margin: 0;
    color: var(--muted);
}

.login-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(179, 68, 68, 0.22);
    border-radius: 8px;
    background: #fff4f4;
    color: #9f3131;
    font-size: 14px;
    font-weight: 700;
}

.login-card .form-label {
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--muted);
    transform: translateY(-50%);
}

.input-icon .form-control {
    min-height: 48px;
    padding-left: 42px;
    border-color: var(--line);
    border-radius: 8px;
}

.input-icon .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(185, 145, 72, 0.16);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 18px 0 24px;
    font-size: 14px;
}

.login-options a {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.login-options a:hover {
    color: var(--accent);
}

.login-submit {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 800;
}

.login-submit:hover {
    background: var(--brand-soft);
    color: #ffffff;
}

.uploaded-document-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid #b7e4ca;
    border-radius: 8px;
    background: #edfdf3;
    color: #176b3a;
}

.uploaded-document-card i {
    flex: 0 0 auto;
    font-size: 20px;
}

.uploaded-document-card strong,
.uploaded-document-card span {
    display: block;
}

.uploaded-document-card strong {
    font-size: 14px;
    line-height: 1.2;
}

.uploaded-document-card span {
    margin-top: 2px;
    color: #357a4f;
    font-size: 13px;
}

.uploaded-document-card-missing {
    border-color: #f2d48a;
    background: #fff8e8;
    color: #8a5a00;
}

.uploaded-document-card-missing span {
    color: #9b6a0f;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.profile-avatar {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 800;
    text-transform: uppercase;
}

.profile-summary strong,
.profile-summary span {
    display: block;
}

.profile-summary span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
}

.profile-details {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.profile-details div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.profile-details span {
    color: var(--muted);
    font-size: 14px;
}

.profile-details strong {
    color: var(--ink);
    font-size: 14px;
    text-align: right;
}

.profile-admin-check {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.profile-admin-check .form-check-input {
    margin: 0;
}

.profile-admin-check .form-check-label {
    color: var(--ink);
    font-weight: 700;
}

.studio-logo-panel {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 18px;
}

.studio-logo-preview {
    width: 150px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.studio-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.studio-recommended-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #b8d6ff;
    border-radius: 8px;
    background: #f1f7ff;
    color: #24598f;
    font-size: 14px;
    font-weight: 600;
}

.recommended-field {
    padding: 10px;
    border: 1px solid #b8d6ff;
    border-radius: 8px;
    background: #f8fbff;
}

.recommended-field .form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.recommended-field .form-label span {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: #dbeafe;
    color: #24598f;
    font-size: 11px;
    font-weight: 800;
}

.field-label-actions {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

.pec-warning-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #eab308;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.pec-warning-info:hover,
.pec-warning-info:focus {
    color: #ca8a04;
    outline: none;
}

.uploaded-document-card .btn {
    flex: 0 0 auto;
}

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

.fascicolo-causes-table {
    width: 100%;
    table-layout: fixed;
}

.fascicolo-causes-table th,
.fascicolo-causes-table td {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fascicolo-causes-table th:nth-child(1) { width: 72px; }
.fascicolo-causes-table th:nth-child(2) { width: 80px; }
.fascicolo-causes-table th:nth-child(4) { width: 85px; }
.fascicolo-causes-table th:nth-child(5) { width: 112px; }
.fascicolo-causes-table th:nth-child(6) { width: 130px; }
.fascicolo-causes-table th:nth-child(7) { width: 105px; }
.fascicolo-causes-table th:nth-child(8) { width: 145px; }
.fascicolo-causes-table th:nth-child(9) { width: 55px; }

.fascicolo-causes-table .badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.case-detail-grid div {
    min-height: 78px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.case-detail-grid span,
.case-detail-grid strong {
    display: block;
}

.case-detail-grid span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.case-detail-grid strong {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.case-detail-wide {
    grid-column: span 2;
}

.case-folder-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.case-folder-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f4f2ee;
    color: var(--muted);
    font-size: 24px;
}

.case-folder-icon.is-ready {
    background: #edfdf3;
    color: #176b3a;
}

.case-tool-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.case-tool-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef5ff;
    color: var(--brand);
    font-size: 24px;
}

.case-folder-content span,
.case-folder-content strong,
.case-folder-content small {
    display: block;
}

.case-folder-content {
    min-width: 0;
}

.folder-explorer {
    overflow: hidden;
}

.folder-explorer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.folder-explorer-toolbar nav {
    min-width: 0;
    flex: 1 1 auto;
}

.folder-breadcrumb {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8f9fb;
}

.folder-breadcrumb a {
    text-decoration: none;
}

.folder-table th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.folder-entry {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.folder-entry i {
    flex: 0 0 auto;
    font-size: 21px;
}

.folder-entry span {
    overflow-wrap: anywhere;
}

.folder-entry:hover span {
    color: var(--brand);
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .folder-explorer-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .folder-explorer-toolbar > .btn {
        align-self: flex-start;
    }
}

.case-folder-content span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.case-folder-content strong {
    margin-top: 3px;
    color: var(--ink);
    font-size: 16px;
}

.case-folder-content small {
    margin-top: 2px;
    color: var(--muted);
    word-break: break-word;
}

.case-flow {
    display: grid;
    gap: 12px;
}

.case-flow-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.case-flow-marker {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f4f2ee;
    color: var(--muted);
}

.case-flow-item.fatto {
    border-color: #b7e4ca;
    background: #edfdf3;
}

.case-flow-item.fatto .case-flow-marker {
    background: #176b3a;
    color: #ffffff;
}

.case-flow-item.in_attesa {
    border-color: #f1d48a;
    background: #fff9e8;
}

.case-flow-item.in_attesa .case-flow-marker {
    background: #f3b61f;
    color: #ffffff;
}

.case-wait-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #faf9f7;
}

.case-wait-form .btn {
    min-height: 42px;
}

.case-flow-meta {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.case-wait-toggle-form .form-check {
    cursor: pointer;
}

.case-wait-toggle-form .form-check-input {
    cursor: pointer;
}

.case-situation-field {
    align-self: start;
}

.case-situation-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.case-situation-form .form-select {
    min-width: 145px;
}

.case-flow-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.case-flow-upload {
    margin: 0;
}

.case-flow-upload .btn {
    cursor: pointer;
}

.case-flow-item strong,
.case-flow-item span {
    display: block;
}

.case-flow-item strong {
    color: var(--ink);
    font-size: 15px;
}

.case-flow-item span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
}

.case-flow-item > div:nth-child(2) {
    min-width: 0;
}

.case-flow-item strong,
.case-flow-item span,
.case-flow-meta {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.appunti-textarea {
    min-height: 440px;
    resize: vertical;
    line-height: 1.55;
}

.appunti-list {
    display: grid;
    gap: 10px;
}

.appunto-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.appunto-card.active {
    border-color: #b7e4ca;
    background: #edfdf3;
}

.appunto-card strong,
.appunto-card span {
    display: block;
}

.appunto-card strong {
    color: var(--ink);
    font-size: 14px;
}

.appunto-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.appunto-actions {
    display: flex;
    gap: 6px;
}

.appunto-actions form {
    margin: 0;
}

.appunto-actions .btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.agenda-calendar-titlebar {
    align-items: center;
    gap: 12px;
}

.agenda-calendar-titlebar .box-title {
    flex: 1;
    text-align: center;
}

.agenda-calendar-actions {
    display: flex;
    gap: 8px;
}

.agenda-calendar-titlebar .btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.agenda-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.agenda-weekday {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.agenda-day {
    position: relative;
    min-height: 92px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.agenda-day:hover {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.agenda-day.muted {
    background: #f8fafc;
    color: #94a3b8;
}

.agenda-day.today {
    border-color: rgba(37, 99, 235, 0.7);
}

.agenda-day.selected {
    border-color: var(--brand);
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.agenda-day-number {
    font-size: 16px;
    font-weight: 900;
}

.agenda-day-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.agenda-day-badge {
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #16a34a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
}

.agenda-day-events {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}

.agenda-day-event,
.agenda-day-more {
    display: block;
    overflow: hidden;
    padding: 4px 6px;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-day-event:hover,
.agenda-day-more:hover {
    background: #dbeafe;
    color: var(--brand);
}

.agenda-day-event span {
    margin-right: 4px;
    color: var(--muted);
    font-weight: 900;
}

.agenda-day-more {
    background: transparent;
    color: var(--brand);
}

.agenda-notes {
    min-height: 110px;
    resize: vertical;
}

.pec-message {
    min-height: 260px;
    resize: vertical;
}

.pec-reminder-card {
    padding: 18px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
}

.deadline-summary-card {
    position: relative;
    display: flex;
    min-height: 118px;
    flex-direction: column;
    justify-content: center;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.deadline-summary-card:hover {
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.1);
}

.deadline-summary-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.deadline-summary-card strong {
    margin-top: 5px;
    font-size: 30px;
}

.deadline-summary-card > i {
    position: absolute;
    right: 20px;
    color: var(--brand);
    font-size: 28px;
}

.deadline-summary-card.is-overdue > i { color: #dc2626; }
.deadline-summary-card.is-today > i { color: #d97706; }
.deadline-summary-card.is-upcoming > i { color: #2563eb; }
.deadline-summary-card.is-completed > i { color: #16a34a; }

.accounting-summary-card {
    position: relative;
    display: flex;
    min-height: 118px;
    flex-direction: column;
    justify-content: center;
    color: var(--ink);
    text-decoration: none;
}

.accounting-period-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

.accounting-year-selector {
    width: 150px;
}

.accounting-year-selector label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.accounting-period-buttons {
    display: flex;
    gap: 8px;
}

.accounting-period-buttons .btn {
    min-width: 84px;
}

.accounting-summary-card:hover {
    color: var(--ink);
}

.accounting-summary-card span {
    padding-right: 42px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.accounting-summary-card strong {
    margin-top: 5px;
    font-size: clamp(22px, 2vw, 30px);
}

.accounting-summary-card > i {
    position: absolute;
    right: 20px;
    color: var(--brand);
    font-size: 28px;
}

.accounting-summary-card.is-paid > i { color: #16a34a; }
.accounting-summary-card.is-due > i { color: #d97706; }
.accounting-summary-card.is-overdue > i { color: #dc2626; }

.accounting-table td:nth-child(4),
.accounting-table td:nth-child(5),
.accounting-table td:nth-child(6) {
    white-space: nowrap;
}

@media (max-width: 575px) {
    .accounting-period-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .accounting-year-selector {
        width: 100%;
    }

    .accounting-period-buttons .btn {
        min-width: 0;
        flex: 1;
    }
}

.agenda-list {
    display: grid;
    gap: 12px;
}

.agenda-event {
    display: grid;
    grid-template-columns: 86px 1fr auto;
    gap: 16px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.agenda-event.completed {
    background: #f7faf8;
    opacity: 0.78;
}

.agenda-date {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 8px;
    background: #edfdf3;
    color: #176b3a;
}

.agenda-date strong,
.agenda-date span {
    display: block;
}

.agenda-date strong {
    font-size: 17px;
}

.agenda-date span {
    margin-top: 2px;
    font-size: 13px;
    font-weight: 800;
}

.agenda-event-title,
.agenda-event-details summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.agenda-event-details summary {
    cursor: pointer;
    list-style: none;
}

.agenda-event-details summary::-webkit-details-marker {
    display: none;
}

.agenda-event-details summary::after {
    content: "\F282";
    margin-left: auto;
    color: var(--muted);
    font-family: "bootstrap-icons";
    font-size: 14px;
}

.agenda-event-details[open] summary::after {
    content: "\F286";
}

.agenda-event-title strong,
.agenda-event-details summary strong {
    color: var(--ink);
    font-size: 16px;
}

.agenda-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.agenda-event-meta a {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.agenda-event-body p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.agenda-actions {
    display: flex;
    gap: 6px;
}

.agenda-actions form {
    margin: 0;
}

.agenda-actions .btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.roles-selector {
    max-width: 520px;
}

.roles-table td:first-child {
    min-width: 280px;
}

.roles-table td:first-child small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.roles-table .form-check-input {
    width: 2.25rem;
    height: 1.2rem;
    cursor: pointer;
}

@media (max-width: 900px) {
    .studio-logo-panel {
        grid-template-columns: 1fr;
    }

    .studio-logo-preview {
        width: 100%;
        max-width: 190px;
    }

    .uploaded-document-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .uploaded-document-card .btn {
        width: 100%;
    }

    .appunto-card {
        grid-template-columns: 1fr;
    }

    .appunto-actions {
        justify-content: flex-end;
    }

    .case-flow-item {
        grid-template-columns: auto 1fr;
    }

    .case-wait-form {
        grid-template-columns: 1fr;
    }

    .case-flow-item .btn {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .agenda-calendar-grid {
        gap: 5px;
    }

    .agenda-day {
        min-height: 62px;
        padding: 7px;
    }

    .agenda-day-badge {
        min-width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .agenda-day-events {
        gap: 4px;
        margin-top: 6px;
    }

    .agenda-day-event,
    .agenda-day-more {
        padding: 3px 4px;
        font-size: 10px;
    }

    .agenda-event {
        grid-template-columns: 1fr;
    }

    .agenda-date {
        width: 90px;
    }

    .agenda-actions {
        justify-content: flex-end;
    }

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

    .case-folder-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .case-folder-card .btn {
        width: 100%;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand-panel {
        min-height: 330px;
        padding: 30px 22px;
    }

    .login-copy {
        padding-bottom: 0;
    }

    .login-copy h1 {
        font-size: 34px;
    }

    .login-copy p:last-child {
        font-size: 16px;
    }

    .login-form-panel {
        padding: 22px;
    }
}

@media (max-width: 575px) {
    .case-detail-grid {
        grid-template-columns: 1fr;
    }

    .case-detail-wide {
        grid-column: auto;
    }

    .table-responsive:has(.case-mobile-table) {
        margin-right: 0;
        padding-right: 0;
        overflow: visible;
    }

    .case-mobile-table {
        min-width: 0;
        table-layout: auto;
    }

    .case-mobile-table thead {
        display: none;
    }

    .case-mobile-table,
    .case-mobile-table tbody,
    .case-mobile-table tr,
    .case-mobile-table td {
        display: block;
        width: 100%;
    }

    .case-mobile-table tbody {
        display: grid;
        gap: 14px;
    }

    .case-mobile-table tbody tr {
        padding: 8px 14px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 4px 14px rgba(31, 49, 69, .05);
    }

    .case-mobile-table tbody td {
        display: grid;
        width: 100%;
        grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 9px 0;
        border: 0;
        border-bottom: 1px solid #edf0f3;
        text-align: left !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .case-mobile-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

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

    .case-mobile-table tbody td[colspan] {
        display: block;
        padding: 18px 0;
    }

    .case-mobile-table tbody td[colspan]::before {
        display: none;
    }

    .case-mobile-table tbody td .btn {
        width: auto;
        justify-self: start;
    }

    .case-folder-icon,
    .case-tool-icon {
        width: 46px;
        height: 46px;
    }

    .case-tool-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .case-tool-card .btn {
        width: 100%;
    }

    .case-flow-item {
        grid-template-columns: 1fr;
    }

    .case-flow-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .case-flow-actions .btn,
    .case-flow-item > .btn {
        width: 100%;
    }

    .case-situation-form {
        align-items: stretch;
        flex-direction: column;
    }

    .case-situation-form .form-select,
    .case-situation-form .btn {
        width: 100%;
    }

    .login-brand-panel {
        min-height: auto;
        padding: 24px 18px 30px;
        gap: 30px;
    }

    .login-brand img {
        width: 118px;
        height: 88px;
        border-radius: 14px;
    }

    .login-copy h1 {
        font-size: 30px;
    }

    .login-form-panel {
        align-items: flex-start;
        padding: 18px;
    }

    .login-card {
        padding: 24px 18px;
    }

    .login-card-header h2 {
        font-size: 26px;
    }

    .login-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}
