:root {
    --pam-teal: #0093B0;
    --pam-teal-dark: #007a93;
    --pam-charcoal: #3C484F;
    --pam-gold: #D4A843;
    --pam-steel: #657375;
    --pam-light: #F2F2F2;
    --pam-red: #D45B5B;
    --pam-white: #FFFFFF;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--pam-light);
    color: var(--pam-charcoal);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--pam-charcoal);
    padding: 1rem 2rem;
    border-bottom: 4px solid var(--pam-teal);
}

.header h1 {
    color: var(--pam-white);
    font-size: 1.4rem;
    font-weight: 600;
}

.header span {
    color: var(--pam-teal);
    font-weight: 400;
    margin-left: 0.5rem;
}

/* Main */
.main {
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--pam-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 2rem;
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--pam-charcoal);
}

.card p.subtitle {
    color: var(--pam-steel);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--pam-steel);
    border-radius: 8px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--pam-teal);
    background: rgba(0, 147, 176, 0.04);
}

.drop-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--pam-steel);
}

.drop-zone p {
    color: var(--pam-steel);
    font-size: 0.95rem;
}

.drop-zone .browse {
    color: var(--pam-teal);
    text-decoration: underline;
    cursor: pointer;
}

/* File info */
.file-info {
    display: none;
    background: var(--pam-light);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--pam-charcoal);
}

.file-info.visible { display: flex; align-items: center; gap: 0.75rem; }
.file-info .name { font-weight: 600; flex: 1; }
.file-info .size { color: var(--pam-steel); }
.file-info .remove {
    color: var(--pam-red);
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: var(--pam-teal);
    color: var(--pam-white);
}

.btn-primary:hover:not(:disabled) { background: var(--pam-teal-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: var(--pam-light);
    color: var(--pam-charcoal);
    border: 1px solid #ccc;
    margin-top: 0.75rem;
}

.btn-secondary:hover { background: #e8e8e8; }

.btn-download {
    background: var(--pam-teal);
    color: var(--pam-white);
}

.btn-download:hover { background: var(--pam-teal-dark); }

/* Progress */
.progress-section {
    display: none;
    text-align: center;
    padding: 1rem 0;
}

.progress-section.visible { display: block; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--pam-light);
    border-top-color: var(--pam-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.progress-timer {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.progress-timer .elapsed {
    font-weight: 600;
    color: var(--pam-charcoal);
    font-variant-numeric: tabular-nums;
}

.progress-timer .estimate {
    color: var(--pam-steel);
}

/* Result */
.result-section {
    display: none;
    text-align: center;
    padding: 1rem 0;
}

.result-section.visible { display: block; }

.result-section .check {
    font-size: 3rem;
    color: var(--pam-teal);
    margin-bottom: 0.5rem;
}

.result-section .patient-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-section .stats {
    font-size: 0.8rem;
    color: var(--pam-steel);
    margin-bottom: 1rem;
}

/* Error */
.error-section {
    display: none;
    background: #fff0f0;
    border: 1px solid var(--pam-red);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    color: var(--pam-red);
    font-size: 0.9rem;
}

.error-section.visible { display: block; }

/* Header nav */
.header-nav {
    float: right;
    margin-top: -1.5rem;
}

.header-nav a {
    color: var(--pam-steel);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
}

.header-nav a.active,
.header-nav a:hover {
    color: var(--pam-white);
    border-bottom: 2px solid var(--pam-teal);
    padding-bottom: 2px;
}

/* Dashboard */
.dashboard-main {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--pam-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.25rem;
    text-align: center;
    border-top: 3px solid var(--pam-teal);
}

.kpi-card.accent-gold { border-top-color: var(--pam-gold); }
.kpi-card.accent-green { border-top-color: #4CAF50; }
.kpi-card.accent-red { border-top-color: var(--pam-red); }

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--pam-charcoal);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--pam-steel);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--pam-steel);
    margin-top: 0.15rem;
}

.dashboard-card {
    margin-bottom: 1.5rem;
}

.dashboard-card h2 {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pam-light);
}

/* Vertical bar chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding: 0 0.5rem;
    border-bottom: 1px solid #ddd;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.bar {
    width: 100%;
    max-width: 24px;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
}

.bar-completed { background: var(--pam-teal); }
.bar-failed { background: var(--pam-red); }

.bar-label {
    font-size: 0.6rem;
    color: var(--pam-steel);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--pam-steel);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-dot.completed { background: var(--pam-teal); }
.legend-dot.failed { background: var(--pam-red); }

/* Horizontal bar chart */
.h-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.h-bar-label {
    width: 200px;
    font-size: 0.85rem;
    text-align: right;
    color: var(--pam-charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-bar-track {
    flex: 1;
    background: var(--pam-light);
    border-radius: 3px;
    height: 18px;
}

.h-bar-fill {
    background: var(--pam-teal);
    height: 100%;
    border-radius: 3px;
    min-width: 4px;
}

.h-bar-value {
    width: 36px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pam-charcoal);
}

/* Dashboard table */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dashboard-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: var(--pam-light);
    color: var(--pam-charcoal);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dashboard-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--pam-light);
    color: var(--pam-charcoal);
}

.dashboard-table tr:hover td {
    background: rgba(0, 147, 176, 0.04);
}

.no-data {
    text-align: center;
    color: var(--pam-steel);
    padding: 2rem;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .h-bar-label { width: 120px; font-size: 0.75rem; }
}

@media (max-width: 500px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .bar-label { display: none; }
    .h-bar-label { width: 80px; }
    .header-nav { float: none; margin-top: 0.5rem; }
    .header-nav a { margin-left: 0; margin-right: 1rem; }
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--pam-steel);
    font-size: 0.8rem;
}
