/* Enode design system — light theme */

@font-face {
  font-family: 'Whyte';
  src: url('/static/fonts/ABCWhyte-Light.woff2') format('woff2');
  font-weight: 380;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Whyte';
  src: url('/static/fonts/ABCWhyte-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Whyte';
  src: url('/static/fonts/ABCWhyte-Book.woff2') format('woff2');
  font-weight: 480;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Whyte';
  src: url('/static/fonts/ABCWhyte-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary-accent: #5D770D;
  --primary-hover: #0E6400;
  --heading-color: #002203;
  --body-color: #423F35;
  --secondary-text: #505038;
  --bg-white: #FFFFFF;
  --bg-cream: #F5F3EE;
  --bg-off-white: #FAFAF9;
  --focus-ring: #059B00;
  --error: #E2722C;
  --lime-accent: #E6F77E;
  --border: #E8E5DD;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Whyte', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "ss02" on;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.3;
  color: var(--body-color);
  background: var(--bg-white);
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  font-size: 0.86em;
}

.container {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Navigation */
.nav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}
.nav-brand {
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
  color: var(--heading-color);
}
.nav-brand-dim { color: var(--secondary-text); font-weight: 400; }
.nav-links { display: flex; gap: 0.5rem; align-items: center; }

/* Buttons — always pill-shaped */
.btn {
  display: inline-block;
  padding: 0.5625rem 1rem;
  border: none;
  border-radius: 5.5rem;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 125ms ease-in-out, color 250ms ease-in-out;
}
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.btn-primary { background: var(--primary-accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-cream); color: var(--secondary-text); }
.btn-secondary:hover { background: var(--border); }
.btn-text { background: transparent; color: var(--secondary-text); }
.btn-text:hover { background: var(--bg-cream); }

/* Sections */
.section { padding-block: 2.5rem; }
@media (min-width: 640px) { .section { padding-block: 3rem; } }

.page-title {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--heading-color);
}
@media (min-width: 960px) { .page-title { font-size: 2rem; } }
.page-subtitle { margin-top: 0.625rem; color: var(--secondary-text); }

.section-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--heading-color);
  margin-bottom: 1.25rem;
}
@media (min-width: 960px) { .section-title { font-size: 1.5rem; } }

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 2rem;
}
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--bg-cream);
  border-radius: 8px;
  padding: 1.5rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.125rem;
}
.card h3 {
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--heading-color);
}
.card-text { margin-bottom: 1.125rem; max-width: 30rem; }

/* Key-value lists */
.kv dt {
  font-size: 0.8125rem;
  color: var(--secondary-text);
  margin-bottom: 0.1875rem;
}
.kv dd { margin-bottom: 0.875rem; overflow-wrap: anywhere; }
.kv dd:last-child { margin-bottom: 0; }
.kv .small { font-size: 0.8125rem; }

/* Chips + tags */
.chip {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip-positive { background: var(--lime-accent); color: #184602; }
/* Neutral chips: cream on white surfaces, white inside cream cards. */
.chip-neutral { background: var(--bg-cream); color: var(--secondary-text); }
.card .chip-neutral { background: var(--bg-white); }

.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tag {
  background: var(--bg-white);
  color: var(--secondary-text);
  border-radius: 4px;
  padding: 0.1875rem 0.5rem;
  font-size: 0.8125rem;
}

/* Banners */
.banner {
  border-radius: 6px;
  padding: 0.875rem 1.125rem;
  margin-bottom: 1.75rem;
}
.banner-success { background: var(--lime-accent); color: #184602; }
.banner-error { background: #FBE8DC; color: #8A3F0C; }
.banner-neutral { background: var(--bg-cream); color: var(--secondary-text); }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--secondary-text);
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.875rem 0.75rem;
  border-bottom: 1px solid var(--bg-off-white);
}
.table-action { text-align: right; }

/* Empty state */
.empty {
  background: var(--bg-cream);
  border-radius: 8px;
  padding: 2.5rem;
  text-align: center;
  color: var(--secondary-text);
}

/* Vehicle detail */
.vehicle-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.page-subtitle .chip { margin-left: 0.5rem; }
.pull-form {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
}
.pulled-at { display: block; margin-top: 1.5rem; }
.pulled-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Raw JSON dialog */
.raw-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  width: min(56rem, 92vw);
  max-height: 85vh;
  margin: auto;
  inset: 0;
  position: fixed;
}
.raw-dialog::backdrop { background: rgba(25, 22, 16, 0.45); }
.raw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-cream);
}
.raw-title { margin-bottom: 0; }
.raw-actions { display: flex; gap: 0.375rem; }
.raw-pre {
  margin: 0;
  padding: 1.25rem;
  overflow: auto;
  max-height: 70vh;
  background: var(--bg-white);
  color: var(--body-color);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.75rem;
}
@media (min-width: 960px) { .detail-grid { grid-template-columns: repeat(2, 1fr); } }
.detail-title {
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--heading-color);
  margin-bottom: 0.75rem;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table td {
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(80, 80, 56, 0.08);
  vertical-align: top;
  font-size: 0.8125rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-key { color: var(--secondary-text); padding-right: 1rem; }
.data-value { text-align: right; overflow-wrap: anywhere; color: var(--body-color); }

.charging-card { margin-top: 1.5rem; }
.charging-card + .empty { margin-top: 1.5rem; }
.cmd-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.extras-table { margin-top: 0.75rem; max-width: 30rem; }
.sched-details { margin-top: 1rem; }
.sched-details summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--secondary-text);
}
.sched-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  align-items: end;
  margin-top: 1rem;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.8125rem; color: var(--secondary-text); }
.field-wide { grid-column: 1 / -1; }
.day-checks { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--secondary-text);
}
.check-row input[type=checkbox] { accent-color: var(--primary-accent); width: 15px; height: 15px; }
.input {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--heading-color);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-white);
}
.input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

.telemetry-note { margin-top: 1.5rem; margin-bottom: 0; max-width: none; }
.telemetry-history-status {
  min-height: 3rem;
  padding-top: 1.25rem;
  text-align: center;
  cursor: pointer;
}

/* Fleet config editor */
.signal-scroll {
  max-height: 28rem;
  overflow-y: auto;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-white);
  padding: 0 0.75rem;
}
.signal-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--bg-white);
}
.ivl-input { width: 5.5rem; padding: 0.3rem 0.5rem; font-size: 0.8125rem; }
.ca-input { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.6875rem; width: 100%; }
.totals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--heading-color);
}
.feed-waiting { text-align: center; color: var(--secondary-text); padding: 2rem 0.75rem; }

.row-link { color: inherit; text-decoration: none; }
.row-link:hover { color: var(--primary-accent); text-decoration: underline; }
.nav-back { color: inherit; text-decoration: none; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: var(--bg-cream);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 22rem;
}
.login-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
}
.login-text { color: var(--secondary-text); margin-bottom: 1.25rem; }
.login-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--secondary-text);
  margin-bottom: 0.3rem;
}
.login-input {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--heading-color);
  width: 100%;
  padding: 0.5625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-white);
  margin-bottom: 1rem;
}
.login-input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.login-btn { width: 100%; }

/* Footer */
.footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding-block: 1.25rem;
}
.caption { font-size: 0.8125rem; color: var(--secondary-text); }
