/* =========================
   ROOT
========================= */

:root {
    --primary: #7057e8;
    --primary-dark: #5c44d7;
    --primary-soft: #f1efff;

    --bg: #f7f8fb;
    --surface: #ffffff;

    --text: #171721;
    --text-secondary: #767685;
    --text-light: #a1a1ad;

    --border: #e9e9ef;

    --green: #2caf74;
    --green-soft: #eaf8f1;

    --orange: #ee9c3a;
    --orange-soft: #fff5e8;

    --red: #e65c64;
    --red-soft: #fdefef;

    --sidebar-width: 260px;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;

    --shadow:
        0 4px 18px rgba(34, 34, 50, 0.04);
}


/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "Poppins", sans-serif;
    background: var(--bg);
    color: var(--text);
}

button,
input,
textarea,
select {
    font-family: inherit;
}

button {
    border: 0;
    cursor: pointer;
}


/* =========================
   APP
========================= */

.app {
    min-height: 100vh;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: var(--sidebar-width);

    background: var(--surface);

    border-right: 1px solid var(--border);

    padding: 28px 20px;

    display: flex;
    flex-direction: column;

    z-index: 100;
}


.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 35px;
}

.brand-icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    background: var(--primary);

    color: white;

    display: grid;
    place-items: center;
}

.brand-icon svg {
    width: 21px;
}

.brand h1 {
    font-size: 18px;
    line-height: 1.2;
}

.brand span {
    display: block;

    margin-top: 3px;

    font-size: 9px;
    font-weight: 500;

    color: var(--text-light);

    letter-spacing: .2px;
}


.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.nav-label {
    font-size: 10px;
    font-weight: 600;
    color: #b0b0ba;

    margin: 24px 12px 8px;

    letter-spacing: .8px;
}


.nav-item {
    width: 100%;
    height: 44px;

    border-radius: 11px;

    background: transparent;

    padding: 0 13px;

    display: flex;
    align-items: center;
    gap: 12px;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 500;

    transition: .2s ease;
}

.nav-item svg {
    width: 18px;
}

.nav-item:hover {
    background: #f7f6fe;
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);

    font-weight: 600;
}


.sidebar-bottom {
    margin-top: auto;
}


.user-profile {
    margin-top: 15px;
    padding-top: 20px;

    border-top: 1px solid var(--border);

    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: var(--primary-soft);
    color: var(--primary);

    display: grid;
    place-items: center;

    font-size: 12px;
    font-weight: 700;
}

.user-info {
    min-width: 0;
    flex: 1;
}

.user-info strong {
    display: block;
    font-size: 11px;
}

.user-info span {
    display: block;

    margin-top: 2px;

    font-size: 9px;
    color: var(--text-light);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-arrow {
    width: 15px;
    color: var(--text-light);
}


/* =========================
   MAIN
========================= */

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}


/* =========================
   TOPBAR
========================= */

.topbar {
    height: 92px;

    padding: 0 38px;

    background: rgba(255, 255, 255, 0.92);

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: sticky;
    top: 0;

    z-index: 50;

    backdrop-filter: blur(10px);
}


.eyebrow {
    margin-bottom: 3px;

    font-size: 9px;
    font-weight: 600;

    color: var(--primary);

    letter-spacing: 1px;
}


.topbar h2 {
    font-size: 21px;
}


.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


.icon-btn {
    width: 42px;
    height: 42px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 11px;

    display: grid;
    place-items: center;

    color: var(--text-secondary);
}

.icon-btn svg {
    width: 18px;
}


.primary-btn {
    height: 42px;

    padding: 0 17px;

    border-radius: 11px;

    background: var(--primary);
    color: white;

    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 12px;
    font-weight: 600;

    box-shadow: 0 6px 16px rgba(112, 87, 232, .20);

    transition: .2s ease;
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.primary-btn svg {
    width: 17px;
}


/* =========================
   PAGE
========================= */

.page {
    display: none;
    padding: 34px 38px 60px;
}

.page.active {
    display: block;
}


/* =========================
   WELCOME
========================= */

.welcome {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    margin-bottom: 27px;
}

.welcome h3 {
    font-size: 22px;
    margin-bottom: 6px;
}

.welcome p {
    font-size: 12px;
    color: var(--text-secondary);
}

.date-display {
    font-size: 11px;
    color: var(--text-secondary);

    background: white;

    padding: 9px 13px;

    border: 1px solid var(--border);
    border-radius: 9px;
}


/* =========================
   STATS
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 16px;

    margin-bottom: 20px;
}

.stat-card {
    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    padding: 20px;

    box-shadow: var(--shadow);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 17px;
}

.stat-header > span {
    font-size: 11px;
    color: var(--text-secondary);
}


.stat-icon {
    width: 34px;
    height: 34px;

    border-radius: 10px;

    display: grid;
    place-items: center;
}

.stat-icon svg {
    width: 16px;
}

.stat-icon.purple {
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-icon.green {
    color: var(--green);
    background: var(--green-soft);
}

.stat-icon.orange {
    color: var(--orange);
    background: var(--orange-soft);
}

.stat-icon.red {
    color: var(--red);
    background: var(--red-soft);
}


.stat-card > strong {
    display: block;

    margin-bottom: 10px;

    font-size: 21px;
}


.stat-footer {
    min-height: 18px;

    display: flex;
    align-items: center;
    gap: 7px;

    font-size: 9px;
    color: var(--text-light);
}

.positive {
    color: var(--green);

    display: flex;
    align-items: center;
    gap: 3px;

    font-weight: 600;
}

.positive svg {
    width: 11px;
}


/* =========================
   DASHBOARD GRID
========================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, .75fr);

    gap: 20px;
}


.panel {
    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow);
}


.panel-header {
    min-height: 78px;

    padding: 18px 21px;

    border-bottom: 1px solid var(--border);

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 14px;
}

.panel-header p {
    margin-top: 4px;

    font-size: 10px;
    color: var(--text-light);
}


.text-btn {
    background: transparent;

    color: var(--primary);

    display: flex;
    align-items: center;
    gap: 5px;

    font-size: 10px;
    font-weight: 600;
}

.text-btn svg {
    width: 13px;
}


/* =========================
   TABLE
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px 20px;

    text-align: left;

    font-size: 9px;
    font-weight: 500;

    color: var(--text-light);

    background: #fafafd;
}

td {
    padding: 14px 20px;

    border-top: 1px solid #f1f1f5;

    font-size: 10px;
    color: var(--text-secondary);
}

td > strong {
    color: var(--text);
    font-size: 10px;
}


.document-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-icon {
    width: 33px;
    height: 33px;

    border-radius: 9px;

    display: grid;
    place-items: center;
}

.doc-icon svg {
    width: 15px;
}

.doc-icon.quote {
    background: var(--primary-soft);
    color: var(--primary);
}

.doc-icon.invoice {
    background: #eef5ff;
    color: #4c83df;
}

.document-cell strong {
    display: block;

    font-size: 10px;
    color: var(--text);
}

.document-cell span {
    display: block;

    margin-top: 2px;

    font-size: 8px;
    color: var(--text-light);
}


.badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;

    border-radius: 100px;

    font-size: 8px;
    font-weight: 600;
}

.badge.accepted,
.badge.paid {
    color: var(--green);
    background: var(--green-soft);
}

.badge.pending {
    color: var(--orange);
    background: var(--orange-soft);
}

.badge.overdue {
    color: var(--red);
    background: var(--red-soft);
}


.table-action {
    width: 28px;
    height: 28px;

    border-radius: 7px;

    background: transparent;
    color: var(--text-light);

    display: grid;
    place-items: center;
}

.table-action:hover {
    background: var(--bg);
}

.table-action svg {
    width: 15px;
}


/* =========================
   QUICK ACTION
========================= */

.quick-panel {
    align-self: start;
}

.quick-action {
    width: calc(100% - 30px);

    margin: 0 15px;
    padding: 15px 5px;

    background: transparent;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    gap: 11px;

    text-align: left;
}

.quick-action:last-child {
    border-bottom: 0;
}

.quick-action > svg {
    margin-left: auto;

    width: 15px;
    color: var(--text-light);
}

.quick-icon {
    width: 37px;
    height: 37px;

    border-radius: 10px;

    background: var(--primary-soft);
    color: var(--primary);

    display: grid;
    place-items: center;
}

.quick-icon svg {
    width: 16px;
}

.quick-action strong {
    display: block;

    font-size: 10px;
    color: var(--text);
}

.quick-action span {
    display: block;

    margin-top: 3px;

    font-size: 8px;
    color: var(--text-light);
}


/* =========================
   EMPTY PAGE
========================= */

.empty-page {
    min-height: calc(100vh - 190px);

    background: white;

    border: 1px dashed #dcdce6;
    border-radius: var(--radius-lg);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
}

.empty-page > svg {
    width: 34px;
    height: 34px;

    color: var(--primary);

    margin-bottom: 15px;
}

.empty-page h3 {
    font-size: 17px;
}

.empty-page p {
    margin-top: 6px;

    font-size: 11px;
    color: var(--text-light);
}


/* =========================
   MOBILE NAV
========================= */

.mobile-nav {
    display: none;
}


/* =========================
   MODAL
========================= */

.modal-overlay {
    position: fixed;
    inset: 0;

    background: rgba(18, 18, 30, .35);

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 20px;

    z-index: 500;

    opacity: 0;
    visibility: hidden;

    transition: .2s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}


.modal {
    width: 100%;
    max-width: 430px;

    background: white;

    border-radius: 20px;

    padding: 24px;

    box-shadow:
        0 25px 80px rgba(18, 18, 30, .18);

    transform: translateY(10px);

    transition: .2s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}


.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 17px;
}

.modal-header p {
    margin-top: 5px;

    color: var(--text-secondary);
    font-size: 10px;
}


.close-modal {
    flex: 0 0 auto;

    width: 34px;
    height: 34px;

    background: var(--bg);
    color: var(--text-secondary);

    border-radius: 9px;

    display: grid;
    place-items: center;
}

.close-modal svg {
    width: 16px;
}


.document-options {
    display: grid;
    gap: 10px;
}

.document-option {
    padding: 15px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 13px;

    display: flex;
    align-items: center;
    gap: 12px;

    text-align: left;

    transition: .2s ease;
}

.document-option:hover {
    border-color: #cbc3f8;
    background: #faf9ff;
}

.document-option > svg {
    width: 16px;

    margin-left: auto;

    color: var(--text-light);
}

.document-option-icon {
    width: 39px;
    height: 39px;

    border-radius: 10px;

    display: grid;
    place-items: center;

    background: var(--primary-soft);
    color: var(--primary);
}

.document-option-icon svg {
    width: 17px;
}

.document-option strong {
    display: block;
    font-size: 11px;
}

.document-option span {
    display: block;

    margin-top: 3px;

    font-size: 9px;
    color: var(--text-light);
}


/* =========================
   TABLET
========================= */

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {

    body {
        padding-bottom: 80px;
    }


    .sidebar {
        display: none;
    }


    .main {
        margin-left: 0;
    }


    .topbar {
        height: 75px;

        padding: 0 18px;
    }

    .eyebrow {
        display: none;
    }

    .topbar h2 {
        font-size: 18px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
    }

    .primary-btn {
        display: none;
    }


    .page {
        padding: 23px 16px 35px;
    }


    .welcome {
        display: block;

        margin-bottom: 22px;
    }

    .welcome h3 {
        font-size: 19px;
    }

    .welcome p {
        line-height: 1.6;
    }

    .date-display {
        display: inline-block;

        margin-top: 13px;
    }


    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-header {
        margin-bottom: 14px;
    }

    .stat-header > span {
        font-size: 9px;
    }

    .stat-icon {
        width: 29px;
        height: 29px;
    }

    .stat-card > strong {
        font-size: 15px;
    }

    .stat-footer {
        font-size: 7px;
    }


    .dashboard-grid {
        display: block;
    }

    .quick-panel {
        margin-top: 15px;
    }


    .panel-header {
        min-height: 70px;
        padding: 15px;
    }

    .panel-header h3 {
        font-size: 13px;
    }


    .recent-panel table th:nth-child(2),
    .recent-panel table td:nth-child(2) {
        display: none;
    }

    th,
    td {
        padding-left: 14px;
        padding-right: 14px;
    }


    .empty-page {
        min-height: calc(100vh - 155px);
    }


    /* MOBILE BOTTOM NAV */

    .mobile-nav {
        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        height: 72px;

        background: white;

        border-top: 1px solid var(--border);

        display: grid;
        grid-template-columns: repeat(5, 1fr);

        align-items: center;

        z-index: 200;

        padding-bottom: env(safe-area-inset-bottom);
    }


    .mobile-nav-item {
        height: 100%;

        background: transparent;
        color: var(--text-light);

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        gap: 4px;

        font-size: 8px;
        font-weight: 500;
    }

    .mobile-nav-item svg {
        width: 19px;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }
    

    .mobile-create-btn {
        width: 48px;
        height: 48px;

        margin: -22px auto 0;

        border-radius: 50%;

        background: var(--primary);
        color: white;

        display: grid;
        place-items: center;

        box-shadow:
            0 8px 22px rgba(112, 87, 232, .30);
    }

    .mobile-create-btn svg {
        width: 22px;
    }


    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        max-width: none;

        border-radius: 22px 22px 0 0;

        padding: 24px 18px 30px;
    }

}


/* =========================
   SMALL MOBILE
========================= */

@media (max-width: 390px) {

    .stats-grid {
        grid-template-columns: 1fr;
    }

}



/* =========================
   TYPOGRAPHY REFINEMENT
========================= */

/* General secondary text */
.welcome p {
    font-size: 13px;
}

.date-display {
    font-size: 11px;
}

/* Dashboard cards */
.stat-header > span {
    font-size: 12px;
}

.stat-footer {
    font-size: 10px;
}

/* Panel */
.panel-header h3 {
    font-size: 14px;
}

.panel-header p {
    font-size: 11px;
}

/* Table */
th {
    font-size: 10px;
}

td {
    font-size: 11px;
}

td > strong {
    font-size: 11px;
}

.document-cell strong {
    font-size: 11px;
}

.document-cell span {
    font-size: 9px;
}

/* Status badge */
.badge {
    font-size: 9px;
}

/* Quick Actions */
.quick-action strong {
    font-size: 11px;
}

.quick-action span {
    font-size: 9px;
}

/* Sidebar */
.nav-item {
    font-size: 13px;
}

.nav-label {
    font-size: 10px;
}

.user-info strong {
    font-size: 11px;
}

.user-info span {
    font-size: 9px;
}



/* =========================
   MOBILE RECENT DOCUMENTS
========================= */

@media (max-width: 768px) {

    .recent-panel thead {
        display: none;
    }

    .recent-panel tbody {
        display: block;
    }

    .recent-panel tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 15px;
        row-gap: 8px;

        padding: 15px;

        border-top: 1px solid var(--border);
    }

    .recent-panel tbody tr:first-child {
        border-top: 0;
    }

    .recent-panel tbody td {
        padding: 0;
        border: 0;
    }

    /* Hide client on dashboard mobile */
    .recent-panel tbody td:nth-child(2) {
        display: none;
    }

    /* Document */
    .recent-panel tbody td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    /* Amount */
    .recent-panel tbody td:nth-child(3) {
        grid-column: 2;
        grid-row: 1;

        text-align: right;
        white-space: nowrap;

        display: flex;
        align-items: center;
    }

    /* Status */
    .recent-panel tbody td:nth-child(4) {
        grid-column: 1;
        grid-row: 2;

        padding-left: 43px;
    }

    /* Action */
    .recent-panel tbody td:nth-child(5) {
        grid-column: 2;
        grid-row: 2;

        display: flex;
        justify-content: flex-end;
    }

    .recent-panel .document-cell {
        min-width: 0;
    }

    .recent-panel .document-cell strong {
        white-space: nowrap;
        font-size: 10px;
    }

    .recent-panel td > strong {
        white-space: nowrap;
        font-size: 10px;
    }

}



/* =========================================================
   CLIENTS PAGE
========================================================= */

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 22px;
}

.section-toolbar h3 {
    font-size: 21px;
}

.section-toolbar p {
    margin-top: 5px;

    font-size: 11px;
    color: var(--text-secondary);
}


/* CLIENT STATS */

.client-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 15px;

    margin-bottom: 20px;
}

.mini-stat-card {
    min-height: 92px;

    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    padding: 18px;

    display: flex;
    align-items: center;
    gap: 14px;

    box-shadow: var(--shadow);
}

.mini-stat-icon {
    width: 42px;
    height: 42px;

    flex: 0 0 auto;

    border-radius: 12px;

    display: grid;
    place-items: center;
}

.mini-stat-icon svg {
    width: 18px;
}

.mini-stat-icon.purple {
    background: var(--primary-soft);
    color: var(--primary);
}

.mini-stat-icon.green {
    background: var(--green-soft);
    color: var(--green);
}

.mini-stat-icon.orange {
    background: var(--orange-soft);
    color: var(--orange);
}

.mini-stat-card span {
    display: block;

    margin-bottom: 4px;

    color: var(--text-secondary);
    font-size: 10px;
}

.mini-stat-card strong {
    font-size: 18px;
}


/* CLIENT LIST */

.client-list-panel {
    overflow: hidden;
}

.client-list-header {
    min-height: 72px;

    padding: 15px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    border-bottom: 1px solid var(--border);
}

.search-box {
    width: 100%;
    max-width: 380px;

    height: 40px;

    padding: 0 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: #fafafd;

    display: flex;
    align-items: center;
    gap: 9px;
}

.search-box svg {
    width: 16px;
    color: var(--text-light);
}

.search-box input {
    width: 100%;

    border: 0;
    outline: 0;

    background: transparent;

    font-size: 11px;
    color: var(--text);
}

.search-box input::placeholder {
    color: var(--text-light);
}

.client-count {
    flex: 0 0 auto;

    color: var(--text-light);
    font-size: 10px;
}


/* CLIENT TABLE */

.client-table-wrap {
    overflow-x: auto;
}

.client-table td {
    vertical-align: middle;
}

.client-table td > span,
.client-table td > strong + span {
    display: block;
}

.client-table td:nth-child(2) strong {
    display: block;

    font-size: 10px;
    font-weight: 500;
    color: var(--text);
}

.client-table td:nth-child(2) span {
    margin-top: 3px;

    font-size: 9px;
    color: var(--text-light);
}

.client-row {
    transition: .15s ease;
}

.client-row:hover {
    background: #fcfbff;
}

.client-name-cell {
    min-width: 210px;

    display: flex;
    align-items: center;
    gap: 11px;
}

.client-avatar {
    width: 38px;
    height: 38px;

    flex: 0 0 auto;

    border-radius: 11px;

    background: var(--primary-soft);
    color: var(--primary);

    display: grid;
    place-items: center;

    font-size: 10px;
    font-weight: 700;
}

.client-name-cell strong {
    display: block;

    color: var(--text);
    font-size: 11px;
}

.client-name-cell span {
    display: block;

    margin-top: 3px;

    color: var(--text-light);
    font-size: 9px;
}

.amount-outstanding {
    font-weight: 600;
    color: var(--orange);
}

.overdue-text {
    color: var(--red);
}

.client-view-btn {
    width: 31px;
    height: 31px;

    border-radius: 8px;

    background: transparent;
    color: var(--text-light);

    display: grid;
    place-items: center;
}

.client-view-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.client-view-btn svg {
    width: 15px;
}


/* EMPTY SEARCH */

.client-empty-search {
    display: none;

    min-height: 220px;

    padding: 40px 20px;

    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
}

.client-empty-search.show {
    display: flex;
}

.client-empty-search svg {
    width: 30px;

    margin-bottom: 12px;

    color: var(--text-light);
}

.client-empty-search strong {
    font-size: 13px;
}

.client-empty-search span {
    margin-top: 5px;

    font-size: 10px;
    color: var(--text-light);
}


/* =========================================================
   FORM
========================================================= */

.client-modal {
    max-width: 620px;
}

.client-form {
    display: grid;
    gap: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 13px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;

    border: 1px solid var(--border);
    border-radius: 10px;

    outline: none;

    background: white;
    color: var(--text);

    font-size: 11px;

    transition: .15s ease;
}

.form-group input {
    height: 42px;
    padding: 0 12px;
}

.form-group textarea {
    padding: 11px 12px;

    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #bdb2f6;

    box-shadow:
        0 0 0 3px rgba(112, 87, 232, .08);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;

    padding-top: 5px;
}

.secondary-btn {
    min-height: 42px;

    padding: 0 16px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: white;
    color: var(--text-secondary);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    font-size: 11px;
    font-weight: 500;
}

.secondary-btn:hover {
    background: var(--bg);
}

.secondary-btn svg {
    width: 15px;
}


/* =========================================================
   CLIENT DETAIL
========================================================= */

.client-detail-modal {
    max-width: 560px;
}

.detail-label {
    display: block;

    margin-bottom: 5px;

    color: var(--primary);

    font-size: 8px;
    font-weight: 600;

    letter-spacing: 1px;
}

.client-detail-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 10px;

    margin-bottom: 18px;
}

.client-detail-summary > div {
    padding: 15px;

    background: var(--bg);

    border-radius: 12px;
}

.client-detail-summary span {
    display: block;

    margin-bottom: 5px;

    font-size: 9px;
    color: var(--text-light);
}

.client-detail-summary strong {
    font-size: 15px;
}

.client-detail-info {
    border: 1px solid var(--border);
    border-radius: 13px;

    overflow: hidden;
}

.detail-row {
    min-height: 48px;

    padding: 12px 14px;

    border-bottom: 1px solid var(--border);

    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 15px;

    align-items: start;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row span {
    font-size: 9px;
    color: var(--text-light);
}

.detail-row strong {
    font-size: 10px;
    font-weight: 500;

    line-height: 1.6;
}

.detail-section {
    margin-top: 20px;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 9px;
}

.detail-section-header h4 {
    font-size: 12px;
}

.client-document-mini {
    min-height: 55px;

    padding: 11px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 7px;
}

.client-document-mini strong {
    font-size: 10px;
}

.client-document-mini span {
    display: block;

    margin-top: 2px;

    font-size: 8px;
    color: var(--text-light);
}

.detail-actions {
    margin-top: 20px;

    padding-top: 17px;

    border-top: 1px solid var(--border);

    display: flex;
    justify-content: flex-end;
    gap: 9px;
}


/* =========================================================
   CLIENT MOBILE
========================================================= */

@media (max-width: 768px) {

    .section-toolbar {
        align-items: flex-start;
    }

    .section-toolbar h3 {
        font-size: 18px;
    }

    .section-toolbar p {
        font-size: 10px;
        line-height: 1.6;
    }

    .section-toolbar .primary-btn {
        display: flex;

        flex: 0 0 auto;

        width: 42px;
        padding: 0;

        justify-content: center;
    }

    .section-toolbar .primary-btn span {
        display: none;
    }


    .client-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .client-stats-grid .mini-stat-card:last-child {
        grid-column: 1 / -1;
    }

    .mini-stat-card {
        min-height: 80px;

        padding: 14px;
    }

    .mini-stat-icon {
        width: 35px;
        height: 35px;
    }

    .mini-stat-card strong {
        font-size: 14px;
    }


    .client-list-header {
        min-height: auto;

        padding: 13px;

        display: block;
    }

    .search-box {
        max-width: none;
    }

    .client-count {
        display: block;

        margin-top: 10px;
    }


    /* MOBILE CLIENT TABLE → CARD ROW */

    .client-table thead {
        display: none;
    }

    .client-table,
    .client-table tbody {
        display: block;
        width: 100%;
    }

    .client-table tbody tr {
        position: relative;

        display: block;

        padding: 15px;

        border-top: 1px solid var(--border);
    }

    .client-table tbody tr:first-child {
        border-top: 0;
    }

    .client-table tbody td {
        display: block;

        padding: 0;
        border: 0;
    }

    .client-table tbody td:nth-child(2) {
        margin-top: 10px;
        padding-left: 49px;
    }

    .client-table tbody td:nth-child(3),
    .client-table tbody td:nth-child(4),
    .client-table tbody td:nth-child(5) {
        display: none;
    }

    .client-table tbody td:last-child {
        position: absolute;

        top: 20px;
        right: 14px;
    }

    .client-name-cell {
        min-width: 0;

        padding-right: 35px;
    }


    .form-grid {
        grid-template-columns: 1fr;
    }

    .client-modal,
    .client-detail-modal {
        max-width: none;
    }

    .client-detail-summary {
        grid-template-columns: 1fr 1fr;
    }

    .detail-row {
        grid-template-columns: 100px 1fr;
    }

    .detail-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

}



/* =========================
   MOBILE MODAL BUTTON FIX
========================= */

@media (max-width: 768px) {

    /* Show primary buttons inside modals */
    .modal .primary-btn {
        display: inline-flex;
    }

    /* Allow long modal to scroll */
    .modal {
        max-height: 92vh;
        overflow-y: auto;
    }

    /* Better mobile action buttons */
    .form-actions {
        display: grid;
        grid-template-columns: 1fr 1.4fr;
        gap: 10px;

        padding-top: 10px;
    }

    .form-actions .secondary-btn,
    .form-actions .primary-btn {
        width: 100%;
        justify-content: center;
    }

    .detail-actions .primary-btn {
        display: inline-flex;
    }

}



/* =========================================================
   ITEMS / SERVICES
========================================================= */

.service-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 15px;

    margin-bottom: 20px;
}


.service-library-panel {
    overflow: hidden;
}


.service-library-toolbar {
    min-height: 72px;

    padding: 15px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    border-bottom: 1px solid var(--border);
}


.service-filter {
    height: 40px;

    padding: 0 11px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: white;

    display: flex;
    align-items: center;
    gap: 7px;
}


.service-filter svg {
    width: 15px;

    color: var(--text-light);
}


.service-filter select {
    border: 0;
    outline: 0;

    background: transparent;

    color: var(--text-secondary);

    font-size: 10px;
}


/* =========================================================
   DESKTOP TABLE
========================================================= */

.service-table-wrap {
    overflow-x: auto;
}


.service-name-cell {
    min-width: 270px;

    display: flex;
    align-items: flex-start;
    gap: 11px;
}


.service-icon {
    width: 38px;
    height: 38px;

    flex: 0 0 auto;

    border-radius: 11px;

    background: var(--primary-soft);
    color: var(--primary);

    display: grid;
    place-items: center;
}


.service-icon svg {
    width: 16px;
}


.service-name-cell strong {
    display: block;

    font-size: 11px;

    color: var(--text);
}


.service-name-cell p {
    max-width: 440px;

    margin-top: 4px;

    color: var(--text-light);

    font-size: 9px;
    line-height: 1.6;

    white-space: pre-line;
}


.service-category-badge {
    display: inline-flex;

    padding: 5px 9px;

    border-radius: 100px;

    background: #f4f3fa;

    color: var(--text-secondary);

    font-size: 8px;
    font-weight: 500;
}


.service-rate {
    color: var(--text);

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}


.service-unit {
    color: var(--text-secondary);

    font-size: 10px;
}


.service-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}


.service-action-btn {
    width: 30px;
    height: 30px;

    border-radius: 8px;

    background: transparent;

    color: var(--text-light);

    display: grid;
    place-items: center;
}


.service-action-btn:hover {
    background: var(--primary-soft);

    color: var(--primary);
}


.service-action-btn.danger:hover {
    background: var(--red-soft);

    color: var(--red);
}


.service-action-btn svg {
    width: 14px;
}


/* =========================================================
   MOBILE SERVICE CARDS
========================================================= */

.service-mobile-list {
    display: none;
}


.service-mobile-card {
    padding: 16px;

    border-bottom: 1px solid var(--border);
}


.service-mobile-card:last-child {
    border-bottom: 0;
}


.service-mobile-top {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}


.service-mobile-info {
    min-width: 0;
    flex: 1;
}


.service-mobile-info strong {
    display: block;

    color: var(--text);

    font-size: 11px;
}


.service-mobile-meta {
    margin-top: 5px;

    display: flex;
    flex-wrap: wrap;
    gap: 7px;

    align-items: center;
}


.service-mobile-meta span {
    color: var(--text-light);

    font-size: 8px;
}


.service-mobile-rate {
    margin-top: 12px;
    padding-top: 11px;

    border-top: 1px solid #f0f0f5;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.service-mobile-rate span {
    font-size: 9px;

    color: var(--text-light);
}


.service-mobile-rate strong {
    font-size: 12px;
}


.service-mobile-description {
    margin-top: 9px;

    color: var(--text-secondary);

    font-size: 9px;
    line-height: 1.7;

    white-space: pre-line;
}


.service-mobile-actions {
    margin-top: 13px;

    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 7px;
}


.service-mobile-action {
    min-height: 34px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: white;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    color: var(--text-secondary);

    font-size: 9px;
}


.service-mobile-action svg {
    width: 13px;
}


.service-mobile-action.danger {
    color: var(--red);
}


/* =========================================================
   EMPTY STATE
========================================================= */

.service-empty-state {
    display: none;

    min-height: 250px;

    padding: 40px 20px;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}


.service-empty-state.show {
    display: flex;
}


.service-empty-state svg {
    width: 32px;

    margin-bottom: 12px;

    color: var(--text-light);
}


.service-empty-state strong {
    font-size: 13px;
}


.service-empty-state span {
    margin-top: 5px;

    color: var(--text-light);

    font-size: 10px;
}


/* =========================================================
   SERVICE MODAL
========================================================= */

.service-modal {
    max-width: 620px;
}


.service-form {
    display: grid;

    gap: 15px;
}


.currency-input {
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 10px;

    display: flex;
    align-items: center;

    overflow: hidden;

    transition: .15s ease;
}


.currency-input:focus-within {
    border-color: #bdb2f6;

    box-shadow:
        0 0 0 3px rgba(112, 87, 232, .08);
}


.currency-input span {
    height: 100%;

    padding: 0 12px;

    background: var(--bg);

    border-right: 1px solid var(--border);

    display: flex;
    align-items: center;

    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 600;
}


.currency-input input {
    flex: 1;

    height: 100%;

    padding: 0 12px;

    border: 0;
    outline: 0;

    font-size: 11px;
}


.service-form-note {
    padding: 11px 12px;

    border-radius: 10px;

    background: var(--primary-soft);

    display: flex;
    align-items: flex-start;
    gap: 8px;

    color: var(--primary);
}


.service-form-note svg {
    width: 14px;
    flex: 0 0 auto;

    margin-top: 1px;
}


.service-form-note span {
    font-size: 9px;
    line-height: 1.6;
}


/* =========================================================
   SERVICE MOBILE
========================================================= */

@media (max-width: 768px) {

    .service-stats-grid {
        grid-template-columns: 1fr 1fr;

        gap: 10px;
    }


    .service-stats-grid .mini-stat-card:last-child {
        grid-column: 1 / -1;
    }


    .service-library-toolbar {
        display: grid;
        grid-template-columns: 1fr;

        padding: 13px;
    }


    .service-filter {
        width: 100%;
    }


    .service-filter select {
        width: 100%;
    }


    .service-table-wrap {
        display: none;
    }


    .service-mobile-list {
        display: block;
    }


    .service-modal {
        max-width: none;
    }

}



/* =========================
   SELECT FIELD FIX
========================= */

.form-group select {
    width: 100%;
    height: 42px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: white;
    color: var(--text);

    font-size: 11px;
    font-family: inherit;

    outline: none;
    cursor: pointer;

    transition: .15s ease;
}

.form-group select:focus {
    border-color: #bdb2f6;

    box-shadow:
        0 0 0 3px rgba(112, 87, 232, .08);
}



/* =========================================================
   DOCUMENT BUILDER
========================================================= */

.builder-page {
    padding-top: 24px;
}


.builder-header {
    margin-bottom: 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}


.builder-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}


.builder-header-left h3 {
    font-size: 18px;
}


.builder-back-btn {
    width: 39px;
    height: 39px;

    border-radius: 10px;

    border: 1px solid var(--border);

    background: white;
    color: var(--text-secondary);

    display: grid;
    place-items: center;
}


.builder-back-btn svg {
    width: 16px;
}


.builder-header-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}


.builder-draft-badge {
    padding: 6px 10px;

    border-radius: 100px;

    background: #f2f2f6;
    color: var(--text-secondary);

    font-size: 9px;
    font-weight: 600;
}


/* =========================================================
   BUILDER LAYOUT
========================================================= */

.builder-layout {
    display: grid;

    grid-template-columns:
        minmax(400px, .8fr)
        minmax(520px, 1.2fr);

    gap: 20px;

    align-items: start;
}


.builder-editor {
    display: grid;
    gap: 14px;
}


.builder-card {
    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow);

    overflow: hidden;
}


.builder-card-header {
    min-height: 70px;

    padding: 16px 18px;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    gap: 12px;
}


.builder-step-number {
    width: 30px;
    height: 30px;

    flex: 0 0 auto;

    border-radius: 9px;

    background: var(--primary);
    color: white;

    display: grid;
    place-items: center;

    font-size: 10px;
    font-weight: 700;
}


.builder-card-header h4 {
    font-size: 12px;
}


.builder-card-header p {
    margin-top: 3px;

    font-size: 9px;
    color: var(--text-light);
}


.builder-card-body {
    padding: 18px;

    display: grid;
    gap: 15px;
}


.builder-two-column,
.builder-discount-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;
}


.builder-auto-field {
    position: relative;
}


.builder-auto-field input {
    padding-right: 55px;
}


.builder-auto-field span {
    position: absolute;

    top: 50%;
    right: 10px;

    transform: translateY(-50%);

    padding: 4px 6px;

    border-radius: 6px;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 7px;
    font-weight: 700;
}


/* =========================================================
   LIBRARY PICKER
========================================================= */

.library-picker {
    display: grid;
    grid-template-columns: 1fr auto;

    align-items: end;
    gap: 9px;
}


.library-add-btn {
    min-width: 82px;

    justify-content: center;
}


.builder-divider {
    position: relative;

    margin: 3px 0;

    text-align: center;
}


.builder-divider::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    top: 50%;

    height: 1px;

    background: var(--border);
}


.builder-divider span {
    position: relative;

    padding: 0 9px;

    background: white;

    color: var(--text-light);

    font-size: 8px;
    font-weight: 600;

    letter-spacing: .7px;
}


/* =========================================================
   BUILDER ITEM
========================================================= */

#builder-items-container {
    display: grid;
    gap: 10px;
}


.builder-item {
    padding: 13px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #fdfdff;
}


.builder-item-top {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        72px
        105px
        32px;

    gap: 8px;

    align-items: end;
}


.builder-item .form-group {
    gap: 5px;
}


.builder-item .form-group label {
    font-size: 8px;
}


.builder-item input {
    width: 100%;
    height: 38px;

    padding: 0 10px;

    border: 1px solid var(--border);
    border-radius: 9px;

    outline: 0;

    background: white;

    font-size: 10px;
}


.builder-item input:focus,
.builder-item textarea:focus {
    border-color: #bdb2f6;

    box-shadow:
        0 0 0 3px rgba(112, 87, 232, .07);
}


.builder-item textarea {
    width: 100%;

    margin-top: 8px;
    padding: 9px 10px;

    border: 1px solid var(--border);
    border-radius: 9px;

    outline: 0;

    background: white;

    resize: vertical;

    color: var(--text-secondary);

    font-family: inherit;
    font-size: 9px;
    line-height: 1.6;
}


.builder-item-delete {
    width: 32px;
    height: 38px;

    border-radius: 9px;

    background: var(--red-soft);
    color: var(--red);

    display: grid;
    place-items: center;
}


.builder-item-delete svg {
    width: 14px;
}


.builder-item-amount {
    margin-top: 9px;

    display: flex;
    justify-content: flex-end;

    color: var(--text-secondary);

    font-size: 9px;
}


.builder-item-amount strong {
    margin-left: 7px;

    color: var(--text);
}


.builder-add-manual-btn {
    min-height: 40px;

    border: 1px dashed #cbc3f8;
    border-radius: 10px;

    background: #faf9ff;
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    font-size: 10px;
    font-weight: 600;
}


.builder-add-manual-btn svg {
    width: 15px;
}


/* =========================================================
   CALCULATION
========================================================= */

.builder-calculation {
    margin-top: 4px;
    padding-top: 13px;

    border-top: 1px solid var(--border);

    display: grid;
    gap: 8px;
}


.builder-calculation > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
}


.builder-calculation span {
    font-size: 9px;
    color: var(--text-secondary);
}


.builder-calculation strong {
    font-size: 10px;
}


.builder-calculation .grand-total-row {
    margin-top: 4px;
    padding: 10px 11px;

    border-radius: 9px;

    background: var(--primary-soft);
}


.builder-calculation .grand-total-row span {
    color: var(--primary);

    font-weight: 600;
}


.builder-calculation .grand-total-row strong {
    color: var(--primary);

    font-size: 13px;
}


/* =========================================================
   PREVIEW SHELL
========================================================= */

.builder-preview-shell {
    position: sticky;
    top: 112px;

    background: #ebedf3;

    border-radius: var(--radius-md);

    padding: 14px;

    box-shadow: var(--shadow);
}


.preview-toolbar {
    min-height: 42px;

    padding: 0 4px 10px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.preview-toolbar strong {
    display: block;

    font-size: 10px;
}


.preview-toolbar > div > span {
    display: block;

    margin-top: 2px;

    color: var(--text-light);

    font-size: 8px;
}


.preview-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}


.preview-toolbar-actions > span {
    font-size: 8px;
    color: var(--text-secondary);
}


/* =========================================================
   A4 QUOTATION PREVIEW
========================================================= */

.quotation-preview {
    width: 100%;
    min-height: 760px;

    padding: 36px;

    background: white;

    border-radius: 8px;

    box-shadow:
        0 8px 30px rgba(25, 25, 40, .08);

    color: #171721;
}


.preview-company-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;
}


.preview-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}


.preview-brand-icon {
    width: 37px;
    height: 37px;

    border-radius: 10px;

    background: var(--primary);
    color: white;

    display: grid;
    place-items: center;

    font-size: 16px;
    font-weight: 700;
}


.preview-brand strong {
    display: block;

    font-size: 12px;
}


.preview-brand span {
    display: block;

    margin-top: 2px;

    color: var(--text-light);

    font-size: 5px;
    letter-spacing: 1px;
}


.preview-title {
    text-align: right;
}


.preview-title span {
    display: block;

    color: var(--primary);

    font-size: 19px;
    font-weight: 700;
}


.preview-title strong {
    display: block;

    margin-top: 3px;

    color: var(--primary);

    font-size: 9px;
}


.preview-business-row {
    margin-top: 25px;

    display: grid;
    grid-template-columns: 1fr auto;

    gap: 30px;
}


.preview-business-row > div:first-child strong {
    font-size: 8px;
}


.preview-business-row p {
    max-width: 280px;

    margin-top: 4px;

    color: #676773;

    font-size: 7px;
    line-height: 1.7;
}


.preview-document-meta {
    display: grid;
    gap: 5px;
}


.preview-document-meta div {
    display: grid;
    grid-template-columns: 65px 1fr;

    gap: 10px;
}


.preview-document-meta span {
    color: var(--text-light);

    font-size: 6px;
}


.preview-document-meta strong {
    text-align: right;

    font-size: 7px;
}


.preview-purple-line {
    height: 2px;

    margin: 18px 0;

    background: var(--primary);
}


.preview-client-section {
    min-height: 82px;
}


.preview-small-label {
    display: block;

    margin-bottom: 5px;

    color: var(--text-light);

    font-size: 6px;
    font-weight: 700;

    letter-spacing: .6px;
}


.preview-client-section strong {
    display: block;

    font-size: 9px;
}


.preview-client-section p {
    margin-top: 5px;

    color: #62626e;

    font-size: 7px;
    line-height: 1.7;

    white-space: pre-line;
}


/* ITEMS */

.preview-items {
    margin-top: 12px;
}


.preview-item-header {
    min-height: 28px;

    padding: 0 8px;

    background: var(--primary);
    color: white;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        45px
        75px
        82px;

    align-items: center;

    gap: 8px;

    font-size: 6px;
    font-weight: 600;
}


.preview-item-header span:not(:first-child) {
    text-align: right;
}


.preview-item-row {
    padding: 9px 8px;

    border-bottom: 1px solid #ececf1;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        45px
        75px
        82px;

    gap: 8px;

    align-items: start;
}


.preview-item-main strong {
    display: block;

    font-size: 7px;
}


.preview-item-main p {
    margin-top: 3px;

    color: #777783;

    font-size: 6px;
    line-height: 1.55;

    white-space: pre-line;
}


.preview-item-row > span {
    text-align: right;

    font-size: 7px;
}


.preview-empty-item {
    padding: 25px;

    text-align: center;

    color: var(--text-light);

    font-size: 7px;

    border-bottom: 1px solid var(--border);
}


/* TOTAL */

.preview-total-area {
    margin-top: 12px;

    display: grid;
    grid-template-columns: 1fr 230px;
}


.preview-total-box {
    display: grid;
    gap: 7px;
}


.preview-total-box > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}


.preview-total-box span {
    font-size: 7px;
    color: #686873;
}


.preview-total-box strong {
    font-size: 7px;
}


.preview-grand-total {
    margin-top: 3px;
    padding: 8px 10px;

    background: var(--primary-soft);

    color: var(--primary);
}


.preview-grand-total span,
.preview-grand-total strong {
    color: var(--primary);

    font-weight: 700;
}


.preview-bottom {
    margin-top: 35px;
    padding-top: 15px;

    border-top: 1px solid var(--border);

    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 30px;
}


.preview-bottom p {
    color: #686873;

    font-size: 6px;
    line-height: 1.7;

    white-space: pre-line;
}


.preview-thank-you {
    margin-top: 28px;

    text-align: right;

    color: var(--primary);

    font-size: 18px;
    font-weight: 600;

    font-style: italic;
}


/* =========================================================
   MOBILE BUILDER
========================================================= */

.builder-mobile-progress,
.builder-mobile-actions {
    display: none;
}


@media (max-width: 768px) {

    body.builder-open {
        padding-bottom: 78px;
    }


    body.builder-open .mobile-nav {
        display: none;
    }


    .builder-page {
        padding:
            18px 14px
            25px;
    }


    .builder-header {
        margin-bottom: 14px;
    }


    .builder-header-left h3 {
        font-size: 16px;
    }


    .builder-header-actions {
        display: none;
    }


    .builder-mobile-progress {
        margin-bottom: 14px;

        padding: 10px 12px;

        background: white;

        border: 1px solid var(--border);
        border-radius: 12px;

        display: flex;
        align-items: center;
    }


    .builder-progress-item {
        display: flex;
        flex-direction: column;
        align-items: center;

        gap: 4px;

        color: var(--text-light);
    }


    .builder-progress-item span {
        width: 24px;
        height: 24px;

        border-radius: 50%;

        border: 1px solid var(--border);

        display: grid;
        place-items: center;

        font-size: 8px;
        font-weight: 600;
    }


    .builder-progress-item small {
        font-size: 6px;
    }


    .builder-progress-item.active {
        color: var(--primary);
    }


    .builder-progress-item.active span {
        background: var(--primary);
        border-color: var(--primary);

        color: white;
    }


    .builder-progress-line {
        flex: 1;

        height: 1px;

        margin: 0 5px 14px;

        background: var(--border);
    }


    .builder-layout {
        display: block;
    }


    .builder-step {
        display: none;
    }


    .builder-step.mobile-active {
        display: block;
    }


    .builder-editor {
        display: block;
    }


    .builder-card-header {
        min-height: 64px;

        padding: 14px;
    }


    .builder-card-body {
        padding: 14px;
    }


    .builder-two-column,
    .builder-discount-grid,
    .library-picker {
        grid-template-columns: 1fr;
    }


    .library-add-btn {
        width: 100%;

        display: flex;
    }


    .builder-item-top {
        grid-template-columns: 1fr 65px;
    }


    .builder-item-top
    .form-group:nth-child(1) {
        grid-column: 1 / -1;
    }


    .builder-item-top
    .form-group:nth-child(2) {
        grid-column: 1;
    }


    .builder-item-top
    .form-group:nth-child(3) {
        grid-column: 2;
    }


    .builder-item-delete {
        grid-column: 2;

        justify-self: end;
    }


    .builder-preview-shell {
        position: static;

        display: none;

        padding: 8px;

        border-radius: 12px;
    }


    .builder-preview-shell.mobile-preview-active {
        display: block;
    }


    .preview-toolbar {
        padding: 4px 4px 10px;
    }


    .quotation-preview {
        min-height: 0;

        padding: 18px;

        border-radius: 7px;
    }


    .preview-title span {
        font-size: 14px;
    }


    .preview-business-row {
        grid-template-columns: 1fr;

        gap: 12px;
    }


    .preview-document-meta {
        max-width: 180px;
    }


    .preview-item-header,
    .preview-item-row {
        grid-template-columns:
            minmax(0, 1fr)
            30px
            55px
            62px;

        gap: 4px;
    }


    .preview-total-area {
        grid-template-columns: 1fr;
    }


    .preview-total-box {
        margin-top: 12px;
    }


    .preview-bottom {
        grid-template-columns: 1fr;

        gap: 15px;
    }


    /* MOBILE ACTION BAR */

    .builder-mobile-actions {
        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        min-height: 70px;

        padding:
            10px 14px
            calc(
                10px +
                env(safe-area-inset-bottom)
            );

        background: white;

        border-top: 1px solid var(--border);

        display: none;

        grid-template-columns:
            1fr auto 1fr;

        align-items: center;

        gap: 10px;

        z-index: 350;
    }


    body.builder-open
    .builder-mobile-actions {
        display: grid;
    }


    .builder-mobile-actions
    .primary-btn {
        display: flex;

        justify-content: center;
    }


    .builder-mobile-actions
    .secondary-btn {
        width: 100%;
    }


    .builder-mobile-actions > span {
        font-size: 8px;

        color: var(--text-light);

        white-space: nowrap;
    }

}





