/* ================================================================
   SAVANNAH TRACKING LTD — Application Theme
   app.css  |  Global styles, shell layout, header, footer
   ================================================================ */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@300;400;500;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --clr-green: #3A7D1E;
    --clr-green-lt: #4E9E2A;
    --clr-green-xlt: #EBF5E6;
    --clr-red-dot: #CC2200;
    /* Shell — light theme */
    --clr-shell: #FFFFFF;
    --clr-header-bg: #F0F0F0;
    --clr-footer-bg: #F0F0F0;
    --clr-header-border: #DCDCDC;
    --clr-footer-border: #DCDCDC;
    /* Text */
    --clr-text-primary: #1A1A1A;
    --clr-text-secondary: #555555;
    --clr-text-muted: #888888;
    /* Inputs */
    --clr-input-bg: #FFFFFF;
    --clr-input-border: #D1D5DB;
    --clr-input-focus: rgba(58, 125, 30, 0.12);
    /* Layout */
    --header-h: 64px;
    --footer-h: 44px;
    --gap-x: 65px;
    --gap-y: 25px;
    --min-w: 860px;
    --min-h: 540px;
    --radius: 10px;
    /* Typography */
    --font-display: 'Barlow Condensed', sans-serif;
    --font-body: 'Barlow', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--clr-text-primary);
    background: #0b0803;
    overflow: hidden;
}

/* ── Background image ──────────────────────────────────────────── */
#stl-bg {
    position: fixed;
    inset: 0;
    /* 60% vertical position keeps the building visible rather than cropping it */
    background: url('/images/STL-Home.webp') center 60% / cover no-repeat;
    z-index: 0;
}

/* No overlay — natural photo colours */

/* ── App shell — white floating frame ──────────────────────────── */
#stl-app {
    position: fixed;
    inset: var(--gap-y) var(--gap-x);
    min-width: var(--min-w);
    min-height: var(--min-h);
    z-index: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--clr-shell);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.10), 0 24px 80px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ── HEADER ────────────────────────────────────────────────────── */
.stl-header {
    flex-shrink: 0;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--clr-header-bg);
    border-bottom: 1px solid var(--clr-header-border);
    position: relative;
    z-index: 20;
}

    /* Thin green accent along the bottom edge of header */
    .stl-header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, transparent 0%, var(--clr-green) 25%, var(--clr-green) 75%, transparent 100%);
        opacity: 0.4;
    }

/* Logo */
.stl-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
}

.stl-logo-img {
    height: 40px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    transition: opacity 0.18s;
}

.stl-logo-link:hover .stl-logo-img {
    opacity: 0.82;
}

/* Fallback text (if image fails) */
.stl-logo-fallback {
    display: none;
    flex-direction: column;
    line-height: 1.1;
}

.stl-logo-img.errored + .stl-logo-fallback {
    display: flex;
}

.stl-logo-fallback .lf-main {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--clr-green);
    text-transform: uppercase;
}

.stl-logo-fallback .lf-sub {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.20em;
    color: var(--clr-text-muted);
    text-transform: uppercase;
}

/* Logout button */
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: transparent;
    border: 1px solid #CCCCCC;
    border-radius: 5px;
    color: var(--clr-text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    text-decoration: none;
}

    .btn-logout:hover {
        background: var(--clr-green-xlt);
        border-color: var(--clr-green);
        color: var(--clr-green);
    }

    .btn-logout .icon {
        opacity: 0.65;
    }

/* ── MAIN CONTENT AREA ─────────────────────────────────────────── */
.stl-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: var(--clr-shell);
    display: flex;
    flex-direction: column;
    height: 0; /* flex child needs this so overflow works and height is calculable */
}

    .stl-main::-webkit-scrollbar {
        width: 5px;
    }

    .stl-main::-webkit-scrollbar-track {
        background: #F5F5F5;
    }

    .stl-main::-webkit-scrollbar-thumb {
        background: #CCCCCC;
        border-radius: 3px;
    }

        .stl-main::-webkit-scrollbar-thumb:hover {
            background: var(--clr-green);
        }

/* ── FOOTER ────────────────────────────────────────────────────── */
.stl-footer {
    flex-shrink: 0;
    height: var(--footer-h);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-footer-bg);
    border-top: 1px solid var(--clr-footer-border);
    padding: 0 28px;
    overflow: hidden;
}

.footer-strip {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-family: var(--font-body);
    font-size: 11.5px;
    color: var(--clr-text-muted);
    letter-spacing: 0.02em;
}

    .footer-strip .fi {
        padding: 0 14px;
        position: relative;
    }

        .footer-strip .fi + .fi::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 1px;
            height: 11px;
            background: #CCCCCC;
        }

    .footer-strip .fi-copy {
        color: #AAAAAA;
    }

    .footer-strip a {
        color: inherit;
        text-decoration: none;
        transition: color 0.15s;
    }

        .footer-strip a:hover {
            color: var(--clr-green);
        }

/* ── Utility ───────────────────────────────────────────────────── */
.page-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}


/* ================================================================
   LOGIN PAGE — defined globally to avoid Blazor CSS isolation issues
   ================================================================ */

/* Blazor renders @Body inside anonymous wrappers — make them stretch to fill stl-main */
.stl-main > * {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* The full height chain for clients page */
.stl-main .clients-page {
    flex: 1;
    flex-direction: row;
    min-height: 0;
}

.login-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-box {
    width: 320px;
}

.login-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0 0 28px 0;
    line-height: 1.3;
    text-align: center;
}

.login-page .field-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

    .login-page .field-group label {
        font-size: 13px;
        font-weight: 600;
        color: #444444;
        margin-bottom: 5px;
    }

.login-page .field-input {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #D1D5DB;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    color: #1A1A1A;
    background: #FAFAFA;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

    .login-page .field-input:focus {
        border-color: #3A7D1E;
        background: #FFFFFF;
        box-shadow: 0 0 0 3px rgba(58, 125, 30, 0.12);
    }

.login-page .validation-message {
    font-size: 11.5px;
    color: #C0392B;
    margin-top: 4px;
}

.login-error {
    background: #FFF2F2;
    border: 1px solid #FFCDD2;
    border-radius: 7px;
    padding: 9px 13px;
    font-size: 13px;
    color: #C0392B;
    margin-bottom: 16px;
}

.login-btn {
    margin-top: 6px;
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 7px;
    background: #3A7D1E;
    color: #FFFFFF;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

    .login-btn:hover:not(:disabled) {
        background: #2C6015;
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(58, 125, 30, 0.28);
    }

    .login-btn:active:not(:disabled) {
        transform: translateY(0);
    }

    .login-btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

.login-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.30);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ── Header user info + logout ─────────────────────────────────── */
.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-username {
    font-size: 13px;
    font-weight: 500;
    color: var(--clr-text-secondary);
}


/* ================================================================
   CLIENTS PAGE — two-panel layout
   ================================================================ */

.clients-page {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* ── LEFT PANEL ─────────────────────────────────────────────────── */
.clients-left {
    width: 30%;
    min-width: 220px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #E8E8E8;
    background: #FFFFFF;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #F0F0F0;
    flex-shrink: 0;
}

.panel-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #AAAAAA;
}

.client-count {
    font-size: 11px;
    font-weight: 600;
    color: #FFFFFF;
    background: #3A7D1E;
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
}

/* Search */
.clients-search-wrap {
    position: relative;
    padding: 10px 20px;
    border-bottom: 1px solid #F0F0F0;
    flex-shrink: 0;
}

.clients-search {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1A1A1A;
    background: #FFFFFF;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

    .clients-search:focus {
        border-color: #3A7D1E;
        box-shadow: 0 0 0 3px rgba(58, 125, 30, 0.10);
    }

.clients-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #AAAAAA;
    pointer-events: none;
}

/* Scrollable list */
.clients-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

    .clients-list::-webkit-scrollbar {
        width: 4px;
    }

    .clients-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .clients-list::-webkit-scrollbar-thumb {
        background: #DDDDDD;
        border-radius: 2px;
    }

        .clients-list::-webkit-scrollbar-thumb:hover {
            background: #BBBBBB;
        }

/* Individual client row — editorial borderless style */
.client-row {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    cursor: pointer;
    position: relative;
    transition: background 0.14s;
    user-select: none;
}

    /* Hairline separator — every row except the last */
    .client-row::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 20px;
        right: 20px;
        height: 1px;
        background: #F0F0F0;
    }

    .client-row:hover {
        background: #F7FAF6;
    }

.client-row--active {
    background: #F0F7ED;
}

    /* Remove separator on active item — cleaner break */
    .client-row--active::after {
        background: transparent;
    }

.client-name {
    font-size: 13.5px;
    font-weight: 400;
    color: #2A2A2A;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.14s;
}

.client-row:hover .client-name {
    color: #3A7D1E;
}

.client-row--active .client-name {
    font-weight: 600;
    color: #2C6015;
}

/* Loading / empty states */
.list-state {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    font-size: 13px;
    color: #AAAAAA;
}

.list-state--error {
    color: #C0392B;
}

.list-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #DDDDDD;
    border-top-color: #3A7D1E;
    border-radius: 50%;
    animation: list-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes list-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── RIGHT PANEL ────────────────────────────────────────────────── */
.clients-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* children handle their own scroll */
    background: #FFFFFF;
}

/* Empty state — no client selected */
.right-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #CCCCCC;
}

    .right-empty p {
        font-size: 14px;
        color: #BBBBBB;
    }

/* Placeholder while billing panel is being built */
.right-placeholder {
    padding: 32px;
    font-size: 14px;
    color: #888888;
}


/* ================================================================
   LEDGER — right panel
   ================================================================ */

.ledger-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid #F0F0F0;
    flex-shrink: 0;
    gap: 16px;
}

.ledger-client-name {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A1A;
    letter-spacing: 0.01em;
}

.ledger-toolbar {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Toolbar buttons */
.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #444444;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

    .tb-btn:hover {
        background: #F5F5F5;
        border-color: #AAAAAA;
    }

.tb-btn--primary {
    background: #3A7D1E;
    border-color: #3A7D1E;
    color: #FFFFFF;
}

    .tb-btn--primary:hover {
        background: #2C6015;
        border-color: #2C6015;
        color: #FFFFFF;
    }

.tb-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Ledger scroll area */
.ledger-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
}

    .ledger-wrap::-webkit-scrollbar {
        width: 5px;
        height: 5px;
    }

    .ledger-wrap::-webkit-scrollbar-thumb {
        background: #CCCCCC;
        border-radius: 3px;
    }

/* Ledger table */
.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .ledger-table thead tr {
        background: #F8F8F8;
        border-bottom: 2px solid #E8E8E8;
    }

    .ledger-table th {
        padding: 10px 14px;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.10em;
        text-transform: uppercase;
        color: #888888;
        white-space: nowrap;
    }

    .ledger-table td {
        padding: 10px 14px;
        color: #1A1A1A;
        border-bottom: 1px solid #F5F5F5;
        vertical-align: middle;
    }

    .ledger-table tbody tr:hover td {
        background: #FAFAFA;
    }

/* Row type colouring — very subtle left tint */
.row-credit td:first-child {
    border-left: 3px solid #4A90D9;
}

.row-invoice td:first-child {
    border-left: 3px solid #3A7D1E;
}

.row-usage td:first-child {
    border-left: 3px solid #E8A820;
}

/* Column alignment helpers */
.col-right {
    text-align: right;
}

.col-center {
    text-align: center;
}

.col-desc {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Credit notes — blue (positive, reduce balance) */
.amt-credit {
    color: #4A90D9;
}

/* Usage statements — red (negative, charges) */
.amt-debit {
    color: #C0392B;
}

/* Balance column */
.bal-cell {
    font-weight: 600;
    color: #1A1A1A;
}

/* Type badges */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.type-badge--1 {
    background: #EBF3FB;
    color: #4A90D9;
}
/* Credit Note — blue */
.type-badge--2 {
    background: #EBF5E6;
    color: #3A7D1E;
}
/* Invoice — green */
.type-badge--3 {
    background: #FEF6E4;
    color: #C07800;
}
/* Usage — amber */

/* Invoiced badges */
.inv-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.inv-badge--yes {
    background: #EBF5E6;
    color: #3A7D1E;
}

.inv-badge--na {
    color: #CCCCCC;
    background: transparent;
}

/* Mark button styled as badge */
.inv-badge--no {
    background: #FEF6E4;
    color: #C07800;
    border: 1px solid #F0D080;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    padding: 2px 8px;
    transition: background 0.15s;
}

    .inv-badge--no:hover {
        background: #FDECC8;
    }

/* Totals footer */
.ledger-totals td {
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    border-top: 2px solid #E8E8E8;
    color: #1A1A1A;
}

/* ================================================================
   MODAL
   ================================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: #FFFFFF;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.14), 0 24px 60px rgba(0,0,0,0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    /* Green accent bar — matches login card */
    .modal-box::before {
        content: '';
        display: block;
        height: 3px;
        background: linear-gradient(90deg, #3A7D1E, #5DB830, #3A7D1E);
        flex-shrink: 0;
    }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px 12px;
    border-bottom: 1px solid #F0F0F0;
}

.modal-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #1A1A1A;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 14px;
    color: #AAAAAA;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}

    .modal-close:hover {
        background: #F5F5F5;
        border-color: #E0E0E0;
        color: #333333;
    }

.modal-body {
    padding: 18px 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Two fields side by side (year + quarter) */
.modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-top: 1px solid #F0F0F0;
    background: #FAFAFA;
}

/* Modal form fields — slightly smaller than login */
.modal-body .field-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

    .modal-body .field-group label {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.10em;
        text-transform: uppercase;
        color: #666666;
        margin-bottom: 5px;
    }

.modal-body .field-input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1A1A1A;
    background: #FAFAFA;
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
}

    .modal-body .field-input::placeholder {
        color: #BBBBBB;
    }

    .modal-body .field-input:focus {
        border-color: #3A7D1E;
        background: #FFFFFF;
        box-shadow: 0 0 0 3px rgba(58, 125, 30, 0.10);
    }

.field-optional {
    font-size: 10px;
    font-weight: 400;
    color: #AAAAAA;
    text-transform: none;
    letter-spacing: 0;
}

/* select dropdown arrow */
select.field-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}


/* ================================================================
   ROW ACTION BUTTONS
   ================================================================ */

.row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s;
    color: #BBBBBB;
    padding: 0;
    flex-shrink: 0;
}

.act-btn--edit:hover {
    background: #EBF5E6;
    border-color: #B0D8A0;
    color: #3A7D1E;
}

.act-btn--uninvoice:hover {
    background: #FEF6E4;
    border-color: #F0D080;
    color: #C07800;
}

.act-btn--delete:hover {
    background: #FFF2F2;
    border-color: #FFCDD2;
    color: #C0392B;
}

/* ================================================================
   DELETE CONFIRM MODAL — smaller variant
   ================================================================ */

.modal-box--sm {
    max-width: 380px;
}

.modal-box--md {
    max-width: 560px;
}

/* ── Multi-input stack (emails / phones) ── */
.cd-multi-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Chip list for view mode emails/phones ── */
.cd-value--list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid #F0F0F0;
    min-height: 30px;
}

.cd-list-chip {
    display: inline-block;
    background: #F4F4F4;
    border: 1px solid #E4E4E4;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12.5px;
    color: #333333;
}

/* ── Toggle pills for view mode ── */
.cd-toggle-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 10px;
    background: #F0F0F0;
    color: #999999;
    border: 1px solid #E4E4E4;
}

.cd-toggle-pill--on {
    background: #EBF5E6;
    color: #3A7D1E;
    border-color: #C5E0B4;
}

.confirm-text {
    font-size: 13.5px;
    color: #1A1A1A;
    line-height: 1.6;
    margin-bottom: 8px;
}

.confirm-warning {
    font-size: 12px;
    color: #C0392B;
}

.tb-btn--danger {
    background: #C0392B;
    border-color: #C0392B;
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .tb-btn--danger:hover {
        background: #A93226;
        border-color: #A93226;
        color: #FFFFFF;
    }


/* ================================================================
   USAGE PREVIEW — inside Add Usage Statement modal
   ================================================================ */

.modal-box--wide {
    max-width: 820px;
}

.usage-preview {
    margin-top: 4px;
}

/* Loading / no-data states */
.usage-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0 8px;
    font-size: 13px;
    color: #888888;
}

.usage-no-data {
    padding: 14px 0 8px;
    font-size: 13px;
    color: #AAAAAA;
    font-style: italic;
}

/* Grand total banner */
.usage-total-banner {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: #F0F7ED;
    border: 1px solid #C5E0B4;
    border-radius: 7px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.usage-total-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #3A7D1E;
}

.usage-total-amount {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #2C6015;
    letter-spacing: 0.02em;
}

/* Grid wrapper — scrollable if many collars */
.usage-grid-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 340px;
    border: 1px solid #EEEEEE;
    border-radius: 6px;
}

    .usage-grid-wrap::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    .usage-grid-wrap::-webkit-scrollbar-thumb {
        background: #CCCCCC;
        border-radius: 2px;
    }

/* Breakdown table */
.usage-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

    .usage-grid thead tr {
        background: #F8F8F8;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .usage-grid th {
        padding: 7px 10px;
        text-align: left;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.10em;
        text-transform: uppercase;
        color: #888888;
        white-space: nowrap;
        border-bottom: 1px solid #E8E8E8;
    }

    .usage-grid td {
        padding: 6px 10px;
        color: #1A1A1A;
        border-bottom: 1px solid #F5F5F5;
        white-space: nowrap;
    }

    .usage-grid tbody tr:hover td {
        background: #FAFAFA;
    }

.ug-right {
    text-align: right;
}

.ug-collar {
    font-weight: 500;
    color: #2A2A2A;
}

.ug-total {
    font-weight: 600;
    color: #1A1A1A;
}

/* Footer totals row */
.ug-footer td {
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #1A1A1A;
    border-top: 2px solid #E0E0E0;
    background: #F8F8F8;
    white-space: nowrap;
}


/* ── Usage grid — expand/collapse sub-rows ─────────────────────── */

.ug-summary-row {
    cursor: pointer;
}

    .ug-summary-row:hover td {
        background: #F3FAF0;
    }

.ug-expand-icon {
    display: inline-block;
    width: 14px;
    font-size: 10px;
    color: #888888;
    margin-right: 4px;
    user-select: none;
}

/* Monthly sub-rows */
.ug-month-row td {
    background: #FAFCFA;
    border-bottom: 1px solid #F0F0F0;
    padding: 4px 10px;
}

.ug-month-indent {
    padding-left: 28px !important;
}

.ug-month-label {
    font-size: 11px;
    font-weight: 600;
    color: #888888;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ug-month-cost {
    font-size: 11.5px;
    color: #555555;
}

/* Delete button inside monthly sub-row */
.ug-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #CCCCCC;
    padding: 0;
    transition: background 0.14s, border-color 0.14s, color 0.14s;
}

    .ug-del-btn:hover {
        background: #FFF2F2;
        border-color: #FFCDD2;
        color: #C0392B;
    }


/* ================================================================
   INVOICE MODAL TABS
   ================================================================ */

.inv-tabs {
    display: flex;
    border-bottom: 1px solid #E8E8E8;
    background: #FAFAFA;
    padding: 0 22px;
    gap: 0;
}

.inv-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #888888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

    .inv-tab:hover:not(:disabled) {
        color: #3A7D1E;
    }

.inv-tab--active {
    color: #3A7D1E;
    border-bottom-color: #3A7D1E;
    font-weight: 600;
}

.inv-tab:disabled {
    opacity: 0.40;
    cursor: not-allowed;
}


/* ── Invoice summary strip (auto invoice modal) ────────────────── */
.inv-summary-strip {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #F0F7ED;
    border: 1px solid #C5E0B4;
    border-radius: 7px;
    padding: 10px 14px;
    margin-bottom: 12px;
    gap: 16px;
}

.inv-summary-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inv-summary-client {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #2C6015;
    text-transform: uppercase;
}

.inv-summary-ref {
    font-size: 11px;
    font-weight: 600;
    color: rgba(58, 125, 30, 0.60);
    letter-spacing: 0.06em;
}

.inv-summary-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.inv-summary-row {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #555555;
}

    .inv-summary-row span:last-child {
        font-weight: 600;
        min-width: 80px;
        text-align: right;
    }

.inv-summary-total {
    font-size: 13px;
    color: #2C6015;
    font-weight: 700;
    border-top: 1px solid #C5E0B4;
    padding-top: 4px;
    margin-top: 2px;
}

.inv-credit {
    color: #4A90D9;
}


/* ================================================================
   DB ERROR BANNER
   ================================================================ */

.db-error-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF2F2;
    border-bottom: 1px solid #FFCDD2;
    padding: 8px 20px;
    font-size: 13px;
    color: #C0392B;
    flex-shrink: 0;
    z-index: 10;
}

    .db-error-banner svg {
        flex-shrink: 0;
    }

    .db-error-banner span {
        flex: 1;
    }

.db-error-dismiss {
    background: none;
    border: none;
    color: #C0392B;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

    .db-error-dismiss:hover {
        opacity: 1;
    }

/* ================================================================
   STALE LEDGER BANNER
   ================================================================ */

.stale-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FEF6E4;
    border-bottom: 1px solid #F0D080;
    padding: 8px 20px;
    font-size: 13px;
    color: #8A6000;
    flex-shrink: 0;
}

    .stale-banner svg {
        flex-shrink: 0;
        color: #C07800;
    }

    .stale-banner span {
        flex: 1;
    }

.stale-refresh {
    background: #C07800;
    border: none;
    border-radius: 5px;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

    .stale-refresh:hover {
        background: #A06000;
    }

.stale-dismiss {
    background: none;
    border: none;
    color: #C07800;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

    .stale-dismiss:hover {
        opacity: 1;
    }


/* ================================================================
   RIGHT PANEL TABS
   ================================================================ */

.right-tabs {
    display: flex;
    border-bottom: 2px solid #E8E8E8;
    background: #FAFAFA;
    padding: 0 20px;
    gap: 0;
    flex-shrink: 0;
}

.right-tab {
    padding: 10px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888888;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

    .right-tab:hover {
        color: #3A7D1E;
    }

.right-tab--active {
    color: #3A7D1E;
    border-bottom-color: #3A7D1E;
    font-weight: 700;
}

.right-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}


/* ── Tab component roots must fill right-tab-content ──────────── */
.airtime-tab-root {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

    .airtime-tab-root .stale-banner {
        flex-shrink: 0;
    }

    .airtime-tab-root .ledger-header {
        flex-shrink: 0;
    }

    .airtime-tab-root .ledger-wrap {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

/* Placeholder and details tabs also fill the space */
.tab-coming-soon,
.client-details-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
/* ================================================================
   CLIENT DETAILS TAB
   ================================================================ */

.client-details-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.cd-name {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 6px;
}

.cd-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
}

.status-active {
    background: #EBF5E6;
    color: #3A7D1E;
}

.status-suspended {
    background: #FFF2F2;
    color: #C0392B;
}

.cd-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #F0F0F0;
    color: #555555;
    margin-right: 6px;
}

.cd-badge--green {
    background: #EBF5E6;
    color: #3A7D1E;
}

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

.cd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.cd-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cd-field--full {
    grid-column: 1 / -1;
}

.cd-field label {
    font-size: 11px;
    font-weight: 600;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cd-value {
    font-size: 13px;
    color: #1A1A1A;
    padding: 6px 0;
    border-bottom: 1px solid #F0F0F0;
    min-height: 30px;
}

.cd-toggles {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1A1A1A;
    cursor: pointer;
}

    .toggle-label input[type="checkbox"] {
        width: 15px;
        height: 15px;
        accent-color: #3A7D1E;
    }

.cd-confirm-box {
    background: #FFF2F2;
    border: 1px solid #FFCDD2;
    border-radius: 7px;
    padding: 14px;
    font-size: 13px;
    color: #C0392B;
}

.cd-success {
    background: #EBF5E6;
    border: 1px solid #C5E0B4;
    border-radius: 7px;
    padding: 10px 14px;
    font-size: 13px;
    color: #2C6015;
    font-weight: 600;
}

.field-required {
    color: #C0392B;
    font-size: 11px;
}

/* ================================================================
   ADD CLIENT BUTTON IN LEFT PANEL
   ================================================================ */

.add-client-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: calc(100% - 24px);
    margin: 0 12px 8px;
    padding: 7px 12px;
    background: #EBF5E6;
    border: 1px dashed #3A7D1E;
    border-radius: 6px;
    color: #3A7D1E;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .add-client-btn:hover {
        background: #D5EBC8;
    }

.client-suspended-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    background: #FFF2F2;
    color: #C0392B;
    margin-left: auto;
    flex-shrink: 0;
}

/* ================================================================
   COMING SOON / PLACEHOLDER TABS
   ================================================================ */

.tab-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    text-align: center;
    color: #AAAAAA;
}

    .tab-coming-soon h3 {
        font-size: 16px;
        font-weight: 600;
        color: #888888;
        margin: 0;
    }

    .tab-coming-soon p {
        font-size: 13px;
        color: #AAAAAA;
        margin: 0;
        max-width: 320px;
    }

.coming-soon-sub {
    font-size: 11px !important;
    font-style: italic;
}

.tab-empty-add {
    padding: 20px;
}

.tab-empty-hint {
    font-size: 13px;
    color: #888888;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F0F0F0;
}
