/* ── Color scheme ─────────────────────────────────────────────────────────
   Orange (#FC4C02) primary, charcoal nav, clean white content area.
   ──────────────────────────────────────────────────────────────────────── */

:root {
  --orange:        #FC4C02;
  --orange-dark:   #d93f00;
  --orange-light:  #fff1eb;
  --charcoal:      #1a1a1a;
  --charcoal-soft: #2e2e2e;
  --text:          #1a1a1a;

  /* Override Pico primary */
  --pico-primary:             var(--orange);
  --pico-primary-hover:       var(--orange-dark);
  --pico-primary-focus:       rgba(252, 76, 2, 0.25);
  --pico-primary-background:  var(--orange);
  --pico-primary-underline:   var(--orange);
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */

body > header {
  background: #ffffff;
  border-bottom: 3px solid var(--orange);
  padding-block: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  --pico-nav-element-spacing-vertical: .15rem;
  --pico-nav-link-spacing-vertical: .1rem;
}

body > header nav a {
  color: var(--charcoal);
  text-decoration: none;
  font-size: .9rem;
}

body > header nav a:hover {
  color: var(--orange);
}

.nav-icon-link {
  display: flex;
  align-items: center;
  color: var(--charcoal);
  opacity: 0.6;
  transition: opacity .15s, color .15s;
  padding: 0 .4rem;
}
.nav-icon-link:hover { opacity: 1; color: var(--orange); }
.nav-icon-link svg { width: 28px; height: 28px; }

body > header nav ul:last-of-type { margin-right: .75rem; }

.nav-logo img {
  display: block;
  height: 88px;
  width: auto;
  max-width: none;
}

/* ── Page background ──────────────────────────────────────────────────────── */

body {
  background: #f4f4f4;
}

main.container {
  padding-top: 2rem;
}

/* ── Cards / articles ─────────────────────────────────────────────────────── */

article {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-top: 3px solid var(--orange);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

article header {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--charcoal);
}

article footer {
  margin-top: 1rem;
  font-size: .9rem;
}

/* ── Auth pages ───────────────────────────────────────────────────────────── */

.auth-card {
  max-width: 420px;
  margin: 4rem auto;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo img {
  width: 240px;
}

/* ── Flash messages ───────────────────────────────────────────────────────── */

.flash {
  padding: .75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-weight: 500;
}
.flash-success { background: #edfaed; border-left: 4px solid #4caf50; color: #1a4d1a; }
.flash-error   { background: #fdecea; border-left: 4px solid #f44336; color: #4d1a1a; }

.breakthrough-banner {
  background: #1a1f12;
  border-left: 4px solid #ffc107;
  padding: .75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.breakthrough-title {
  font-weight: 600;
  color: #ffc107;
  display: block;
  margin-bottom: .4rem;
}
.breakthrough-list {
  margin: 0;
  padding-left: 1.2rem;
  color: #e0e0e0;
}
.breakthrough-list li {
  margin-bottom: .2rem;
}

.config-warning {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  padding: .75rem 1rem;
  border-radius: 4px;
  color: #5a4000;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

table input { margin-bottom: 0; padding: .25rem .5rem; min-width: 0; }
table input[type="color"] { width: 48px; height: 36px; padding: 2px; }
table input[type="number"] { width: 80px; }

/* ── Settings checkboxes grid ─────────────────────────────────────────────── */

.grid-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .25rem;
}
.grid-fields label { display: flex; align-items: center; gap: .5rem; margin-bottom: 0; }

details summary { cursor: pointer; margin-bottom: .75rem; }

/* ── Zone tabs ────────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e8e8e8;
  padding-bottom: .5rem;
}
.tab-bar a { text-decoration: none; opacity: 0.5; color: var(--text); }
.tab-bar a:hover { opacity: 0.8; }
.tab-bar a[aria-selected="true"] {
  opacity: 1;
  font-weight: 700;
  color: var(--orange);
  border-bottom: 3px solid var(--orange);
  margin-bottom: -3px;
}

/* ── Sortable table headers ───────────────────────────────────────────────── */

th[data-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th[data-col]:hover { color: var(--orange); }

.sort-arrow {
  display: inline-block;
  margin-left: .3em;
  font-size: .75em;
  opacity: 0.35;
  vertical-align: middle;
}
th[data-col].sort-asc  .sort-arrow,
th[data-col].sort-desc .sort-arrow {
  opacity: 1;
  color: var(--orange);
}

/* ── Brand icons ──────────────────────────────────────────────────────────── */

.brand-icon-link {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: .3rem;
  opacity: 0.55;
  transition: opacity .15s;
  text-decoration: none;
}
.brand-icon-link:hover { opacity: 1; }

.brand-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.strava-icon  { filter: invert(40%) sepia(90%) saturate(1500%) hue-rotate(10deg) brightness(95%); }
.mastodon-icon { filter: invert(40%) sepia(60%) saturate(800%) hue-rotate(210deg) brightness(90%); }

/* ── Activity detail ──────────────────────────────────────────────────────── */

.activity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.stat-chip {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-top: 3px solid var(--orange);
  border-radius: 6px;
  padding: .5rem .9rem;
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #888;
  margin-bottom: .1rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--charcoal);
}

.activity-figure {
  margin: 0 0 1.2rem 0;
}

.activity-map {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.activity-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.activity-chart {
  width: 100%;
  border-radius: 8px;
  display: block;
}

/* ── Schedule toggle ──────────────────────────────────────────────────────── */

.btn-schedule {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .5rem 1.2rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-schedule:hover { background: var(--orange-dark); }

.btn-scheduled {
  background: #edfaed;
  color: #1a4d1a;
  border: 2px solid #4caf50;
  border-radius: 6px;
  padding: .5rem 1.2rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-scheduled:hover { background: #d4f5d4; }

.scheduled-badge {
  font-size: .75rem;
  font-weight: 600;
  color: #1a4d1a;
  background: #edfaed;
  border: 1px solid #4caf50;
  border-radius: 4px;
  padding: .1rem .4rem;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 1rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--charcoal);
  border: 1px solid #ddd;
  transition: background .15s, color .15s;
}
.page-btn:hover { background: var(--orange-light); color: var(--orange); border-color: var(--orange); }
.page-btn-disabled { opacity: 0.3; cursor: default; }

.page-info { font-size: .9rem; color: #666; padding: 0 .5rem; }

/* ── Sort links ───────────────────────────────────────────────────────────── */

.sort-link {
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}
.sort-link:hover { color: var(--orange); }
.sort-active { color: var(--orange); font-weight: 600; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.center  { text-align: center; }
.muted   { opacity: 0.45; }
.no-underline { text-decoration: none; }
