:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef3f8;
    --ink: #17212f;
    --muted: #647084;
    --line: #d9e1ea;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --ok: #0f8a53;
    --warn: #b7791f;
    --idle: #667085;
    --danger-bg: #fee2e2;
    --danger-ink: #991b1b;
    --success-bg: #dcfce7;
    --success-ink: #166534;
    --shadow: 0 16px 36px rgba(23, 33, 47, 0.08);
}

* {
    box-sizing: border-box;
}

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

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background:
        linear-gradient(90deg, rgba(23, 33, 47, 0.92), rgba(23, 33, 47, 0.58)),
        url("assets/accounting-office-hero.png") center / cover no-repeat;
}

.login-shell {
    width: min(430px, calc(100% - 32px));
}

.login-card {
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-card .eyebrow {
    color: var(--brand-dark);
}

.login-card h1 {
    margin: 8px 0 22px;
    color: var(--ink);
    font-size: 1.8rem;
    line-height: 1.1;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form button {
    min-height: 42px;
}

.login-error {
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger-ink);
    font-weight: 800;
    padding: 10px 12px;
}

.login-error p {
    margin: 0;
}

.totp-login-setup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
}

.totp-login-setup img {
    display: block;
    width: 180px;
    height: 180px;
    margin: 0 auto;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #ffffff;
}

.totp-login-setup > div {
    width: 100%;
    min-width: 0;
}

.totp-login-setup strong,
.totp-login-setup code {
    display: block;
}

.totp-login-setup strong {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.totp-login-setup code {
    padding: 9px 10px;
    border: 1px solid #d8e1ec;
    border-radius: 7px;
    background: #f4f7fb;
    color: #0f766e;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}

.totp-app-hint {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #f8fafc;
    color: #52637a;
    font-size: 0.92rem;
    line-height: 1.35;
}

.totp-app-hint strong {
    color: #17212f;
}

.totp-app-hint a {
    color: var(--brand);
    font-weight: 900;
}

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 86px;
    padding: 10px clamp(18px, 5vw, 44px);
    background:
        linear-gradient(90deg, rgba(23, 33, 47, 0.92), rgba(23, 33, 47, 0.68) 46%, rgba(23, 33, 47, 0.22)),
        url("assets/accounting-office-hero.png") center right / cover no-repeat;
    color: #ffffff;
    isolation: isolate;
}

.app-header h1,
.app-header p {
    margin: 0;
}

.app-header h1 {
    margin-top: 4px;
    font-size: clamp(1.15rem, 2.2vw, 1.7rem);
    line-height: 1;
}

.app-header > div,
.app-header nav {
    position: relative;
    z-index: 1;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-header-logo-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    line-height: 0;
}

.app-header-logo {
    display: block;
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.app-header-title {
    min-width: 0;
}

.eyebrow {
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    opacity: 0.72;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

nav a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    padding: 0 11px;
    color: #ffffff;
    font-size: 0.88rem;
    text-decoration: none;
}

.header-action-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

nav a.logout-link {
    border-color: #fecaca;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 800;
}

nav a.settings-link {
    border-color: #fde68a;
    background: #fef3c7;
    color: #92400e;
    font-weight: 800;
}

nav a.icon-only {
    width: 38px;
    justify-content: center;
    padding: 0;
}

.header-year-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.header-year-form select {
    width: 76px;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 800;
    text-align: center;
}

.header-year-form select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: 2px;
}

.header-year-form option {
    color: var(--ink);
}

nav a.active,
nav a:hover {
    background: #ffffff;
    color: #17212f;
}

nav a.logout-link:hover {
    background: #991b1b;
    color: #ffffff;
}

nav a.settings-link.active,
nav a.settings-link:hover {
    background: #f59e0b;
    color: #ffffff;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 56px;
}

.site-footer {
    display: grid;
    gap: 3px;
    width: min(1180px, calc(100% - 32px));
    margin: -28px auto 24px;
    padding: 14px 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

.site-footer a {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
}

.site-footer-line {
    display: block;
}

.site-footer a:hover {
    color: #0f4f49;
    text-decoration: underline;
}

.login-footer {
    position: fixed;
    right: 16px;
    bottom: 14px;
    left: 16px;
    width: auto;
    margin: 0;
    border-top: 0;
    color: rgba(255, 255, 255, 0.78);
}

.login-footer a {
    color: #ffffff;
}

.toast-stack {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 50;
    display: grid;
    width: min(560px, calc(100% - 28px));
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    border: 1px solid transparent;
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(23, 33, 47, 0.18);
    font-weight: 800;
    padding: 11px 14px;
    text-align: center;
    animation: toast-fade 5s ease forwards;
}

.toast p {
    margin: 0;
}

.toast p + p {
    margin-top: 4px;
}

.toast.success {
    border-color: #86efac;
    background: var(--success-bg);
    color: var(--success-ink);
}

.toast.error {
    border-color: #fecaca;
    background: var(--danger-bg);
    color: var(--danger-ink);
}

@keyframes toast-fade {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }

    10%,
    78% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-8px);
        visibility: hidden;
    }
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dashboard-company-list {
    display: grid;
    gap: 18px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.vat-status-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
}

.dashboard-filter-panel {
    position: sticky;
    top: 14px;
}

.mini-loading-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.mini-loading-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.mini-loading-modal {
    width: min(340px, calc(100vw - 36px));
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid rgba(216, 225, 236, 0.95);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.mini-loading-modal strong {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.2;
}

.mini-loading-modal span {
    color: var(--muted);
    font-size: 0.9rem;
}

.mini-loading-bar {
    position: relative;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef6;
}

.mini-loading-bar i {
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    animation: mini-loading-slide 1.05s ease-in-out infinite;
}

@keyframes mini-loading-slide {
    0% {
        transform: translateX(-110%);
    }

    50% {
        transform: translateX(75%);
    }

    100% {
        transform: translateX(260%);
    }
}

.page-ant {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 901;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    font-size: 14px;
    line-height: 1;
    filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.18));
    transform: translate3d(-40px, -40px, 0);
    transition:
        transform 4.8s linear,
        opacity 0.4s ease;
}

.page-ant.is-visible {
    opacity: 0.88;
}

.page-ant-body {
    display: block;
    transform: rotate(0deg);
    transform-origin: 50% 50%;
    transition: transform 0.2s ease;
}

.page-ant.is-paused {
    opacity: 1;
    transition: opacity 0.18s ease;
}

.page-ant.is-hidden {
    opacity: 0;
}

.page-ant.is-entering-hole {
    opacity: 0;
    transform: translate3d(var(--ant-hole-x, -40px), var(--ant-hole-y, -40px), 0) scale(0.18);
    transition:
        transform 1.2s ease-in,
        opacity 0.8s ease-in;
}

.page-ant-hole {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 900;
    width: 30px;
    height: 16px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, #020617 0%, #020617 52%, rgba(2, 6, 23, 0.82) 72%, rgba(2, 6, 23, 0) 74%);
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.08), 0 5px 12px rgba(15, 23, 42, 0.24);
    transform: translate3d(-80px, -80px, 0) scale(0);
    transition:
        transform 0.42s ease,
        opacity 0.32s ease;
}

.page-ant-hole.is-open {
    opacity: 1;
    transform: translate3d(var(--ant-hole-left, -80px), var(--ant-hole-top, -80px), 0) scale(1);
}

.page-ant-hole.is-closing {
    opacity: 0;
    transform: translate3d(var(--ant-hole-left, -80px), var(--ant-hole-top, -80px), 0) scale(0);
}

.page-ant-bubble {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 902;
    width: max-content;
    max-width: min(270px, calc(100vw - 28px));
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid #cdd8e5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    color: var(--ink);
    font-size: 0.82rem;
    line-height: 1.25;
    transform: translate3d(-999px, -999px, 0);
}

.page-ant-bubble[hidden] {
    display: none;
}

.page-ant-bubble::after {
    content: "";
    position: absolute;
    left: 18px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    border-right: 1px solid #cdd8e5;
    border-bottom: 1px solid #cdd8e5;
    background: rgba(255, 255, 255, 0.98);
    transform: rotate(45deg);
}

.page-ant-bubble strong {
    color: #0f766e;
}

@media (prefers-reduced-motion: reduce) {
    .page-ant,
    .page-ant-hole,
    .page-ant-bubble {
        display: none;
    }
}

.cae-shell {
    display: grid;
    gap: 18px;
}

.cae-hero,
.cae-converter-card,
.cae-source-card,
.cae-results-panel,
.cae-lookup-detail,
.cae-detail-card,
.cae-children-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.cae-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
}

.cae-hero h2,
.cae-source-card strong,
.cae-source-card span,
.cae-source-card a {
    margin: 0;
}

.cae-source-card {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 260px;
    padding: 16px;
}

.cae-source-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 14px;
}

.cae-source-card a {
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
}

.cae-converter-card {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.cae-flow-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
}

.cae-flow-step {
    display: grid;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.cae-flow-kicker {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cae-flow-step strong,
.cae-flow-step small {
    margin: 0;
}

.cae-flow-step strong {
    color: var(--ink);
    font-size: 1rem;
}

.cae-flow-step small {
    color: var(--brand-dark);
    font-weight: 800;
}

.cae-flow-arrow {
    color: var(--muted);
    font-size: 1.4rem;
    font-weight: 800;
}

.cae-flow-status {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 16px;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.cae-flow-status-success {
    background: #dcfce7;
    color: #166534;
}

.cae-flow-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.cae-flow-status-empty {
    background: #e2e8f0;
    color: #475569;
}

.cae-import-form {
    display: flex;
    justify-content: flex-end;
}

.cae-import-form button {
    min-width: 180px;
}

.cae-import-error {
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff1f2;
    color: #9f1239;
    padding: 14px 16px;
}

.cae-import-error strong,
.cae-import-error p {
    margin: 0;
}

.cae-import-error p {
    margin-top: 6px;
}

.cae-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.cae-converter-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
}

.cae-results-panel,
.cae-lookup-detail {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.cae-result-list,
.cae-children-list {
    display: grid;
    gap: 10px;
    max-height: 620px;
    overflow-y: auto;
    padding-right: 4px;
}

.cae-result-item,
.cae-child-item {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    padding: 12px;
    text-decoration: none;
}

.cae-result-item strong,
.cae-child-item strong {
    color: var(--brand-dark);
}

.cae-result-item small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.cae-result-item.is-active,
.cae-result-item:hover,
.cae-child-item:hover {
    border-color: #9ccfc8;
    background: #f2fbf9;
}

.cae-match-item {
    cursor: default;
}

.cae-match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cae-match-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.cae-match-pill-direct {
    background: #dcfce7;
    color: #166534;
}

.cae-match-pill-partial {
    background: #fef3c7;
    color: #92400e;
}

.cae-match-item small {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.cae-detail-card,
.cae-children-card {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.cae-detail-card h3 {
    margin: 0;
}

.cae-detail-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cae-conversion-summary-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.cae-conversion-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cae-conversion-primary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.cae-conversion-primary-copy {
    display: grid;
    gap: 6px;
}

.cae-conversion-primary-copy h3,
.cae-conversion-primary-copy p,
.cae-summary-empty {
    margin: 0;
}

.cae-conversion-primary-copy p,
.cae-summary-empty {
    color: var(--muted);
    font-weight: 700;
}

.cae-detail-code {
    display: inline-flex;
    width: fit-content;
    min-height: 40px;
    align-items: center;
    border-radius: 8px;
    background: #e6f4f1;
    color: var(--brand-dark);
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0 14px;
}

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

.cae-meta-list div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}

.cae-meta-list dt,
.cae-meta-list dd {
    margin: 0;
}

.cae-meta-list dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.cae-meta-list dd {
    margin-top: 6px;
    color: var(--ink);
    font-weight: 700;
}

.compact-empty {
    padding: 24px;
}

.dashboard-company-card,
.empty-state,
.toolbar,
.work-card,
.panel-form,
.company-detail-panel,
.settings-summary,
.settings-panel,
.table-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.logs-filter-form {
    display: grid;
    gap: 10px;
}

.logs-filter-form fieldset {
    display: grid;
    gap: 6px;
}

.logs-checkbox-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 24px;
    color: #344054;
    font-weight: 800;
    line-height: 1.1;
}

.logs-checkbox-option input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

.logs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.logs-filter-panel {
    position: sticky;
    top: 14px;
}

.logs-filter-form button {
    margin-top: 2px;
}

.logs-clear-trigger {
    display: inline-grid;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    place-items: center;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0;
    background: transparent !important;
    color: #991b1b;
    font-size: 1.35rem;
    padding: 0 !important;
}

.logs-clear-trigger:hover {
    background: transparent !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

button.logs-clear-trigger {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.confirm-modal {
    max-width: 460px;
}

.confirm-modal-body {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.confirm-modal-body p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.4;
}

.document-notify-modal {
    max-width: 560px;
}

.document-notify-modal .modal-heading {
    align-items: center;
    padding: 22px 24px 18px;
}

.document-notify-body {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 16px;
    padding: 22px 24px;
}

.document-notify-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid #c7d7ea;
    border-radius: 8px;
    background: #f4f8ff;
    font-size: 1.65rem;
}

.document-notify-copy {
    display: grid;
    gap: 12px;
}

.document-notify-copy p {
    margin: 0;
    color: #475569;
    font-weight: 700;
    line-height: 1.45;
}

.document-notify-lead {
    color: #0f172a !important;
    font-size: 1.02rem;
}

.document-notify-file {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #ffffff;
}

.document-notify-file strong {
    color: #0f172a;
    font-size: 0.98rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.document-notify-file span {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 800;
}

.document-notify-modal .modal-actions {
    flex-wrap: wrap;
    padding: 16px 24px;
}

.document-notify-modal .modal-actions select,
.document-notify-modal .modal-actions input[type="email"] {
    flex: 1 1 100%;
    min-width: 0;
}

.document-upload-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #f8fafc;
}

.document-company-filter,
.document-upload-form {
    display: grid;
    gap: 12px;
    align-items: end;
}

.document-company-filter {
    grid-template-columns: minmax(280px, 1fr);
}

.document-upload-form {
    grid-template-columns: minmax(90px, 0.45fr) minmax(140px, 0.7fr) minmax(190px, 1fr) minmax(220px, 1.2fr) auto;
}

.document-upload-form button {
    min-height: 44px;
    padding-inline: 24px;
}

.document-file-field > input[type="file"] {
    min-height: 44px;
    padding: 9px 12px;
    line-height: 1.4;
}

.document-file-field > input[type="file"]::file-selector-button {
    min-height: 26px;
    margin-right: 10px;
    border: 1px solid #cfd9e6;
    border-radius: 6px;
    background: #f8fafc;
    color: #52637a;
    font-weight: 800;
}

.document-file-field > input[type="file"]::-webkit-file-upload-button {
    min-height: 26px;
    margin-right: 10px;
    border: 1px solid #cfd9e6;
    border-radius: 6px;
    background: #f8fafc;
    color: #52637a;
    font-weight: 800;
}

.document-heading-search {
    width: min(360px, 100%);
    margin-left: auto;
}

.document-heading-search input {
    min-height: 40px;
    border-radius: 999px;
    padding-inline: 16px;
    background: #ffffff;
}

.document-row td {
    position: relative;
    padding: 10px 18px;
}

.document-row td::before,
.document-row td::after {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    width: 6px;
    border-radius: 999px;
    background: #bfdbfe;
}

.document-row td::before {
    left: 0;
}

.document-row td::after {
    right: 0;
}

.document-row.is-client-eni td::before,
.document-row.is-client-eni td::after {
    background: #fed7aa;
}

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

.document-card-main {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.document-company-cell {
    min-width: 0;
}

.document-company-cell strong {
    display: block;
    color: #0f172a;
    font-size: 0.96rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.document-detail-line {
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.document-detail-line strong {
    font-weight: 900;
}

.document-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.document-actions form {
    display: inline-flex !important;
    margin: 0;
}

.danger-icon-button:hover {
    background: #fee2e2;
    color: #991b1b;
}

.confirm-code-box {
    display: grid;
    min-height: 70px;
    place-items: center;
    border: 1px dashed #ef4444;
    border-radius: 8px;
    background: #fff1f2;
    color: #991b1b;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0;
}

.danger-button {
    background: #dc2626;
    color: #ffffff;
}

.danger-button:hover {
    background: #b91c1c;
}

.database-restore-form {
    display: grid;
    gap: 12px;
}

.database-restore-form input[type="file"] {
    padding: 9px 12px;
}

.table-wrap td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-weight: 700;
}

.dashboard-company-card {
    background: #ffffff !important;
    background-image: none !important;
    padding: 18px;
}

.dashboard-company-list .dashboard-company-card.is-client-company {
    border-left: 6px solid #bfdbfe !important;
    border-right: 6px solid #bfdbfe !important;
}

.dashboard-company-list .dashboard-company-card.is-client-eni {
    border-left: 6px solid #fed7aa !important;
    border-right: 6px solid #fed7aa !important;
}

.dashboard-company-head h2,
.dashboard-company-head p {
    margin: 0;
}

.dashboard-company-head h2 {
    font-size: 1.2rem;
    line-height: 1.15;
}

.dashboard-company-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.dashboard-company-title-row h2 {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-company-quick-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    justify-self: end;
    white-space: nowrap;
}

.company-work-state-form {
    flex: 0 0 auto;
    margin: 0;
    display: flex;
}

.company-work-state-button {
    display: inline-grid;
    box-sizing: border-box;
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    min-width: 34px;
    min-height: 26px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 7px;
    place-items: center;
    font-size: 0.62rem;
    line-height: 1;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
}

.company-work-state-button.is-open {
    border-color: #facc15;
    background: #fef3c7;
    color: #854d0e;
}

.company-work-state-button.is-closed {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.company-work-state-button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.company-birthday-icon {
    display: inline-block;
    margin-right: 6px;
    cursor: help;
    filter: drop-shadow(0 1px 2px rgba(23, 33, 47, 0.16));
}

.birthday-modal {
    max-width: 560px;
    padding: 0;
    overflow: hidden;
}

.birthday-modal .modal-heading {
    padding: 22px 24px;
    border-bottom: 1px solid #fde68a;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 70%);
}

.birthday-modal .modal-heading h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    color: #101828;
    font-size: 1.35rem;
}

.birthday-list {
    display: grid;
    gap: 12px;
    padding: 18px 24px 24px;
}

.birthday-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fff7ed;
    box-shadow: 0 10px 24px rgba(146, 64, 14, 0.08);
}

.birthday-item-icon {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
    background: #ffffff;
    font-size: 1.45rem;
    box-shadow: inset 0 0 0 1px #fed7aa;
}

.birthday-item div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.birthday-item strong {
    color: #101828;
    font-size: 1rem;
}

.birthday-item span {
    color: #92400e;
    font-size: 0.92rem;
    font-weight: 800;
}

.dashboard-company-head p {
    color: var(--muted);
    font-weight: 700;
}

.dashboard-company-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}

.dashboard-company-meta-row p {
    min-width: 0;
}

.dashboard-company-extra-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
}

.dashboard-company-extra-actions .period-tile {
    min-width: 34px;
    min-height: 26px;
    padding: 0 5px;
    font-size: 0.62rem;
    line-height: 1;
}

.dashboard-company-extra-actions .period-tile-options {
    right: 0;
    left: auto;
}

.company-email-button {
    display: inline-flex;
    width: 32px;
    min-width: 32px;
    min-height: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.company-email-button:hover {
    background: transparent;
    color: inherit;
    transform: translateY(-1px);
}

.company-email-modal {
    max-width: 720px;
}

.company-pdf-modal {
    width: min(1040px, calc(100vw - 36px));
    max-width: 1040px;
    height: min(820px, calc(100vh - 36px));
    padding: 0;
    overflow: hidden;
}

.company-pdf-modal .modal-heading {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.company-pdf-frame {
    display: block;
    width: 100%;
    height: calc(100% - 78px);
    border: 0;
    background: #eef3f8;
}

.year-note-button {
    display: inline-flex;
    width: 32px;
    min-width: 32px;
    height: 26px;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0;
}

.year-note-button.has-note {
    background: transparent;
    color: inherit;
}

.year-note-button.has-note span {
    color: inherit;
}

.note-emoji-stack {
    position: relative;
    display: grid;
    width: 1em;
    height: 1em;
    place-items: center;
}

.year-note-button > span:not(.note-emoji-stack),
.note-emoji {
    display: block;
    width: 1em;
    margin: 0 auto;
    line-height: 1;
    text-align: center;
}

.note-emoji {
    position: absolute;
    inset: 0;
}

.note-emoji-current {
    animation: note-current-fade 4s ease-in-out infinite;
}

.note-emoji-light {
    animation: note-light-fade 4s ease-in-out infinite;
}

@keyframes note-current-fade {
    0%,
    20% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0;
        transform: scale(0.96);
    }

    80%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes note-light-fade {
    0%,
    20% {
        opacity: 0;
        transform: scale(0.96);
        filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0));
        text-shadow: none;
    }

    50% {
        opacity: 1;
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(245, 158, 11, 1));
        text-shadow:
            0 0 8px rgba(245, 158, 11, 1),
            0 0 16px rgba(251, 191, 36, 0.95),
            0 0 24px rgba(253, 230, 138, 0.85);
    }

    80%,
    100% {
        opacity: 0;
        transform: scale(0.96);
        filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0));
        text-shadow: none;
    }
}

.year-note-button:hover {
    transform: translateY(-1px);
}

.year-observation-modal {
    max-width: 660px;
}

.dashboard-period-grid {
    display: grid;
    grid-auto-flow: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.dashboard-period-grid-monthly {
    grid-template-columns: repeat(24, minmax(64px, 1fr));
}

.dashboard-period-stack {
    display: grid;
    gap: 6px;
    margin-top: 16px;
}

.dashboard-period-stack-monthly {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
}

.dashboard-period-stack-quarterly {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
}

.dashboard-period-main {
    display: grid;
    gap: 6px;
}

.dashboard-period-row {
    display: grid;
    gap: 6px;
}

.dashboard-period-row-months {
    grid-template-columns: repeat(12, minmax(28px, 1fr));
}

.dashboard-period-row-iva {
    grid-template-columns: repeat(4, minmax(28px, 1fr));
}

.dashboard-period-row-monthly-iva {
    grid-template-columns: repeat(12, minmax(28px, 1fr));
}

.dashboard-period-row-exempt {
    min-height: 31px;
    place-items: center;
    border: 1px solid #d8e1ec;
    border-radius: 7px;
    background: #f8fafc;
    color: #52627a;
    font-size: 0.74rem;
    font-weight: 900;
    text-align: center;
}

.dashboard-period-extra-column {
    display: grid;
    align-content: stretch;
    width: 28px;
    gap: 6px;
    grid-auto-rows: 1fr;
}

.dashboard-period-extra-column .period-tile {
    min-height: 34px;
}

.dashboard-period-row .period-tile,
.dashboard-period-extra-column .period-tile {
    min-height: 31px;
    min-width: 28px;
    font-size: 0.64rem;
    line-height: 1;
    padding: 0 2px;
}

.period-tile-menu {
    position: relative;
}

.period-tile-menu > summary {
    list-style: none;
}

.period-tile-menu > summary::-webkit-details-marker {
    display: none;
}

.period-tile {
    display: grid;
    min-height: 62px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 800;
    text-align: center;
    user-select: none;
}

.period-tile-readonly {
    cursor: default;
}

.period-tile.is-gray {
    background: #e5e7eb;
    color: #4b5563;
}

.period-tile.is-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.period-tile.is-red {
    background: #fecaca;
    color: #991b1b;
}

.period-tile.is-yellow {
    background: #fef3c7;
    color: #92400e;
}

.period-tile.is-green {
    background: #dcfce7;
    color: #166534;
}

.vat-status-main {
    min-width: 0;
}

.vat-status-filter-panel {
    position: static;
    padding: 10px 16px;
}

.vat-status-filter-form {
    display: grid;
    grid-template-columns: minmax(250px, 0.45fr) minmax(520px, 1fr) minmax(170px, 0.28fr);
    gap: 12px;
    align-items: stretch;
}

.vat-status-filter-level,
.vat-status-result-fieldset {
    box-sizing: border-box;
    height: 72px;
    min-height: 72px;
    margin: 0;
}

.vat-status-filter-level {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px !important;
    align-content: center;
}

.vat-status-filter-level > label {
    min-height: 34px;
}

.vat-status-period-fieldset {
    justify-content: flex-start;
}

.vat-status-result-fieldset {
    display: grid !important;
    align-content: center;
    gap: 2px !important;
    padding-top: 8px;
    padding-bottom: 8px;
}

.vat-status-result-fieldset strong {
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1;
}

.vat-status-result-fieldset span {
    color: var(--muted);
    font-weight: 800;
}

.vat-status-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.vat-status-column {
    display: flex;
    min-height: 320px;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--line);
    border-top-width: 5px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.vat-status-column.is-gray {
    border-top-color: #9ca3af;
}

.vat-status-column.is-blue {
    border-top-color: #60a5fa;
}

.vat-status-column.is-red {
    border-top-color: #ef4444;
}

.vat-status-column.is-yellow {
    border-top-color: #f59e0b;
}

.vat-status-column.is-green {
    border-top-color: #22c55e;
}

.vat-status-column header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.vat-status-column h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.15;
}

.vat-status-column header span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.vat-status-company-list {
    display: grid;
    margin: 0;
    padding: 4px 12px 8px;
    list-style: none;
}

.vat-status-company-list li {
    padding: 8px 2px;
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid #e5edf5;
    border-radius: 0;
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
}

.vat-status-board[data-status-can-edit="1"] .vat-status-company-list li {
    cursor: grab;
}

.vat-status-board[data-status-can-edit="1"] .vat-status-company-list li:active {
    cursor: grabbing;
}

.vat-status-company-list li.is-dragging {
    opacity: 0.45;
}

.vat-status-column.is-drop-target {
    border-color: #0f766e;
    background: #f0fdfa;
}

.vat-status-company-list li:last-child {
    border-bottom: 0;
}

.vat-status-empty {
    margin: 0;
    padding: 16px;
    color: var(--muted);
    font-weight: 700;
}

.vat-status-filter-row {
    display: grid !important;
    grid-template-columns: auto 128px;
    gap: 8px !important;
    align-items: center;
}

.vat-status-filter-check {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.vat-status-filter-row select {
    min-height: 34px;
    height: 34px;
    padding: 4px 28px 4px 10px;
    font-size: 0.82rem;
}

.period-tile-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 8;
    display: grid;
    min-width: 180px;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(23, 33, 47, 0.14);
}

.period-tile-options form {
    margin: 0;
}

.period-option {
    width: 100%;
    min-height: 38px;
    border: 1px solid transparent;
    color: #17212f;
    font-size: 0.84rem;
    font-weight: 800;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.period-option-gray {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #4b5563;
}

.period-option-gray:hover {
    background: #4b5563;
    color: #e5e7eb;
}

.period-option-blue {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #1d4ed8;
}

.period-option-blue:hover {
    background: #1d4ed8;
    color: #dbeafe;
}

.period-option-red {
    background: #fecaca;
    border-color: #f87171;
    color: #991b1b;
}

.period-option-red:hover {
    background: #991b1b;
    color: #fecaca;
}

.period-option-yellow {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.period-option-yellow:hover {
    background: #92400e;
    color: #fef3c7;
}

.period-option-green {
    background: #dcfce7;
    border-color: #4ade80;
    color: #166534;
}

.period-option-green:hover {
    background: #166534;
    color: #dcfce7;
}

.company-filter-form select.period-option-gray,
.company-filter-form select option.period-option-gray {
    background: #e5e7eb;
    color: #4b5563;
}

.company-filter-form select.period-option-blue,
.company-filter-form select option.period-option-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.company-filter-form select.period-option-red,
.company-filter-form select option.period-option-red {
    background: #fecaca;
    color: #991b1b;
}

.company-filter-form select.period-option-yellow,
.company-filter-form select option.period-option-yellow {
    background: #fef3c7;
    color: #92400e;
}

.company-filter-form select.period-option-green,
.company-filter-form select option.period-option-green {
    background: #dcfce7;
    color: #166534;
}

.summary-grid article,
.work-card,
.panel-form,
.company-detail-panel,
.settings-summary,
.settings-panel,
.table-panel,
.empty-state,
.toolbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.summary-grid article {
    padding: 18px;
}

.summary-grid span,
.section-heading span,
.muted,
.timestamp {
    color: var(--muted);
}

.summary-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
}

.toolbar {
    margin-bottom: 18px;
    padding: 16px;
}

.filter-form,
.work-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.25fr) repeat(4, minmax(150px, 0.9fr)) auto;
    gap: 12px;
    align-items: end;
}

.work-form {
    grid-template-columns: 1.2fr 0.9fr 1fr auto;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select,
textarea,
button {
    border-radius: 8px;
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

input,
select {
    min-height: 42px;
    padding: 0 12px;
}

input::placeholder {
    color: #7b8798;
    opacity: 1;
}

.floating-field {
    position: relative;
    min-width: 0;
}

.floating-field > input,
.floating-field > select,
.floating-field > textarea {
    display: block;
}

.input-action-field > input {
    padding-right: 86px;
}

.field-action-link {
    position: absolute;
    top: 1px;
    right: 1px;
    display: grid;
    width: 40px;
    min-height: 40px;
    place-items: center;
    border-radius: 0 7px 7px 0;
    color: var(--brand-dark);
    font-size: 1rem;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

.field-action-link-secondary {
    right: 41px;
}

.field-action-link:hover {
    background: var(--surface-soft);
}

.field-favicon-link img {
    display: block;
    width: 18px;
    height: 18px;
}

.signature-editor-field {
    display: grid;
    gap: 8px;
}

.signature-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.signature-toolbar button,
.signature-toolbar select,
.signature-toolbar label {
    display: inline-grid;
    min-height: 32px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
}

.signature-toolbar button {
    width: 34px;
    padding: 0;
    place-items: center;
}

.signature-toolbar .signature-copy-all-button {
    width: auto;
    min-width: 142px;
    padding: 0 12px;
    background: #e6f4f1;
    color: var(--brand-dark);
}

.signature-toolbar select {
    width: 104px;
    padding: 0 8px;
}

.signature-toolbar label {
    width: 38px;
    justify-content: center;
    padding: 0;
}

.signature-toolbar input[type="color"] {
    width: 24px;
    min-height: 24px;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.signature-toolbar button:hover,
.signature-toolbar select:hover,
.signature-toolbar label:hover {
    border-color: #b8c4d2;
    background: #eef3f8;
}

.signature-toolbar .signature-copy-all-button:hover {
    background: #ccebe6;
    color: var(--brand-dark);
}

.signature-editor {
    min-height: 126px;
    max-height: 230px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.45;
    padding: 12px;
    outline: none;
}

.signature-editor:focus {
    border-color: #9fc7c2;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.signature-editor:empty::before {
    color: #7b8798;
    content: attr(data-placeholder);
}

.cae-embedded-page {
    background: var(--surface-soft);
}

.cae-embedded-main {
    padding: 18px;
}

.floating-field.has-value > input::placeholder,
.floating-field.has-value > textarea::placeholder,
.floating-field.is-focused > input::placeholder,
.floating-field.is-focused > textarea::placeholder {
    color: transparent;
}

.floating-field-label {
    position: absolute;
    top: -8px;
    left: 12px;
    z-index: 1;
    display: none;
    max-width: calc(100% - 24px);
    overflow: hidden;
    background: #ffffff;
    color: #526070;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    padding: 0 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floating-field.has-value .floating-field-label,
.floating-field.is-focused .floating-field-label {
    display: block;
}

input[readonly] {
    background: var(--surface-soft);
    color: var(--muted);
    font-weight: 800;
}

textarea {
    min-height: 112px;
    padding: 11px 12px;
    resize: vertical;
}

button {
    min-height: 42px;
}

button {
    border: 0;
    background: var(--brand);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
    padding: 0 18px;
}

button.year-note-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    min-height: 26px;
    height: 26px;
    padding: 0 !important;
    background: transparent;
    color: inherit;
}

button.company-email-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    min-height: 26px;
    height: 26px;
    padding: 0 !important;
    background: transparent;
    color: inherit;
}

button:hover {
    background: var(--brand-dark);
}

button.year-note-button:hover {
    background: transparent;
    color: inherit;
    transform: translateY(-1px);
}

button.company-email-button:hover {
    background: transparent;
    color: inherit;
    transform: translateY(-1px);
}

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

.secondary-link-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--brand-dark);
    font-weight: 800;
    padding: 0 14px;
    text-decoration: none;
    white-space: nowrap;
}

.secondary-link-button:hover {
    border-color: var(--brand);
    background: var(--surface-soft);
}

body.modal-open {
    overflow: hidden;
}

.work-list {
    display: grid;
    gap: 14px;
}

.work-card {
    padding: 18px;
}

.work-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.work-card h2,
.panel-form h2,
.table-panel h2,
.empty-state h2 {
    margin: 0;
}

.work-card .muted {
    margin: 8px 0 0;
}

.status-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.84rem;
    font-weight: 800;
}

.status-start {
    background: #eef2f7;
    color: var(--idle);
}

.status-running {
    background: #fef3c7;
    color: var(--warn);
}

.status-done {
    background: #dcfce7;
    color: var(--ok);
}

.notes-field {
    grid-column: span 1;
}

.timestamp {
    margin: 12px 0 0;
    font-size: 0.85rem;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 18px;
    align-items: start;
}

.company-page {
    grid-template-columns: minmax(285px, 420px) 1fr;
}

.settings-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

.settings-layout .settings-tabs-card {
    grid-column: 1;
}

.settings-tabs-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.settings-tabs-card .settings-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.settings-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.settings-tab-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--brand-dark);
    font-weight: 800;
    padding: 0 14px;
    text-decoration: none;
}

.settings-tab-button:hover:not(.is-active) {
    border-color: var(--brand);
    background: var(--surface-soft);
}

.settings-tab-button.is-active {
    background: #e5e7eb;
    color: #4b5563;
    cursor: default;
}

.settings-tab-panel[hidden] {
    display: none;
}

.communications-panel {
    padding: 0;
}

.communications-list {
    display: grid;
    gap: 10px;
    padding: 0 20px 20px;
}

.communication-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.communication-item[open] {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.communication-summary {
    display: grid;
    grid-template-columns: minmax(105px, 0.7fr) minmax(150px, 1fr) minmax(170px, 1.15fr) minmax(240px, 1.6fr) max-content;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

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

.communication-summary span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.communication-summary small {
    color: #667085;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.communication-summary strong,
.communication-summary em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.communication-summary strong {
    color: #17212f;
}

.communication-summary em {
    color: #52627a;
    font-size: 0.84rem;
    font-style: normal;
}

.communication-date strong {
    font-size: 0.95rem;
}

.communication-toggle-text {
    justify-self: end;
    align-self: center;
    display: inline-flex !important;
    min-width: max-content;
    min-height: 34px;
    align-items: center;
    border: 1px solid rgba(15, 118, 110, 0.28);
    border-radius: 8px;
    background: #f0fdfa;
    color: var(--brand);
    font-size: 0.84rem;
    font-weight: 900;
    padding: 0 12px;
}

.communication-item[open] .communication-toggle-text {
    background: #eef2f6;
    border-color: #d0d5dd;
    color: #52627a;
}

.communication-body {
    margin: 0 16px 16px;
    padding: 16px;
    border: 1px solid #dbe6f3;
    border-radius: 8px;
    background: #f8fafc;
    color: #17212f;
    font-size: 0.94rem;
    line-height: 1.6;
}

.communication-body p {
    margin: 0 0 10px;
}

.communication-body p:last-child {
    margin-bottom: 0;
}

.communication-body hr {
    height: 1px;
    margin: 16px 0;
    border: 0;
    background: #d0d5dd;
}

.panel-form {
    display: grid;
    gap: 14px;
    padding: 20px;
}

fieldset {
    display: grid;
    gap: 14px;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

legend {
    padding: 0 8px;
    color: #344054;
    font-weight: 800;
}

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

.panel-form button {
    margin-top: 4px;
}

.table-panel {
    overflow: hidden;
}

.company-side-stack {
    position: sticky;
    top: 14px;
    display: grid;
    gap: 14px;
}

.company-detail-panel,
.company-filter-panel {
    padding: 16px;
}

.settings-summary {
    padding: 20px;
}

.company-detail-panel h2 {
    margin: 8px 0 18px;
    word-break: break-word;
}

.settings-summary h2 {
    margin: 8px 0 10px;
}

.settings-summary .muted {
    margin: 0 0 18px;
    line-height: 1.5;
}

.company-detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.company-detail-list div {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.company-filter-panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.company-filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.company-filter-heading strong {
    color: var(--ink);
    font-size: 0.98rem;
}

.company-filter-heading a {
    color: var(--brand-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
}

.company-filter-heading a:hover {
    text-decoration: underline;
}

.company-filter-form {
    display: grid;
    gap: 10px;
}

.company-filter-form fieldset {
    gap: 0;
    border-width: 2px;
    border-color: #d8e1ec;
    padding: 8px 12px 7px;
}

.company-filter-form .company-filter-group-company {
    border-color: #bfdbfe;
}

.company-filter-form .company-filter-group-personal {
    border-color: #fed7aa;
}

.company-filter-form legend {
    color: #344054;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.company-filter-form label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 21px;
    color: #344054;
    font-weight: 800;
    line-height: 1.1;
}

.company-filter-form input[type="checkbox"],
.company-filter-form input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.company-detail-list dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.company-detail-list dd {
    margin: 5px 0 0;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
}

.company-detail-list dd span,
.company-detail-list dd a {
    display: inline;
    color: inherit;
    font: inherit;
    text-decoration: none;
}

.company-detail-list dd a[aria-disabled="true"] {
    pointer-events: none;
}

.assigned-chip {
    display: inline-flex !important;
    align-items: center;
    min-height: 24px;
    margin: 0 6px 6px 0;
    border: 1px solid #c7d7fe;
    border-radius: 999px;
    background: #eef4ff;
    color: #344054 !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    padding: 0 9px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.companies-list-heading {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(260px, 1.1fr) auto;
    align-items: center;
}

.companies-heading-title {
    min-width: 0;
}

.companies-heading-title h2 {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
}

.companies-heading-title h2 span {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.companies-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.company-page-size-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.company-page-size-form select {
    width: 84px;
    min-height: 42px;
    padding: 0 8px;
    border-radius: 8px;
    background: #ffffff;
    font-weight: 800;
}

.company-name-search {
    position: relative;
    display: block;
    align-items: center;
    width: 100%;
    height: 42px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.company-name-search input {
    min-width: 0;
    height: 40px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 78px 0 12px;
}

.company-name-search button,
.company-name-search a {
    position: absolute;
    top: 50%;
    display: inline-grid;
    width: 36px;
    height: 36px;
    min-height: 0;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: var(--brand-dark);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 0;
    text-decoration: none;
    transform: translateY(-50%);
}

.company-name-search button {
    right: 36px;
}

.company-name-search a {
    right: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1;
}

.company-name-search button:hover,
.company-name-search a:hover {
    background: transparent !important;
    color: var(--brand-dark);
}

.empty-table-cell {
    padding: 24px !important;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.settings-heading {
    background: #ffffff;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.compact-button {
    flex: 0 0 auto;
}

.table-wrap {
    overflow-x: auto;
}

.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 0 2px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.pagination-nav a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    color: var(--brand-dark);
    text-decoration: none;
}

.pagination-nav a:hover {
    border-color: var(--brand);
    background: var(--surface-soft);
}

.pagination-nav a.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-soft);
    color: #344054;
    font-size: 0.86rem;
    text-transform: uppercase;
}

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

.company-row {
    cursor: pointer;
}

.company-row.is-inactive td:first-child {
    border-left: 6px solid #fecaca;
}

.company-row.is-inactive td:last-child {
    border-right: 6px solid #fecaca;
}

.company-row:hover,
.company-row.is-selected {
    background: #f8fbfd;
}

.company-row:focus {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.actions-heading,
.company-actions {
    text-align: right;
    width: 120px;
}

.company-actions {
    white-space: nowrap;
}

.company-actions .inline-delete-form {
    display: inline-grid;
    margin: 0 0 0 8px;
    vertical-align: middle;
}

.company-actions .icon-button + .icon-button {
    margin-left: 8px;
}

.icon-button,
.modal-close,
.secondary-button {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
}

.icon-button {
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    line-height: 1;
    text-decoration: none;
}

a.icon-button,
a.icon-button:hover,
a.icon-button:focus {
    text-decoration: none;
}

.icon-button:hover,
.modal-close:hover,
.secondary-button:hover {
    border-color: var(--brand);
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.icon-button.danger-icon-button:hover {
    border-color: #fecaca;
    background: #fee2e2;
    color: #991b1b;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    overflow-y: auto;
    background: rgba(23, 33, 47, 0.62);
    padding: 24px;
}

.modal-backdrop[hidden] {
    display: none;
}

.access-modal {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(23, 33, 47, 0.28);
}

.cae-picker-modal {
    width: min(1280px, 100%);
    overflow: hidden;
}

.cae-picker-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 150px);
    border: 0;
    background: var(--surface);
}

.modal-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    padding: 20px;
}

.modal-heading h3,
.modal-heading p {
    margin: 0;
}

.modal-heading h3 {
    margin-top: 6px;
    font-size: 1.35rem;
}

.modal-heading-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.modal-heading-actions .active-toggle {
    min-height: 40px;
}

.modal-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
    line-height: 1;
}

.modal-access-form {
    display: grid;
}

.modal-company-form {
    display: grid;
}

.company-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px;
}

.company-general-grid {
    display: grid;
    grid-template-columns: minmax(112px, 20%) minmax(112px, 20%) minmax(0, 1fr) minmax(112px, 20%);
    gap: 14px;
    padding: 20px 20px 0;
}

.company-other-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 20px 20px;
}

.other-top-row,
.other-legal-row,
.other-single-row,
.company-classification-row,
.retainer-values-row {
    display: grid;
    gap: 14px;
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
}

.other-top-row {
    grid-template-columns: minmax(112px, 20%) minmax(112px, 20%) minmax(0, 1fr) minmax(112px, 20%);
    align-items: start;
}

.other-single-row {
    grid-template-columns: minmax(112px, 20%) minmax(0, 80%);
}

.other-legal-row {
    grid-template-columns: minmax(112px, 20%) minmax(112px, 20%) minmax(112px, 20%) minmax(0, 1fr);
    align-items: start;
}

.retainer-values-row {
    grid-template-columns: minmax(112px, 20%) minmax(112px, 20%) minmax(112px, 20%) minmax(0, 1fr);
}

.company-classification-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.other-legal-field {
    grid-column: 1;
}

.other-share-field {
    grid-column: 2 / span 1;
}

.other-cae-field {
    grid-column: 3;
}

.cae-description-field {
    display: -webkit-box;
    grid-column: 4;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    overflow: hidden !important;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fc;
    color: var(--brand-dark);
    font-size: 0.68rem;
    line-height: 1.12;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cae-description-field:empty::before {
    content: attr(data-empty);
    color: var(--muted);
}

.retainer-row-spacer {
    min-width: 0;
}

.company-observations-field {
    grid-column: 1 / -1;
}

.floating-field.company-observations-field > textarea,
textarea.company-observations-field {
    min-height: 64px;
    height: 64px;
    resize: vertical;
}

.cae-select-button {
    margin-top: 8px;
    align-self: start;
}

.input-currency-field {
    position: relative;
    min-width: 0;
}

.input-currency-field > input {
    padding-right: 34px;
}

.currency-suffix {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 800;
    pointer-events: none;
}

.date-picker-field {
    display: flex;
    min-width: 0;
}

.date-picker-field input[data-date-display] {
    padding-right: 48px;
}

.date-picker-field input[data-date-native] {
    position: absolute;
    inset: auto 0 0 auto;
    width: 1px;
    height: 1px;
    min-height: 1px;
    opacity: 0;
    pointer-events: none;
}

.date-picker-field button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 40px;
    min-height: 40px;
    border-radius: 0 7px 7px 0;
    background: #ffffff;
    color: var(--brand-dark);
    padding: 0;
}

.date-picker-field button:hover {
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.modal-section-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    margin: 20px 20px 0;
}

.modal-section-controls {
    display: grid;
    grid-template-columns: 110px 110px;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    justify-content: end;
}

.modal-section-heading h4 {
    margin: 0;
    color: #344054;
}

.client-number-field {
    flex: 0 0 110px;
    max-width: 110px;
    min-width: 110px;
}

.modal-section-controls .floating-field.client-number-field {
    flex: 0 0 110px;
    max-width: 110px;
    min-width: 110px;
}

.modal-section-controls .active-toggle {
    margin: 0;
    width: 110px;
}

.span-20 {
    grid-column: span 1;
}

.span-type {
    grid-column: span 2;
}

.span-rest {
    grid-column: 2 / -1;
}

.span-full {
    grid-column: 1 / -1;
}

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

.span-small {
    grid-column: span 1;
}

.general-regime-field {
    grid-column: 4;
}

.active-toggle {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: #344054;
    font-weight: 800;
    padding: 0 12px;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.active-toggle.is-checked {
    border-color: #8fd19e;
    background: #e8f7ed;
    color: #1f5130;
}

.active-toggle.is-unchecked {
    border-color: #f2a7a7;
    background: #fdecec;
    color: #8f2d2d;
}

.active-toggle input {
    width: 16px;
    min-height: 16px;
    height: 16px;
}

.field-half-line {
    grid-column: 1;
}

.field-new-row {
    grid-column: 1;
}

.modal-form-section {
    scroll-margin-top: 88px;
}

.modal-form-section[hidden] {
    display: none;
}

.modal-form-section h4 {
    margin: 20px 20px 0;
    color: #344054;
}

.modal-form-section .modal-section-heading h4 {
    margin: 0;
}

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

.settings-grid-compact {
    grid-template-columns: minmax(220px, 340px);
}

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

.settings-grid.email-settings-grid {
    grid-template-areas:
        "smtp auth"
        "sender test"
        "signature signature";
}

.email-settings-grid fieldset:nth-of-type(1) {
    grid-area: smtp;
}

.email-settings-grid fieldset:nth-of-type(2) {
    grid-area: auth;
}

.email-settings-grid fieldset:nth-of-type(3) {
    grid-area: sender;
}

.email-test-settings {
    grid-area: test;
}

.email-signature-settings {
    grid-area: signature;
}

.mass-email-modal {
    max-width: 860px;
}

.mass-email-form .modal-form-section {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.mass-email-editor {
    min-height: 190px;
}

.settings-grid fieldset {
    background: #ffffff;
}

.settings-permissions-list {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.permissions-matrix-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.permissions-matrix {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

.permissions-matrix th,
.permissions-matrix td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    vertical-align: middle;
}

.permissions-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

.permissions-matrix thead tr:nth-child(2) th {
    top: 38px;
}

.permission-group-heading {
    color: #101828;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    border-left: 2px solid #cbd5e1;
}

.permission-group-start {
    border-left: 2px solid #cbd5e1;
}

.permission-action-heading {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
}

.permissions-matrix tbody tr:last-child th,
.permissions-matrix tbody tr:last-child td {
    border-bottom: 0;
}

.permissions-matrix tbody tr:hover th,
.permissions-matrix tbody tr:hover td {
    background: #f8fafc;
}

.permission-user-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 180px;
    max-width: 220px;
    background: #ffffff;
    text-align: left !important;
}

.permissions-matrix thead .permission-user-cell {
    top: 0;
    z-index: 3;
    background: #f8fafc;
}

.permission-user-cell strong,
.permission-user-cell span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-user-cell span {
    color: var(--muted);
    font-size: 0.82rem;
}

.matrix-check {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
}

.matrix-check input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

.permission-user-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.permission-user-heading {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.permission-user-card strong,
.permission-user-card span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-user-card span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

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

.permission-grid fieldset {
    gap: 8px;
    padding: 12px;
    background: #ffffff;
}

.permission-check {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: #344054;
    font-weight: 800;
}

.permission-check input {
    width: 15px;
    min-width: 15px;
    height: 15px;
    min-height: 15px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.task-permissions-list {
    display: grid;
    gap: 10px;
    padding: 20px;
}

.task-permission-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.task-permission-option:hover {
    border-color: rgba(15, 118, 110, 0.35);
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 33, 47, 0.06);
}

.task-permission-option input {
    width: 15px;
    min-width: 15px;
    height: 15px;
    min-height: 15px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

.task-permission-option span {
    min-width: 0;
    color: #344054;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.two-factor-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.two-factor-card .task-permission-option {
    min-height: 38px;
    padding-inline: 10px;
    background: #ffffff;
}

.totp-setup-box {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #ffffff;
}

.totp-setup-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.totp-setup-content .secondary-link-button {
    width: min(360px, 100%);
}

.totp-key-row {
    display: grid;
    grid-template-columns: minmax(160px, 0.7fr) minmax(260px, 1fr);
    gap: 12px;
    align-items: center;
}

.totp-setup-box strong {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.totp-setup-box code {
    padding: 9px 10px;
    border: 1px solid #d8e1ec;
    border-radius: 7px;
    background: #f4f7fb;
    color: #0f766e;
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    overflow-wrap: anywhere;
}

.totp-setup-box img {
    flex: 0 0 128px;
    width: 128px;
    height: 128px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    background: #ffffff;
}

.totp-reset-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.25;
}

.totp-reset-option input {
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    height: 16px;
    min-height: 16px;
    max-height: 16px;
    flex: 0 0 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

@media (max-width: 760px) {
    .totp-setup-box {
        flex-direction: column;
        align-items: center;
    }

    .totp-setup-content {
        width: 100%;
    }

    .totp-key-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.modal-access-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 14px;
    row-gap: 20px;
    padding: 20px;
}

.access-card-at { order: 1; }
.access-card-social-security { order: 2; }
.access-card-single-report { order: 3; }
.access-card-iapmei { order: 4; }
.access-card-viactt { order: 5; }
.access-card-webinq { order: 6; }
.access-card-act { order: 7; }
.access-card-net-empregos { order: 8; }
.access-card-certificate { order: 9; }
.access-card-rcbe { order: 10; }
.access-card-complaints { order: 11; }
.access-card-bank { order: 12; }

.modal-access-grid fieldset {
    display: flex;
    flex-direction: column;
    align-self: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    gap: 14px;
    padding: 16px;
}

.modal-access-grid input {
    min-height: 42px;
    height: 42px;
}

.access-inline-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.observations-card {
    grid-column: 1 / -1;
    order: 13;
}

.modal-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--line);
    background: #ffffff;
    padding: 16px 20px;
}

.modal-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-right: auto;
}

.modal-tab-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--brand-dark);
    font-weight: 800;
    padding: 0 16px;
}

.modal-tab-button:hover:not(:disabled) {
    border-color: var(--brand);
    background: var(--surface-soft);
}

.modal-tab-button.is-active,
.modal-tab-button:disabled {
    border-color: #d0d5dd;
    background: #eef2f6;
    color: #667085;
    cursor: default;
}

.secondary-button {
    min-height: 42px;
    padding: 0 16px;
}

.empty-state {
    padding: 32px;
    text-align: center;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 0;
}

@media (max-width: 860px) {
    .app-header,
    .work-card-main {
        align-items: stretch;
        flex-direction: column;
    }

    .app-header-brand {
        align-items: center;
    }

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

    .filter-form,
    .work-form,
    .dashboard-layout,
    .vat-status-layout,
    .vat-status-board,
    .vat-status-filter-form,
    .logs-layout,
    .split-layout,
    .company-page,
    .companies-list-heading,
    .settings-layout,
    .access-grid,
    .access-column,
    .company-form-grid,
    .company-general-grid,
    .company-other-grid,
    .other-top-row,
    .other-single-row,
    .company-classification-row,
    .retainer-values-row,
    .cae-source-stack,
    .cae-flow-bar,
    .cae-converter-grid,
    .settings-grid,
    .permission-grid,
    .modal-access-grid,
    .document-company-filter,
    .document-upload-form,
    .document-card-line {
        grid-template-columns: 1fr;
    }

    .document-heading-search {
        width: 100%;
        margin-left: 0;
    }

    .document-actions {
        justify-content: flex-start;
    }

    .settings-grid.email-settings-grid {
        grid-template-areas:
            "smtp"
            "auth"
            "sender"
            "test"
            "signature";
    }

    .company-side-stack {
        position: static;
    }

    .dashboard-filter-panel {
        position: static;
    }

    .settings-layout .settings-tabs-card {
        grid-column: auto;
    }

    .span-20,
    .span-type,
    .span-rest,
    .span-full,
    .span-2,
    .span-small {
        grid-column: 1;
    }

    .modal-section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .cae-hero {
        flex-direction: column;
    }

    .cae-flow-arrow {
        display: none;
    }

    .cae-source-card {
        min-width: 0;
    }

    .cae-search-form,
    .cae-meta-list {
        grid-template-columns: 1fr;
    }

    .modal-section-controls {
        width: 100%;
        grid-template-columns: 110px 110px;
        justify-content: end;
    }

    .client-number-field {
        flex-basis: auto;
        max-width: 110px;
        min-width: 110px;
    }

    .modal-section-controls .floating-field.client-number-field {
        max-width: 110px;
        min-width: 110px;
    }

    .modal-section-controls .active-toggle {
        width: 110px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .communication-summary {
        grid-template-columns: 1fr;
    }

    .status-pill {
        width: max-content;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
    }

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

    nav a {
        flex: 1 1 auto;
        justify-content: center;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .access-modal {
        max-height: calc(100vh - 20px);
    }
}
