:root {
  --bg: #0b0f13;
  --bg-alt: #0e1319;
  --card: #161c23;
  --card-alt: #1d2530;
  --line: #28313b;
  --text: #edf2f6;
  --dim: #8a97a3;
  --dimmer: #5c6873;
  --accent: #5ee0a0;
  --accent2: #4bc8ff;
  --danger: #ff6b5e;
  --walk: #5ee0a0;
  --bike: #4bc8ff;
  --drive: #ff9f5e;
  --radius: 16px;
  --max-width: 1080px;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 15, 19, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

nav.wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.brand:hover {
  text-decoration: none;
}
.brand svg {
  display: block;
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-tag {
  color: var(--dimmer);
  font-size: 12.5px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layout */

main {
  padding: 32px 0 80px;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 26px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 16px;
  margin: 28px 0 12px;
  color: var(--text);
}

.sub {
  color: var(--dim);
  font-size: 13.5px;
  margin: 0 0 8px;
}

/* Login */

.login-shell {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 4px;
}

.login-card .sub {
  text-align: center;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--dim);
  margin-bottom: 6px;
  font-weight: 600;
}

.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover {
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #0b1f16;
  width: 100%;
}
.btn.primary:hover:not(:disabled) {
  background: #78e8b3;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--card-alt);
}

.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger:hover:not(:disabled) {
  background: rgba(255, 107, 94, 0.12);
}

.btn.small {
  padding: 7px 14px;
  font-size: 13px;
}

.error-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--danger);
  font-size: 13.5px;
  background: rgba(255, 107, 94, 0.1);
  border: 1px solid rgba(255, 107, 94, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.note-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--accent);
  font-size: 13.5px;
  background: rgba(94, 224, 160, 0.08);
  border: 1px solid rgba(94, 224, 160, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

/* Stat tiles */

.tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.tile .tile-value {
  font-size: 22px;
  font-weight: 800;
  margin: 6px 0 2px;
}

.tile .tile-label {
  color: var(--dim);
  font-size: 12px;
}

/* Card / panel */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel + .panel {
  margin-top: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

/* Range control */

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.segmented button.active {
  background: var(--card-alt);
  color: var(--text);
}

/* Chart */

.chart {
  position: relative;
  margin-top: 8px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.chart-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity 0.1s;
}

.chart-bar-col:hover .chart-bar {
  opacity: 0.75;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--dimmer);
  font-size: 10.5px;
}

.chart-caption {
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
  margin-top: 10px;
  letter-spacing: 0.04em;
}

.chart-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  margin-bottom: 6px;
  z-index: 5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.chart-tooltip .t-day {
  color: var(--dim);
  display: block;
}

.chart-tooltip .t-val {
  color: var(--text);
  font-weight: 700;
}

/* Mode legend */

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--dim);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* Rows / lists */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row-title {
  font-weight: 700;
  font-size: 13.5px;
}

.row-sub {
  color: var(--dim);
  font-size: 12px;
  margin-top: 2px;
}

.row-value {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

.row-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--card-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: none;
}

.time-ago {
  color: var(--dimmer);
  font-size: 10.5px;
  white-space: nowrap;
}

.empty {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 10, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
}

.modal h3 {
  margin: 0 0 8px;
  color: var(--danger);
}

.modal p {
  color: var(--dim);
  font-size: 13.5px;
}

.modal .field input {
  text-align: center;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .btn {
  flex: 1;
}

/* Footer */

footer.site {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}

footer.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-size: 13px;
}

@media (max-width: 640px) {
  .server-tag {
    display: none;
  }
}
