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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.app-header {
    background: #1a1a2e;
    color: #fff;
    padding: 1rem 0;
}

.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.header-logout {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
}

.header-logout:hover {
    color: #fff;
}

/* Login */
.login-body {
    justify-content: center;
    align-items: center;
    background: #1a1a2e;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.login-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1a2e;
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.btn-login {
    width: 100%;
    padding: 0.7rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-login:hover {
    background: #2a2a4e;
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #ffeaea;
    color: #c00;
    border: 1px solid #fcc;
}

/* Stats Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.stat-green { color: #16a34a; }
.stat-red { color: #dc2626; }
.stat-gray { color: #9ca3af; }

.stat-unit {
    font-size: 1.2rem;
    font-weight: 600;
    margin-left: 0.1rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.filter-presets {
    display: flex;
    gap: 0.5rem;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-form label {
    font-size: 0.85rem;
    color: #666;
}

.filter-form input[type="date"] {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn:hover {
    background: #f0f0f0;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

.btn-active:hover {
    background: #2a2a4e;
}

/* Call Table */
.call-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    border-collapse: collapse;
    overflow: hidden;
}

.call-table th,
.call-table td {
    padding: 0.75rem 1rem;
    text-align: left;
}

.call-table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
    border-bottom: 2px solid #eee;
}

.call-table td {
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.call-table tbody tr:hover {
    background: #fafafe;
}

.empty {
    text-align: center;
    color: #999;
    padding: 2rem !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-failure {
    background: #fee2e2;
    color: #991b1b;
}

.badge-unknown {
    background: #f3f4f6;
    color: #6b7280;
}

/* Call Detail Page */
.back-link {
    display: inline-block;
    margin: 1.5rem 0 1rem;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    color: #333;
}

.call-meta {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.call-meta h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.meta-label {
    display: block;
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    display: block;
    font-size: 0.95rem;
    margin-top: 0.2rem;
}

.mono {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

/* Sections */
.section {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #444;
}

.summary-text {
    color: #555;
    line-height: 1.6;
}

/* Criteria */
.criteria-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.criterion {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.criterion-result {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.criterion-success { background: #dcfce7; color: #166534; }
.criterion-failure { background: #fee2e2; color: #991b1b; }
.criterion-unknown { background: #f3f4f6; color: #6b7280; }

.criterion-name {
    font-weight: 600;
}

.criterion-rationale {
    color: #666;
}

/* Audio Player */
.audio-player {
    width: 100%;
    margin-top: 0.5rem;
}

/* Transcript */
.transcript-box {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.transcript-turn {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.transcript-turn:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.transcript-role {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.role-agent {
    background: #dbeafe;
    color: #1e40af;
}

.role-user {
    background: #f3e8ff;
    color: #6b21a8;
}

.transcript-time {
    font-size: 0.75rem;
    color: #999;
    margin-left: 0.5rem;
}

.transcript-message {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
}

.summary-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 640px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-form {
        flex-wrap: wrap;
    }

    .call-table th:nth-child(2),
    .call-table td:nth-child(2) {
        display: none;
    }

    .meta-grid {
        grid-template-columns: 1fr 1fr;
    }
}
