* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       margin: 0; color: #1c1c1e; background: #fafafa; }
header { padding: 16px 24px; background: white; border-bottom: 1px solid #eee;
         display: flex; align-items: baseline; gap: 16px; }
header h1 { margin: 0; font-size: 20px; }
header p { margin: 0; color: #666; font-size: 13px; }
.back { color: #2563eb; text-decoration: none; font-weight: 500; }
section { padding: 16px 24px; }

table { border-collapse: collapse; width: 100%; font-size: 13px; background: white; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }
th { background: #f5f5f7; font-weight: 600; position: sticky; top: 0; }
tr:hover td { background: #fafbff; }
code { background: #f3f3f7; padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: ui-monospace, monospace; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
         font-size: 11px; font-weight: 600; }
.badge.green { background: #d4f8d4; color: #1a6f1a; }
.badge.amber { background: #fff2cc; color: #7a5c00; }
.badge.red { background: #fde0e0; color: #a30000; }

.upload { background: white; border-radius: 8px; padding: 16px 24px; margin: 16px 24px;
          border: 1px solid #eee; }
.upload h2 { margin-top: 0; font-size: 16px; }
.upload form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.upload input[type=text], .upload select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
.upload button { background: #2563eb; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.upload button:hover { background: #1d4ed8; }
#upload-result { width: 100%; padding: 8px 0; color: #666; font-size: 13px; }

.meta { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi { background: white; padding: 10px 14px; border-radius: 8px; min-width: 100px; border: 1px solid #eee; }
.kpi .l { font-size: 11px; color: #666; text-transform: uppercase; }
.kpi .v { font-size: 18px; font-weight: 600; margin-top: 2px; }

.audio-row { background: white; border-radius: 8px; padding: 12px 16px; }
.audio-row audio { width: 100%; }

.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; padding: 16px 24px; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.col-segments, .col-sidebar { background: white; padding: 16px; border-radius: 8px; border: 1px solid #eee; }

.seg { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 120ms; }
.seg:hover { background: #f9fafb; }
.seg.active { background: #eef4ff; }
.seg.playing { background: #fff7d6; border-left: 3px solid #f0b400; padding-left: 9px; }
.seg-head { font-size: 11px; color: #555; display: flex; gap: 10px; align-items: center; margin-bottom: 3px; }
.seg-time { font-family: ui-monospace, monospace; color: #888; }
.seg-speaker { font-weight: 600; color: #2563eb; }
.seg-conf { padding: 0 6px; border-radius: 8px; font-weight: 600; }
.seg-conf.hi { background: #d4f8d4; color: #1a6f1a; }
.seg-conf.mid { background: #fff2cc; color: #7a5c00; }
.seg-conf.low { background: #fde0e0; color: #a30000; }
.seg-flag { background: #fde0e0; color: #a30000; padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 600; }
.seg-text { font-size: 14px; line-height: 1.4; }

.col-sidebar h2 { font-size: 14px; margin: 12px 0 4px; color: #444; }
.col-sidebar ul { padding-left: 18px; margin: 4px 0; font-size: 13px; }
.col-sidebar a { color: #2563eb; text-decoration: none; }
.col-sidebar a:hover { text-decoration: underline; }
.pii-conf { color: #888; font-size: 11px; }
.versions code { font-size: 11px; }
.muted { color: #888; font-size: 12px; }

/* === Phase 2 — nav, filters, stats === */
.topnav { display: flex; gap: 14px; margin-left: auto; align-items: center; font-size: 13px; }
.topnav a { color: #2563eb; text-decoration: none; font-weight: 500; padding: 4px 8px; border-radius: 4px; }
.topnav a:hover, .topnav a.active { background: #eef4ff; }
.topnav .admin-link { color: #c80; }
.admin-badge { background: #fff2cc; color: #7a5c00; padding: 3px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; }

.filters { background: white; border-radius: 8px; padding: 14px 24px; margin: 16px 24px;
           border: 1px solid #eee; }
.filters h2 { margin-top: 0; font-size: 15px; }
.filters form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; }
.filters input[type=number] { width: 100px; }
.filters input[type=date] { width: 140px; }
.filters input[type=text] { width: 180px; }
.filters button { background: #2563eb; color: white; border: none; padding: 6px 14px; border-radius: 5px; cursor: pointer; font-weight: 500; }
.filters .btn-clear, .filters .btn-export { color: #555; text-decoration: none; padding: 6px 12px; border-radius: 5px; border: 1px solid #ccc; font-size: 13px; }
.filters .btn-export { color: #2a7; border-color: #2a7; }

.admin-actions button { padding: 4px 8px; font-size: 11px; border-radius: 4px; border: 1px solid #ccc; background: white; cursor: pointer; margin-right: 4px; }
.admin-actions button.danger { color: #a30000; border-color: #fbb; }
.admin-actions button:hover { background: #f5f5f7; }

.kpi-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi-grid .kpi { background: white; padding: 14px 18px; border-radius: 8px; min-width: 140px; border: 1px solid #eee; }
.kpi-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; color: #1c1c1e; }

.bar-chart { display: flex; flex-direction: column; gap: 4px; max-width: 720px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 60px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { color: #444; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-bar { background: #f0f0f3; border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; }
.bar-val { color: #666; font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 16px 24px; }
.two-col > div { background: white; padding: 16px; border-radius: 8px; border: 1px solid #eee; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
