:root {
  color-scheme: dark;
  --bg: #101417;
  --ink: #f2f5f2;
  --muted: #a9b4ba;
  --line: #344047;
  --accent: #2fa36f;
  --accent-2: #ff8a80;
  --surface: #1b2328;
  --surface-2: #243039;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
}

button,
a[role="button"] {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

button.active,
.actions button,
.actions a {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(16, 20, 23, 0.96);
  border-bottom: 1px solid var(--line);
}

.logout-form {
  margin: 0;
  flex: 0 0 auto;
}

.logout-btn {
  width: 48px;
  padding: 0;
}

.logout-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.1;
}

.range-label,
.meta,
.empty {
  color: var(--muted);
  font-size: 16px;
}

.icon-btn {
  width: 48px;
  padding: 0;
  font-size: 28px;
}

.controls {
  display: grid;
  gap: 10px;
  padding: 12px 12px 8px;
}

.segmented,
.quick-ranges {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.site-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.segmented button,
.quick-ranges button {
  padding: 0 6px;
  font-size: 16px;
}

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

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: var(--surface-2);
  color: var(--ink);
}

select {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--ink);
}

.timeline {
  display: grid;
  gap: 14px;
  padding: 8px 12px 28px;
}

.event {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.event button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.event img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #05080a;
}

.event-body {
  padding: 12px;
}

.event-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 24px;
  font-weight: 850;
}

.badge {
  flex: 0 0 auto;
  align-self: start;
  border-radius: 999px;
  padding: 4px 9px;
  background: #d8f7e6;
  color: #0f3d2f;
  font-size: 14px;
  text-transform: uppercase;
}

.subtitle {
  margin-top: 4px;
  font-size: 18px;
  color: var(--muted);
}

.empty {
  padding: 30px 12px;
  text-align: center;
}

dialog {
  width: min(94vw, 620px);
  max-height: 90vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.95);
}

.date-dialog {
  width: min(94vw, 440px);
}

.date-picker-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.date-picker-body input {
  min-height: 64px;
  padding: 10px 14px;
  font-size: 24px;
  font-weight: 800;
}

.date-picker-body button {
  min-height: 58px;
  font-size: 20px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
}

#detailImage {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  background: #05080a;
}

.detail-status {
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

#detailSubtitle {
  padding: 12px;
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

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

.login-box {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-box form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.error {
  color: var(--accent-2);
  font-weight: 800;
}

@media (min-width: 720px) {
  .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 1180px;
    margin: 0 auto;
  }

  .controls {
    max-width: 1180px;
    margin: 0 auto;
    grid-template-columns: 2fr 1.3fr 1fr;
  }
}
