:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #657080;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #9a3412;
  --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.locked {
  overflow: hidden;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(246, 247, 249, 0.96);
  padding: 24px;
}

.login-box {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-box h1 {
  font-size: 24px;
}

.login-box p {
  color: var(--muted);
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.toolbar,
.panel,
.person,
.stats article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

#status,
.person p,
.panel dt,
.stats span {
  color: var(--muted);
}

#status {
  margin-top: 8px;
}

.filters {
  display: grid;
  grid-template-columns: 170px minmax(260px, 360px) auto;
  align-items: end;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.hidden {
  display: none;
}

.report {
  display: grid;
  gap: 18px;
}

.person {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
}

.grid {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats article {
  min-height: 112px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.stats strong {
  font-size: 30px;
  line-height: 1;
}

.panels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 18px;
}

dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef1f5;
  padding-bottom: 10px;
}

.metric:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metric dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.timeline-panel {
  padding: 0;
}

.coverage-panel p {
  margin-top: 10px;
  color: var(--muted);
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.timeline-head input {
  max-width: 320px;
}

.timeline {
  max-height: 620px;
  overflow: auto;
}

.event {
  display: grid;
  grid-template-columns: 92px 120px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px 18px;
  border-bottom: 1px solid #eef1f5;
}

.event:last-child {
  border-bottom: 0;
}

.time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.badge {
  width: fit-content;
  border-radius: 999px;
  background: #e8f3f1;
  color: var(--accent-strong);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.event-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.error {
  color: var(--warn);
}

@media (max-width: 900px) {
  .toolbar,
  .person {
    align-items: stretch;
    flex-direction: column;
  }

  .filters,
  .stats,
  .panels {
    grid-template-columns: 1fr;
  }

  .event {
    grid-template-columns: 80px 1fr;
  }

  .event-title {
    grid-column: 1 / -1;
  }
}

@media print {
  body {
    background: #fff;
  }

  .toolbar,
  #printButton,
  #timelineSearch {
    display: none;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .panel,
  .person,
  .stats article {
    box-shadow: none;
  }

  .timeline {
    max-height: none;
  }
}
