/* base.css */
/* =========================================================
   DESIGN TOKENS
   All colors live here. Light values in :root, dark values
   in body.dark-mode override the SAME variable names — so
   component rules below never need a separate dark selector
   unless they're overriding an external (e.g. Tailwind)
   utility class.
   ========================================================= */
:root {
    /* --- Brand --- */
    --pt-blue: #20ADE4;
    --pt-blue-dark: #0c88b9;
    --pt-brand-subtle-bg: #eef5fd;
    /* active doc-list item bg */
    --pt-brand-gradient-from: #3fb6e6;
    --pt-brand-gradient-to: #2f6fd6;

    /* --- Status colors --- */
    --pt-green: #16a34a;
    --pt-green-bg: #e9f9ee;
    --pt-green-bg-hover: #f0fbf3;
    --pt-green-border-hover: #bfe8cc;

    --pt-orange: #ea7c1f;
    --pt-orange-bg: #fdf1e3;
    --pt-orange-bg-hover: #fef6ee;
    --pt-orange-border-hover: #f3d3ab;

    --pt-red: #dc4c3f;
    --pt-red-bg: #fdecea;
    --pt-red-bg-strong: #fdecea;

    --pt-purple: #7c5cd6;
    --pt-purple-bg: #eee9fb;

    --pt-muted-bg: #f1f2f4;
    /* inactive / draft chips */
    --pt-muted-text: #7a7f8a;

    /* --- Text --- */
    --pt-text: #1f2430;
    /* headings, primary text */
    --pt-text-secondary: #4b5060;
    --pt-text-tertiary: #6b7080;
    --pt-text-muted: #8b8f9a;
    --pt-text-faint: #9aa0ab;
    --pt-text-faintest: #adb0ba;
    --pt-text-disabled: #b0b3bb;
    --pt-text-inverse: #ffffff;
    --pt-nav-text: #7e8396;
    --pt-nav-icon: #6b7080;
    --pt-nav-section-label: #adb0ba;

    /* --- Surfaces / backgrounds --- */
    --pt-bg-page: #ffffff;
    --pt-bg-surface: #ffffff;
    /* cards, panels, modal */
    --pt-sidebar-bg: #fafafa;
    --pt-bg-subtle: #f2f3f5;
    /* tab-group / segmented / hovers */
    --pt-bg-subtle-hover: #eef0f3;
    /* nav-item hover */
    --pt-bg-hover: #f9fafb;
    /* doc-list-item / secondary btn hover */
    --pt-bg-row-hover: #fafbfc;
    /* tx-row hover */
    --pt-bg-avatar: #eef1f5;
    --pt-avatar-text: #5a5f6b;

    --pt-action-primary-bg: #1f2430;
    /* doc-primary-btn / doc-tab active */
    --pt-action-primary-bg-hover: #14171f;
    --pt-action-primary-text: #ffffff;

    /* --- Borders --- */
    --pt-border: #eceef1;
    /* stat-card / panel */
    --pt-border-subtle: #f5f5f6;
    /* list-row / tx-row */
    --pt-border-strong: #e2e4e9;
    /* inputs / action-box */
    --pt-border-input: #e5e7eb;
    /* search-input */
    --pt-sidebar-border: #e7e7ea;
    --pt-border-header: #f0f1f3;
    /* panel-header / tx-head / modal */

    /* --- Controls --- */
    --pt-switch-track: #dcdfe4;
    --pt-switch-thumb: #ffffff;

    /* --- Modal --- */
    --pt-modal-overlay: rgba(15, 17, 22, 0.45);
    --pt-modal-shadow: rgba(0, 0, 0, 0.2);
}

html.dark-mode{
    /* --- Brand (unchanged — brand color stays constant across themes) --- */
    --pt-brand-subtle-bg: #1c2734;

    /* --- Status colors (fills/bgs kept as-is except where contrast breaks) --- */
    --pt-green: #4ade80;
    --pt-green-bg: #123423;
    --pt-green-bg-hover: #16402a;
    --pt-green-border-hover: #276e45;

    --pt-orange: #f0973a;
    --pt-orange-bg: #3a2712;
    --pt-orange-bg-hover: #453016;
    --pt-orange-border-hover: #7a5324;

    --pt-red: #f0685a;
    --pt-red-bg: #3a1815;
    --pt-red-bg-strong: #3a2320;

    --pt-purple: #a78bfa;
    --pt-purple-bg: #251f3d;

    --pt-muted-bg: #2a2c31;
    /* inactive / draft chips */
    --pt-muted-text: #9a9fa8;

    /* --- Text --- */
    --pt-text: #e2e4e9;
    --pt-text-secondary: #d7dae0;
    --pt-text-tertiary: #a6abb5;
    --pt-text-muted: #82868f;
    --pt-text-faint: #82868f;
    --pt-text-faintest: #6b7080;
    --pt-text-disabled: #6b7080;
    --pt-nav-text: #a6abb5;
    --pt-nav-icon: #a6abb5;
    --pt-nav-section-label: #575c66;

    /* --- Surfaces / backgrounds --- */
    --pt-bg-page: #14161b;
    --pt-bg-surface: #1b1e25;
    --pt-sidebar-bg: #1b1e25;
    --pt-bg-subtle: #22252c;
    --pt-bg-subtle-hover: #22252c;
    --pt-bg-hover: #22252c;
    --pt-bg-row-hover: #20232a;
    --pt-bg-avatar: #2b2f38;
    --pt-avatar-text: #a6abb5;

    --pt-action-primary-bg: #3a6fd9;
    --pt-action-primary-bg-hover: #3260c2;
    --pt-muted-bg: #2b2f38;
    --pt-muted-text: #a6abb5;

    /* --- Borders --- */
    --pt-border: #272b33;
    --pt-border-subtle: #23262d;
    --pt-border-strong: #2e323b;
    --pt-border-input: #2e323b;
    --pt-sidebar-border: #272b33;
    --pt-border-header: #272b33;

    /* --- Controls --- */
    --pt-switch-track: #3a3f4a;

    /* --- Modal --- */
    --pt-modal-overlay: rgba(0, 0, 0, 0.6);

    background-color: var(--pt-bg-page);
    color: var(--pt-text-secondary);
}

/* =========================================================
   BASE
   ========================================================= */
body {
    font-family: "Quicksand", sans-serif;
    color: var(--pt-text);
    background-color: var(--pt-bg-page);
}

body main{
    padding-bottom: 3rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Poppins", sans-serif;
    color: var(--pt-text);
}

/* =========================================================
   SIDEBAR NAV
   ========================================================= */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pt-nav-text);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
    background-color: var(--pt-bg-subtle-hover);
}

.nav-item.active {
    background-color: var(--pt-blue);
    color: var(--pt-text-inverse);
}

.nav-item.active svg {
    stroke: var(--pt-text-inverse);
}

.nav-item svg {
    stroke: var(--pt-nav-icon);
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.nav-item.active:hover {
    background-color: var(--pt-blue-dark);
}

.nav-section-label {
    font-size: 0.6875rem;
    letter-spacing: 0.07em;
    color: var(--pt-nav-section-label);
    font-weight: 600;
    padding: 0 0.75rem;
    margin-bottom: 0.375rem;
    margin-top: 1.25rem;
}

.action-box {
    flex: 1;
    border: 1px solid var(--pt-border-strong);
    border-radius: 0.625rem;
    padding: 0.6rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--pt-bg-surface);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.action-box.income {
    color: var(--pt-green);
}

.action-box.income:hover {
    background-color: var(--pt-green-bg-hover);
    border-color: var(--pt-green-border-hover);
}

.action-box.expense {
    color: var(--pt-orange);
}

.action-box.expense:hover {
    background-color: var(--pt-orange-bg-hover);
    border-color: var(--pt-orange-border-hover);
}

/* =========================================================
   DASHBOARD
   ========================================================= */
.stat-card {
    background: var(--pt-bg-surface);
    border: 1px solid var(--pt-border);
    border-radius: 0.75rem;
    padding: 1rem 1.125rem;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--pt-text-faint);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.stat-delta-up {
    color: var(--pt-green);
}

.stat-delta-down {
    color: var(--pt-red);
}

.panel {
    background: var(--pt-bg-surface);
    border: 1px solid var(--pt-border);
    border-radius: 0.75rem;
}

.panel-header {
    padding: 0.9rem 1.125rem;
    border-bottom: 1px solid var(--pt-border-header);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-bar-track {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    height: 6px;
    width: 6px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.125rem;
    border-bottom: 1px solid var(--pt-border-subtle);
    font-size: 0.8125rem;
}

.list-row:last-child {
    border-bottom: none;
}

.avatar-chip {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    background: var(--pt-bg-avatar);
    color: var(--pt-avatar-text);
    font-size: 0.6875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================================================
   TRANSACTIONS
   ========================================================= */
.tab-btn {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pt-text-tertiary);
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
    background-color: var(--pt-bg-subtle);
}

.tab-btn.active {
    background-color: var(--pt-bg-surface);
    color: var(--pt-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tab-group {
    display: inline-flex;
    gap: 0.15rem;
    background-color: var(--pt-bg-subtle);
    padding: 0.2rem;
    border-radius: 0.625rem;
}

.search-input {
    width: 100%;
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem 0.5rem 2.1rem;
    border: 1px solid var(--pt-border-input);
    border-radius: 0.5rem;
    outline: none !important;
    background: var(--pt-bg-surface);
    color: var(--pt-text);
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: var(--pt-blue);
}

.tx-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 0.9fr 0.9fr;
    align-items: center;
    padding: 0.75rem 1.125rem;
    border-bottom: 1px solid var(--pt-border-subtle);
    font-size: 0.8125rem;
}

.tx-row:last-child {
    border-bottom: none;
}

.tx-row:hover {
    background-color: var(--pt-bg-row-hover);
}

.tx-head {
    display: grid;
    grid-template-columns: 1.6fr 1fr 0.9fr 0.9fr;
    padding: 0.6rem 1.125rem;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    color: var(--pt-text-faintest);
    font-weight: 600;
    border-bottom: 1px solid var(--pt-border-header);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
}

.badge-paid {
    background-color: var(--pt-green-bg);
    color: var(--pt-green);
}

.badge-pending {
    background-color: var(--pt-orange-bg);
    color: var(--pt-orange);
}

.badge-rejected {
    background-color: var(--pt-red-bg);
    color: var(--pt-red);
}

/* =========================================================
   DOCUMENTS / INVOICES
   ========================================================= */
.doc-list-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--pt-bg-subtle);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.doc-list-item:hover {
    background-color: var(--pt-bg-hover);
}

.doc-list-item.active {
    background-color: var(--pt-brand-subtle-bg);
    border-left: 2px solid var(--pt-blue);
    padding-left: calc(1rem - 2px);
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
}

.doc-badge-paid {
    background-color: var(--pt-green-bg);
    color: var(--pt-green);
}

.doc-badge-sent {
    background-color: var(--pt-purple-bg);
    color: var(--pt-purple);
}

.doc-badge-draft {
    background-color: var(--pt-muted-bg);
    color: var(--pt-muted-text);
}

.doc-tab {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: 0.4rem;
    cursor: pointer;
    color: var(--pt-text-tertiary);
}

.doc-tab:hover {
    background-color: var(--pt-bg-subtle);
}

.doc-tab.active {
    background-color: var(--pt-action-primary-bg);
    color: var(--pt-action-primary-text);
}

.doc-primary-btn {
    background-color: var(--pt-action-primary-bg);
    color: var(--pt-action-primary-text);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.55rem;
    border-radius: 0.5rem;
    text-align: center;
    cursor: pointer;
}

.doc-primary-btn:hover {
    background-color: var(--pt-action-primary-bg-hover);
}

.doc-secondary-btn {
    border: 1px solid var(--pt-border-strong);
    color: var(--pt-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.55rem;
    border-radius: 0.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--pt-bg-surface);
}

.doc-secondary-btn:hover {
    background-color: var(--pt-bg-hover);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pt-text-secondary);
    padding: 0.45rem 0.7rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

.toolbar-btn:hover {
    background-color: var(--pt-bg-subtle);
}

.inv-table th {
    text-align: left;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    color: var(--pt-text-faintest);
    font-weight: 600;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--pt-border);
}

.inv-table td {
    padding: 0.6rem 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--pt-border-subtle);
}

/* =========================================================
   CUSTOMERS
   ========================================================= */
.badge-active {
    background-color: var(--pt-green-bg);
    color: var(--pt-green);
}

.badge-inactive {
    background-color: var(--pt-muted-bg);
    color: var(--pt-text-faint);
}

.worktype-row {
    padding: 0.6rem 1.125rem;
    border-bottom: 1px solid var(--pt-border-subtle);
}

.worktype-row:last-child {
    border-bottom: none;
}

.worktype-bar-track {
    width: 100%;
    height: 6px;
    border-radius: 9999px;
    background-color: var(--pt-bg-subtle);
    overflow: hidden;
    margin-top: 0.35rem;
}

.worktype-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background-color: var(--pt-blue);
}

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--pt-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-panel {
    background: var(--pt-bg-surface);
    border-radius: 0.875rem;
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px var(--pt-modal-shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--pt-border-header);
}

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--pt-border-header);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pt-text-tertiary);
    margin-bottom: 0.35rem;
    display: block;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    font-size: 0.8125rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--pt-border-strong);
    border-radius: 0.5rem;
    outline: none !important;
    background: var(--pt-bg-surface);
    color: var(--pt-text);
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    border-color: var(--pt-blue);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.segmented {
    display: flex;
    background: var(--pt-bg-subtle);
    border-radius: 0.5rem;
    padding: 0.2rem;
    gap: 0.15rem;
}

.segmented-opt {
    flex: 1;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pt-text-tertiary);
    padding: 0.4rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.segmented-opt.active {
    background: var(--pt-bg-surface);
    color: var(--pt-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.line-item-row {
    display: grid;
    grid-template-columns: 1fr 60px 90px 30px;
    gap: 0.4rem;
    align-items: center;
}

.remove-line-btn {
    color: var(--pt-text-disabled);
    cursor: pointer;
    text-align: center;
}

.remove-line-btn:hover {
    color: var(--pt-red);
}

/* =========================================================
   TOGGLE SWITCH
   ========================================================= */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: absolute;
    inset: 0;
    background: var(--pt-switch-track);
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.switch-track::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: var(--pt-switch-thumb);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.switch input:checked+.switch-track {
    background-color: var(--pt-blue);
}

.switch input:checked+.switch-track::before {
    transform: translateX(16px);
}

/* =========================================================
   DARK MODE — overrides for classes we don't control
   (Tailwind utility classes). Everything else above already
   reacts to dark mode automatically via the token overrides
   defined in html.dark-mode at the top of this file.
   ========================================================= */
html.dark-mode #sidebar,
html.dark-mode header,
html.dark-mode .bg-white {
    background-color: var(--pt-bg-surface) !important;
}

html.dark-mode #sidebar {
    border-color: var(--pt-sidebar-border) !important;
}

html.dark-mode header,
html.dark-mode .border-gray-200,
html.dark-mode .border-gray-100 {
    border-color: var(--pt-border-header) !important;
}

html.dark-mode .text-gray-400,
html.dark-mode .text-gray-500 {
    color: var(--pt-text-muted) !important;
}

html.dark-mode .text-gray-600,
html.dark-mode .text-gray-700,
html.dark-mode .text-gray-800 {
    color: var(--pt-text) !important;
}

/* =========================================================
   LOGO
   ========================================================= */
.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--pt-brand-gradient-from) 0%, var(--pt-brand-gradient-to) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


/* =========================================================
   SIDEBAR NAV
   =========================================================
 */

/* Base transition */
#sidebar {
    transition: width 0.2s ease, transform 0.2s ease;
    overflow-x: hidden;
    /* safety net against any stray overflow */
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--pt-muted-text, #9aa0ab);
    transition: background-color 0.15s, color 0.15s;
}

.user-menu-item:hover {
    background-color: var(--pt-bg-subtle-hover);
    color: #fff;
}

.user-menu-item svg {
    flex-shrink: 0;
    opacity: 0.85;
}

/* ---- DESKTOP: collapsed = icon rail ---- */
@media (min-width: 768px) {
    #sidebar.collapsed {
        width: 4.5rem;
    }

    #sidebar.collapsed .sidebar-label {
        display: none;
    }

    /* Square icon buttons when collapsed */
    #sidebar.collapsed .nav-item {
        width: 2.75rem;
        aspect-ratio: 1 / 1;
        padding: 0;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    #sidebar.collapsed .sidebar-actions {
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        padding-right: 0;
        gap: 0.5rem;
    }

    #sidebar.collapsed .action-box {
        width: 2.75rem;
        aspect-ratio: 1 / 1;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    #sidebar.collapsed .nav-item svg,
    #sidebar.collapsed .action-box svg {
        margin: 0;
    }

    #sidebar.collapsed .sidebar-actions {
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        padding-right: 0;
        aspect-ratio: 1 / 1;
    }

    #sidebar.collapsed nav>div.flex.flex-col {
        align-items: center;
    }

    #sidebar.collapsed .sidebar-logo-row {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    #sidebar.collapsed .sidebar-footer {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    /* Tooltip on hover when collapsed */
    #sidebar.collapsed .nav-item {
        position: relative;
        z-index: 10;
    }

    .sidebar-tooltip {
        position: fixed;
        background: var(--pt-nav-text);
        color: var(--pt-bg-subtle-hover);
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
        z-index: 100;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.1s ease;
    }

    .sidebar-tooltip.visible {
        opacity: 1;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ---- MOBILE: collapsed = fully hidden off-canvas ---- */
@media (max-width: 767px) {
    #sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        transform: translateX(0);
    }

    #sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 55;
    }

    .sidebar-overlay.visible {
        display: block;
    }
}


/* =========================================================
   DRAWER
   =========================================================
 */
/* ---- Desktop: unchanged two-column layout ---- */
.doc-drawer-handle,
.doc-drawer-backdrop {
    display: none;
}

/* ---- Mobile: left column becomes a bottom drawer ---- */
@media (max-width: 767px) {
    .doc-grid {
        display: block !important;
        padding: 1rem !important;
        padding-bottom: 5rem !important;
        /* room so content isn't hidden behind the collapsed handle */
    }

    .doc-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .table-scroll {
        overflow-x: auto;
    }

    #docDrawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        background: var(--pt-bg-surface);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -4px 24px var(--pt-modal-shadow);
        max-height: 78vh;
        display: flex;
        flex-direction: column;
        transform: translateY(calc(100% - 4rem));
        /* collapsed: only handle peeks up */
        transition: transform 0.28s ease;
    }

    #docDrawer.open {
        transform: translateY(0);
    }

    .doc-drawer-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        cursor: pointer;
    }

    .drawer-grip {
        width: 36px;
        height: 4px;
        background: var(--pt-border);
        border-radius: 2px;
    }

    .drawer-chevron {
        transition: transform 0.28s ease;
    }

    #docDrawer.open .drawer-chevron {
        transform: rotate(180deg);
    }

    .doc-drawer-body {
        overflow-y: auto;
        padding: 0 1rem 1.25rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .doc-title-desktop {
        display: none;
        /* handle already shows the "Documents" label */
    }

    .doc-drawer-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: var(--pt-modal-overlay);
        z-index: 65;
    }

    .doc-drawer-backdrop.visible {
        display: block;
    }
}

/* ============================================================================================== */
/* ====================================== DRAWER ================================================ */
/* ============================================================================================== */

/* Row is now interactive */
.tx-row {
    cursor: pointer;
    transition: background-color .15s ease;
}

.tx-row:hover,
.tx-row:focus-visible {
    background-color: var(--pt-bg-row-hover);
    outline: none;
}

/* Overlay */
.tx-overlay {
    position: fixed;
    inset: 0;
    background: var(--pt-modal-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 60;
}

.tx-overlay.tx-open {
    opacity: 1;
    pointer-events: auto;
}

/* Drawer base */
.tx-drawer {
    position: fixed;
    background: var(--pt-bg-surface);
    z-index: 61;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px var(--pt-modal-shadow);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

/* Desktop: slide in from the right */
@media (min-width: 768px) {
    .tx-drawer {
        top: 0;
        right: 0;
        height: 100vh;
        width: 380px;
        max-width: 90vw;
        transform: translateX(100%);
        border-left: 1px solid var(--pt-border-header);
    }

    .tx-drawer.tx-open {
        transform: translateX(0);
    }
}

/* Mobile: slide up from the bottom */
@media (max-width: 767px) {
    .tx-drawer {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88vh;
        width: 100%;
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
        transform: translateY(100%);
        border-top: 1px solid var(--pt-border-header);
    }

    .tx-drawer.tx-open {
        transform: translateY(0);
    }
}

.tx-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--pt-border-header);
    flex-shrink: 0;
}

.tx-drawer-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pt-text-faint);
    margin-bottom: 2px;
}

.tx-drawer-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--pt-text);
    margin: 0;
}

.tx-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: var(--pt-text-tertiary);
    background: var(--pt-bg-subtle);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.tx-drawer-close:hover {
    background: var(--pt-bg-subtle-hover);
    color: var(--pt-text);
}

.tx-drawer-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.tx-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.tx-field-row {
    display: flex;
    gap: 12px;
}

.tx-field-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--pt-text-tertiary);
}

.tx-input {
    border: 1px solid var(--pt-border-strong);
    border-radius: 9px;
    padding: 9px 11px;
    font-size: 13.5px;
    color: var(--pt-text);
    background: var(--pt-bg-surface);
    outline: none !important;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tx-input:focus {
    border-color: var(--pt-blue);
    box-shadow: 0 0 0 3px var(--pt-brand-subtle-bg);
}

.tx-drawer-footer {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--pt-border-header);
}

.tx-drawer-footer-right {
    display: flex;
    gap: 8px;
}

.tx-btn {
    border: none;
    border-radius: 9px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}

.tx-btn-primary {
    background: var(--pt-action-primary-bg);
    color: var(--pt-action-primary-text);
}

.tx-btn-primary:hover {
    background: var(--pt-action-primary-bg-hover);
}

.tx-btn-ghost {
    background: var(--pt-bg-subtle);
    color: var(--pt-text-secondary);
}

.tx-btn-ghost:hover {
    background: var(--pt-bg-subtle-hover);
}

.tx-btn-danger {
    background: var(--pt-red-bg);
    color: var(--pt-red);
}

.tx-btn-danger:hover {
    opacity: .85;
}

body.tx-drawer-active {
    overflow: hidden;
}


/* =============== TOAST NOTIFICATION ============== */
.notyf__message {
    font-family: "Quicksand", system-ui, sans-serif !important;
    font-size: 14px !important;
    /* color: white !important; */
}

/* Toast Base */
.notyf__toast {
    border-radius: 18px !important;
    padding: 4px 12px !important;
}

@media screen and (max-width: 600px) {
    .notyf__toast {
        border-radius: 0 !important;
    }
}