:root {
    --brand: #ff5b57;
    --brand-dark: #e84946;
    --brand-soft: #fff0ef;
    --ink: #202128;
    --ink-2: #3c3f4a;
    --muted: #747986;
    --line: #e8e9ee;
    --surface: #ffffff;
    --canvas: #f6f7f9;
    --sidebar-width: 264px;
    --success: #1ca56b;
    --success-soft: #e8f8f1;
    --warning: #d89217;
    --warning-soft: #fff5dd;
    --danger: #dc4b55;
    --danger-soft: #ffeaec;
    --info: #4c7cf3;
    --info-soft: #ebf1ff;
    --shadow-sm: 0 2px 8px rgba(26, 29, 41, .05);
    --shadow-md: 0 12px 32px rgba(26, 29, 41, .10);
}

/* v27: legal documents, API responses and plugin requests */
.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e6e8ec;
    font-size: 12px;
}

.auth-legal-links a {
    color: #68707c;
    text-decoration: none;
}

.auth-legal-links a:hover,
.auth-legal-links a:focus {
    color: var(--bs-primary);
    text-decoration: underline;
}

.api-response-example {
    margin-top: 16px;
}

.api-response-example-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    color: #525a65;
    font-size: 13px;
}

.api-response-example-head span {
    color: #79818c;
    font-family: var(--bs-font-monospace);
    font-size: 12px;
}

.api-response-code {
    max-height: 360px;
    border-color: #344154;
    background: #141b24;
}

.plugin-company-summary {
    min-height: 68px;
    padding: 14px 16px;
    border: 1px solid #e0e4e9;
    border-radius: 8px;
    background: #f8f9fb;
    color: #5a626d;
    font-size: 13px;
    line-height: 1.55;
}

.plugin-company-summary strong {
    display: block;
    margin-bottom: 3px;
    color: #252b33;
    font-size: 14px;
}

.legal-settings-card {
    padding: 0;
    overflow: hidden;
}

.legal-document {
    max-width: 960px;
    margin: 0 auto;
    padding: 34px 38px 42px;
    color: #414852;
    font-size: 14px;
    line-height: 1.7;
}

.legal-document header {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid #e4e7eb;
}

.legal-document h2 {
    margin: 0 0 6px;
    color: #20262e;
    font-size: 28px;
    font-weight: 700;
}

.legal-document h3 {
    margin: 26px 0 8px;
    color: #252b33;
    font-size: 17px;
    font-weight: 700;
}

.legal-document p {
    margin: 0 0 10px;
}

.legal-document a {
    overflow-wrap: anywhere;
}

.legal-updated {
    margin-bottom: 12px !important;
    color: #7b838e;
    font-size: 12px;
}

.legal-intro {
    max-width: 820px;
    color: #59616c;
    font-size: 15px;
}

#legalModalBody {
    padding: 0;
    overflow-x: hidden;
}

@media (max-width: 767.98px) {
    .auth-legal-links {
        gap: 7px 12px;
    }

    .api-response-example-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .legal-document {
        padding: 24px 20px 30px;
    }

    .legal-document h2 {
        font-size: 23px;
    }
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}

.root-impersonation-banner {
    position: fixed;
    z-index: 1100;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    min-height: 48px;
    padding: 8px 18px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
    background: #202128;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .22);
}

.root-impersonation-banner i {
    margin-right: 7px;
}

body.root-impersonating .app-sidebar {
    top: 48px;
    height: calc(100vh - 48px);
}

body.root-impersonating .app-main {
    padding-top: 48px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.btn {
    --bs-btn-border-radius: 9px;
    font-weight: 600;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: #ff9d9a;
    --bs-btn-disabled-border-color: #ff9d9a;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-dark);
    --bs-btn-border-color: #ffaaa7;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
}

.btn-light {
    --bs-btn-bg: #f4f5f7;
    --bs-btn-border-color: #eceef1;
    --bs-btn-hover-bg: #eceef2;
    --bs-btn-hover-border-color: #e1e3e7;
    --bs-btn-color: var(--ink-2);
}

.form-label {
    margin-bottom: 7px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
    border-color: #dfe1e6;
    border-radius: 9px;
    color: var(--ink);
    font-size: 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: #ff9693;
    box-shadow: 0 0 0 3px rgba(255, 91, 87, .12);
}

textarea.form-control {
    min-height: auto;
    resize: vertical;
}

.form-check-input:checked {
    border-color: var(--brand);
    background-color: var(--brand);
}

.form-switch .form-check-input {
    width: 2.4em;
}

.required {
    color: var(--brand);
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.sidebar-header {
    display: flex;
    min-height: 82px;
    padding: 16px 20px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.sidebar-brand {
    display: block;
    width: 174px;
}

.sidebar-brand img {
    display: block;
    width: 100%;
    height: auto;
}

.sidebar-close {
    padding: 5px 8px;
    font-size: 20px;
}

.sidebar-company {
    padding: 17px 18px 11px;
}

.sidebar-company .form-label {
    margin-bottom: 5px;
    color: #989ca7;
    font-size: 10px;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.sidebar-company .form-select {
    min-height: 37px;
    padding-left: 10px;
    background-color: #f7f7f9;
    border-color: transparent;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 4px 12px 18px;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    min-height: 42px;
    margin: 2px 0;
    padding: 9px 12px;
    align-items: center;
    gap: 11px;
    border-radius: 9px;
    color: #555a67;
    font-size: 13px;
    font-weight: 600;
    transition: .15s ease;
}

.sidebar-nav .nav-link > i:first-child {
    width: 18px;
    color: #8d919c;
    font-size: 17px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: var(--ink);
    background: #f5f5f7;
}

.sidebar-nav .nav-link.active {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.sidebar-nav .nav-link.active > i:first-child {
    color: var(--brand);
}

.sidebar-nav .nav-link .badge {
    color: #7d818b !important;
    font-size: 10px;
}

.nav-caption {
    margin: 20px 12px 5px;
    color: #a1a4ad;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.sidebar-plan {
    margin: 0 12px 14px;
    padding: 14px;
    border: 1px solid #ffd5d3;
    border-radius: 12px;
    background: linear-gradient(145deg, #fff, #fff6f5);
}

.sidebar-plan .plan-name {
    font-size: 12px;
    font-weight: 800;
}

.sidebar-plan .badge {
    color: var(--success);
    background: var(--success-soft);
    font-size: 9px;
}

.sidebar-plan .progress,
.usage-card .progress {
    height: 5px;
    background: #eceef1;
}

.sidebar-plan .progress-bar,
.usage-card .progress-bar {
    background: var(--brand);
}

.sidebar-plan .btn-link {
    color: var(--brand-dark);
    font-size: 11px;
    text-decoration: none;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    height: 82px;
    padding: 0 28px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.page-eyebrow {
    margin-bottom: 2px;
    color: #a2a5ae;
    font-size: 10px;
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -.02em;
}

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

.icon-btn {
    display: inline-grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    font-size: 17px;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border: 2px solid white;
    border-radius: 50%;
    background: var(--brand);
}

.language-btn {
    height: 40px;
    font-size: 12px;
}

.user-menu {
    display: flex;
    height: 48px;
    padding: 4px 10px 4px 5px;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 11px;
    background: transparent;
}

.user-menu:hover {
    background: #f5f5f7;
}

.avatar {
    display: inline-grid;
    width: 37px;
    height: 37px;
    place-items: center;
    border-radius: 10px;
    color: white;
    background: linear-gradient(135deg, var(--brand), #fb8474);
    font-size: 12px;
    font-weight: 800;
}

.user-copy {
    text-align: left;
    line-height: 1.15;
}

.user-copy strong,
.user-copy small {
    display: block;
}

.user-copy strong {
    font-size: 12px;
}

.user-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.dropdown-menu {
    padding: 7px;
    border-color: var(--line);
    border-radius: 10px;
    font-size: 13px;
}

.dropdown-item {
    padding: 8px 10px;
    border-radius: 7px;
}

.dropdown-item i {
    display: inline-block;
    width: 18px;
    color: #8b8f99;
}

.app-content {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 26px 28px 48px;
}

.app-view {
    display: none;
    animation: viewFade .18s ease;
}

.app-view.active {
    display: block;
}

@keyframes viewFade {
    from { opacity: .3; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
}

.view-toolbar {
    display: flex;
    min-height: 55px;
    margin-bottom: 20px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.view-toolbar h2 {
    margin: 0 0 5px;
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.025em;
}

.view-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.view-toolbar .btn {
    min-height: 40px;
}

.metric-card,
.panel-card,
.form-card,
.invoice-preview-card,
.summary-strip,
.entity-card,
.contract-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-card {
    position: relative;
    height: 100%;
    min-height: 144px;
    padding: 18px;
    overflow: hidden;
}

.metric-card.danger-border::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    content: "";
    background: var(--danger);
}

.metric-icon {
    display: grid;
    width: 37px;
    height: 37px;
    margin-bottom: 15px;
    place-items: center;
    border-radius: 10px;
    font-size: 17px;
}

.metric-icon.coral { color: var(--brand); background: var(--brand-soft); }
.metric-icon.green { color: var(--success); background: var(--success-soft); }
.metric-icon.amber { color: var(--warning); background: var(--warning-soft); }
.metric-icon.red { color: var(--danger); background: var(--danger-soft); }

.metric-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.metric-value {
    margin: 2px 0 5px;
    font-size: 22px;
    font-weight: 760;
    letter-spacing: -.035em;
}

.metric-change {
    color: var(--muted);
    font-size: 10px;
}

.metric-change.positive {
    color: var(--success);
}

.metric-change.negative {
    color: var(--danger);
}

.panel-card {
    overflow: hidden;
}

.panel-header {
    display: flex;
    min-height: 68px;
    padding: 17px 19px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.panel-header h3 {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 750;
}

.panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.legend {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--muted);
    font-size: 10px;
}

.legend span,
.status-list span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend i,
.status-list i {
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.mini-chart {
    display: flex;
    height: 244px;
    padding: 20px 24px 15px;
}

.chart-y-axis {
    display: flex;
    width: 35px;
    padding-bottom: 23px;
    flex-direction: column;
    justify-content: space-between;
    color: #b0b3bb;
    font-size: 9px;
}

.chart-bars {
    position: relative;
    display: flex;
    flex: 1;
    justify-content: space-around;
    gap: 10px;
    background: repeating-linear-gradient(to bottom, #f0f1f4 0 1px, transparent 1px 33.333%);
}

.chart-month {
    display: flex;
    width: 12%;
    flex-direction: column;
    align-items: center;
}

.chart-month .bars {
    display: flex;
    width: 100%;
    height: calc(100% - 23px);
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.chart-month .bars i,
.chart-month .bars b {
    display: block;
    width: 12px;
    border-radius: 4px 4px 1px 1px;
}

.chart-month .bars i {
    background: var(--brand);
}

.chart-month .bars b {
    background: var(--success);
}

.chart-month > span {
    margin-top: 8px;
    color: #979ba5;
    font-size: 9px;
}

.status-ring-wrap {
    display: flex;
    min-height: 244px;
    padding: 22px;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.status-ring {
    display: grid;
    width: 136px;
    height: 136px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0 66.6%, var(--warning) 66.6% 91.6%, var(--danger) 91.6% 100%);
}

.status-ring::before {
    position: absolute;
    width: 95px;
    height: 95px;
    border-radius: 50%;
    content: "";
    background: white;
}

.status-ring > div {
    position: relative;
    z-index: 1;
    text-align: center;
}

.status-ring strong,
.status-ring span {
    display: block;
}

.status-ring strong {
    font-size: 25px;
    line-height: 1;
}

.status-ring span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.status-list {
    min-width: 115px;
}

.status-list > div {
    display: flex;
    padding: 8px 0;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #f0f1f3;
    color: var(--muted);
    font-size: 10px;
}

.status-list > div:last-child {
    border: 0;
}

.status-list strong {
    color: var(--ink);
    font-size: 12px;
}

.app-table {
    width: 100% !important;
    margin: 0 !important;
}

.app-table > :not(caption) > * > * {
    padding: 13px 14px;
    border-bottom-color: #eef0f2;
    vertical-align: middle;
    white-space: nowrap;
}

.app-table thead th {
    color: #9296a0;
    background: #fafafb;
    border-bottom-width: 1px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.app-table tbody td {
    color: #555965;
    font-size: 11px;
}

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

.app-table tbody tr:hover td {
    background: #fdfdfd;
}

.app-table tbody tr.invoice-row-created td {
    background: rgba(255, 91, 87, .1);
    transition: background-color .35s ease;
}

/* Keep the automatic-rule actions visible when its wide table scrolls. */
#recurringTable th:last-child,
#recurringTable td:last-child {
    position: sticky;
    right: 0;
    width: 48px;
    min-width: 48px;
    padding-right: 8px;
    padding-left: 8px;
    text-align: center;
    background: #fff;
    box-shadow: -10px 0 14px -16px rgba(31, 35, 48, .65);
}

#recurringTable thead th:last-child {
    z-index: 3;
    background: #fafafb;
}

#recurringTable tbody td:last-child {
    z-index: 2;
}

#recurringTable tbody tr:hover td:last-child {
    background: #fdfdfd;
}

.app-table td small,
.app-table td strong {
    display: block;
}

.app-table td small {
    margin-top: 3px;
    color: #a0a4ad;
    font-size: 9px;
}

.invoice-link {
    color: #393c45;
    font-weight: 750;
}

.invoice-link:hover {
    color: var(--brand);
}

.status-badge {
    display: inline-flex;
    padding: 5px 8px;
    align-items: center;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 750;
    line-height: 1;
}

.status-badge.sent { color: var(--info); background: var(--info-soft); }
.status-badge.partial { color: var(--warning); background: var(--warning-soft); }
.status-badge.paid { color: var(--success); background: var(--success-soft); }
.status-badge.overdue { color: var(--danger); background: var(--danger-soft); }
.status-badge.draft { color: #757984; background: #eef0f2; }

.row-menu {
    display: inline-grid;
    width: 31px;
    height: 31px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #898d97;
}

.row-menu:hover,
.row-menu:focus {
    color: var(--ink);
    background: #f1f2f4;
}

.event-list {
    padding: 8px 18px;
}

.event-item {
    display: flex;
    padding: 13px 0;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eff0f2;
}

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

.event-date {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-content: center;
    border-radius: 10px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    text-align: center;
}

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

.event-date strong {
    font-size: 14px;
    line-height: 1;
}

.event-date span {
    margin-top: 3px;
    font-size: 8px;
    text-transform: uppercase;
}

.event-item > div:last-child strong,
.event-item > div:last-child span {
    display: block;
}

.event-item > div:last-child strong {
    font-size: 11px;
}

.event-item > div:last-child span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.filter-bar {
    display: flex;
    padding: 15px;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--line);
}

.filter-bar .form-select,
.filter-bar .btn {
    width: auto;
    min-width: 155px;
    min-height: 39px;
    font-size: 11px;
}

.filter-search {
    position: relative;
    min-width: 250px;
    flex: 1;
}

.filter-search > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 12px;
    color: #a3a6ae;
    transform: translateY(-50%);
}

.filter-search .form-control {
    min-height: 39px;
    padding-left: 34px;
    font-size: 11px;
}

.dt-container .dt-search {
    display: none;
}

.dt-container .dt-length {
    color: var(--muted);
    font-size: 10px;
}

.dt-container .dt-length select {
    min-width: 66px;
    min-height: 30px;
    margin: 0 5px;
    padding: 3px 24px 3px 8px;
    border-color: var(--line);
    border-radius: 7px;
    color: var(--ink-2);
    background-color: var(--surface);
    font-size: 10px;
}

.dt-container .dt-layout-row {
    margin: 0 !important;
    padding: 12px 15px;
    align-items: center;
    border-top: 1px solid var(--line);
}

.dt-container .dt-layout-row.dt-layout-table {
    padding: 0;
    border: 0;
}

.dt-container .dt-info {
    color: var(--muted);
    font-size: 10px;
}

.dt-container .pagination {
    --bs-pagination-font-size: 10px;
    --bs-pagination-color: #70747f;
    --bs-pagination-hover-color: var(--brand-dark);
    --bs-pagination-focus-box-shadow: none;
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    gap: 3px;
}

.dt-container .page-link {
    border-radius: 7px !important;
}

.table-responsive.dropdown-visible {
    overflow: visible;
}

.form-card {
    margin-bottom: 16px;
    padding: 20px;
}

.form-card-header {
    display: flex;
    min-height: 46px;
    margin-bottom: 20px;
    align-items: center;
    gap: 12px;
}

.form-card-header h3 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 750;
}

.form-card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.step-number {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 12px;
    font-weight: 800;
}

.invoice-items-wrap {
    margin: 0 -20px 14px;
    overflow-x: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.invoice-items-table {
    min-width: 990px;
    margin: 0;
}

.invoice-items-table > :not(caption) > * > * {
    padding: 10px 6px;
    border-bottom-color: #eef0f2;
    vertical-align: top;
}

.invoice-items-table thead th {
    padding-top: 11px;
    padding-bottom: 11px;
    color: #979ba5;
    background: #fafafb;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.invoice-items-table th:first-child,
.invoice-items-table td:first-child {
    padding-left: 18px;
}

.invoice-items-table th:last-child,
.invoice-items-table td:last-child {
    padding-right: 18px;
}

.invoice-items-table .item-drag { width: 24px; }
.invoice-items-table .item-qty { width: 76px; }
.invoice-items-table .item-unit { width: 82px; }
.invoice-items-table .item-price { width: 100px; }
.invoice-items-table .item-discount { width: 100px; }
.invoice-items-table .item-tax { width: 90px; }
.invoice-items-table .item-total { width: 90px; }
.invoice-items-table .item-action { width: 36px; }

.invoice-items-table .form-control,
.invoice-items-table .form-select,
.invoice-items-table .input-group-text {
    min-height: 35px;
    padding-top: 6px;
    padding-bottom: 6px;
    border-radius: 7px;
    font-size: 10px;
}

.invoice-items-table .item-description {
    min-height: 31px;
    margin-top: 5px;
    color: var(--muted);
}

.inline-catalog-suggestions {
    position: fixed;
    z-index: 1095;
    display: none;
    max-width: min(520px, calc(100vw - 24px));
    max-height: 290px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(31, 35, 48, .18);
}

.inline-catalog-option {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 9px 10px;
    gap: 12px;
    border: 0;
    border-radius: 7px;
    color: var(--text);
    background: transparent;
    text-align: left;
}

.inline-catalog-option:hover,
.inline-catalog-option:focus {
    outline: none;
    background: var(--brand-soft);
}

.inline-catalog-option strong,
.inline-catalog-option small {
    display: block;
}

.inline-catalog-option small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.inline-catalog-option > span:last-child {
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.inline-catalog-no-results {
    display: flex;
    padding: 12px;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.waybill-items-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.waybill-items-table {
    min-width: 840px;
    margin-bottom: 0;
}

.recurring-items-table {
    min-width: 820px;
    margin-bottom: 0;
}

.waybill-items-table .waybill-item-description {
    min-height: 31px;
    margin-top: 5px;
    color: var(--muted);
}

.waybill-items-table .waybill-item-total {
    padding-top: 18px;
    font-weight: 750;
    white-space: nowrap;
}

.remove-waybill-item,
.remove-bank-account,
.remove-partner-bank-account,
.remove-recurring-item {
    color: #a8abb3;
}

.remove-waybill-item:hover,
.remove-bank-account:hover,
.remove-partner-bank-account:hover,
.remove-recurring-item:hover {
    color: var(--danger);
}

.recurring-total {
    color: var(--muted);
    font-size: 11px;
}

.recurring-total strong {
    margin-left: 7px;
    color: var(--text);
    font-size: 15px;
}

.document-preview {
    max-width: 900px;
    min-height: 760px;
    margin: 0 auto;
    padding: 50px;
    border: 1px solid #e6e7eb;
    border-radius: 8px;
    color: #262932;
    background: #fff;
    box-shadow: 0 16px 45px rgba(31, 35, 48, .08);
}

.document-preview-brand,
.document-preview-title,
.document-preview-parties,
.document-preview-total,
.document-preview-signatures {
    display: flex;
    justify-content: space-between;
    gap: 25px;
}

.document-preview-brand {
    align-items: center;
}

.document-preview-brand img {
    width: 180px;
    height: auto;
}

.document-preview-brand > span {
    font-size: 18px;
    font-weight: 850;
    letter-spacing: .06em;
}

.document-preview-title {
    margin: 30px 0;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.document-preview-title > div,
.document-preview-parties > div {
    flex: 1;
}

.document-preview small,
.document-preview strong,
.document-preview span {
    display: block;
}

.document-preview small {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
}

.document-preview-parties {
    margin-bottom: 30px;
}

.document-preview-parties strong {
    margin: 5px 0;
    font-size: 13px;
}

.document-preview-parties span {
    color: #5f636d;
    font-size: 10px;
}

.document-preview-table {
    font-size: 10px;
}

.document-preview-table th {
    color: #858995;
    font-size: 8px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.document-preview-table td small {
    margin-top: 3px;
    text-transform: none;
}

.document-preview-total {
    margin-top: 25px;
    padding-top: 20px;
    align-items: center;
    justify-content: flex-end;
    border-top: 2px solid #2d3038;
    font-size: 16px;
}

.document-preview-total strong {
    font-size: 22px;
}

.document-preview-signatures {
    margin-top: 75px;
    color: #5f636d;
    font-size: 10px;
}

.plan-watermark-card {
    border-style: dashed;
}

.plan-watermark-card.free-plan {
    border-color: #ffaaa7;
    background: #fff8f7;
}

.bank-table-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.bank-accounts-editor {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.bank-accounts-editor-head {
    display: flex;
    padding: 13px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fafafb;
    border-bottom: 1px solid var(--line);
}

.bank-accounts-editor-head strong,
.bank-accounts-editor-head span {
    display: block;
}

.bank-accounts-editor-head span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.bank-account-editor-table {
    min-width: 1280px;
    margin-bottom: 0;
}

.bank-account-editor-table > :not(caption) > * > * {
    padding: 8px 5px;
    vertical-align: middle;
}

.bank-account-editor-table thead th {
    color: #8c9099;
    background: #fff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.bank-account-editor-table th:first-child,
.bank-account-editor-table td:first-child {
    padding-left: 12px;
}

.bank-account-editor-table th:last-child,
.bank-account-editor-table td:last-child {
    padding-right: 12px;
}

.bank-account-editor-table .form-control,
.bank-account-editor-table .form-select {
    min-height: 34px;
    font-size: 10px;
}

.bank-account-editor-table th:nth-child(1) { width: 180px; }
.bank-account-editor-table th:nth-child(2) { width: 130px; }
.bank-account-editor-table th:nth-child(3) { width: 220px; }
.bank-account-editor-table th:nth-child(4) { width: 85px; }
.bank-account-editor-table th:nth-child(5) { width: 180px; }
.bank-account-editor-table th:nth-child(6) { width: 260px; }
.bank-account-editor-table th:nth-child(7) { width: 70px; }
.bank-account-editor-table th:nth-child(8) { width: 38px; }

.drag-handle {
    padding-top: 17px !important;
    color: #c0c2c9;
    cursor: grab;
}

.item-row-total {
    padding-top: 19px !important;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.remove-item {
    margin-top: 8px;
    padding: 4px 7px;
    color: #a0a3ac;
    border: 0;
}

.remove-item:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.invoice-totals {
    width: min(100%, 320px);
}

.invoice-totals > div {
    display: flex;
    padding: 7px 0;
    justify-content: space-between;
    gap: 30px;
    color: var(--muted);
    font-size: 11px;
}

.invoice-totals > div strong {
    color: var(--ink);
}

.invoice-totals .grand-total {
    margin-top: 4px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
    font-weight: 750;
}

.invoice-totals .grand-total strong {
    color: var(--brand-dark);
    font-size: 17px;
}

.installment-settings {
    display: none;
    padding: 17px;
    border: 1px solid #e9eaee;
    border-radius: 11px;
    background: #fafafb;
}

.installment-row {
    display: grid;
    padding: 8px 0;
    grid-template-columns: 26px 1fr 1fr;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e9eaee;
}

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

.installment-row .part-index {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    color: var(--muted);
    background: white;
    font-size: 9px;
    font-weight: 750;
}

.send-option {
    display: flex;
    padding: 15px;
    align-items: center;
    gap: 12px;
    border: 1px solid #dce7ff;
    border-radius: 11px;
    background: #f7f9ff;
}

.send-option > i {
    color: var(--info);
    font-size: 20px;
}

.send-option strong,
.send-option span {
    display: block;
}

.send-option strong {
    margin-bottom: 3px;
    font-size: 11px;
}

.send-option span {
    color: var(--muted);
    font-size: 9px;
}

.invoice-preview-card {
    position: sticky;
    top: 98px;
    margin-bottom: 16px;
    padding: 15px;
}

.preview-toolbar {
    display: flex;
    margin-bottom: 12px;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
}

.invoice-paper {
    position: relative;
    min-height: 470px;
    padding: 23px 20px;
    overflow: hidden;
    border: 1px solid #e2e3e7;
    background: white;
    box-shadow: 0 6px 20px rgba(28, 30, 39, .08);
}

.paper-brand img {
    width: 110px;
}

.paper-title {
    display: flex;
    margin: 28px 0 8px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
}

.paper-title span {
    font-size: 23px;
    font-weight: 850;
    letter-spacing: .08em;
}

.paper-title strong {
    font-size: 9px;
}

.paper-meta {
    display: flex;
    padding: 7px 0;
    justify-content: space-between;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid #dedfe3;
    font-size: 7px;
}

.paper-parties {
    display: grid;
    margin: 17px 0;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.paper-parties small,
.paper-parties strong,
.paper-parties span {
    display: block;
}

.paper-parties small {
    margin-bottom: 5px;
    color: #969aa4;
    font-size: 6px;
    letter-spacing: .09em;
}

.paper-parties strong {
    margin-bottom: 3px;
    font-size: 8px;
}

.paper-parties span {
    color: #737781;
    font-size: 6px;
}

.paper-lines {
    border-top: 1px solid var(--ink);
}

.paper-lines > div {
    display: flex;
    padding: 9px 2px;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #e5e6e9;
    font-size: 7px;
}

.paper-total {
    display: flex;
    margin-top: 13px;
    padding: 11px 12px;
    align-items: center;
    justify-content: space-between;
    color: white;
    background: var(--ink);
}

.paper-total span {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .08em;
}

.paper-total strong {
    font-size: 14px;
}

.paper-footer {
    position: absolute;
    right: 20px;
    bottom: 20px;
    left: 20px;
    padding-top: 8px;
    border-top: 1px solid #e2e3e6;
    color: #858994;
    font-size: 6px;
    text-align: center;
}

.paper-watermark {
    position: absolute;
    z-index: 5;
    top: 48%;
    left: 50%;
    color: rgba(255, 91, 87, .18);
    font-size: 39px;
    font-weight: 850;
    transform: translate(-50%, -50%) rotate(-32deg);
    white-space: nowrap;
}

.preview-note {
    display: flex;
    margin-top: 12px;
    align-items: flex-start;
    gap: 7px;
    color: var(--muted);
    font-size: 9px;
}

.preview-note i {
    color: var(--info);
}

.compact-card {
    padding: 16px;
}

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

.compact-card strong {
    font-size: 11px;
}

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

.summary-strip {
    display: flex;
    padding: 17px;
    align-items: center;
    gap: 13px;
}

.summary-strip > i {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    font-size: 18px;
}

.summary-strip > i.coral { color: var(--brand); background: var(--brand-soft); }
.summary-strip > i.amber { color: var(--warning); background: var(--warning-soft); }
.summary-strip > i.red { color: var(--danger); background: var(--danger-soft); }

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

.summary-strip span {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
}

.summary-strip strong {
    font-size: 17px;
}

.payment-method,
.type-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.payment-method i {
    color: var(--info);
}

.timeline-list {
    padding: 8px 20px 18px;
}

.timeline-list > div {
    position: relative;
    padding: 13px 0 13px 22px;
    border-left: 1px solid #e2e4e8;
}

.timeline-list > div > i {
    position: absolute;
    top: 20px;
    left: -5px;
    width: 9px;
    height: 9px;
    border: 2px solid white;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px #ffb7b4;
}

.timeline-list span,
.timeline-list strong,
.timeline-list small {
    display: block;
}

.timeline-list span {
    margin-bottom: 3px;
    color: var(--brand-dark);
    font-size: 8px;
    font-weight: 700;
}

.timeline-list strong {
    font-size: 11px;
}

.timeline-list small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.limit-banner {
    display: flex;
    margin-bottom: 17px;
    padding: 14px 16px;
    align-items: center;
    gap: 12px;
    border: 1px solid #ffd6d4;
    border-radius: 12px;
    background: #fff9f8;
}

.limit-banner > i {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 16px;
}

.limit-banner > div {
    flex: 1;
}

.limit-banner strong,
.limit-banner span {
    display: block;
}

.limit-banner strong {
    margin-bottom: 3px;
    font-size: 11px;
}

.limit-banner span {
    color: var(--muted);
    font-size: 9px;
}

.entity-card {
    height: 100%;
    padding: 20px;
}

.entity-card.primary-entity {
    border-color: #ffc4c1;
}

.entity-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.entity-head h3 {
    margin: 0 0 5px;
    font-size: 15px;
}

.entity-logo {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, var(--brand), #fc8977);
    font-size: 18px;
    font-weight: 850;
}

.entity-logo.alternate {
    background: linear-gradient(135deg, #2e3343, #696f82);
}

.entity-data {
    display: grid;
    margin: 20px 0;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.entity-data span,
.entity-data strong {
    display: block;
}

.entity-data span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
}

.entity-data strong {
    font-size: 10px;
}

.entity-footer {
    display: flex;
    padding-top: 14px;
    align-items: center;
    gap: 15px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 9px;
}

.entity-footer .btn {
    margin-left: auto;
}

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

.table-entity > span {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 10px;
    font-weight: 800;
}

.type-pill {
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
}

.type-pill.service { color: var(--info); background: var(--info-soft); }
.type-pill.product { color: #7c59c8; background: #f1ebff; }

.tax-pill {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 6px;
    color: var(--success);
    background: var(--success-soft);
    font-size: 9px;
    font-weight: 750;
}

.tax-pill.reduced {
    color: var(--warning);
    background: var(--warning-soft);
}

.contract-card {
    position: relative;
    height: 100%;
    padding: 20px;
}

.contract-card.muted {
    opacity: .72;
}

.contract-icon {
    display: grid;
    width: 43px;
    height: 43px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 11px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 19px;
}

.contract-status {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 750;
}

.contract-status.active { color: var(--success); background: var(--success-soft); }
.contract-status.ended { color: #777b86; background: #edf0f2; }

.contract-card h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.contract-card > p {
    min-height: 33px;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 10px;
}

.contract-partner {
    padding: 12px;
    border-radius: 9px;
    background: #f7f8f9;
}

.contract-partner span,
.contract-partner strong {
    display: block;
}

.contract-partner span {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 8px;
}

.contract-partner strong {
    font-size: 10px;
}

.contract-dates {
    display: grid;
    padding: 16px 2px;
    grid-template-columns: 1fr 1fr;
}

.contract-dates span,
.contract-dates strong {
    display: block;
}

.contract-dates span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 8px;
}

.contract-dates strong {
    font-size: 10px;
}

.contract-footer {
    display: flex;
    padding-top: 13px;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 9px;
}

.settings-nav {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.settings-nav .list-group-item {
    display: flex;
    padding: 13px 15px;
    align-items: center;
    gap: 10px;
    border-color: var(--line);
    color: #656975;
    background: white;
    font-size: 11px;
    font-weight: 600;
}

.settings-nav .list-group-item.active {
    z-index: 1;
    color: var(--brand-dark);
    border-color: #ffd1cf;
    background: var(--brand-soft);
}

.settings-nav .list-group-item i {
    width: 16px;
    text-align: center;
}

.plan-price {
    margin-left: auto;
    color: var(--brand-dark);
    font-size: 17px;
    font-weight: 800;
}

.usage-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.usage-card > div:first-child {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
}

.modal-content {
    border: 0;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    padding: 18px 20px;
    align-items: flex-start;
    border-color: var(--line);
}

.modal-title {
    font-size: 16px;
    font-weight: 750;
}

.modal-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 14px 20px;
    border-color: var(--line);
}

.notification-list {
    padding: 10px 16px;
}

.notification {
    display: flex;
    padding: 14px 5px;
    gap: 11px;
    border-bottom: 1px solid var(--line);
}

.notification > i {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    color: var(--brand);
    background: var(--brand-soft);
}

.notification strong {
    font-size: 11px;
}

.notification p {
    margin: 4px 0;
    color: var(--muted);
    font-size: 10px;
}

.notification small {
    color: #aaaeb6;
    font-size: 8px;
}

.notification.unread {
    position: relative;
}

.notification.unread::after {
    position: absolute;
    top: 19px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    content: "";
    background: var(--brand);
}

.toast {
    border: 0;
    border-radius: 11px;
    box-shadow: var(--shadow-md);
}

.toast-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    place-items: center;
    border-radius: 7px;
    color: white;
    background: var(--success);
}

.preview-modal-content .modal-body {
    max-height: 72vh;
    overflow: auto;
    background: #e8eaee;
}

.preview-modal-content .invoice-paper {
    width: 700px;
    min-height: 990px;
    margin: 0 auto;
    padding: 55px;
}

.preview-modal-content .paper-brand img { width: 190px; }
.preview-modal-content .paper-title { margin-top: 65px; }
.preview-modal-content .paper-title span { font-size: 42px; }
.preview-modal-content .paper-title strong { font-size: 16px; }
.preview-modal-content .paper-meta { padding: 15px 0; font-size: 13px; }
.preview-modal-content .paper-parties { margin: 35px 0; gap: 40px; }
.preview-modal-content .paper-parties small { font-size: 10px; }
.preview-modal-content .paper-parties strong { font-size: 14px; }
.preview-modal-content .paper-parties span { font-size: 11px; }
.preview-modal-content .paper-lines > div { padding: 17px 3px; font-size: 13px; }
.preview-modal-content .paper-total { margin-top: 25px; padding: 20px 24px; }
.preview-modal-content .paper-total span { font-size: 12px; }
.preview-modal-content .paper-total strong { font-size: 25px; }
.preview-modal-content .paper-footer { right: 55px; bottom: 55px; left: 55px; padding-top: 15px; font-size: 10px; }
.preview-modal-content .paper-watermark { font-size: 86px; }

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1199.98px) {
    .app-content {
        padding-right: 22px;
        padding-left: 22px;
    }

    .invoice-preview-card {
        top: 92px;
    }

    .filter-bar {
        flex-wrap: wrap;
    }

    .filter-search {
        min-width: 100%;
    }
}

@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 270px;
    }

    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
        transition: transform .2s ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

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

    body.sidebar-open .sidebar-backdrop {
        position: fixed;
        z-index: 1035;
        inset: 0;
        display: block;
        background: rgba(24, 26, 33, .4);
    }

    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        height: 72px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .app-content {
        padding: 20px 18px 40px;
    }

    .invoice-preview-card {
        position: static;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 13px;
    }

    .app-topbar {
        height: 66px;
        padding-right: 12px;
        padding-left: 12px;
    }

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

    .topbar-actions {
        gap: 4px;
    }

    .language-btn {
        display: none;
    }

    .user-menu {
        padding-right: 3px;
    }

    .user-menu::after {
        display: none;
    }

    .app-content {
        padding: 16px 12px 35px;
    }

    .view-toolbar {
        margin-bottom: 15px;
        flex-direction: column;
        align-items: stretch;
    }

    .view-toolbar h2 {
        font-size: 20px;
    }

    .view-toolbar > .btn,
    .view-toolbar > .d-flex {
        width: 100%;
    }

    .view-toolbar > .d-flex .btn {
        flex: 1;
    }

    .invoice-toolbar {
        position: static;
    }

    .panel-header,
    .form-card {
        padding-right: 15px;
        padding-left: 15px;
    }

    .metric-card {
        min-height: 133px;
    }

    .metric-value {
        font-size: 19px;
    }

    .mini-chart {
        height: 220px;
        padding-right: 15px;
        padding-left: 15px;
    }

    .chart-month .bars i,
    .chart-month .bars b {
        width: 8px;
    }

    .status-ring-wrap {
        min-height: auto;
        padding: 24px 15px;
    }

    .filter-bar .form-select,
    .filter-bar .btn {
        min-width: calc(50% - 5px);
        flex: 1;
    }

    .form-card-header {
        align-items: flex-start;
    }

    .invoice-items-wrap {
        margin-right: -15px;
        margin-left: -15px;
    }

    .invoice-totals {
        width: 100%;
    }

    .entity-data {
        grid-template-columns: 1fr;
    }

    .limit-banner {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .limit-banner .btn {
        width: 100%;
    }

    .preview-modal-content .invoice-paper {
        width: 620px;
    }
}

/* v23: server-backed settings, roles and account security */
.team-agent-summary {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.team-agent-access {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-tertiary-bg);
}

.team-agent-access-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.5fr) repeat(5, minmax(86px, 1fr));
    gap: .65rem;
    align-items: center;
    padding: .65rem 0;
    border-top: 1px solid var(--bs-border-color);
}

.team-agent-access-row:first-child {
    border-top: 0;
}

.team-agent-access-row label {
    display: flex;
    gap: .4rem;
    align-items: center;
    margin: 0;
    font-size: .82rem;
}

.recovery-codes {
    max-height: 250px;
    margin: 0 0 1rem;
    padding: 1rem;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-tertiary-bg);
    font-size: .9rem;
    letter-spacing: .08em;
    line-height: 1.8;
    user-select: all;
}

@media (max-width: 991.98px) {
    .team-agent-access-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-agent-access-row strong {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .metric-grid > [class*="col-"] {
        width: 50%;
    }

    .metric-card {
        min-height: 125px;
        padding: 14px;
    }

    .metric-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 10px;
        font-size: 15px;
    }

    .metric-label {
        font-size: 9px;
    }

    .metric-value {
        font-size: 16px;
    }

    .metric-change {
        font-size: 8px;
    }

    .status-ring-wrap {
        gap: 18px;
    }

    .status-ring {
        width: 110px;
        height: 110px;
    }

    .status-ring::before {
        width: 77px;
        height: 77px;
    }

    .status-ring strong {
        font-size: 21px;
    }

    .filter-bar .form-select,
    .filter-bar .btn {
        width: 100%;
        min-width: 100%;
    }

    .installment-row {
        grid-template-columns: 26px 1fr;
    }

    .installment-row .installment-amount {
        grid-column: 2;
    }

    .send-option {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .entity-footer {
        flex-wrap: wrap;
    }

    .entity-footer .btn {
        width: 100%;
        margin-left: 0;
    }
}

.document-formats {
    display: flex;
    padding: 14px 16px;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fafafd;
}

.document-formats > div:first-child {
    min-width: 230px;
    margin-right: auto;
}

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

.document-formats > div > span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.format-option {
    display: flex;
    min-width: 150px;
    padding: 10px 12px;
    align-items: center;
    gap: 9px;
    border: 1px solid #e4e5e9;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.format-option > i {
    color: var(--brand);
    font-size: 20px;
}

.format-option span {
    font-weight: 800;
}

.format-option small {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
    animation: panel-in .18s ease;
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

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

.plan-option {
    display: flex;
    min-height: 225px;
    padding: 14px;
    align-items: flex-start;
    gap: 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: .15s ease;
}

.plan-option:hover,
.plan-option.selected {
    border-color: #ffaaa7;
    background: var(--brand-soft);
}

.plan-option > input {
    margin-top: 4px;
}

.plan-option .plan-option-copy {
    display: block;
    flex: 1;
}

.plan-option-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.plan-option strong,
.plan-option small {
    display: block;
}

.plan-option small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.plan-option b {
    color: var(--brand-dark);
    font-size: 18px;
}

.plan-option em {
    display: block;
    min-height: 36px;
    margin-top: 10px;
    color: var(--ink-2);
    font-size: 11px;
    font-style: normal;
    line-height: 1.45;
}

.plan-option ul {
    margin: 11px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid rgba(0, 0, 0, .07);
    list-style: none;
}

.plan-option li {
    position: relative;
    margin-top: 5px;
    padding-left: 17px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.plan-option li::before {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--success);
    font-family: inherit;
    font-weight: 800;
    content: "✓";
}

#rootAccountsTable .root-user-select {
    min-width: 230px;
}

#rootAccountsTable .root-account-actions {
    min-width: 190px;
}

.settings-table {
    min-width: 760px;
    margin-bottom: 0;
}

.settings-table th {
    color: #969aa4;
    background: #fafafd;
    font-size: 9px;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.settings-table td,
.settings-table th {
    padding: 10px 12px;
    border-color: var(--line);
}

.settings-table .form-control,
.settings-table .form-select {
    min-width: 135px;
    min-height: 36px;
}

.settings-table code {
    color: var(--brand-dark);
    font-size: 11px;
}

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

.template-choice {
    position: relative;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.template-choice:hover,
.template-choice.selected {
    border-color: #ffaaa7;
    box-shadow: 0 0 0 3px rgba(255, 91, 87, .07);
}

.template-choice > input {
    position: absolute;
    top: 18px;
    right: 18px;
}

.template-choice > strong,
.template-choice > small {
    display: block;
}

.template-choice > strong {
    margin-top: 10px;
}

.template-choice > small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.template-preview {
    display: block;
    height: 145px;
    padding: 18px;
    border-radius: 8px;
    background: #f8f8fa;
}

.template-preview i {
    display: block;
    margin-bottom: 25px;
    color: var(--brand);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.template-preview b {
    display: block;
    height: 5px;
    margin: 8px 0;
    border-radius: 3px;
    background: #dfe1e7;
}

.template-preview b:nth-of-type(2) {
    width: 78%;
}

.template-preview b:nth-of-type(3) {
    width: 55%;
}

.template-preview.compact {
    background: #f4f7ff;
}

.template-preview.plain i {
    color: var(--ink);
}

.connection-status {
    display: inline-flex;
    padding: 6px 9px;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    border-radius: 99px;
    background: #f2f3f6;
    font-size: 10px;
    font-weight: 700;
}

.connection-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a4a7b0;
}

.connection-status.success {
    color: var(--success);
    background: var(--success-soft);
}

.connection-status.success i {
    background: var(--success);
}

.connection-status.failed i {
    background: var(--danger);
}

.connection-status.failed {
    color: var(--danger);
    background: var(--danger-soft);
}

.mail-delivery-history h6 {
    margin-bottom: 12px;
}

.mail-delivery-list {
    display: grid;
    gap: 9px;
}

.mail-delivery-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.mail-delivery-item > i {
    margin-top: 2px;
    color: var(--success);
}

.mail-delivery-item.failed > i,
.mail-delivery-item.failed .mail-delivery-state {
    color: var(--danger);
}

.mail-delivery-item strong,
.mail-delivery-item span,
.mail-delivery-item small {
    display: block;
}

.mail-delivery-item span {
    overflow-wrap: anywhere;
}

.mail-delivery-item small {
    margin-top: 3px;
    color: var(--muted);
}

.mail-delivery-state {
    color: var(--success);
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .mail-delivery-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .mail-delivery-state {
        grid-column: 2;
    }
}

.security-option,
.session-row {
    display: flex;
    min-height: 64px;
    padding: 12px 0;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--line);
}

.security-option:first-of-type,
.session-row:first-of-type {
    border-top: 0;
}

.security-option > div:first-child,
.session-row > div {
    flex: 1;
}

.security-option strong,
.security-option span,
.session-row strong,
.session-row span {
    display: block;
}

.security-option span,
.session-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.session-row > i {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--brand-dark);
    border-radius: 10px;
    background: var(--brand-soft);
    font-size: 17px;
}

.catalog-search {
    max-width: none;
}

.catalog-list {
    display: grid;
    gap: 8px;
}

.catalog-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    min-height: 66px;
    padding: 12px;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    cursor: pointer;
    transition: .15s ease;
}

.catalog-item:hover,
.catalog-item.selected {
    border-color: #ffaaa7;
    background: #fff8f7;
}

.catalog-item-copy strong,
.catalog-item-copy small {
    display: block;
}

.catalog-item-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.catalog-item-price {
    min-width: 95px;
    text-align: right;
}

.catalog-item-price strong,
.catalog-item-price small {
    display: block;
}

.catalog-item-price small {
    color: var(--muted);
    font-size: 9px;
}

.catalog-empty {
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--muted);
    text-align: center;
}

.catalog-empty i {
    margin-bottom: 10px;
    font-size: 30px;
}

.catalog-empty strong,
.catalog-empty span {
    display: block;
}

.catalog-empty span {
    margin-top: 4px;
    font-size: 11px;
}

.send-option.compact {
    min-height: 70px;
}

@media (max-width: 767.98px) {
    .document-preview {
        min-height: 0;
        padding: 24px 18px;
    }

    .document-preview-brand,
    .document-preview-title,
    .document-preview-parties,
    .document-preview-signatures {
        flex-direction: column;
    }

    .document-preview-brand {
        align-items: flex-start;
    }

    .document-formats {
        align-items: stretch;
        flex-direction: column;
    }

    .document-formats > div:first-child,
    .format-option {
        width: 100%;
        min-width: 0;
    }

    .plan-options,
    .template-grid {
        grid-template-columns: 1fr;
    }

    .root-impersonation-banner {
        align-items: stretch;
        flex-direction: column;
    }

    body.root-impersonating .app-sidebar {
        top: 86px;
        height: calc(100vh - 86px);
    }

    body.root-impersonating .app-main {
        padding-top: 86px;
    }

    .catalog-item {
        grid-template-columns: 28px minmax(0, 1fr) auto;
    }

    .catalog-item .type-pill {
        display: none;
    }
}

/* List pages fill the available workspace instead of ending directly after the last row. */
.table-panel {
    display: flex;
    min-height: 330px;
    flex-direction: column;
}

.table-panel > .table-responsive {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.table-panel .dt-container {
    display: flex;
    min-width: 100%;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.table-panel .dt-container > .row:last-child {
    margin-top: auto !important;
    padding: 12px 15px;
    align-items: center;
    border-top: 1px solid var(--line);
}

.table-panel .dt-layout-cell {
    min-width: 0;
}

@media (min-width: 992px) {
    .app-content {
        display: flex;
        min-height: calc(100vh - 82px);
        flex-direction: column;
    }

    .app-view[data-view="invoices"].active,
    .app-view[data-view="waybills"].active,
    .app-view[data-view="payments"].active,
    .app-view[data-view="recurring"].active,
    .app-view[data-view="services"].active,
    .app-view[data-view="contracts"].active {
        display: flex;
        min-height: calc(100vh - 156px);
        flex: 1;
        flex-direction: column;
    }

    .app-view[data-view="invoices"] > .panel-card,
    .app-view[data-view="waybills"] > .panel-card,
    .app-view[data-view="payments"] > .panel-card,
    .app-view[data-view="services"] > .panel-card,
    .app-view[data-view="contracts"] > .panel-card {
        flex: 1;
    }

    .app-view[data-view="recurring"] > .row {
        min-height: 0;
        flex: 1;
    }

    .app-view[data-view="recurring"] > .row > [class*="col-"] {
        display: flex;
    }

    .app-view[data-view="recurring"] > .row .panel-card {
        width: 100%;
        flex: 1;
    }
}

/* Table action menus are temporarily moved to <body> by app.js. */
.floating-action-menu {
    position: fixed !important;
    top: var(--floating-menu-top, 10px) !important;
    right: auto !important;
    bottom: auto !important;
    left: var(--floating-menu-left, 10px) !important;
    z-index: 1095 !important;
    display: block;
    min-width: 190px;
    margin: 0 !important;
    transform: none !important;
    box-shadow: 0 16px 38px rgba(26, 29, 41, .18);
}

.paid-feature-badge {
    display: inline-flex;
    margin-left: auto;
    padding: 6px 9px;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    color: #a56a00;
    background: #fff4d5;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.logo-upload-card {
    position: relative;
    display: flex;
    min-height: 150px;
    padding: 18px;
    align-items: center;
    gap: 18px;
    overflow: hidden;
    border: 1px dashed #d9dbe1;
    border-radius: 12px;
    background: #fafafd;
}

.logo-upload-preview {
    display: grid;
    width: 190px;
    height: 94px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #adb0b8;
    background: white;
    font-size: 27px;
}

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

.logo-upload-preview.has-image img {
    display: block;
}

.logo-upload-preview.has-image i {
    display: none;
}

.logo-upload-copy {
    min-width: 0;
    flex: 1;
}

.logo-upload-copy strong,
.logo-upload-copy > span {
    display: block;
}

.logo-upload-copy strong {
    margin-bottom: 5px;
    font-size: 13px;
}

.logo-upload-copy > span {
    color: var(--muted);
    font-size: 10px;
}

.logo-plan-lock {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    padding: 22px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--ink-2);
    background: rgba(250, 250, 253, .94);
    text-align: center;
    backdrop-filter: blur(3px);
}

.logo-plan-lock i {
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 23px;
}

.logo-plan-lock strong,
.logo-plan-lock span {
    display: block;
}

.logo-plan-lock span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.template-preview.waybill-standard i {
    color: #3e6ad8;
}

.template-preview.waybill-warehouse i {
    color: #5c6877;
}

.existing-invoice-preview {
    min-height: 590px;
    padding: 52px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 10px 35px rgba(26, 29, 41, .08);
}

.existing-invoice-preview .record-preview-head,
.existing-invoice-preview .record-preview-parties,
.existing-invoice-preview .record-preview-summary {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.existing-invoice-preview .record-preview-head {
    padding-bottom: 28px;
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
}

.existing-invoice-preview .record-preview-head img {
    width: 175px;
}

.existing-invoice-preview .record-preview-head h3 {
    margin: 0 0 6px;
    font-size: 23px;
}

.existing-invoice-preview .record-preview-head span,
.existing-invoice-preview .record-preview-parties span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.existing-invoice-preview .record-preview-parties {
    margin: 38px 0;
}

.existing-invoice-preview .record-preview-parties > div {
    width: 50%;
}

.existing-invoice-preview .record-preview-parties small,
.existing-invoice-preview .record-preview-parties strong {
    display: block;
}

.existing-invoice-preview .record-preview-parties small {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.existing-invoice-preview .record-preview-parties strong {
    margin-bottom: 6px;
    font-size: 14px;
}

.existing-invoice-preview .record-preview-line {
    display: flex;
    padding: 18px 0;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.existing-invoice-preview .record-preview-summary {
    margin-top: 34px;
    padding: 18px 22px;
    align-items: center;
    border-radius: 10px;
    background: #f8f8fa;
}

.existing-invoice-preview .record-preview-summary span,
.existing-invoice-preview .record-preview-summary strong {
    display: block;
}

.existing-invoice-preview .record-preview-summary span {
    color: var(--muted);
    font-size: 10px;
}

.existing-invoice-preview .record-preview-summary strong {
    margin-top: 4px;
    font-size: 18px;
}

.template-help-note {
    display: flex;
    margin-top: 14px;
    padding: 11px 13px;
    align-items: flex-start;
    gap: 9px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fafafd;
    font-size: 10px;
}

.template-help-note i {
    margin-top: 1px;
    color: var(--brand);
}

.template-help-note code,
.api-response-note code {
    color: var(--brand-dark);
}

.template-editor-modal {
    height: min(900px, calc(100vh - 36px));
}

.template-editor-modal .modal-body {
    min-height: 0;
    overflow: hidden;
}

.template-editor-layout {
    display: grid;
    height: calc(100% - 84px);
    min-height: 510px;
    grid-template-columns: 250px minmax(380px, 1fr) minmax(330px, .9fr);
    gap: 12px;
}

.template-variables-panel,
.template-code-panel,
.template-preview-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: white;
}

.template-variables-panel {
    overflow-y: auto;
}

.template-panel-title,
.template-code-toolbar,
.template-preview-toolbar {
    display: flex;
    min-height: 54px;
    padding: 11px 13px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    background: #fafafd;
}

.template-panel-title strong,
.template-panel-title span,
.template-code-toolbar strong,
.template-code-toolbar span,
.template-preview-toolbar strong,
.template-preview-toolbar span {
    display: block;
}

.template-panel-title strong,
.template-code-toolbar strong,
.template-preview-toolbar strong {
    font-size: 11px;
}

.template-panel-title span,
.template-code-toolbar span,
.template-preview-toolbar span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.template-panel-title > i {
    color: var(--brand);
    font-size: 18px;
}

.template-variables-panel .accordion-button {
    min-height: 43px;
    padding: 10px 13px;
    color: var(--ink);
    background: white;
    box-shadow: none;
    font-size: 10px;
    font-weight: 700;
}

.template-variables-panel .accordion-button:not(.collapsed) {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.template-variables-panel .accordion-button::after {
    background-size: 12px;
}

.template-variables-panel .accordion-body {
    padding: 7px;
}

.template-token-list {
    display: grid;
    gap: 5px;
}

.template-token-list > button {
    display: block;
    width: 100%;
    padding: 8px 9px;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #f7f7fa;
    transition: .15s ease;
}

.template-token-list > button:hover {
    border-color: #ffc4c1;
    background: var(--brand-soft);
}

.template-token-list code,
.template-token-list span {
    display: block;
}

.template-token-list code {
    overflow: hidden;
    color: #a6322f;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-token-list span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 8px;
}

.template-code-panel {
    display: flex;
    flex-direction: column;
}

.template-code-toolbar .btn {
    font-size: 9px;
}

.template-code-editor {
    flex: 1;
    min-height: 390px;
    padding: 14px;
    resize: none;
    border: 0;
    border-radius: 0;
    color: #d7dcea;
    background: #171923;
    font: 10px/1.55 Consolas, "Courier New", monospace;
    tab-size: 4;
}

.template-code-editor:focus {
    color: #eef1f8;
    background: #171923;
    box-shadow: inset 0 0 0 2px rgba(255, 91, 87, .35);
}

.template-validation-status {
    display: flex;
    min-height: 40px;
    padding: 9px 12px;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    border-top: 1px solid #2d303d;
    background: #20232e;
    font-size: 9px;
}

.template-validation-status.success {
    color: #69d39a;
}

.template-validation-status.error {
    color: #ff8884;
}

.template-preview-panel {
    display: flex;
    flex-direction: column;
    background: #e8e9ed;
}

#templatePreviewFrame {
    width: calc(100% - 20px);
    height: calc(100% - 74px);
    min-height: 435px;
    margin: 10px;
    border: 0;
    background: white;
    box-shadow: 0 4px 18px rgba(39, 42, 52, .12);
}

.template-save-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 9px;
}

.api-endpoint-card {
    display: flex;
    padding: 14px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border: 1px solid #ffd0cd;
    border-radius: 11px;
    background: var(--brand-soft);
}

.api-endpoint-card span,
.api-endpoint-card code {
    display: block;
}

.api-endpoint-card span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
}

.api-endpoint-card code {
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
}

.api-feature {
    display: grid;
    min-height: 102px;
    padding: 14px;
    align-content: center;
    grid-template-columns: 32px 1fr;
    column-gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.api-feature i {
    grid-row: 1 / 3;
    color: var(--brand);
    font-size: 22px;
}

.api-feature strong,
.api-feature span {
    display: block;
}

.api-feature strong {
    font-size: 11px;
}

.api-feature span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

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

.integration-card {
    display: grid;
    min-height: 68px;
    padding: 10px;
    align-items: center;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.integration-logo {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: white;
    border-radius: 9px;
    background: #555b68;
    font-size: 10px;
    font-weight: 800;
}

.integration-logo.woo { background: #96588a; }
.integration-logo.opencart { background: #20a8d8; }
.integration-logo.presta { background: #24b9d7; }
.integration-logo.magento { background: #f26322; }
.integration-logo.shopify { background: #7ab55c; }
.integration-logo.shopware { background: #189eff; }

.integration-card strong,
.integration-card small {
    display: block;
}

.api-method-groups {
    display: grid;
    margin-bottom: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.api-method-group {
    display: flex;
    padding: 10px;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafd;
}

.api-method-group > strong {
    width: 100%;
    margin-bottom: 2px;
    color: var(--ink-2);
    font-size: 10px;
}

.api-method-group > button {
    display: inline-flex;
    padding: 6px 8px;
    align-items: center;
    gap: 5px;
    color: var(--ink-2);
    border: 1px solid #dfe1e7;
    border-radius: 7px;
    background: white;
    font-size: 9px;
    font-weight: 700;
}

.api-method-group > button:hover,
.api-method-group > button.active {
    color: var(--brand-dark);
    border-color: #ffaaa7;
    background: var(--brand-soft);
}

.api-method-group > button span {
    color: var(--brand-dark);
    font: 700 7px/1 Consolas, monospace;
}

.integration-card strong {
    font-size: 10px;
}

.integration-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 8px;
}

.api-code-tabs {
    display: flex;
    margin-bottom: -1px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 9px 9px 0 0;
    background: #f5f6f9;
}

.api-code-tabs button {
    padding: 9px 11px;
    flex: 0 0 auto;
    color: var(--muted);
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    font-size: 9px;
    font-weight: 700;
}

.api-code-tabs button.active {
    color: white;
    background: #20232e;
}

.api-code-block {
    min-height: 320px;
    max-height: 430px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    color: #d9dfed;
    border-radius: 0 0 9px 9px;
    background: #20232e;
    font: 10px/1.55 Consolas, "Courier New", monospace;
    white-space: pre;
}

.api-response-note {
    display: flex;
    margin-top: 10px;
    padding: 10px 12px;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 9px;
}

.api-scope-options,
.api-permissions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.api-permissions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.api-scope-options label,
.api-permissions label {
    display: flex;
    min-height: 75px;
    padding: 12px;
    align-items: flex-start;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.api-scope-options label:has(input:checked),
.api-permissions label:has(input:checked) {
    border-color: #ffaaa7;
    background: var(--brand-soft);
}

.api-scope-options strong,
.api-scope-options small,
.api-permissions strong,
.api-permissions small {
    display: block;
}

.api-scope-options strong,
.api-permissions strong {
    font-size: 10px;
}

.api-scope-options small,
.api-permissions small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 8px;
}

.created-api-key {
    display: flex;
    align-items: stretch;
    gap: 7px;
}

.created-api-key code {
    display: flex;
    min-height: 48px;
    padding: 10px 13px;
    overflow: auto;
    flex: 1;
    align-items: center;
    color: #dce1ee;
    border-radius: 8px;
    background: #20232e;
    font-size: 11px;
}

@media (max-width: 767.98px) {
    .table-panel {
        min-height: 0;
    }

    .logo-upload-card,
    .existing-invoice-preview .record-preview-head,
    .existing-invoice-preview .record-preview-parties,
    .existing-invoice-preview .record-preview-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .logo-upload-preview,
    .existing-invoice-preview .record-preview-parties > div {
        width: 100%;
    }

    .existing-invoice-preview {
        min-height: 0;
        padding: 24px 18px;
    }

    .api-endpoint-card,
    .integration-card {
        align-items: stretch;
        grid-template-columns: 40px 1fr;
        flex-direction: column;
    }

    .integration-card .btn {
        grid-column: 1 / -1;
    }

    .integration-grid,
    .api-method-groups,
    .api-scope-options,
    .api-permissions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1199.98px) {
    .template-editor-modal {
        height: 100%;
    }

    .template-editor-modal .modal-body {
        overflow-y: auto;
    }

    .template-editor-layout {
        height: auto;
        min-height: 0;
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .template-preview-panel {
        min-height: 600px;
        grid-column: 1 / -1;
    }
}

@media (max-width: 767.98px) {
    .template-editor-layout {
        grid-template-columns: 1fr;
    }

    .template-variables-panel {
        max-height: 340px;
    }

    .template-preview-panel {
        min-height: 520px;
        grid-column: auto;
    }

    .template-code-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .template-code-toolbar .btn-group {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* First invoice wizard and contextual page assistant */
.page-guide-button {
    color: var(--brand-dark);
}

.page-guide-button.is-disabled {
    color: #9da1ab;
    background: #f5f5f7;
}

.assistant-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--muted);
    background: #f1f2f5;
    font-size: 12px;
    font-weight: 700;
}

.assistant-state-badge.active {
    color: var(--success);
    background: var(--success-soft);
}

.guide-progress-total {
    color: var(--brand-dark);
    font-size: 14px;
}

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

.guide-progress-item {
    display: flex;
    min-width: 0;
    padding: 11px 12px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafd;
}

.guide-progress-item i {
    color: #a4a8b1;
    font-size: 16px;
}

.guide-progress-item strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-progress-item span {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.guide-progress-item.completed {
    border-color: #caeddd;
    background: #f3fbf7;
}

.guide-progress-item.completed i,
.guide-progress-item.completed span {
    color: var(--success);
}

.first-invoice-settings {
    display: grid;
    align-items: center;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 14px;
}

.first-invoice-settings-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 13px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 22px;
}

.first-invoice-settings strong,
.first-invoice-settings span {
    display: block;
}

.first-invoice-settings span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.first-invoice-wizard {
    --bs-modal-width: 1060px;
}

.first-invoice-wizard .modal-content {
    overflow: hidden;
    min-height: min(760px, calc(100vh - 40px));
    border: 0;
    border-radius: 18px;
    box-shadow: 0 25px 70px rgba(27, 29, 38, .22);
}

.wizard-header {
    display: grid;
    padding: 24px 28px 18px;
    align-items: center;
    grid-template-columns: 145px minmax(0, 1fr) 32px;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.wizard-brand img {
    display: block;
    width: 135px;
    height: auto;
}

.wizard-heading h5,
.wizard-heading p {
    margin: 0;
}

.wizard-heading h5 {
    font-size: 22px;
    font-weight: 750;
}

.wizard-heading p {
    margin-top: 4px;
    color: var(--muted);
}

.wizard-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.wizard-stepper {
    display: flex;
    padding: 18px 30px 17px;
    align-items: flex-start;
    justify-content: center;
    background: #fafafd;
    border-bottom: 1px solid var(--line);
}

.wizard-stepper > i {
    width: clamp(28px, 6vw, 76px);
    height: 2px;
    margin: 17px 7px 0;
    background: #e2e4e9;
}

.wizard-step-dot {
    display: grid;
    min-width: 66px;
    padding: 0;
    place-items: center;
    border: 0;
    color: #999da7;
    background: transparent;
}

.wizard-step-dot span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid #dfe1e7;
    border-radius: 50%;
    background: #fff;
    font-size: 12px;
    font-weight: 800;
}

.wizard-step-dot small {
    margin-top: 6px;
    font-size: 10px;
    font-weight: 700;
}

.wizard-step-dot.active,
.wizard-step-dot.completed {
    color: var(--brand-dark);
}

.wizard-step-dot.active span,
.wizard-step-dot.completed span {
    border-color: var(--brand);
    color: #fff;
    background: var(--brand);
}

.wizard-step-dot.completed span {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.wizard-body {
    padding: 28px 32px;
    background: #fff;
}

.wizard-pane {
    display: none;
    max-width: 900px;
    margin: 0 auto;
}

.wizard-pane.active {
    display: block;
    animation: wizardPaneIn .18s ease-out;
}

@keyframes wizardPaneIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-pane-title {
    display: flex;
    margin-bottom: 24px;
    align-items: center;
    gap: 13px;
}

.wizard-pane-title > span {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border-radius: 13px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 20px;
}

.wizard-pane-title h6,
.wizard-pane-title p {
    margin: 0;
}

.wizard-pane-title h6 {
    font-size: 18px;
    font-weight: 750;
}

.wizard-pane-title p {
    margin-top: 3px;
    color: var(--muted);
}

.wizard-choice-row {
    display: grid;
    align-items: end;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 15px;
}

.wizard-choice-or {
    padding: 0 0 11px;
    color: #a0a4ae;
    font-size: 12px;
}

.wizard-new-toggle {
    min-height: 48px;
}

.wizard-new-toggle.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.wizard-quick-form {
    margin-top: 20px;
    padding: 19px;
    border: 1px solid #ffd4d2;
    border-radius: 13px;
    background: #fffafa;
}

.wizard-quick-form-head {
    display: flex;
    margin-bottom: 16px;
    align-items: baseline;
    gap: 9px;
}

.wizard-quick-form-head strong {
    font-size: 14px;
}

.wizard-quick-form-head span {
    color: var(--muted);
    font-size: 11px;
}

.wizard-catalog-search {
    max-width: none;
    margin-bottom: 14px;
}

.wizard-catalog-grid {
    display: grid;
    max-height: 285px;
    padding-right: 4px;
    overflow-y: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.wizard-catalog-card {
    display: grid;
    min-width: 0;
    padding: 13px;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.wizard-catalog-card:hover,
.wizard-catalog-card.selected {
    border-color: #ffaaa7;
    background: #fffafa;
}

.wizard-catalog-card strong,
.wizard-catalog-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-catalog-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.wizard-catalog-card b {
    font-size: 13px;
    white-space: nowrap;
}

.wizard-catalog-empty {
    padding: 32px 15px;
    grid-column: 1 / -1;
    color: var(--muted);
    text-align: center;
}

.wizard-send-choice {
    display: flex;
    padding: 15px;
    align-items: center;
    gap: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fafafd;
    cursor: pointer;
}

.wizard-send-choice > i {
    color: var(--brand-dark);
    font-size: 22px;
}

.wizard-send-choice strong,
.wizard-send-choice small {
    display: block;
}

.wizard-send-choice small {
    margin-top: 2px;
    color: var(--muted);
}

.wizard-summary {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.wizard-summary-head {
    display: flex;
    padding: 18px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: #fff;
    background: linear-gradient(135deg, #ff6863, #ef4d49);
}

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

.wizard-summary-head strong {
    font-size: 18px;
}

.wizard-summary-head span {
    margin-top: 2px;
    opacity: .85;
    font-size: 11px;
}

.wizard-summary-head b {
    font-size: 24px;
}

.wizard-summary-parties {
    display: grid;
    padding: 18px 20px;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.wizard-summary-parties small,
.wizard-summary-parties strong {
    display: block;
}

.wizard-summary-parties small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.wizard-summary-lines {
    padding: 8px 20px;
}

.wizard-summary-line {
    display: grid;
    padding: 9px 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px;
    border-bottom: 1px dashed var(--line);
}

.wizard-summary-line:last-child {
    border-bottom: 0;
}

.wizard-summary-line small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.wizard-summary-total {
    display: flex;
    padding: 16px 20px;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    background: #fafafd;
}

.wizard-summary-total span {
    color: var(--muted);
    font-weight: 700;
}

.wizard-summary-total strong {
    font-size: 20px;
}

.wizard-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.driver-popover.invoicer-driver-popover {
    max-width: 340px;
    padding: 18px;
    border-radius: 13px;
    box-shadow: 0 18px 55px rgba(25, 28, 39, .23);
}

.invoicer-driver-popover .driver-popover-title {
    color: var(--ink);
    font: 750 17px/1.25 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.invoicer-driver-popover .driver-popover-description {
    color: var(--muted);
    font: 13px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.invoicer-driver-popover .driver-popover-progress-text {
    color: #969aa4;
    font-size: 11px;
}

.invoicer-driver-popover .driver-popover-navigation-btns button {
    padding: 7px 12px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--brand);
    text-shadow: none;
    font-size: 12px;
    font-weight: 700;
}

.invoicer-driver-popover .driver-popover-navigation-btns .driver-popover-prev-btn {
    color: var(--ink-2);
    background: #f0f1f4;
}

.driver-active-element {
    border-radius: 8px;
}

.language-dropdown {
    width: 286px;
    padding: 8px;
}

.language-search-wrap {
    position: relative;
    padding: 4px 4px 8px;
}

.language-search-wrap > i {
    position: absolute;
    z-index: 2;
    top: 14px;
    left: 15px;
    color: #a0a4ae;
}

.language-search-wrap .form-control {
    min-height: 36px;
    padding-left: 34px;
}

.language-menu-list {
    max-height: min(430px, 62vh);
    overflow-y: auto;
}

.language-menu-item {
    display: grid;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    background: transparent;
    text-align: left;
}

.language-menu-item:hover,
.language-menu-item.active {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.language-menu-item .language-code {
    color: #969aa4;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
}

.language-menu-item .language-native {
    font-size: 13px;
    font-weight: 650;
}

.language-menu-item .bi-check2 {
    opacity: 0;
}

.language-menu-item.active .bi-check2 {
    opacity: 1;
}

.language-count-badge {
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 11px;
    font-weight: 750;
}

.language-priority-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.language-priority-note > i {
    color: var(--brand);
}

.language-priority-note strong,
.language-priority-note span {
    display: block;
}

.language-priority-note span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.language-settings-search {
    max-width: 430px;
}

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

.language-setting-item {
    display: grid;
    min-height: 62px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.language-setting-item:hover,
.language-setting-item.enabled {
    border-color: #ffb7b4;
    background: #fffafa;
}

.language-setting-item strong,
.language-setting-item small {
    display: block;
}

.language-setting-item strong {
    color: var(--ink-2);
    font-size: 13px;
}

.language-setting-item small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.assistant-toggle-button {
    min-width: 184px;
}

.assistant-toggle-button.is-disabled {
    color: #fff;
    border-color: var(--success);
    background: var(--success);
}

.invoicer-driver-disable {
    width: 100%;
    margin-top: 11px;
    padding: 8px 10px;
    border: 1px solid #ffd0ce;
    border-radius: 8px;
    color: var(--brand-dark);
    background: #fff6f5;
    font-size: 11px;
    font-weight: 700;
}

.invoicer-driver-disable:hover {
    color: #fff;
    background: var(--brand);
}

.wizard-bank-heading {
    display: flex;
    margin-top: 3px;
    padding-top: 14px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
}

.wizard-bank-heading strong,
.wizard-bank-heading span {
    display: block;
}

.wizard-bank-heading span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.wizard-bank-list {
    display: grid;
    margin-top: 11px;
    gap: 10px;
}

.wizard-bank-row {
    position: relative;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafd;
}

.wizard-bank-row .wizard-bank-row-title {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wizard-bank-row .wizard-bank-row-title strong {
    font-size: 12px;
}

.wizard-bank-primary-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] .app-sidebar {
    inset: 0 0 0 auto;
    border-right: 0;
    border-left: 1px solid var(--line);
}

html[dir="rtl"] .app-main {
    margin-right: var(--sidebar-width);
    margin-left: 0;
}

html[dir="rtl"] .sidebar-nav .nav-link,
html[dir="rtl"] .language-menu-item {
    text-align: right;
}

html[dir="rtl"] .language-search-wrap > i {
    right: 15px;
    left: auto;
}

html[dir="rtl"] .language-search-wrap .form-control {
    padding-right: 34px;
    padding-left: 10px;
}

@media (max-width: 767.98px) {
    .guide-progress-grid,
    .wizard-catalog-grid,
    .wizard-summary-parties {
        grid-template-columns: 1fr;
    }

    .first-invoice-settings,
    .wizard-header,
    .wizard-choice-row {
        grid-template-columns: 1fr;
    }

    .language-settings-grid {
        grid-template-columns: 1fr;
    }

    .first-invoice-settings .btn {
        width: 100%;
    }

    .wizard-header {
        padding: 19px 20px 15px;
        gap: 10px;
    }

    .wizard-header .btn-close {
        position: absolute;
        top: 18px;
        right: 18px;
    }

    .wizard-brand img {
        width: 116px;
    }

    .wizard-heading {
        padding-right: 28px;
    }

    .wizard-heading h5 {
        font-size: 19px;
    }

    .wizard-stepper {
        padding-inline: 10px;
    }

    .wizard-stepper > i {
        width: 12px;
        margin-inline: 2px;
    }

    .wizard-step-dot {
        min-width: 43px;
    }

    .wizard-step-dot small {
        display: none;
    }

    .wizard-body {
        padding: 22px 18px;
    }

    .wizard-choice-or {
        display: none;
    }

    .wizard-footer {
        padding: 13px 16px;
    }

    .wizard-footer #skipFirstInvoiceWizard {
        order: 4;
        width: 100%;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .language-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }

    html[dir="rtl"] body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    html[dir="rtl"] .app-main {
        margin-right: 0;
    }
}
body.auth-pending {
    overflow: hidden;
}

body.auth-pending > .app-sidebar,
body.auth-pending > .app-main,
body.auth-pending > .sidebar-backdrop,
body.auth-pending > .modal:not(#legalModal),
body.auth-pending > .offcanvas,
body.auth-pending > .toast-container {
    visibility: hidden;
}

body.auth-pending > #legalModal {
    visibility: visible;
    z-index: 12150;
}

body.auth-pending > .modal-backdrop {
    z-index: 12100;
}

/* v29: public legal/support modal, sidebar legal links and live dashboard */
.sidebar-legal-link {
    width: 100%;
    padding-top: .48rem;
    padding-bottom: .48rem;
    padding-left: 2.15rem;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: .82rem;
    text-align: left;
}

.sidebar-legal-link i {
    font-size: .92rem;
}

.sidebar-legal-link:hover,
.sidebar-legal-link:focus-visible {
    color: var(--ink-2);
    background: rgba(255, 91, 87, .06);
}

.dashboard-plan-card {
    overflow: hidden;
    border-color: rgba(255, 91, 87, .24);
    background: linear-gradient(135deg, #fff 0%, #fff8f7 100%);
}

.dashboard-plan-header {
    gap: 1rem;
}

.dashboard-plan-content {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
    gap: 1.4rem;
}

.dashboard-limit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}

.dashboard-limit-card {
    padding: .85rem;
    border: 1px solid #e8e9ed;
    border-radius: 12px;
    background: rgba(255, 255, 255, .88);
}

.dashboard-limit-card span,
.dashboard-limit-card small {
    display: block;
    color: var(--muted);
    font-size: .75rem;
}

.dashboard-limit-card strong {
    display: block;
    margin: .2rem 0 .5rem;
    color: var(--ink);
    font-size: 1.05rem;
}

.dashboard-limit-card .progress {
    height: 5px;
}

.dashboard-limit-card.is-near-limit .progress-bar {
    background: var(--bs-warning);
}

.dashboard-limit-card.is-at-limit .progress-bar {
    background: var(--bs-danger);
}

.dashboard-feature-list {
    display: grid;
    align-content: start;
    gap: .45rem;
    padding: .85rem 1rem;
    border: 1px solid #e8e9ed;
    border-radius: 12px;
    background: rgba(255, 255, 255, .88);
}

.dashboard-feature-item {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    color: var(--ink-2);
    font-size: .82rem;
    line-height: 1.35;
}

.dashboard-feature-item i {
    margin-top: .05rem;
    color: #26965e;
}

.dashboard-empty-state {
    display: flex;
    min-height: 115px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .84rem;
    text-align: center;
}

.support-request-form {
    width: 100%;
    max-width: 960px;
    min-width: 0;
    margin: 0 auto;
    padding: 1.5rem 2.375rem 2.5rem;
    border-top: 1px solid #e4e6ea;
}

.support-request-form .row {
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
}

.support-request-form .row > * {
    min-width: 0;
}

.support-request-form .form-control,
.support-request-form .form-select {
    max-width: 100%;
}

.support-request-form h3 {
    margin-bottom: .35rem;
}

.support-request-form .support-form-intro {
    margin-bottom: 1rem;
    color: var(--muted);
}

.support-request-form .support-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.support-file-list {
    display: grid;
    gap: .35rem;
    margin-top: .55rem;
    color: var(--muted);
    font-size: .78rem;
}

.support-file-list span {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.support-form-result {
    margin-top: 1rem;
}

@media (max-width: 1199.98px) {
    .dashboard-plan-content {
        grid-template-columns: 1fr;
    }
}

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

    .dashboard-plan-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .support-request-form {
        padding: 1.25rem 1.25rem 1.75rem;
    }
}

@media (max-width: 419.98px) {
    .dashboard-limit-grid {
        grid-template-columns: 1fr;
    }
}

.app-loading-overlay {
    position: fixed;
    z-index: 11500;
    inset: 0;
    display: grid;
    visibility: hidden;
    padding: 24px;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    background: rgba(245, 246, 248, .58);
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
    transition: opacity .16s ease, visibility .16s ease;
}

body.app-loading {
    overflow: hidden;
}

body.app-loading > .app-loading-overlay {
    visibility: visible;
    opacity: 1;
    pointer-events: all;
}

.app-loading-card {
    display: grid;
    min-width: 220px;
    padding: 25px 30px;
    border: 1px solid rgba(230, 231, 235, .92);
    border-radius: 20px;
    place-items: center;
    gap: 15px;
    color: #4d515d;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 24px 65px rgba(31, 35, 48, .16);
}

.app-loading-card img {
    width: 150px;
    height: auto;
}

.app-loading-card .spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: .2em;
}

.app-loading-card strong {
    font-size: .9rem;
    font-weight: 650;
}

.auth-gate {
    position: fixed;
    z-index: 12000;
    inset: 0;
    display: grid;
    overflow: auto;
    padding: 32px 18px;
    place-items: center;
    background:
        radial-gradient(circle at 14% 12%, rgba(255, 91, 87, .17), transparent 34%),
        radial-gradient(circle at 86% 82%, rgba(72, 93, 221, .12), transparent 36%),
        #f5f6f8;
}

.auth-card {
    width: min(100%, 500px);
    padding: 30px;
    border: 1px solid #e6e7eb;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 26px 70px rgba(31, 35, 48, .13);
}

.auth-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.auth-brand-row img {
    width: 154px;
    height: auto;
}

.auth-language-dropdown {
    flex: 0 0 auto;
}

.auth-language-button {
    display: grid;
    min-width: 145px;
    min-height: 38px;
    padding: 6px 30px 6px 10px;
    border-color: #e1e3e8;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    text-align: left;
}

.auth-language-button::after {
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-50%);
}

.auth-language-code {
    color: #8a8e98;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
}

.auth-language-name {
    overflow: hidden;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-language-menu {
    width: 286px;
    padding: 8px;
}

.auth-language-list {
    max-height: min(390px, 58vh);
    overflow-y: auto;
}

.auth-language-option {
    display: grid;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    background: transparent;
    text-align: left;
}

.auth-language-option:hover,
.auth-language-option.active {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.auth-language-option .language-code {
    color: #969aa4;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
}

.auth-language-option .language-native {
    font-size: 13px;
    font-weight: 650;
}

.auth-language-option .bi-check2 {
    opacity: 0;
}

.auth-language-option.active .bi-check2 {
    opacity: 1;
}

.auth-language-empty {
    display: flex;
    padding: 18px 10px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.auth-status {
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6b6f7b;
}

.auth-heading {
    margin-bottom: 23px;
}

.auth-heading h1 {
    margin: 0 0 8px;
    color: #242731;
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 750;
}

.auth-heading p {
    margin: 0;
    color: #777b86;
    line-height: 1.55;
}

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

.auth-form .form-floating > .form-control {
    min-height: 56px;
    border-color: #dddfe5;
}

.auth-form .auth-submit {
    min-height: 46px;
    margin-top: 3px;
    font-weight: 650;
}

.auth-submit.is-loading {
    color: transparent !important;
    pointer-events: none;
}

.auth-submit.is-loading::after {
    position: absolute;
    width: 18px;
    height: 18px;
    margin: 2px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    content: "";
    animation: auth-spin .7s linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

.auth-switch {
    justify-self: center;
    text-decoration: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #999da8;
    font-size: .78rem;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    background: #e7e8ec;
    content: "";
    flex: 1;
}

.auth-message {
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid;
    border-radius: 9px;
    font-size: .9rem;
}

.auth-message.error {
    border-color: #f3c2c0;
    color: #a2322e;
    background: #fff2f1;
}

.auth-message.success {
    border-color: #b9dfca;
    color: #267a4d;
    background: #effaf4;
}

.auth-server-error {
    display: grid;
    min-height: 220px;
    align-content: center;
    justify-items: center;
    gap: 9px;
    color: #656a76;
    text-align: center;
}

.auth-server-error > i {
    color: var(--bs-primary);
    font-size: 2.4rem;
}

.auth-server-error strong {
    color: #292c35;
    font-size: 1.1rem;
}

.auth-server-error span {
    max-width: 350px;
    margin-bottom: 8px;
}

.email-verification-banner {
    gap: 15px;
}

@media (max-width: 575.98px) {
    .auth-gate {
        padding: 0;
        background: #fff;
    }

    .auth-card {
        min-height: 100dvh;
        padding: 24px 18px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-brand-row {
        margin-bottom: 22px;
    }

    .auth-language-button {
        min-width: 108px;
        grid-template-columns: 27px minmax(0, 1fr);
    }

    .auth-language-name {
        max-width: 64px;
    }

    .auth-language-menu {
        width: min(286px, calc(100vw - 36px));
    }

    .email-verification-banner {
        align-items: flex-start !important;
        flex-direction: column;
    }
}
/* v22: complete table controls and Bootstrap/server validation */
.table-date-range {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.table-date-range .form-control {
    width: 145px;
}

.table-view-controls {
    margin-left: .5rem;
}

.table-columns-menu {
    min-width: 260px;
    max-height: min(70vh, 520px);
    overflow: auto;
    padding: .65rem;
}

.table-columns-title {
    padding: .25rem .5rem .5rem;
    color: var(--bs-secondary-color);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.table-column-option {
    display: flex;
    gap: .55rem;
    align-items: center;
    padding: .38rem .5rem;
    border-radius: .35rem;
    cursor: pointer;
}

.table-column-option:hover {
    background: var(--bs-tertiary-bg);
}

.form-api-error {
    margin-bottom: 1rem;
}

.server-feedback {
    display: block;
}

.partner-import-summary {
    margin-bottom: 1rem;
}

.partner-import-preview {
    max-height: 380px;
}

.partner-import-preview .import-ok {
    color: var(--bs-success);
}

.partner-import-preview .import-error {
    color: var(--bs-danger);
}

#smtpInheritanceNotice {
    white-space: normal;
}

@media (max-width: 767.98px) {
    .table-date-range {
        width: 100%;
        flex-wrap: wrap;
    }

    .table-date-range .form-control {
        flex: 1 1 130px;
        width: auto;
    }
}
