/* Shipment Exception Desk UI styled to match InterviewIQ visual language */
:root {
    --bg: #121212;
    --bg-elevated: #1e1e1e;
    --bg-elevated-2: #2a2a2a;
    --bg-soft: #0f172a;
    --border: #2c2c2c;
    --text: #e0e0e0;
    --text-muted: #9e9e9e;
    --text-faint: #757575;
    --primary: #1565c0;
    --primary-hover: #1976d2;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #ef9a9a;
    --accent: #90caf9;
    --focus: rgba(144, 202, 249, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    width: 90%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
    opacity: 0.85;
}

.logo {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.project-shell {
    padding: 0.5rem 0 1.5rem;
}

.app-header {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(144, 202, 249, 0.12);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent);
}

.brand-tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    background: rgba(76, 175, 80, 0.12);
    color: #a5d6a7;
    border: 1px solid rgba(76, 175, 80, 0.25);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.grid-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: rgba(144, 202, 249, 0.3);
}

.table-card {
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-neutral {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.preset-section {
    margin-bottom: 1rem;
}

.section-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.45rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: #d4d4d4;
}

.required {
    color: #fca5a5;
}

textarea,
input[type="number"] {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.9rem;
    outline: none;
}

textarea:focus,
input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-prefix-wrapper {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-prefix-wrapper input {
    padding-left: 26px;
}

.tier-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.tier-option {
    flex: 1;
}

.tier-option input {
    display: none;
}

.tier-label {
    display: block;
    text-align: center;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.tier-option input:checked+.tier-label {
    background: var(--primary);
    color: #fff;
}

.btn {
    padding: 9px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg-elevated-2);
}

.btn-secondary {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg-elevated-2);
    color: var(--text);
    border-color: rgba(144, 202, 249, 0.3);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.22);
}

.btn-preset {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.76rem;
    padding: 7px 10px;
}

.btn-preset:hover {
    background: var(--bg-elevated-2);
    color: var(--text);
    border-color: rgba(144, 202, 249, 0.3);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

.hidden {
    display: none !important;
}

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

.status-banner {
    display: flex;
    gap: 12px;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
}

.banner-idle {
    border-color: var(--border);
    color: var(--text-muted);
}

.banner-resolved {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.32);
    color: #d1fae5;
}

.banner-escalated {
    background: rgba(244, 63, 94, 0.14);
    border-color: rgba(244, 63, 94, 0.32);
    color: #ffe4e6;
}

.banner-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.banner-content h3 {
    font-size: 0.92rem;
    margin-bottom: 3px;
}

.banner-content p {
    font-size: 0.82rem;
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.metric-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    padding: 10px;
}

.metric-title {
    color: var(--text-muted);
    font-size: 0.74rem;
    display: block;
    margin-bottom: 2px;
}

.metric-val {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
}

.step-list {
    list-style: none;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    max-height: 160px;
    overflow-y: auto;
}

.step-list li {
    font-size: 0.81rem;
    color: #dbe2ee;
    border-bottom: 1px dashed rgba(158, 158, 158, 0.2);
    padding: 6px 0;
}

.step-list li:last-child {
    border-bottom: none;
}

.step-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.draft-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.draft-box {
    background: #0c111f;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    white-space: pre-wrap;
    max-height: 220px;
    overflow-y: auto;
    color: #d8e0ef;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
}

.tab-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 8px 10px;
    border-bottom: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

th,
td {
    text-align: left;
    padding: 10px 12px;
}

thead {
    background: #141b2d;
    border-bottom: 1px solid var(--border);
}

th {
    color: #b6c0d0;
    font-weight: 600;
}

tbody tr {
    border-bottom: 1px solid rgba(158, 158, 158, 0.16);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(42, 42, 42, 0.5);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    padding: 24px !important;
}

.summary-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.kpi-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.kpi-highlight {
    border-color: rgba(144, 202, 249, 0.35);
}

.kpi-label {
    display: block;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--text);
}

.kpi-subtext {
    display: block;
    margin-top: 3px;
    color: var(--text-faint);
    font-size: 0.74rem;
}

.category-breakdown-section h3 {
    margin-bottom: 8px;
    font-size: 0.98rem;
    font-weight: 700;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

footer {
    border-top: 1px solid var(--border);
    padding: 0.9rem 0;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.82rem;
}

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

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .summary-kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: 100%;
        padding: 0 0.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .metrics-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    .tab-actions {
        width: 100%;
    }

    .tab-actions .btn {
        flex: 1;
    }
}