:root {
  --paper: #efe6d3;
  --panel: #e8ddc4;
  --panel-alt: #ddd0b0;
  --ink: #26241a;
  --ink-soft: #6c6350;
  --line: #c3b48a;
  --teal: #1f6b63;
  --teal-soft: #dde9e4;
  --brick: #a3402b;

  --font-display: ui-serif, Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
}

/* Status lamp: small indicator dot, not a floating glow badge */
.status-lamp {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brick);
  border: 1px solid rgba(38, 36, 26, 0.3);
  z-index: 100;
}
.status-lamp.live {
  background: var(--teal);
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 24px 32px 18px 44px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.back-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.back-link:hover {
  color: var(--teal);
  border-color: var(--teal);
}

.dashboard {
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 720px;
  margin: 0 auto;
}

.indoor-banner {
  max-width: 720px;
  margin: 18px auto 0;
  padding: 12px 18px;
  border: 1px solid var(--brick);
  color: var(--brick);
  background: rgba(163, 64, 43, 0.06);
  font-size: 0.82rem;
  line-height: 1.5;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 26px 28px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.history-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 10px 0 16px;
}

/* --- Current reading --- */

.reading-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.reading-primary {
  font-family: var(--font-display);
  line-height: 1;
}
.reading-value {
  font-size: 3.4rem;
  font-weight: 600;
}
.reading-unit {
  font-size: 1.6rem;
  color: var(--ink-soft);
  margin-left: 2px;
}

.reading-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  font-size: 0.85rem;
}
.reading-meta span:first-child {
  color: var(--ink);
  font-weight: 600;
}
.reading-time {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.conditions-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 18px;
}

.forecast-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.forecast-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
}
.forecast-col:first-child {
  border-right: 1px solid var(--line);
}
.row-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.row-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--teal);
}

.reading-table {
  width: 100%;
  border-collapse: collapse;
}
.reading-table th, .reading-table td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 400;
  font-size: 0.92rem;
}
.reading-table th {
  color: var(--ink-soft);
  width: 55%;
}
.reading-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.reading-table tr:last-child th, .reading-table tr:last-child td {
  border-bottom: none;
}

/* --- History --- */

.calendar {
  margin-bottom: 18px;
}
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-label {
  font-family: var(--font-display);
  font-size: 0.98rem;
}
.cal-nav {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  width: 28px;
  height: 28px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.cal-nav:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.cal-cell {
  background: var(--panel);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.cal-cell.has-data {
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}
.cal-cell.has-data:hover {
  background: var(--teal-soft);
}
.cal-cell.selected {
  background: var(--teal);
  color: var(--paper);
}
.cal-cell.dow {
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.72rem;
  min-height: auto;
  padding-bottom: 4px;
}
.cal-cell.empty {
  background: transparent;
}

.log-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.log-entry {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.log-entry:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.log-entry.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--paper);
}
.log-row .empty-note {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.history-result table {
  width: 100%;
  border-collapse: collapse;
}
.history-result th, .history-result td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
  font-weight: 400;
}
.history-result th {
  color: var(--ink-soft);
  width: 50%;
}
.history-result td {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- Auth page --- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-panel {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.auth-brand {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0 0 20px 0;
}

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.auth-panel label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 10px;
}

.auth-panel input {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 10px;
  font-size: 0.95rem;
  font-family: var(--font-sans);
}
.auth-panel input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.auth-panel button {
  margin-top: 20px;
  background: var(--teal);
  color: var(--paper);
  border: none;
  padding: 11px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: var(--font-sans);
}
.auth-panel button:hover {
  background: #185a53;
}

.auth-error {
  border: 1px solid var(--brick);
  color: var(--brick);
  background: rgba(163, 64, 43, 0.06);
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.auth-back {
  display: inline-block;
  margin-top: 22px;
}

@media (max-width: 480px) {
  .forecast-row { grid-template-columns: 1fr; }
  .forecast-col:first-child { border-right: none; border-bottom: 1px solid var(--line); }
  .reading-value { font-size: 2.6rem; }
}

/* --- Day graphs (/weather/graph) --- */

#graphs-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.graph-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px 22px 14px;
}

.graph-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.graph-svg-wrap {
  width: 100%;
  overflow-x: auto;
}

.graph-svg text {
  font-family: var(--font-sans);
  fill: var(--ink-soft);
  font-size: 10px;
}

.graph-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.graph-axis-line {
  stroke: var(--ink-soft);
  stroke-width: 1;
}

.graph-data-line {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
}

.graph-data-dot {
  fill: var(--teal);
}

.graph-empty {
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 10px 0 4px;
}

.graph-jump-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.graph-jump-link:hover {
  color: var(--teal);
}

/* --- Lows/Highs two-line chart --- */

.graph-line-low {
  stroke: var(--teal);
}
.graph-line-high {
  stroke: var(--brick);
}
.graph-dot-low {
  fill: var(--teal);
}
.graph-dot-high {
  fill: var(--brick);
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-low { background: var(--teal); }
.legend-high { background: var(--brick); }

/* Clickable data points (month graph -> jump to that day's graph page) */
.graph-dot-clickable {
  cursor: pointer;
}
.graph-dot-clickable:hover {
  stroke: var(--ink);
  stroke-width: 1.5;
}