:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f2;
  color: #18201d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f5f2; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #d9ddd8;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: #18201d; font-size: 20px; font-weight: 750; text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-state { color: #65706a; font-size: 13px; }
.connection-state.online { color: #18794e; }
.connection-state.error { color: #b42318; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.login-view { min-height: calc(100vh - 115px); display: grid; place-items: center; }
.login-panel { width: min(380px, 100%); display: grid; gap: 9px; }
.login-panel h1 { margin: 0 0 20px; font-size: 30px; }
.login-panel label { color: #4f5b55; font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  height: 42px;
  border: 1px solid #c9cfca;
  border-radius: 6px;
  padding: 0 11px;
  color: #18201d;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid #147d64; outline-offset: 1px; }
.eyebrow { margin: 0 0 6px; color: #147d64; font-size: 11px; font-weight: 800; }
.form-error { min-height: 20px; color: #b42318; font-size: 13px; }

.primary-button, .secondary-button, .icon-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}
.primary-button { color: #fff; background: #147d64; }
.secondary-button { color: #26332d; border-color: #c9cfca; background: #fff; }
.icon-button { width: 38px; padding: 0; color: #536059; border-color: #c9cfca; background: #fff; }
.primary-button:hover { background: #0e6b55; }
.secondary-button:hover, .icon-button:hover { background: #edf0ed; }

.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 28px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid #d6dbd6;
  background: #fff;
}
.metrics div { padding: 16px 18px; border-right: 1px solid #e1e4e0; }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: #69736e; font-size: 12px; }
.metrics strong { display: block; margin-top: 4px; font-size: 23px; }

.filters {
  display: grid;
  grid-template-columns: 160px 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 20px 0;
}
.filters label { color: #5e6963; font-size: 12px; font-weight: 650; }
.filters input, .filters select { margin-top: 5px; }
.check-filter { height: 42px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.check-filter input { width: 17px; height: 17px; margin: 0; }

.timeline-heading { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.timeline-heading h2 { margin: 0; font-size: 17px; }
.timeline-heading span { color: #69736e; font-size: 13px; }
.event-list { display: grid; gap: 8px; }
.event-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 15px;
  border: 1px solid #d6dbd6;
  border-radius: 7px;
  background: #fff;
}
.event-time { color: #536059; font-size: 13px; font-variant-numeric: tabular-nums; }
.event-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.event-title { font-size: 15px; }
.event-confidence, .event-state { padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: 750; }
.event-confidence { color: #075985; background: #e0f2fe; }
.event-state { color: #7a4a00; background: #fff2cc; }
.event-state.active { color: #166534; background: #dcfce7; }
.event-meta { margin-top: 5px; color: #68736d; font-size: 12px; }
.event-actions { display: flex; align-items: start; gap: 6px; }
.event-actions button { min-height: 34px; padding: 0 10px; font-size: 12px; }
.event-actions .icon-button { width: 34px; padding: 0; }
.event-audio audio { width: min(460px, 100%); height: 38px; margin-top: 10px; }
.feedback-editor { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; margin-top: 10px; }
.feedback-editor input { height: 38px; }
.feedback-editor button { min-height: 38px; }
.event-row.reviewed { border-left: 4px solid #25936f; }
.event-row.dismissed { opacity: .62; }
.empty-state { padding: 44px 12px; color: #6b756f; text-align: center; border-top: 1px solid #d6dbd6; }

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  main { padding: 20px 14px 44px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid #e1e4e0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .event-row { grid-template-columns: 66px minmax(0, 1fr); }
  .event-actions { grid-column: 2; flex-wrap: wrap; }
  .feedback-editor { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .page-heading h1 { font-size: 23px; }
  .filters { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr; gap: 8px; }
  .event-actions { grid-column: 1; }
}
