:root {
    --telos-ink: #18212f;
    --telos-muted: #687386;
    --telos-surface: #ffffff;
    --telos-canvas: #f4f6f8;
    --telos-border: #e3e7ed;
    --telos-primary: #2563eb;
}

body {
    min-height: 100vh;
    background: var(--telos-canvas);
    color: var(--telos-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    padding: 1.5rem;
    place-items: center;
}

.login-card {
    width: min(100%, 400px);
    border-radius: 20px;
}

.login-card .form-control {
    min-height: 52px;
}

.app-navbar {
    min-height: 68px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--telos-border);
    backdrop-filter: blur(14px);
}

.navbar-brand {
    color: var(--telos-ink);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: var(--telos-ink);
    color: #fff;
}

.user-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--telos-border);
    font-weight: 700;
}

.navbar-latest-file {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    max-width: min(34vw, 360px);
    padding: 0.45rem 0.7rem;
    overflow: hidden;
    border: 1px solid var(--telos-border);
    border-radius: 8px;
    background: #fafbfc;
    white-space: nowrap;
}

.navbar-latest-file-name {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.eyebrow {
    color: var(--telos-primary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.app-panel {
    overflow: hidden;
    border: 1px solid var(--telos-border);
    border-radius: 18px;
    background: var(--telos-surface);
    box-shadow: 0 8px 24px rgba(24, 33, 47, 0.04);
}

.queue-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}

.queue-tabs {
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
}

.queue-tabs .btn {
    white-space: nowrap;
}

.queue-tabs .btn.active[data-queue-filter-value-param="communication"] {
    --bs-btn-color: #fff;
    --bs-btn-bg: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #2563eb;
    --bs-btn-active-border-color: #2563eb;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
}

.queue-tabs .btn.active[data-queue-filter-value-param="accounting"] {
    --bs-btn-color: #713f12;
    --bs-btn-bg: #facc15;
    --bs-btn-border-color: #facc15;
    --bs-btn-active-color: #713f12;
    --bs-btn-active-bg: #facc15;
    --bs-btn-active-border-color: #facc15;
    --bs-btn-hover-color: #713f12;
    --bs-btn-hover-bg: #eab308;
    --bs-btn-hover-border-color: #eab308;
}

.queue-tabs .btn.active[data-queue-filter-value-param="escalation"] {
    --bs-btn-color: #fff;
    --bs-btn-bg: #dc2626;
    --bs-btn-border-color: #dc2626;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #dc2626;
    --bs-btn-active-border-color: #dc2626;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #b91c1c;
    --bs-btn-hover-border-color: #b91c1c;
}

.queue-tabs .btn.active[data-queue-filter-value-param="closed"] {
    --bs-btn-color: #fff;
    --bs-btn-bg: #16a34a;
    --bs-btn-border-color: #16a34a;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #16a34a;
    --bs-btn-active-border-color: #16a34a;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #15803d;
    --bs-btn-hover-border-color: #15803d;
}

.accounting-view [data-case-action-target="communicationButtons"],
.escalation-view [data-case-action-target="communicationButtons"] {
    display: none !important;
}

.accounting-view [data-case-action-target="accountingContact"],
.escalation-view [data-case-action-target="supervisor"] {
    display: none !important;
}

.closed-view [data-case-action-target="communicationSection"] {
    display: none !important;
}

.accounting-view [data-case-action-target="paidForm"] {
    margin-top: 0.5rem !important;
    padding-top: 0 !important;
    border-top: 0 !important;
}

.queue-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    margin-left: 0.15rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.queue-counter-danger {
    color: #dc2626;
}

.queue-tabs .btn.active .queue-counter {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.3rem;
    border-radius: 50%;
    background: #fff;
}

@media (max-width: 767.98px) {
    .queue-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .queue-summary {
        order: 2;
    }

    .queue-summary h2 {
        display: none;
    }

    .queue-tabs {
        order: 1;
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        overflow: visible !important;
    }

    .queue-tabs .btn {
        min-width: 0;
        font-size: 1rem;
        font-weight: 700;
    }

    .app-table {
        min-width: 960px;
    }
}

.app-table thead th {
    padding: 0.9rem 1rem;
    border-bottom-color: var(--telos-border);
    background: #fafbfc;
    color: var(--telos-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.app-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom-color: var(--telos-border);
    line-height: 1.2;
}

.app-table tbody tr:last-child td {
    border-bottom: 0;
}

.branch-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.branch-badge {
    background: #eef1f5;
    color: #4b5565;
}

.status-call {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-message {
    background: #dbeafe;
    color: #1d4ed8;
}

.communication-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    color: #2563eb;
}

.communication-icons svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.communication-icons svg.is-pending {
    display: none;
}

.communication-icons svg.is-done {
    opacity: 1;
}

.communication-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.communication-prompt {
    display: none;
    align-items: center;
    gap: 0.08rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    color: #dc2626;
}

.communication-prompt svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.communication-prompt-message svg:not(:first-child) {
    display: none;
}

.communication-icon {
    display: inline-block;
    margin-left: 0.35rem;
    color: #2563eb;
    font-size: 1.25rem;
    line-height: 1;
    vertical-align: middle;
}

.communication-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.contact-days-left {
    display: inline-block;
    margin-left: 0.35rem;
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 600;
    vertical-align: middle;
}

.contact-days-left.is-due {
    color: #dc2626;
}

.accounting-contact-marker {
    display: inline-grid;
    width: 1.45rem;
    height: 1.45rem;
    margin-left: 0.35rem;
    place-items: center;
    border-radius: 50%;
    background: #facc15;
    color: #713f12;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.history-note {
    display: inline-block;
    margin-left: 0.35rem;
    white-space: nowrap;
    vertical-align: middle;
}

[data-status="accounting"] .communication-icon,
[data-status="escalation"] .communication-icon,
[data-status="message_sent"] .communication-icon,
[data-status="closed"] .communication-icon {
    color: #cbd5e1;
}

.action-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.accounting-column {
    display: none;
}

.accounting-view .accounting-column {
    display: table-cell;
}

.needs-communication td {
    background: #fff1f2;
}

.needs-communication td:first-child {
    border-left: 4px solid #dc2626;
}

.due-date-reached {
    color: #dc2626 !important;
    font-weight: 700;
}

.non-communication-view .due-date-reached {
    color: inherit !important;
    font-weight: inherit;
}

.mobile-case-card.needs-communication {
    border: 2px solid #dc2626;
    background: #fff1f2;
}

button[name="action"][value="message"],
button[name="action"][value="phone"] {
    --bs-btn-color: #fff;
    --bs-btn-bg: #4f6bed;
    --bs-btn-border-color: #4f6bed;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #4058c9;
    --bs-btn-hover-border-color: #4058c9;
}

.status-message-sent {
    background: #dcfce7;
    color: #166534;
}

.status-accounting {
    background: #fef3c7;
    color: #92400e;
}

.status-escalation {
    background: #fee2e2;
    color: #b91c1c;
}

.manual-accounting-pin {
    width: 0.85rem;
    height: 0.85rem;
    margin-right: 0.3rem;
    vertical-align: -0.08em;
    fill: #d82800;
}

.status-closed {
    background: #dcfce7;
    color: #166534;
}

.closed-count {
    display: inline-flex;
    min-width: 1.35rem;
    justify-content: center;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.7rem;
}

.mobile-case-card {
    padding: 1rem 0;
    border-bottom: 1px solid var(--telos-border);
}

.mobile-case-card:first-child {
    padding-top: 0;
}

.mobile-case-card:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.offcanvas {
    --bs-offcanvas-width: min(460px, 100vw);
}

.import-icon {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: #e8efff;
    color: var(--telos-primary);
    font-size: 1.35rem;
    font-weight: 700;
}

.import-steps {
    display: grid;
    gap: 1rem;
    padding-left: 1.25rem;
}

.import-steps li {
    padding-left: 0.35rem;
}

.import-steps strong,
.import-steps span {
    display: block;
}

.import-steps span {
    margin-top: 0.2rem;
    color: var(--telos-muted);
    font-size: 0.86rem;
}

@media (max-width: 575.98px) {
    .app-navbar {
        background: #fff;
        backdrop-filter: none;
    }

    #casePanel .action-icon {
        width: 18px !important;
        height: 18px !important;
        flex: 0 0 18px;
    }

    .app-table tbody td:nth-child(6) {
        white-space: nowrap;
    }

    .app-table .communication-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        margin-left: 0.2rem;
        font-size: 1rem !important;
        line-height: 1;
        vertical-align: middle;
    }

    .app-table .communication-icon svg {
        width: 20px !important;
        min-width: 20px;
        max-width: 20px;
        height: 20px !important;
        min-height: 20px;
        max-height: 20px;
        flex: 0 0 20px;
    }
}
