:root {
  color-scheme: light;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #dcdcdc;
  --bg: #ffffff;
  --accent: #1c5cff;
}

* {
  box-sizing: border-box;
}

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

.site-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

main.dashboard {
  max-width: 960px;
}

.landing h1 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

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

.auth-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.button-google {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.6rem 1.1rem 0.6rem 0.9rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.button-google:hover {
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.notice {
  padding: 0.65rem 0.9rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  color: #7a5c00;
}

.flash-success {
  padding: 0.65rem 0.9rem;
  background: #e6f4ea;
  border: 1px solid #a8dab5;
  border-radius: 4px;
  color: #1e7e34;
  font-weight: 600;
}

.site-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.site-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.link-button {
  display: block;
  margin-top: 0.75rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 0.9rem;
  cursor: pointer;
}

.site-footer {
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.range-picker {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.range-picker a {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.range-picker a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#chart {
  margin: 1rem 0;
}

.event-tooltip {
  position: fixed;
  z-index: 10;
  background: #1a1a1a;
  color: #fff;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  pointer-events: none;
  max-width: 320px;
}

.field-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
}

.field-filter a {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.field-filter a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.event-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.event-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.event-time {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.event-diff {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  word-break: break-word;
}

.event-diff .old-value {
  color: var(--muted);
  text-decoration: line-through;
}

.event-diff .new-value {
  color: var(--text);
  font-weight: 600;
}

.pagination {
  display: flex;
  justify-content: space-between;
  margin: 1.5rem 0;
}

.annotation-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
}

.annotation-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.annotation-form input[type="date"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.annotation-form button {
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.event-tooltip .expand-toggle,
.event-tooltip .close-toggle {
  display: inline-block;
  margin-top: 0.3rem;
  margin-right: 0.6rem;
  color: #9ecbff;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

.detail-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.detail-chart {
  flex: 3;
  min-width: 0;
}

.detail-history {
  flex: 2;
  min-width: 260px;
  max-height: 460px;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .detail-layout {
    flex-direction: column;
  }

  .detail-history {
    max-height: none;
  }
}
