:root {
  color: #1f2933;
  background: #eef2f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --line: #d8e0e8;
  --muted: #697586;
  --text: #1f2933;
  --accent: #267f72;
  --warn: #9f6b16;
  --urgent: #b42318;
  --unclear: #4d5b6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eef2f5;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
.day-link {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button.secondary,
.day-link {
  background: #ffffff;
  color: var(--text);
}

.topbar {
  min-height: 82px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar form {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.75rem;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 18px 36px;
  display: grid;
  gap: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 86px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 2rem;
  line-height: 1;
}

.metric strong.small {
  font-size: 1.3rem;
}

.filters {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.filter-form {
  display: grid;
  grid-template-columns: 160px 130px minmax(180px, 1fr) 120px auto auto;
  gap: 10px;
}

.filter-form input,
.filter-form select,
.login-box input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
}

.filter-form button,
.filter-form input,
.filter-form select {
  width: 100%;
}

.check-option {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.check-option input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
}

.section-head,
.timetable {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-head {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-head > span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.timetable {
  overflow: hidden;
}

.timetable .section-head {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td:first-child {
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

td:nth-child(2) {
  text-align: center;
  font-weight: 800;
}

td:nth-child(4) {
  font-weight: 800;
}

.count-link {
  min-width: 42px;
  min-height: 32px;
  border: 1px solid #b9d5cf;
  border-radius: 6px;
  background: #edf8f5;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  text-decoration: none;
}

.count-link:hover {
  background: #dff2ed;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.details-head {
  margin-top: 4px;
}

.observations {
  display: grid;
  gap: 10px;
}

.observation {
  min-height: 142px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
}

.thumb {
  background: #101820;
  display: block;
  min-height: 142px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.content {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.row-head,
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.badge,
.flag {
  border-radius: 999px;
  min-height: 24px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.normal {
  color: #116149;
  background: #e8f6ef;
}

.badge.watch {
  color: var(--warn);
  background: #fff3d6;
}

.badge.urgent {
  color: var(--urgent);
  background: #fde8e7;
}

.badge.unclear {
  color: var(--unclear);
  background: #edf1f5;
}

.content p {
  margin: 0;
  line-height: 1.45;
  font-size: 1.02rem;
}

.meta {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 0.86rem;
  min-width: 0;
}

.meta > span:first-child {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.flag {
  background: var(--surface-soft);
  color: var(--muted);
  text-transform: none;
}

.empty {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.login-body {
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 14px;
}

.login-box label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.error {
  margin: 0;
  color: var(--urgent);
  background: #fde8e7;
  border: 1px solid #f8c7c3;
  border-radius: 6px;
  padding: 9px 10px;
}

@media (max-width: 760px) {
  .topbar {
    min-height: 0;
    padding: 14px 16px;
    align-items: center;
  }

  .topbar h1 {
    font-size: 1.35rem;
  }

  .topbar .secondary {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .page {
    padding: 14px 10px 28px;
    gap: 12px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 72px;
    padding: 11px;
  }

  .metric span {
    font-size: 0.72rem;
  }

  .metric strong {
    font-size: 1.55rem;
  }

  .metric strong.small {
    font-size: 1.05rem;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }

  .filter-form {
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filters .day-link:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .filters .day-link:last-child {
    grid-column: 2;
    grid-row: 2;
  }

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

  .thumb {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .content {
    padding: 12px;
  }

  .row-head {
    align-items: flex-start;
  }

  .content p {
    font-size: 0.98rem;
  }

  .section-head {
    padding: 12px;
    align-items: flex-start;
  }

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 10px 11px;
  }
}

@media (max-width: 420px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

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

  .metric:last-child {
    grid-column: 1 / -1;
  }

  .badge,
  .flag {
    font-size: 0.72rem;
  }

  .login-body {
    padding: 12px;
  }

  .login-box {
    padding: 18px;
  }
}
