@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans-variable.ttf") format("truetype");
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
}

[x-cloak] {
    display: none !important;
}

:root {
    --admin-bg: #f4f6f8;
    --admin-card: #ffffff;
    --admin-ink: #10131c;
    --admin-muted: #727887;
    --admin-line: #e8eaee;
    --admin-sidebar: #0b0d12;
    --admin-sidebar-soft: #171a21;
    --admin-green: #7dffb0;
    --admin-blue: #8fe8ff;
    --admin-yellow: #ffef13;
}

* {
    box-sizing: border-box;
}

.admin-body,
.admin-login-body {
    margin: 0;
    min-width: 320px;
    color: var(--admin-ink);
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.admin-shell {
    min-height: 100vh;
    background: var(--admin-bg);
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: 270px;
    height: 100vh;
    flex-direction: column;
    padding: 26px 20px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #fff;
    background:
        radial-gradient(
            circle at 25% 3%,
            rgba(125, 255, 176, 0.11),
            transparent 24%
        ),
        var(--admin-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.admin-sidebar::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.26);
}

.admin-sidebar::-webkit-scrollbar-button {
    display: none;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.admin-brand-mark,
.admin-mobile-mark,
.login-mobile-brand span {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    overflow: hidden;
    color: #0b0d12;
    font-weight: 800;
    background: var(--admin-green);
    border-radius: 13px;
}

.admin-brand-mark img {
    width: 27px;
    height: 27px;
    object-fit: contain;
}
.admin-brand strong {
    display: block;
    font-size: 16px;
    letter-spacing: -0.02em;
}
.admin-brand small {
    display: block;
    margin-top: 2px;
    color: #8c929f;
    font-size: 11px;
}

.admin-nav {
    margin-top: 55px;
}

.admin-nav-label {
    margin: 12px 12px;
    color: #626875;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-nav-label:first-of-type {
    margin: 0 12px 12px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 44px;
    padding: 8px 14px;
    color: #aeb3be;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.admin-nav-link svg,
.admin-logout svg {
    width: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.admin-nav-link.active {
    color: #11151a;
    background: var(--admin-green);
    box-shadow: 0 6px 18px rgba(125, 255, 176, 0.12);
}

.admin-sidebar-footer {
    display: none;
}

.admin-sidebar-user {
    margin-top: auto;
    padding-top: 14px;
}

.admin-user-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    padding: 10px 12px;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.admin-user-trigger:hover,
.admin-user-trigger:focus-visible,
.admin-user-trigger.open {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    outline: none;
}

.admin-user-trigger-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-user-trigger svg {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.admin-topbar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #444957;
    font-size: 12px;
    font-weight: 600;
}

.admin-topbar-user-trigger {
    display: inline-flex;
    width: auto;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    color: inherit;
}

.admin-topbar-user-trigger:hover,
.admin-topbar-user-trigger:focus-visible,
.admin-topbar-user-trigger.open {
    background: transparent;
    border-color: transparent;
}

.admin-user-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    min-width: 190px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(9, 13, 19, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0.18s ease;
    pointer-events: none;
}

.admin-user-menu:not([hidden]) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.admin-user-menu[hidden] {
    display: none;
}

.admin-user-menu form {
    margin: 0;
}

.admin-user-menu-link,
.admin-user-menu-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    color: var(--admin-ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.admin-user-menu-link svg,
.admin-user-menu-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.admin-user-menu-link:hover,
.admin-user-menu-button:hover,
.admin-user-menu-link:focus-visible,
.admin-user-menu-button:focus-visible {
    background: #f3f5f7;
    outline: none;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    color: #11151a;
    font-size: 13px;
    font-weight: 800;
    background: var(--admin-blue);
    border-radius: 50%;
}

.admin-avatar.small {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.admin-avatar-image {
    display: block;
    object-fit: cover;
    overflow: hidden;
}
.admin-profile-copy {
    min-width: 0;
}
.admin-profile-copy strong {
    display: block;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-profile-copy small {
    display: block;
    margin-top: 2px;
    color: #747b88;
    font-size: 10px;
}
.admin-sidebar-footer form {
    margin-top: 13px;
}

.admin-logout {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 0 0;
    color: #8f95a1;
    font-size: 12px;
    font-weight: 600;
    background: none;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
}

.admin-profile-editor {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.admin-profile-editor-avatar {
    display: grid;
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    place-items: center;
    object-fit: cover;
    color: #11151a;
    font-size: 24px;
    font-weight: 800;
    background: var(--admin-blue);
    border-radius: 50%;
}

.admin-logout:hover {
    color: #fff;
}
.admin-main {
    min-height: 100vh;
    margin-left: 270px;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 76px;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--admin-line);
    backdrop-filter: blur(16px);
}

.admin-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.admin-mobile-mark {
    display: none;
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 10px;
}
.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #444957;
    font-size: 12px;
    font-weight: 600;
}

.admin-menu-button {
    display: none;
    width: 42px;
    height: 42px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 11px;
    cursor: pointer;
}

.admin-menu-button > span:not(.sr-only) {
    display: block;
    width: 19px;
    height: 2px;
    margin: 4px auto;
    background: #151821;
    border-radius: 2px;
}
.admin-content {
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: 42px 40px 60px;
}

.dashboard-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}
.dashboard-eyebrow {
    margin: 0 0 8px;
    color: #6f7582;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.dashboard-heading h1 {
    margin: 0;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.045em;
}
.dashboard-heading > div > p:last-child {
    max-width: 610px;
    margin: 12px 0 0;
    color: var(--admin-muted);
    font-size: 14px;
    line-height: 1.65;
}

.dashboard-date {
    display: flex;
    min-width: 145px;
    flex-direction: column;
    padding: 13px 16px;
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 12px;
}

.dashboard-date span {
    color: #8a909c;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.dashboard-date strong {
    margin-top: 4px;
    font-size: 12px;
}
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 34px;
}

.stat-card,
.dashboard-panel {
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 18px;
    box-shadow: 0 5px 30px rgba(18, 23, 35, 0.035);
}

.stat-card {
    min-height: 205px;
    padding: 22px;
}
.stat-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: #151821;
    border-radius: 13px;
}

.stat-icon.green {
    background: var(--admin-green);
}
.stat-icon.blue {
    background: var(--admin-blue);
}
.stat-icon.yellow {
    background: var(--admin-yellow);
}
.stat-icon svg {
    width: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-status {
    padding: 6px 9px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-radius: 20px;
}

.stat-status.live {
    color: #21633c;
    background: #e1faea;
}
.stat-status.soon {
    color: #767b86;
    background: #f0f1f3;
}
.stat-card > p {
    margin: 22px 0 2px;
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 600;
}
.stat-card > strong {
    display: block;
    font-size: 34px;
    line-height: 1.15;
    letter-spacing: -0.04em;
}
.stat-card > small {
    display: block;
    margin-top: 8px;
    color: #969ba5;
    font-size: 10px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
    gap: 18px;
    margin-top: 18px;
}
.dashboard-panel {
    min-height: 360px;
    padding: 25px;
}
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.panel-heading h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.025em;
}
.panel-badge,
.setup-score {
    padding: 7px 10px;
    color: #69707d;
    font-size: 9px;
    font-weight: 800;
    background: #f2f4f5;
    border-radius: 20px;
}

.empty-state {
    display: flex;
    min-height: 255px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}
.empty-state-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    color: #6b7280;
    background: #f0f2f4;
    border-radius: 50%;
}
.empty-state-icon svg {
    width: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.empty-state h3 {
    margin: 15px 0 5px;
    font-size: 14px;
}
.empty-state p {
    max-width: 290px;
    margin: 0;
    color: #969ba5;
    font-size: 11px;
    line-height: 1.6;
}
.setup-list {
    display: grid;
    gap: 18px;
    padding: 0;
    margin: 28px 0;
    list-style: none;
}
.setup-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #8b909b;
    font-size: 11px;
    font-weight: 600;
}
.setup-list li span {
    width: 10px;
    height: 10px;
    background: #e3e5e9;
    border: 3px solid #f5f6f7;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #d9dce1;
}
.setup-list li.complete {
    color: #303641;
}
.setup-list li.complete span {
    background: #1f9f59;
    border-color: #dff7e9;
    box-shadow: none;
}
.setup-progress {
    height: 6px;
    overflow: hidden;
    background: #eceef1;
    border-radius: 6px;
}
.setup-progress span {
    display: block;
    width: 50%;
    height: 100%;
    background: var(--admin-green);
    border-radius: inherit;
}
.setup-note {
    margin: 13px 0 0;
    color: #969ba5;
    font-size: 10px;
    line-height: 1.55;
}
.admin-sidebar-backdrop {
    display: none;
}

/* Login */
.admin-login-body {
    min-height: 100vh;
    background: #fff;
}
.admin-login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 0.9fr) 1.1fr;
}

.admin-login-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    flex-direction: column;
    padding: 42px 7vw;
    color: #fff;
    background: #0b0d12;
}

.login-brand {
    position: relative;
    z-index: 2;
    width: fit-content;
}
.login-visual-copy {
    position: relative;
    z-index: 2;
    margin: auto 0;
}
.login-kicker {
    display: inline-block;
    padding: 7px 11px;
    color: var(--admin-green);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    border: 1px solid rgba(125, 255, 176, 0.28);
    border-radius: 20px;
}
.login-visual-copy h1 {
    margin: 24px 0 18px;
    font-size: clamp(38px, 5vw, 66px);
    line-height: 1.03;
    letter-spacing: -0.06em;
}
.login-visual-copy p {
    max-width: 420px;
    margin: 0;
    color: #8f95a1;
    font-size: 14px;
    line-height: 1.7;
}
.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
}
.login-orb.one {
    right: -18%;
    bottom: -24%;
    width: 520px;
    height: 520px;
    background: radial-gradient(
        circle at 30% 25%,
        rgba(125, 255, 176, 0.28),
        rgba(125, 255, 176, 0.025) 60%,
        transparent 70%
    );
}
.login-orb.two {
    top: 13%;
    right: 3%;
    width: 200px;
    height: 200px;
    background: radial-gradient(
        circle,
        rgba(143, 232, 255, 0.12),
        transparent 68%
    );
}
.admin-login-form-wrap {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 48px;
}
.admin-login-form-card {
    width: min(420px, 100%);
}
.login-mobile-brand {
    display: none;
}
.admin-login-form-card h2 {
    margin: 0;
    font-size: 38px;
    letter-spacing: -0.05em;
}
.login-intro {
    margin: 12px 0 32px;
    color: var(--admin-muted);
    font-size: 13px;
    line-height: 1.6;
}
.admin-login-form {
    display: flex;
    flex-direction: column;
}
.admin-login-form label {
    margin: 0 0 8px;
    color: #343946;
    font-size: 11px;
    font-weight: 700;
}
.admin-login-form input {
    width: 100%;
    height: 50px;
    margin-bottom: 19px;
    padding: 0 15px;
    color: #151821;
    background: #fafafa;
    border: 1px solid #e1e4e8;
    border-radius: 11px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}
.admin-login-form input:focus {
    border-color: #77dda0;
    box-shadow: 0 0 0 4px rgba(125, 255, 176, 0.18);
}
.admin-login-form input.invalid {
    margin-bottom: 5px;
    border-color: #e36c6c;
}
.field-error {
    margin: 0 0 18px;
    color: #b33a3a;
    font-size: 10px;
}
.admin-login-form button {
    display: flex;
    height: 52px;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 18px;
    color: #0b0d12;
    font-size: 12px;
    font-weight: 800;
    background: var(--admin-green);
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}
.admin-login-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(51, 181, 102, 0.18);
}
.admin-login-form button span {
    font-size: 20px;
    font-weight: 400;
}
.back-to-site {
    display: inline-block;
    margin-top: 24px;
    color: #737986;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}
.back-to-site:hover {
    color: #11151a;
}

@media (max-width: 1024px) {
    .admin-content {
        padding-inline: 28px;
    }
    .admin-topbar {
        padding-inline: 28px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .admin-login-shell {
        grid-template-columns: minmax(380px, 0.8fr) 1.2fr;
    }
    .admin-login-visual {
        padding-inline: 5vw;
    }
}

@media (max-width: 820px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar-open .admin-sidebar {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-menu-button {
        display: block;
    }
    .admin-mobile-mark {
        display: grid;
    }
    .admin-topbar {
        height: 68px;
        padding-inline: 20px;
    }
    .admin-topbar-user > span:first-child {
        display: none;
    }
    .admin-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 25;
        width: 100%;
        height: 100%;
        padding: 0;
        background: rgba(3, 5, 8, 0.52);
        border: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-open .admin-sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    .admin-content {
        padding: 32px 20px 48px;
    }
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-stats .stat-card:last-child {
        grid-column: 1 / -1;
    }
    .admin-login-shell {
        display: block;
    }
    .admin-login-visual {
        display: none;
    }
    .admin-login-form-wrap {
        min-height: 100vh;
        padding: 40px 24px;
    }
    .login-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        width: fit-content;
        margin-bottom: 70px;
        color: #11151a;
        font-size: 14px;
        font-weight: 800;
        text-decoration: none;
    }
    .login-mobile-brand span {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
    }
}

@media (max-width: 580px) {
    .admin-topbar-title strong {
        display: none;
    }
    .dashboard-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .dashboard-date {
        width: 100%;
    }
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    .dashboard-stats .stat-card:last-child {
        grid-column: auto;
    }
    .stat-card {
        min-height: 190px;
    }
    .dashboard-panel {
        min-height: 330px;
        padding: 20px;
    }
    .admin-login-form-card h2 {
        font-size: 34px;
    }
    .login-mobile-brand {
        margin-bottom: 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════
   INVOICE MODULE
   ═══════════════════════════════════════════════════════ */

/* Page header */
.inv-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.inv-page-header h1 {
    margin: 0;
    font-size: clamp(26px, 3vw, 38px);
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.inv-page-header .inv-subtitle {
    margin: 8px 0 0;
    color: var(--admin-muted);
    font-size: 13px;
}

/* Search */
.inv-search-wrap {
    position: relative;
}
.inv-search-wrap svg {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 16px;
    transform: translateY(-50%);
    fill: none;
    stroke: #9ca3af;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.inv-search {
    height: 42px;
    width: 260px;
    padding: 0 14px 0 38px;
    color: var(--admin-ink);
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.inv-search:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.2);
}

/* Action row */
.inv-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.inv-action-row-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.inv-action-row-sub {
    display: block;
    margin-top: 3px;
    color: var(--admin-muted);
    font-size: 12px;
}
.inv-action-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.inv-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    transition:
        background 0.15s,
        box-shadow 0.15s,
        transform 0.15s;
}
.inv-btn:focus-visible {
    outline: 3px solid var(--admin-green);
    outline-offset: 2px;
}
.inv-btn-primary {
    background: var(--admin-green);
    color: #0b0d12;
}
.inv-btn-primary:hover {
    background: #5de89a;
}
.inv-btn-secondary {
    background: #fff;
    color: var(--admin-ink);
    border: 1px solid var(--admin-line);
}
.inv-btn-secondary:hover {
    background: #f8f9fa;
}
.inv-btn-danger {
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.inv-btn-danger:hover {
    background: #fef2f2;
}
.inv-btn svg {
    width: 15px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Stat cards — 4-column on large screens */
.inv-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat-icon.red {
    background: #ffe4e4;
    color: #b91c1c;
}

/* Stat multi-currency note */
.inv-stat-multicurrency {
    font-size: 10px;
    color: var(--admin-muted);
    margin-top: 4px;
}

/* Table card */
.inv-table-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 18px;
    overflow: hidden;
    margin-top: 22px;
}

/* Tabs */
.inv-tabs {
    display: flex;
    gap: 2px;
    padding: 14px 20px 0;
    border-bottom: 1px solid var(--admin-line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.inv-tabs::-webkit-scrollbar {
    display: none;
}
.inv-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px 11px;
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition:
        color 0.15s,
        border-color 0.15s;
}
.inv-tab:focus-visible {
    outline: 3px solid var(--admin-green);
    outline-offset: -2px;
    border-radius: 4px;
}
.inv-tab:hover {
    color: var(--admin-ink);
}
.inv-tab[aria-current="page"] {
    color: var(--admin-ink);
    border-bottom-color: var(--admin-ink);
}
.inv-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    background: #f0f1f3;
    border-radius: 20px;
}
.inv-tab[aria-current="page"] .inv-tab-count {
    background: var(--admin-ink);
    color: #fff;
}

/* Table toolbar */
.inv-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px;
}
.inv-sort-label {
    color: var(--admin-muted);
    font-size: 12px;
}
.inv-sort-select {
    height: 34px;
    padding: 0 10px;
    font: inherit;
    font-size: 12px;
    color: var(--admin-ink);
    background: #fafafa;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}
.inv-sort-select:focus {
    border-color: var(--admin-green);
}

/* Table */
.inv-table-wrap {
    overflow-x: auto;
}
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.inv-table th {
    padding: 0 16px 12px;
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--admin-line);
}
.inv-table th.right,
.inv-table td.right {
    text-align: right;
}
.inv-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f4f5f7;
    vertical-align: middle;
}
.inv-table tbody tr:last-child td {
    border-bottom: 0;
}
.inv-table tbody tr:hover td {
    background: #fafbfc;
}

/* Number cell */
.inv-num {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: -0.01em;
    color: var(--admin-ink);
}
.inv-num-sub {
    display: block;
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 500;
}

/* Client cell */
.inv-client-name {
    font-weight: 600;
}
.inv-client-city {
    display: block;
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 11px;
}

/* Amount */
.inv-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.inv-amount-sub {
    display: block;
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 500;
}

/* Status badges */
.inv-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    white-space: nowrap;
}
.inv-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
}
.inv-badge--paid {
    background: #dcfce7;
    color: #166534;
}
.inv-badge--sent {
    background: #fef9c3;
    color: #854d0e;
}
.inv-badge--viewed {
    background: #e4e4de;
    color: #27272a;
}
.inv-badge--partial {
    background: #dbeafe;
    color: #1d4ed8;
}
.inv-badge--overdue {
    background: #fee2e2;
    color: #b91c1c;
}
.inv-badge--draft {
    background: #f2f2ee;
    color: #6b7280;
}
.inv-badge--void {
    background: #f4f4f5;
    color: #9ca3af;
    text-decoration: line-through;
}

/* Row actions */
.inv-actions {
    position: relative;
}
.inv-actions summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--admin-muted);
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.inv-actions summary::-webkit-details-marker {
    display: none;
}
.inv-actions summary:hover,
.inv-actions[open] summary {
    background: #f4f5f7;
    border-color: var(--admin-line);
    color: var(--admin-ink);
}
.inv-actions summary:focus-visible {
    outline: 3px solid var(--admin-green);
}
.inv-actions summary svg {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inv-actions-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 180px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(12, 16, 28, 0.1);
}
.inv-actions-menu a,
.inv-actions-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    color: var(--admin-ink);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.inv-actions-menu a:hover,
.inv-actions-menu button:hover {
    background: #f4f5f7;
}
.inv-actions-menu a:focus-visible,
.inv-actions-menu button:focus-visible {
    outline: 3px solid var(--admin-green);
}
.inv-actions-menu .danger {
    color: #b91c1c;
}
.inv-actions-menu .danger:hover {
    background: #fef2f2;
}
.inv-actions-menu svg {
    width: 14px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inv-actions-menu hr {
    border: 0;
    border-top: 1px solid var(--admin-line);
    margin: 5px 0;
}

/* Pagination */
.inv-pagination {
    padding: 14px 20px;
    border-top: 1px solid var(--admin-line);
}
.pag-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.pag-info {
    font-size: 12px;
    font-weight: 600;
    color: var(--admin-muted);
    white-space: nowrap;
}
.pag-controls {
    display: flex;
    align-items: center;
    gap: 3px;
}
.pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    transition:
        background 0.12s,
        border-color 0.12s,
        color 0.12s;
    cursor: pointer;
}
a.pag-btn:hover {
    background: var(--admin-bg);
    border-color: var(--admin-line);
    color: var(--admin-ink);
}
.pag-btn--active {
    background: var(--admin-ink);
    color: #fff;
    border-color: var(--admin-ink);
    cursor: default;
}
.pag-btn--disabled {
    color: var(--admin-line);
    cursor: not-allowed;
}
.pag-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-muted);
    user-select: none;
}

/* Empty state (reuses .empty-state) */
.inv-empty {
    padding: 60px 20px;
}

/* Responsive */
@media (max-width: 1100px) {
    .inv-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 768px) {
    .inv-page-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .inv-search {
        width: 100%;
    }
    .inv-search-wrap {
        width: 100%;
    }
    .inv-action-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .inv-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .inv-table th:nth-child(3),
    .inv-table td:nth-child(3),
    .inv-table th:nth-child(4),
    .inv-table td:nth-child(4) {
        display: none;
    }
}
@media (max-width: 500px) {
    .inv-stats {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════
   INVOICE BUILDER (Phase 4)
   ═══════════════════════════════════════════════════════ */

/* Sticky sub-topbar */
.inv-builder-topbar {
    position: sticky;
    top: 76px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: -42px -40px 32px;
    padding: 14px 40px;
    background: rgba(244, 246, 248, 0.92);
    border-bottom: 1px solid var(--admin-line);
    backdrop-filter: blur(12px);
}
.inv-builder-topbar-title h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.03em;
}
.inv-builder-topbar-title span {
    display: block;
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 11px;
}
.inv-builder-topbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Two-column layout */
.inv-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

.inv-builder-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sidebar */
.inv-builder-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 144px;
}

/* Section cards */
.inv-section {
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 16px;
    padding: 24px;
}
.inv-section-title {
    margin: 0 0 20px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--admin-muted);
}
.inv-section-warn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 12px;
    color: #92400e;
}
.inv-section-warn svg {
    width: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    margin-top: 1px;
}

/* Form fields */
.inv-field {
    margin-bottom: 16px;
}
.inv-field:last-child {
    margin-bottom: 0;
}
.inv-row {
    display: grid;
    gap: 14px;
}
.inv-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}
.inv-row-2 {
    grid-template-columns: 1fr 1fr;
}
.inv-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #3d4250;
    letter-spacing: 0.02em;
}
.inv-label-required::after {
    content: " *";
    color: #e53e3e;
}
.inv-input,
.inv-select,
.inv-textarea {
    width: 100%;
    padding: 0 12px;
    height: 42px;
    color: var(--admin-ink);
    font: inherit;
    font-size: 13px;
    background: #fafafa;
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.inv-input:focus,
.inv-select:focus,
.inv-textarea:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.18);
}
.inv-input:disabled,
.inv-select:disabled {
    background: #f0f1f3;
    color: #9ca3af;
    cursor: not-allowed;
}
.inv-input[readonly] {
    background: #f5f6f8;
    cursor: default;
}
.inv-textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    min-height: 80px;
}
.inv-field-error {
    margin-top: 5px;
    font-size: 11px;
    color: #dc2626;
}

.inv-file-inp {
    height: auto;
    padding: 10px 12px;
    line-height: 1.4;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

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

.rounded-circle {
    border-radius: 50%;
}

/* Client searchable dropdown */
.inv-client-wrap {
    position: relative;
    z-index: 10;
}
.inv-client-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-ink);
    background: #fafafa;
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.inv-client-trigger:focus,
.inv-client-trigger:focus-visible {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.18);
    outline: none;
}
.inv-client-trigger.is-open {
    border-color: var(--admin-green);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.inv-client-trigger span {
    color: #9ca3af;
}
.inv-client-trigger svg {
    width: 14px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--admin-muted);
    stroke-width: 2;
}
.inv-client-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    background: #fff;
    border: 1px solid var(--admin-green);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(12, 16, 28, 0.1);
    overflow: hidden;
}
.inv-client-search {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 12px;
    border: 0;
    border-bottom: 1px solid var(--admin-line);
    outline: none;
    background: #f8f9fa;
}
.inv-client-list {
    max-height: 220px;
    overflow-y: auto;
}
.inv-client-option {
    display: block;
    width: 100%;
    padding: 9px 14px;
    font: inherit;
    font-size: 13px;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
    transition: background 0.1s;
}
.inv-client-option:hover {
    background: #f4f5f7;
}
.inv-client-empty {
    padding: 14px;
    color: var(--admin-muted);
    font-size: 12px;
    text-align: center;
}
.inv-client-new {
    border-top: 1px solid var(--admin-line);
    padding: 8px;
}
.inv-client-new-link {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--admin-green);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s;
}
.inv-client-new-link:hover {
    background: rgba(125, 255, 176, 0.08);
}
.inv-client-new-link svg {
    width: 14px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Line items */
.inv-items-header {
    display: grid;
    grid-template-columns: 32px 1fr 90px 120px 110px 36px;
    gap: 10px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--admin-line);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--admin-muted);
}
.inv-item-row {
    display: grid;
    grid-template-columns: 32px 1fr 90px 120px 110px 36px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f4f5f7;
    align-items: start;
}
.inv-item-row:last-child {
    border-bottom: 0;
}
.inv-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    color: #c5c9d1;
    cursor: grab;
    touch-action: none;
    font-size: 16px;
}
.inv-drag-handle:active {
    cursor: grabbing;
}
.inv-item-desc-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.inv-item-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--admin-muted);
    background: none;
    border: 0;
    cursor: pointer;
}
.inv-item-details-toggle:hover {
    color: var(--admin-ink);
}
.inv-item-amount-display {
    display: flex;
    align-items: center;
    height: 42px;
    justify-content: flex-end;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--admin-ink);
}
.inv-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 42px;
    padding: 0;
    color: #cbd5e0;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition:
        color 0.15s,
        background 0.15s;
}
.inv-item-remove:hover {
    color: #b91c1c;
    background: #fef2f2;
}
.inv-item-remove svg {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}
.inv-add-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
    color: var(--admin-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    background: none;
    border: 1.5px dashed var(--admin-line);
    border-radius: 10px;
    cursor: pointer;
    transition:
        color 0.15s,
        border-color 0.15s;
}
.inv-add-item:hover {
    color: var(--admin-ink);
    border-color: #aeb4be;
}
.inv-add-item:focus-visible {
    outline: 3px solid var(--admin-green);
}

/* Totals */
.inv-totals {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}
.inv-totals-inner {
    width: 290px;
}
.inv-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    gap: 16px;
}
.inv-totals-label {
    color: var(--admin-muted);
}
.inv-totals-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.inv-totals-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
    margin-top: 6px;
    border-top: 2px solid var(--admin-ink);
    font-size: 16px;
    font-weight: 800;
    gap: 16px;
}
.inv-discount-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.inv-discount-type-toggle {
    display: flex;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    overflow: hidden;
}
.inv-discount-type-toggle button {
    padding: 4px 9px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--admin-muted);
    transition:
        background 0.12s,
        color 0.12s;
}
.inv-discount-type-toggle button.active {
    background: var(--admin-ink);
    color: #fff;
}
.inv-totals-discount-input {
    width: 90px;
    height: 30px;
    padding: 0 8px;
    font: inherit;
    font-size: 12px;
    background: #fafafa;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    outline: none;
    text-align: right;
}
.inv-totals-discount-input:focus {
    border-color: var(--admin-green);
}

/* Currency tag */
.inv-currency-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: #f0f1f3;
    border-radius: 20px;
    margin-left: 6px;
}

/* Sidebar cards */
.inv-sidebar-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    padding: 18px;
}
.inv-sidebar-card-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-muted);
}
.inv-sidebar-card p {
    margin: 0;
    font-size: 12px;
    color: var(--admin-muted);
    line-height: 1.6;
}
.inv-sidebar-card .inv-btn {
    margin-top: 12px;
    width: 100%;
    justify-content: center;
}

.inv-section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.inv-section-heading-row .inv-section-title {
    margin: 0;
}
.inv-section-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.inv-items-empty {
    padding: 26px 18px;
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    background: #f8fafb;
    border: 1px dashed #dfe4ea;
    border-radius: 8px;
}
.inv-service-option {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 8px 16px;
    padding: 13px 14px;
    text-align: left;
    background: #ffffff;
    border: 1px solid transparent;
    border-bottom-color: var(--admin-line);
    cursor: pointer;
}
.inv-service-option:last-child {
    border-bottom-color: transparent;
}
.inv-service-option:hover,
.inv-service-option:focus-visible {
    z-index: 1;
    background: #f8fafb;
    border-color: #cfe8dc;
    outline: none;
}
.service-picker-option-main {
    display: grid;
    min-width: 0;
    gap: 4px;
}
.inv-service-option strong {
    overflow: hidden;
    color: var(--admin-ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inv-service-option .clients-meta {
    overflow: hidden;
    margin-top: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.service-picker-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.service-picker-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    color: #4b5563;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.inv-service-option-price {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    color: #174c3a;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.service-picker-combobox {
    position: relative;
    display: grid;
    gap: 10px;
}
.service-picker-combobox .inv-label {
    margin-bottom: 0;
}
.service-picker-search {
    position: relative;
    display: flex;
    align-items: center;
}
.service-picker-search svg {
    position: absolute;
    left: 12px;
    width: 17px;
    fill: none;
    stroke: #8f96a3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    pointer-events: none;
}
.service-picker-search .inv-input {
    padding-left: 40px;
}
.inv-modal-body:has(.service-picker-combobox) {
    min-height: 420px;
}
.service-picker-dropdown {
    display: none;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.service-picker-dropdown.is-open {
    display: block;
}

.proposal-form-header {
    margin-bottom: 22px;
}
.proposal-form-page .inv-builder-main {
    gap: 18px;
}
.proposal-form-page .inv-section {
    padding: 22px;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(18, 23, 35, 0.035);
}
.proposal-section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}
.proposal-section-heading-row .inv-section-title {
    margin-bottom: 4px;
}
.proposal-section-hint {
    display: block;
    color: var(--admin-muted);
    font-size: 12px;
    line-height: 1.5;
}
.proposal-form-page .inv-section-actions .inv-btn {
    min-height: 38px;
    padding-inline: 13px;
}
.proposal-form-page .inv-section-actions svg {
    width: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}
.proposal-item-row {
    margin-bottom: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e7eaef;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(18, 23, 35, 0.035);
}
.proposal-item-row.is-service-item {
    border-color: #cfe8dc;
    background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
}
.proposal-item-row:last-child {
    margin-bottom: 0;
}
.proposal-items-header {
    display: grid;
    grid-template-columns: 34px minmax(260px, 1.4fr) 90px 96px 122px 96px 36px;
    gap: 10px;
    margin-bottom: 8px;
    padding: 0 12px 8px;
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--admin-line);
}
.proposal-item-main {
    display: grid;
    grid-template-columns: 34px minmax(260px, 1.4fr) 90px 96px 122px 96px 36px;
    gap: 10px;
    align-items: end;
}
.proposal-item-row.is-dragging {
    opacity: 0.55;
    border-color: var(--admin-green);
    box-shadow: 0 12px 28px rgba(18, 23, 35, 0.12);
}
.proposal-item-drag {
    display: inline-grid;
    width: 34px;
    height: 40px;
    place-items: center;
    align-self: end;
    color: #a3aab5;
    background: #f8fafb;
    border: 1px solid #e7eaef;
    border-radius: 8px;
    cursor: grab;
}
.proposal-item-drag:hover {
    color: #174c3a;
    border-color: #cfe8dc;
}
.proposal-item-drag:active {
    cursor: grabbing;
}
.proposal-item-drag svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}
.proposal-item-namebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.proposal-item-namebar .inv-label {
    margin-bottom: 0;
}
.proposal-item-type-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.proposal-item-type-badge--custom {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.proposal-item-type-badge--service {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}
.proposal-item-description {
    grid-column: 2 / -2;
}
.proposal-item-drag {
    grid-column: 1;
    grid-row: 1;
}
.proposal-item-name {
    grid-column: 2;
    grid-row: 1;
}
.proposal-item-quantity {
    grid-column: 3;
    grid-row: 1;
}
.proposal-item-unit {
    grid-column: 4;
    grid-row: 1;
}
.proposal-item-price {
    grid-column: 5;
    grid-row: 1;
}
.proposal-item-tax {
    grid-column: 6;
    grid-row: 1;
}
.proposal-item-remove {
    grid-column: 7;
    grid-row: 1;
}
.proposal-item-description {
    grid-row: 2;
}
.proposal-item-description .inv-textarea {
    min-height: 64px;
}
.proposal-item-field {
    min-width: 0;
}
.proposal-item-field .inv-label {
    display: none;
}
.proposal-item-name .inv-label,
.proposal-item-description .inv-label {
    display: block;
}
.proposal-item-remove {
    display: inline-grid;
    width: 36px;
    height: 40px;
    place-items: center;
    align-self: end;
    color: #8f96a3;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    cursor: pointer;
}
.proposal-item-remove:hover {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fff7f7;
}
.proposal-item-remove svg {
    width: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}
.proposal-totals-panel {
    margin-top: 18px;
    padding: 16px;
    background: #f8fafb;
    border: 1px solid #edf0f3;
    border-radius: 8px;
}
.proposal-totals-panel .inv-section-title {
    margin-bottom: 14px;
}
.proposal-totals-panel .inv-field {
    margin-bottom: 0;
}
.proposal-narrative-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}
.proposal-narrative-intro,
.proposal-narrative-grid .inv-field:last-child {
    grid-column: 1 / -1;
}
.proposal-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--admin-line);
}

/* Success flash */
.inv-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 10px;
    font-size: 13px;
    color: #15803d;
    font-weight: 600;
}
.inv-flash svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.inv-flash--info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* Monospace hash / token display */
.inv-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8em;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 5px;
    word-break: break-all;
}

/* Keep invoice form's sticky header from pulling over a preceding flash message. */
.inv-flash + form .inv-builder-topbar {
    margin-top: 0;
}

/* Builder responsive */
@media (max-width: 1100px) {
    .inv-builder-layout {
        grid-template-columns: 1fr;
    }
    .inv-builder-sidebar {
        position: static;
    }
}
@media (max-width: 820px) {
    .inv-builder-topbar {
        margin-inline: -28px;
        padding-inline: 28px;
    }
    .inv-row-3 {
        grid-template-columns: 1fr 1fr;
    }
    .inv-items-header,
    .inv-item-row {
        grid-template-columns: 28px 1fr 80px 100px 100px 32px;
        gap: 6px;
    }
    .proposal-items-header {
        display: none;
    }
    .proposal-item-main {
        grid-template-columns: 32px repeat(2, minmax(0, 1fr)) 34px;
    }
    .proposal-item-drag {
        grid-column: 1;
        grid-row: 1;
    }
    .proposal-item-name {
        grid-column: 2 / span 2;
    }
    .proposal-item-remove {
        grid-column: 4;
        grid-row: 1;
    }
    .proposal-item-quantity,
    .proposal-item-unit,
    .proposal-item-price,
    .proposal-item-tax {
        grid-row: auto;
    }
    .proposal-item-quantity,
    .proposal-item-price {
        grid-column: 1 / span 2;
    }
    .proposal-item-unit,
    .proposal-item-tax {
        grid-column: 3 / span 2;
    }
    .proposal-item-description {
        grid-column: 1 / -1;
    }
    .proposal-item-field .inv-label {
        display: block;
    }
    .proposal-section-heading-row,
    .proposal-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .proposal-form-page .inv-section-actions,
    .proposal-form-actions {
        justify-content: flex-start;
    }
}
@media (max-width: 600px) {
    .inv-builder-topbar {
        margin-inline: -20px;
        padding-inline: 20px;
        top: 68px;
    }
    .inv-row-3 {
        grid-template-columns: 1fr;
    }
    .inv-row-2 {
        grid-template-columns: 1fr;
    }
    .inv-items-header {
        display: none;
    }
    .inv-item-row {
        grid-template-columns: 28px 1fr 1fr 32px;
    }
    .inv-item-row > :nth-child(3),
    .inv-item-row > :nth-child(5) {
        display: none;
    }
    .proposal-form-page .inv-section {
        padding: 18px;
    }
    .proposal-item-main {
        grid-template-columns: 32px minmax(0, 1fr) 34px;
    }
    .proposal-item-drag {
        grid-column: 1;
        grid-row: 1;
    }
    .proposal-item-name,
    .proposal-item-description,
    .proposal-item-field {
        grid-column: 1 / -1;
    }
    .proposal-item-name {
        grid-column: 2 / 3;
    }
    .proposal-item-remove {
        grid-column: 3;
        grid-row: 1;
    }
    .proposal-item-quantity,
    .proposal-item-unit,
    .proposal-item-price,
    .proposal-item-tax {
        grid-column: 1 / -1;
    }
    .proposal-narrative-grid {
        grid-template-columns: 1fr;
    }
    .proposal-form-actions .inv-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ── Phase 8: Invoice Show ──────────────────────────────────────────── */

/* Page wrapper */
.inv-show-page {
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
/* Remove individual margins — the flex gap owns vertical spacing */
.inv-show-page > .inv-show-header {
    margin-bottom: 0;
}
.inv-show-page > .inv-flash {
    margin-bottom: 0;
}

/* Header */
.inv-show-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.inv-show-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inv-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-muted);
    text-decoration: none;
    margin-bottom: 6px;
    transition: color 0.15s;
}
.inv-back-link svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}
.inv-back-link:hover {
    color: var(--admin-ink);
}

.inv-show-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.inv-show-title h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
}
.inv-show-subtitle {
    font-size: 13px;
    color: var(--admin-muted);
}
.inv-show-overdue {
    color: #dc2626;
    font-weight: 600;
}

/* Header actions */
.inv-show-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Danger button */
.inv-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s,
        border-color 0.15s;
}
.inv-btn-danger:hover {
    background: #fee2e2;
    border-color: #f87171;
}

/* Meta grid */
.inv-show-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.inv-show-client-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}
.inv-show-client-detail {
    font-size: 13px;
    color: var(--admin-muted);
    line-height: 1.6;
}

.inv-show-meta-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.inv-show-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    gap: 16px;
    padding: 4px 0;
    border-bottom: 1px solid var(--admin-line);
}
.inv-show-meta-row:last-child {
    border-bottom: none;
}
.inv-show-meta-label {
    color: var(--admin-muted);
    font-size: 12px;
}

/* Form field group (alias for .inv-field used in schedule/proposal forms) */
.inv-field-group {
    margin-bottom: 16px;
}
.inv-field-group:last-child {
    margin-bottom: 0;
}

/* Field label (e.g. "Bill To", section sub-labels) */
.inv-field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--admin-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Inline link */
.inv-link {
    color: var(--admin-ink);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--admin-line);
    transition: text-decoration-color 0.15s;
}
.inv-link:hover {
    text-decoration-color: var(--admin-ink);
}

/* Section header row */
.inv-show-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

/* Balance row */
.inv-show-balance {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 32px;
    margin-top: 12px;
    padding: 12px 0 0;
    border-top: 2px solid var(--admin-ink);
    font-size: 16px;
    font-weight: 800;
}
.inv-show-balance-paid {
    color: #16a34a;
}

/* Delete payment button */
.inv-show-del-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--admin-muted);
    cursor: pointer;
    transition:
        color 0.15s,
        background 0.15s;
}
.inv-show-del-btn svg {
    width: 14px;
    height: 14px;
}
.inv-show-del-btn:hover {
    color: #dc2626;
    background: #fef2f2;
}

.inv-payment-note-row td {
    font-style: italic;
}

/* Modal */
.inv-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);

    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.inv-modal {
    background: var(--admin-card);
    border: 0;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.inv-modal:has(.service-picker-combobox) {
    max-width: 620px;
}
.inv-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--admin-line);
}
.inv-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}
.inv-modal-close {
    display: inline-flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    color: var(--admin-ink);
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.inv-modal-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}
.inv-modal-close:hover {
    background: #f8f9fa;
    border-color: #cfd6df;
    color: #b91c1c;
}
.inv-modal-close:focus-visible {
    outline: 3px solid var(--admin-green);
    outline-offset: 2px;
}
.inv-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.inv-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

/* Notes grid */
.inv-show-notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 8px;
}
.inv-show-note-body {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--admin-muted);
    line-height: 1.7;
    white-space: pre-wrap;
    background: #f8f9fa;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    padding: 10px 12px;
}

/* Timeline */
.inv-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
}
.inv-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--admin-line);
    position: relative;
}
.inv-timeline-item:last-child {
    border-bottom: none;
}
.inv-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--admin-green);
    border: 2px solid var(--admin-card);
    box-shadow: 0 0 0 1.5px var(--admin-green);
    flex-shrink: 0;
    margin-top: 5px;
}
.inv-timeline-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}
.inv-timeline-label {
    font-weight: 600;
}
.inv-timeline-actor {
    color: var(--admin-muted);
}
.inv-timeline-time {
    color: var(--admin-muted);
    font-size: 12px;
    margin-left: auto;
}

/* Responsive */
@media (max-width: 700px) {
    .inv-show-meta-grid {
        grid-template-columns: 1fr;
    }
    .inv-show-notes-grid {
        grid-template-columns: 1fr;
    }
    .inv-show-header {
        flex-direction: column;
    }
    .inv-show-actions {
        width: 100%;
    }
}

/* Dashboard switch controls */
.inv-switch,
.inv-sched-toggle,
.inv-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    cursor: pointer;
}
.inv-switch input[type="checkbox"],
.inv-sched-toggle input[type="checkbox"],
.inv-toggle-label input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.inv-switch-control {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
    background: #d7dce3;
    border: 1px solid #c9ced6;
    border-radius: 999px;
    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}
.inv-switch-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    content: "";
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.18s ease;
}
.inv-switch input[type="checkbox"]:checked + .inv-switch-control,
.inv-sched-toggle input[type="checkbox"]:checked + .inv-switch-control,
.inv-toggle-label input[type="checkbox"]:checked + .inv-switch-control {
    background: #16a34a;
    border-color: #15803d;
}
.inv-switch input[type="checkbox"]:checked + .inv-switch-control::after,
.inv-sched-toggle input[type="checkbox"]:checked + .inv-switch-control::after,
.inv-toggle-label input[type="checkbox"]:checked + .inv-switch-control::after {
    transform: translateX(20px);
}
.inv-switch input[type="checkbox"]:focus-visible + .inv-switch-control,
.inv-sched-toggle input[type="checkbox"]:focus-visible + .inv-switch-control,
.inv-toggle-label input[type="checkbox"]:focus-visible + .inv-switch-control {
    outline: 3px solid var(--admin-green);
    outline-offset: 3px;
}
.inv-switch-text {
    color: #363b47;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Clients directory */
.clients-page-header {
    margin-bottom: 24px;
}
.clients-page-header .inv-subtitle {
    max-width: 520px;
    font-size: 14px;
    line-height: 1.6;
}
.clients-card {
    margin-top: 0;
    box-shadow: 0 5px 30px rgba(18, 23, 35, 0.035);
}
.clients-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--admin-line);
}
.clients-card-head h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.025em;
}
.clients-card-head p {
    margin: 5px 0 0;
    color: var(--admin-muted);
    font-size: 11px;
    line-height: 1.5;
}
.clients-total {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    color: #4d5360;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    background: #f2f4f5;
    border-radius: 20px;
}
.clients-table th {
    padding: 14px 20px 12px;
}
.clients-table td {
    padding: 17px 20px;
}
.clients-table th:first-child {
    width: 28%;
}
.clients-table th:nth-child(2) {
    width: 16%;
}
.clients-table th:nth-child(3) {
    width: 22%;
}
.clients-table th:last-child,
.clients-table td:last-child {
    text-align: right;
}

/* Services table styling - equal thead gaps */
.inv-table thead tr th {
    padding: 14px 20px 12px;
}
.inv-table tbody tr td {
    padding: 17px 20px;
}
.inv-table th:last-child,
.inv-table td:last-child {
    text-align: right;
}

.clients-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.clients-identity > div {
    min-width: 0;
}
.clients-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    color: #17452a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: #dcfce7;
    border: 1px solid #c8f2d7;
    border-radius: 11px;
}
.clients-name {
    display: block;
    overflow: hidden;
    color: var(--admin-ink);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clients-name:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.clients-name:focus-visible,
.clients-contact a:focus-visible,
.clients-invoice-count:focus-visible,
.clients-edit-link:focus-visible,
.clients-icon-button:focus-visible {
    outline: 3px solid var(--admin-green);
    outline-offset: 3px;
    border-radius: 4px;
}
.clients-meta {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    color: var(--admin-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clients-contact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: var(--admin-muted);
    font-size: 11px;
}
.clients-contact a {
    overflow: hidden;
    color: #353a46;
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clients-contact a:hover {
    color: #11151a;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.clients-muted {
    color: #9ba0aa;
}
.clients-currency {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 27px;
    color: #555b67;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: #f2f4f5;
    border-radius: 8px;
}
.clients-invoice-count {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: #1f5133;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    background: #e7faee;
    border-radius: 50%;
}
.clients-invoice-count:hover {
    background: var(--admin-green);
}
.clients-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #4c5260;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}
.clients-edit-link:hover {
    color: var(--admin-ink);
}
.clients-edit-link svg {
    width: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.clients-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.clients-actions form {
    margin: 0;
}
.clients-icon-button {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    color: #4c5260;
    text-decoration: none;
    background: #f7f8fa;
    border: 1px solid #eceef2;
    border-radius: 8px;
    cursor: pointer;
    transition:
        color 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}
.clients-icon-button:hover {
    color: var(--admin-ink);
    background: #ffffff;
    border-color: #dfe3e8;
}
.clients-icon-button svg {
    width: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}
.clients-icon-button--danger {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fca5a5;
}
.clients-icon-button--danger:hover {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #f87171;
}
.clients-empty {
    gap: 0;
}
.clients-empty p {
    margin-bottom: 18px;
}

@media (max-width: 700px) {
    .clients-card-head {
        align-items: flex-start;
        padding: 18px;
    }
    .clients-table,
    .clients-table tbody {
        display: block;
    }
    .clients-table thead {
        display: none;
    }
    .clients-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 15px 18px;
        padding: 18px;
        border-bottom: 1px solid var(--admin-line);
    }
    .clients-table tbody tr:last-child {
        border-bottom: 0;
    }
    .clients-table td,
    .clients-table td:nth-child(3),
    .clients-table td:nth-child(4),
    .clients-table td:nth-child(5) {
        display: flex;
        min-width: 0;
        padding: 0;
        border: 0;
    }
    .clients-table td:first-child {
        grid-column: 1;
        grid-row: 1;
    }
    .clients-table td:nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    .clients-table td:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
        align-items: center;
        gap: 10px;
    }
    .clients-table td:nth-child(4) {
        grid-column: 1;
        grid-row: 4;
        align-items: center;
        gap: 10px;
    }
    .clients-table td:nth-child(5) {
        grid-column: 2;
        grid-row: 3;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
    }
    .clients-table td:last-child {
        grid-column: 2;
        grid-row: 1;
        align-items: flex-start;
    }
    .clients-table td:nth-child(3)::before,
    .clients-table td:nth-child(4)::before,
    .clients-table td:nth-child(5)::before {
        color: var(--admin-muted);
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
    .clients-table td:nth-child(3)::before {
        content: "Currency";
    }
    .clients-table td:nth-child(4)::before {
        content: "Status";
    }
    .clients-table td:nth-child(5)::before {
        content: "Invoices";
    }
    .clients-contact {
        width: 100%;
        padding-top: 13px;
        border-top: 1px solid #f0f1f3;
    }
    .clients-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 7px;
    }
    .categories-table td:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
    .categories-table td:nth-child(4) {
        grid-column: 2;
        grid-row: 3;
        justify-content: flex-end;
    }
    .categories-table td:nth-child(5) {
        grid-column: 2;
        grid-row: 1;
    }
    .categories-table td:nth-child(3)::before {
        content: "Status";
    }
    .categories-table td:nth-child(4)::before {
        content: "Services";
    }
    .categories-table td:nth-child(5)::before {
        content: "";
    }
}

@media (max-width: 460px) {
    .clients-page-header .inv-btn {
        width: 100%;
        justify-content: center;
    }
    .clients-card-head {
        gap: 12px;
    }
    .clients-card-head p {
        display: none;
    }
    .clients-total {
        min-height: 27px;
        padding-inline: 9px;
    }
}

/* ─── DataTables: cell display classes ─────────────────────────────────────── */
/* Used by DataTableService for the client/service name + subtitle cells */
.client-name {
    color: var(--admin-ink);
    font-size: 13px;
    font-weight: 800;
}
.client-name a {
    color: inherit;
    text-decoration: none;
}
.client-name a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.client-subtitle {
    margin-top: 3px;
    color: var(--admin-muted);
    font-size: 10px;
}

/* ─── DataTables: themed overrides ──────────────────────────────────────────── */
.dataTables_wrapper {
    position: relative; /* needed so processing overlay positions correctly */
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    font-size: 13px;
    color: var(--admin-ink);
}

/* ── Top controls bar (length + filter) ── */
.dataTables_wrapper .dataTables_length {
    float: left;
    padding: 14px 20px;
}
.dataTables_wrapper .dataTables_filter {
    float: right;
    padding: 14px 20px;
}
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input[type="search"] {
    height: 34px;
    padding: 0 10px;
    color: var(--admin-ink);
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    font-size: 12px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    outline: none !important;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dataTables_wrapper .dataTables_filter input[type="search"] {
    padding: 0 12px;
    min-width: 210px;
}
.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input[type="search"]:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.2);
    outline: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:focus-visible {
    outline: 3px solid var(--admin-green);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ── Table: clear floats, full-width borders replacing all DataTables #111 defaults ── */
.dataTables_wrapper table.dataTable {
    clear: both;
    width: 100% !important;
    margin: 0 !important;
    border-top: 1px solid var(--admin-line) !important;   /* divider: controls → table */
    border-bottom: 1px solid var(--admin-line) !important; /* divider: table → pagination */
    border-collapse: collapse !important;
}
/* thead row border */
table.dataTable thead th,
table.dataTable thead td {
    border-bottom: 1px solid var(--admin-line) !important;
}
/* tbody row separators */
table.dataTable tbody tr td {
    border-bottom: 1px solid #f4f5f7 !important;
}
table.dataTable tbody tr:last-child td {
    border-bottom: none !important;
}

/* ── Sorting arrows: replace default background-image sprites ── */
table.dataTable thead th {
    position: relative;
    background-image: none !important;
}
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    background-image: none !important;
    padding-right: 28px !important;
    cursor: pointer;
}
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    line-height: 1;
    color: #c4c8d0;
    content: "⇅";
}
table.dataTable thead th.sorting_asc::after {
    color: var(--admin-ink);
    content: "↑";
}
table.dataTable thead th.sorting_desc::after {
    color: var(--admin-ink);
    content: "↓";
}

/* ── Bottom bar: info + pagination ── */
/* No border-top needed here — table border-bottom is the full-width divider */
.dataTables_wrapper .dataTables_info {
    float: left;
    padding: 13px 20px;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 600;
    border-top: none;
}
.dataTables_wrapper .dataTables_paginate {
    float: right;
    padding: 8px 20px;
    border-top: none;
}
/* Clearfix */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    overflow: visible;
}
.dataTables_wrapper > .dataTables_paginate:last-child::after {
    display: block;
    clear: both;
    content: "";
}

/* Pagination buttons — fully override DataTables gradient + dark-hover */
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button:link,
.dataTables_wrapper .dataTables_paginate .paginate_button:visited {
    display: inline-block !important;
    min-width: 32px !important;
    height: 32px !important;
    line-height: 30px !important;
    padding: 0 10px !important;
    margin: 0 2px !important;
    color: var(--admin-muted) !important;
    font-family: "Plus Jakarta Sans", Arial, sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-align: center !important;
    text-decoration: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: var(--admin-ink) !important;
    background: #f4f6f8 !important;
    background-color: #f4f6f8 !important;
    background-image: none !important;
    border: 1px solid var(--admin-line) !important;
    box-shadow: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: var(--admin-ink) !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: 1px solid var(--admin-line) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: #c4c8d0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    cursor: default;
}
.dataTables_wrapper .dataTables_paginate span {
    display: inline-flex;
    gap: 2px;
}

/* ── Processing overlay ── */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 20;
    min-width: 160px;
    padding: 16px 24px 14px;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: center;
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.06),
        0 10px 30px -4px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -50%);
}
/* Hide the default "Processing..." text — dots carry the message */
.dataTables_wrapper .dataTables_processing > :first-child {
    display: none;
}
/* Dots row */
.dataTables_wrapper .dataTables_processing > div:last-child {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    height: auto;
    margin: 0;
}
/* Each dot */
.dataTables_wrapper .dataTables_processing > div:last-child > div {
    position: static;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--admin-green);
    animation: dt-processing-pulse 1.2s ease-in-out infinite;
}
.dataTables_wrapper .dataTables_processing > div:last-child > div:nth-child(1) { animation-delay: 0s; }
.dataTables_wrapper .dataTables_processing > div:last-child > div:nth-child(2) { animation-delay: 0.2s; }
.dataTables_wrapper .dataTables_processing > div:last-child > div:nth-child(3) { animation-delay: 0.4s; }
.dataTables_wrapper .dataTables_processing > div:last-child > div:nth-child(4) { animation-delay: 0.6s; }

@keyframes dt-processing-pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.35;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Invoice settings form */
.inv-settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 860px;
    margin: 0 auto;
}

.inv-settings-form .inv-section {
    padding: 24px;
}

.inv-settings-form .inv-row {
    margin-top: 0;
}

.inv-settings-form .inv-row .inv-field {
    margin-bottom: 0;
}

.inv-settings-form .inv-field {
    margin-bottom: 16px;
}

.inv-settings-form .inv-field:last-child {
    margin-bottom: 0;
}

.inv-settings-form .inv-input[type="file"] {
    height: auto;
    padding: 10px 12px;
    line-height: 1.4;
}

.inv-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.inv-form-actions .inv-btn {
    min-width: 150px;
}

.inv-settings-form .inv-section-title {
    margin-bottom: 18px;
}

.inv-settings-form .inv-row-2,
.inv-settings-form .inv-row-3 {
    margin-bottom: 16px;
}

.inv-settings-form .inv-row-2:last-child,
.inv-settings-form .inv-row-3:last-child {
    margin-bottom: 0;
}

.inv-settings-form .inv-input,
.inv-settings-form .inv-select,
.inv-settings-form .inv-textarea {
    display: block;
}

.inv-settings-form .inv-label {
    display: block;
    margin-bottom: 6px;
}
