.billed-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-dot--yes {
    background-color: var(--app-success);
}

.status-dot--no {
    background-color: #bfbfbf;
}

.billed-header {
    text-align: center;
}

.current-status-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 1rem 1.25rem;
    align-items: start;
}

.current-status-work {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.current-status-title {
    color: var(--app-ink);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.current-status-meta {
    color: var(--app-ink-soft);
    font-size: 0.9rem;
    line-height: 1.45;
}

.current-status-meta--spaced {
    margin-top: 0.2rem;
}

.current-status-value {
    color: var(--app-ink);
    font-weight: 700;
}

.current-status-billability {
    display: inline-block;
    color: var(--app-ink-soft);
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 0.25rem;
    white-space: nowrap;
}

.current-status-summary-panel {
    width: 100%;
    max-width: 360px;
    justify-self: end;
    border: 1px solid var(--app-border);
    border-radius: 0.95rem;
    background: rgba(245, 248, 251, 0.92);
    padding: 0.85rem 0.95rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.current-status-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: baseline;
}

.current-status-summary-row + .current-status-summary-row {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.current-status-summary-row--stacked {
    gap: 0.75rem;
    align-items: start;
}

.current-status-summary-row--nextdue {
    display: block;
}

.current-status-summary-label {
    color: var(--app-ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.35;
    white-space: nowrap;
    text-transform: uppercase;
}

.current-status-summary-value {
    color: var(--app-ink);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: right;
}

.current-status-summary-value--hours {
    font-size: 1.1rem;
}

.current-status-summary-value--stacked {
    text-align: left;
    font-weight: 600;
    min-width: 0;
    display: grid;
    gap: 0.45rem;
    justify-items: stretch;
}

.current-status-summary-stacked-header {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.current-status-summary-stacked-header-value {
    text-align: right;
    white-space: nowrap;
}

.current-status-summary-nextdue-list {
    display: grid;
    gap: 0.65rem;
}

.current-status-summary-nextdue {
    display: grid;
    gap: 0.34rem;
    min-width: 0;
}

.current-status-summary-nextdue + .current-status-summary-nextdue {
    padding-top: 0.55rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.current-status-summary-nextdue-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.current-status-summary-nextdue-header .current-status-summary-label {
    white-space: nowrap;
    flex: 0 0 auto;
}

.current-status-summary-nextdue-header .current-status-summary-value {
    text-align: right;
    white-space: nowrap;
    flex: 0 0 auto;
}

.current-status-summary-nextdue-detail {
    display: grid;
    gap: 0.14rem;
    min-width: 0;
    text-align: left;
    justify-items: start;
}

.current-status-summary-nextdue-detail-line {
    color: var(--app-ink-soft);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: left;
}

.current-status-summary-note {
    color: var(--app-ink-soft);
    font-size: 0.85rem;
    line-height: 1.35;
}

.current-status-summary-note + .current-status-summary-note {
    margin-top: 0.35rem;
}

.current-status-summary-detail {
    display: grid;
    gap: 0.14rem;
    min-width: 0;
    width: 100%;
    text-align: left;
}

.current-status-summary-detail + .current-status-summary-detail {
    padding-top: 0.45rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.current-status-summary-detail-main {
    color: var(--app-ink);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-align: left;
}

.current-status-summary-detail-meta {
    color: var(--app-ink-soft);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: left;
}

.billing-project-single-panel {
    display: grid;
    gap: 0.3rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--app-border);
    border-radius: 0.95rem;
    background: rgba(245, 248, 251, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.billing-project-single-panel__value {
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.billing-project-single-panel__note {
    color: var(--app-ink-soft);
    font-size: 0.88rem;
    line-height: 1.4;
}

.topbar__theme {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.5rem;
}

.topbar__theme-label {
    margin: 0;
    color: var(--app-ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar__theme-select {
    min-width: 96px;
    border-radius: 999px;
}

body.theme-dark {
    --app-ink: #e7edf2;
    --app-ink-soft: #b4c0cc;
    --app-bg: #0f161d;
    --app-panel: #1a232d;
    --app-accent: #85adad;
    --app-accent-dark: #669999;
    --app-border: #34404d;
    --app-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    --app-success: #79c68f;
    --app-danger: #EA1414;
}

body.app-body.theme-dark {
    color: var(--app-ink);
    background:
        radial-gradient(circle at top right, rgba(102, 153, 153, 0.16), transparent 32%),
        linear-gradient(180deg, #121a23 0%, var(--app-bg) 100%);
}

body.theme-dark .topbar {
    background: rgba(19, 27, 36, 0.92);
    border-bottom-color: rgba(52, 64, 77, 0.9);
}

html.theme-dark .app-topbar {
    background: rgba(19, 27, 36, 0.92);
    border-color: rgba(52, 64, 77, 0.9);
}

body.theme-dark .topbar__brand,
body.theme-dark .topbar__brand:hover,
body.theme-dark .topbar__dropdown-toggle,
body.theme-dark .topbar__nav a {
    color: var(--app-ink);
}

body.theme-dark .topbar__theme-label,
body.theme-dark .topbar-status-text,
body.theme-dark .topbar__nav a:not(:hover):not(:focus),
body.theme-dark .topbar__dropdown-toggle:not(:hover):not(:focus) {
    color: var(--app-ink-soft);
}

body.theme-dark .topbar__toggle {
    border-color: rgba(231, 237, 242, 0.28);
}

body.theme-dark .topbar__toggle .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28231, 237, 242, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body.theme-dark .topbar__dropdown-menu {
    background-color: #1c2631;
    border-color: var(--app-border);
}

body.theme-dark .topbar__dropdown-menu .dropdown-item {
    color: var(--app-ink);
}

body.theme-dark .topbar__dropdown-menu .dropdown-item:hover,
body.theme-dark .topbar__dropdown-menu .dropdown-item:focus {
    background: rgba(133, 173, 173, 0.18);
}

body.theme-dark .topbar__theme-select,
body.theme-dark .form-select,
body.theme-dark .form-control {
    color: var(--app-ink);
    background-color: #1f2a35;
    border-color: var(--app-border);
}

body.theme-dark .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23c6d2de' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    color: var(--app-ink);
    background-color: #1f2a35;
    border-color: #669999;
    box-shadow: 0 0 0 0.2rem rgba(102, 153, 153, 0.2);
}

body.theme-dark .form-control[type="date"]::-webkit-calendar-picker-indicator,
body.theme-dark .form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.theme-dark .form-control[type="time"]::-webkit-calendar-picker-indicator,
body.theme-dark input[type="date"]::-webkit-calendar-picker-indicator,
body.theme-dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.theme-dark input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.4) !important;
    opacity: 0.9;
}

body.theme-dark .form-control[type="date"]::-webkit-calendar-picker-indicator:hover,
body.theme-dark .form-control[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
body.theme-dark .form-control[type="time"]::-webkit-calendar-picker-indicator:hover,
body.theme-dark input[type="date"]::-webkit-calendar-picker-indicator:hover,
body.theme-dark input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
body.theme-dark input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

body.theme-dark .billing-project-advanced-panel,
body.theme-dark .commission-payout-summary-box {
    background: rgba(20, 29, 38, 0.94);
    border-color: var(--app-border);
    color: var(--app-ink);
}

.billing-project-advanced-panel,
.commission-payout-summary-box {
    background: rgba(245, 248, 251, 0.95);
    border-color: var(--app-border);
}

body.theme-dark .hero-card,
body.theme-dark .panel,
body.theme-dark .status-panel,
html.theme-dark .app-card,
body.theme-dark .card,
body.theme-dark .modal-content,
body.theme-dark .crm-timeline__item {
    background: rgba(26, 35, 45, 0.96);
    border-color: var(--app-border);
    color: var(--app-ink);
}

body.theme-dark .bill-selection-summary {
    background: rgba(20, 29, 38, 0.94);
    border-color: var(--app-border);
}

body.theme-dark .bill-selection-summary__item {
    background: rgba(255, 255, 255, 0.045);
}

html.theme-dark .app-shell {
    color: var(--app-ink);
}

body.theme-dark .table {
    --bs-table-bg: #1a232d;
    --bs-table-striped-bg: #202b36;
    --bs-table-hover-bg: #25313d;
    --bs-table-color: var(--app-ink);
    --bs-table-border-color: var(--app-border);
}

body.theme-dark .table td,
body.theme-dark .table th,
body.theme-dark .table > :not(caption) > * > * {
    color: var(--app-ink);
    border-color: var(--app-border);
}

body.theme-dark .table a {
    color: #9fc4df;
    text-decoration-color: rgba(159, 196, 223, 0.7);
}

body.theme-dark .table a:hover,
body.theme-dark .table a:focus {
    color: #bdd9ee;
}

body.theme-dark .badge,
body.theme-dark .badge-pill,
body.theme-dark .rounded-pill {
    color: #eef4fa;
}

body.theme-dark .badge.text-bg-primary {
    background-color: #254f88 !important;
    color: #f2f7fd !important;
}

body.theme-dark .badge.text-bg-secondary {
    background-color: #415363 !important;
    color: #eef4fa !important;
}

body.theme-dark .badge.text-bg-info {
    background-color: #2d6e87 !important;
    color: #eef4fa !important;
}

body.theme-dark .badge.text-bg-success {
    background-color: #2c6a45 !important;
    color: #f1faee !important;
}

body.theme-dark .badge.text-bg-warning {
    background-color: #8b6a1f !important;
    color: #fff9e8 !important;
}

body.theme-dark .badge.text-bg-danger {
    background-color: #8f3a42 !important;
    color: #fff1f1 !important;
}

body.theme-dark .badge.text-bg-light {
    background-color: #3e4a56 !important;
    color: #f2f6fb !important;
}

body.theme-dark .badge.text-bg-dark {
    background-color: #111922 !important;
    color: #eaf2f9 !important;
}

body.theme-dark .primary-metric-column {
    background-color: #22303d;
}

body.theme-dark .primary-metric-value {
    background-color: #2e4154;
    color: #edf5fd;
    border: 1px solid #3c5369;
}

body.theme-dark .list-group-item {
    color: var(--app-ink);
    background-color: #1a232d;
    border-color: var(--app-border);
}

body.theme-dark .alert {
    color: #eef5fb;
    background-color: rgba(52, 67, 82, 0.42);
    border-color: #4f6478;
}

body.theme-dark .alert a,
body.theme-dark .alert .alert-link {
    color: #d4e9ff;
    text-decoration-color: rgba(212, 233, 255, 0.8);
}

body.theme-dark .alert a:hover,
body.theme-dark .alert a:focus,
body.theme-dark .alert .alert-link:hover,
body.theme-dark .alert .alert-link:focus {
    color: #eef6ff;
    text-decoration-color: rgba(238, 246, 255, 0.95);
}

body.theme-dark .alert-success {
    color: #dff6e7;
    background-color: rgba(31, 79, 52, 0.5);
    border-color: #4d9b6e;
}

body.theme-dark .alert-light {
    color: #eff5fb;
    background-color: rgba(57, 72, 86, 0.52);
    border-color: #75889c;
}

body.theme-dark .alert-info {
    color: #dff0fb;
    background-color: rgba(33, 77, 101, 0.5);
    border-color: #4e95b7;
}

body.theme-dark .alert-warning {
    color: #fff1cf;
    background-color: rgba(107, 83, 26, 0.52);
    border-color: #c49a36;
}

body.theme-dark .alert-danger {
    color: #ffe3e6;
    background-color: rgba(112, 38, 47, 0.52);
    border-color: #d36d79;
}

body.theme-dark .alert-primary {
    color: #e2ecff;
    background-color: rgba(32, 69, 121, 0.52);
    border-color: #5e89c6;
}

body.theme-dark .alert-secondary {
    color: #e8edf2;
    background-color: rgba(67, 82, 97, 0.52);
    border-color: #8798aa;
}

body.theme-dark .alert-dark {
    color: #eef5fb;
    background-color: rgba(20, 29, 39, 0.82);
    border-color: #5a6b7c;
}

body.theme-dark .invalid-feedback,
body.theme-dark .valid-feedback,
body.theme-dark .invalid-tooltip,
body.theme-dark .valid-tooltip {
    font-weight: 500;
}

body.theme-dark .invalid-feedback,
body.theme-dark .invalid-tooltip {
    color: #ffb8bf;
}

body.theme-dark .valid-feedback,
body.theme-dark .valid-tooltip {
    color: #a8e7c0;
}

body.theme-dark .is-invalid,
body.theme-dark .was-validated .form-control:invalid,
body.theme-dark .was-validated .form-select:invalid {
    border-color: #d36d79;
}

body.theme-dark .is-valid,
body.theme-dark .was-validated .form-control:valid,
body.theme-dark .was-validated .form-select:valid {
    border-color: #4d9b6e;
}

body.theme-dark [class*="banner"],
body.theme-dark [class*="notice"],
body.theme-dark [class*="notification"] {
    color: #eef5fb;
}

body.theme-dark .btn-primary {
    background-color: var(--app-accent);
    border-color: var(--app-accent);
    color: #0f161d;
}

body.theme-dark .btn-primary:hover,
body.theme-dark .btn-primary:focus {
    background-color: var(--app-accent-dark);
    border-color: var(--app-accent-dark);
    color: #0f161d;
}

body.theme-dark .btn:not(.btn-primary) {
    color: #eaf2f9;
}

body.theme-dark .btn-outline-secondary {
    color: #d5e1ec;
    border-color: #4c5c6b;
}

body.theme-dark .btn-outline-secondary:hover,
body.theme-dark .btn-outline-secondary:focus {
    color: var(--app-ink);
    border-color: #669999;
    background-color: rgba(102, 153, 153, 0.2);
}

body.theme-dark .current-status-layout {
    color: var(--app-ink);
}

body.theme-dark .current-status-summary-panel {
    background: rgba(20, 29, 38, 0.94);
    border-color: var(--app-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .current-status-summary-row + .current-status-summary-row {
    border-top-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .current-status-title,
body.theme-dark .current-status-summary-value,
body.theme-dark .current-status-summary-detail-main {
    color: var(--app-ink);
}

body.theme-dark .current-status-meta,
body.theme-dark .current-status-billability,
body.theme-dark .current-status-summary-label,
body.theme-dark .current-status-summary-note,
body.theme-dark .current-status-summary-detail-meta {
    color: var(--app-ink-soft);
}

body.theme-dark .current-status-summary-detail + .current-status-summary-detail {
    border-top-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .current-status-summary-stacked-header-value {
    color: var(--app-ink);
}

body.theme-dark .current-status-summary-nextdue + .current-status-summary-nextdue {
    border-top-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .current-status-summary-nextdue-detail-line {
    color: var(--app-ink-soft);
}

body.theme-dark .billing-project-single-panel {
    background: rgba(20, 29, 38, 0.94);
    border-color: var(--app-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .billing-project-single-panel__value {
    color: var(--app-ink);
}

body.theme-dark .billing-project-single-panel__note {
    color: var(--app-ink-soft);
}

body.theme-dark .status-dot--no {
    background-color: #6d7884;
}

body.theme-dark .website-monitor-row-down td {
    background-color: rgba(234, 20, 20, 0.2);
}

body.theme-dark .billing-row-reversed td {
    background-color: #1a232d;
    color: #90a1b3;
}

body.theme-dark .billing-row-reversed a {
    color: #9ecfef;
}

body.theme-dark .executive-bars__track {
    background: #2b3948;
}

body.theme-dark .crm-meta--warning {
    color: #f0b46d;
}

body.theme-dark .crm-meta--overdue {
    color: #ff8f8f;
}

body.theme-dark .table-light,
body.theme-dark .table-light > th,
body.theme-dark .table-light > td,
body.theme-dark tr.table-light > th,
body.theme-dark tr.table-light > td {
    color: #e7eff7 !important;
    background-color: #2b3a48 !important;
}

body.theme-dark .bg-light {
    background-color: #2a3744 !important;
    color: var(--app-ink);
}

body.theme-dark .text-light {
    color: #e7eff7 !important;
}

body.theme-dark .text-muted,
body.theme-dark .text-secondary {
    color: #b7c5d3 !important;
}

@media (max-width: 991.98px) {
    .current-status-layout {
        grid-template-columns: 1fr;
    }

    .current-status-summary-panel {
        max-width: none;
        justify-self: stretch;
    }
}

body.theme-dark .border {
    border-color: #425364 !important;
}

body.theme-dark .table .form-control,
body.theme-dark .table .form-select,
body.theme-dark .table .form-check-input {
    background-color: #22303b;
    border-color: #4a5b6b;
    color: var(--app-ink);
}

body.theme-dark .table .form-control:disabled,
body.theme-dark .table .form-select:disabled {
    background-color: #1c2731;
    color: #c2d0dc;
    opacity: 1;
}

body.theme-dark .table .form-check-input {
    box-shadow: none;
}

body.theme-dark .table .form-check-input:checked {
    background-color: #6fa8c5;
    border-color: #6fa8c5;
}

/* Customer-description review: keep long internal text and row actions usable. */
.customer-description-review-table table { min-width: 1040px; }
.customer-description-review-table th, .customer-description-review-table td { vertical-align: top; }
.customer-description-review-table th:nth-child(1) { min-width: 112px; }
.customer-description-review-table th:nth-child(4), .customer-description-review__internal { min-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.customer-description-review-table th:nth-child(5) { min-width: 310px; }
.customer-description-review__editor { min-width: 310px; }
.customer-description-review__editor textarea { min-height: 5.5rem; resize: vertical; }
.customer-description-ai-panel textarea { max-width: 920px; }

/* Public transactional SMS consent: keep required proof-of-opt-in content together. */
.sms-opt-in { max-width: 960px; }
.sms-opt-in__header { max-width: 860px; margin-left: auto; margin-right: auto; }
.sms-opt-in__panel { padding: clamp(1.25rem, 3vw, 2.25rem); }
.sms-opt-in__consent { padding: 1rem 1.1rem; border: 1px solid #b9c8d5; border-radius: .65rem; background: #f5f9fc; }
.sms-opt-in__consent .form-check-input { margin-top: .3rem; }
.sms-opt-in__consent p { line-height: 1.55; }

body.theme-dark .sms-opt-in__consent {
    border-color: #4a5b6b;
    background: #22303b;
}

@media (max-width: 991.98px) {
    .customer-description-review-table table { min-width: 920px; }
    .customer-description-review-table th:nth-child(4), .customer-description-review__internal { min-width: 180px; }
    .customer-description-review-table th:nth-child(5), .customer-description-review__editor { min-width: 260px; }

    .sms-opt-in__panel { padding: 1.1rem; }
}
