/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Lyden brand */
  --brand-red:  #EE3524;
  --brand-blue: #005695;
  --ink:        #161413;
  /* UI neutrals */
  --blue:    #1a56db;
  --red:     #e02424;
  --orange:  #ff5a1f;
  --yellow:  #c27803;
  --green:   #057a55;
  --gray-50: #f9fafb;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-400:#9ca3af;
  --gray-500:#6b7280;
  --gray-700:#374151;
  --gray-900:#111827;
  --white:   #ffffff;
  --shadow:  0 1px 3px rgba(0,0,0,.12);
  --radius:  8px;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--gray-100);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 360px;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo img {
  width: 140px;
  height: auto;
  display: block;
  margin: 0 auto .75rem;
}

.login-logo .login-subtitle {
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: .01em;
}

.login-form label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .375rem;
}

.login-form input[type="password"] {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  outline: none;
  transition: border-color .15s;
}

.login-form input[type="password"]:focus { border-color: var(--brand-blue); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary  { background: var(--brand-blue); color: var(--white); }
.btn-primary:hover { background: #004880; }
.btn-ghost    { background: transparent;    color: var(--gray-500); }
.btn-ghost:hover  { background: var(--gray-200); }
.btn-lg  { padding: .875rem 1.5rem; font-size: 1rem;   width: 100%; }
.btn-sm  { padding: .375rem .75rem; font-size: .8125rem; }

/* ── App header ───────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: var(--white);
  padding: .5rem 1rem;
  box-shadow: var(--shadow);
}

.header-logo {
  height: 32px;
  width: auto;
  display: block;
}

/* 3px accent stripe — red left half, blue right half */
.accent-stripe {
  height: 3px;
  background: linear-gradient(to right, var(--brand-red) 50%, var(--brand-blue) 50%);
  position: sticky;
  top: 53px;   /* sits flush below the header */
  z-index: 99;
  flex-shrink: 0;
}

/* Sub-header: app title + data stamp */
.sub-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem 1rem .375rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.sub-header-title {
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.data-stamp {
  font-size: .75rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  text-align: right;
}

/* ── Filters bar ──────────────────────────────────────────────────────────── */
.filters-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .625rem;
}

.search-input {
  width: 100%;
  padding: .625rem .875rem;
  font-size: 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  outline: none;
  background: var(--gray-50);
  transition: border-color .15s;
}

.search-input:focus { border-color: var(--brand-blue); background: var(--white); }

.chips-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.chip {
  padding: .375rem .875rem;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all .15s;
  min-height: 36px;
}

.chip:hover  { border-color: var(--brand-blue); color: var(--brand-blue); }
.chip.active { border-color: var(--brand-blue); background: var(--brand-blue); color: var(--white); }

.filter-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.select-filter {
  flex: 1;
  min-width: 120px;
  padding: .5rem .625rem;
  font-size: .875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-700);
  outline: none;
  min-height: 40px;
}

.select-filter:focus { border-color: var(--brand-blue); }

.toggle-label {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--gray-700);
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand-blue);
}

.result-count {
  font-size: .8125rem;
  color: var(--gray-500);
  margin-left: auto;
}

/* ── Tank list & cards ────────────────────────────────────────────────────── */
.tank-list {
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.customer-group-header {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-500);
  padding: .5rem 0 .25rem;
  margin-top: .5rem;
}

.tank-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .875rem 1rem;
  border-left: 4px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.tank-card.status-MUST   { border-left-color: var(--brand-red); }
.tank-card.status-SHOULD { border-left-color: var(--orange); }
.tank-card.status-COULD  { border-left-color: var(--yellow); }
.tank-card.status-GOOD   { border-left-color: var(--green); }

.tank-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.tank-location {
  font-weight: 700;
  font-size: .9375rem;
  flex: 1;
  min-width: 0;
}

.tank-product {
  font-size: .8125rem;
  color: var(--gray-500);
}

.tank-address {
  font-size: .75rem;
  color: var(--gray-400);
}

.tank-card-mid {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-wrap: wrap;
}

/* Fill bar */
.fill-bar-wrap {
  flex: 1;
  min-width: 120px;
}

.fill-bar-track {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.fill-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  transition: width .3s;
}

.fill-bar-fill.status-MUST   { background: var(--brand-red); }
.fill-bar-fill.status-SHOULD { background: var(--orange); }
.fill-bar-fill.status-COULD  { background: var(--yellow); }
.fill-bar-fill.status-GOOD   { background: var(--green); }

.fill-pct {
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: .25rem; }

.badge {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 700;
  padding: .125rem .4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-status-MUST   { background: #fde8e8; color: var(--brand-red); }
.badge-status-SHOULD { background: #feecdc; color: var(--orange); }
.badge-status-COULD  { background: #fdf6b2; color: var(--yellow); }
.badge-status-GOOD   { background: #def7ec; color: var(--green); }
.badge-stale         { background: #e5edff; color: #3f83f8; }
.badge-suspect       { background: #fdf6b2; color: var(--yellow); }
.badge-category      { background: var(--gray-100); color: var(--gray-700); }
.badge-def           { background: #edebfe; color: #6c2bd9; }

.tank-card-bot {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .8125rem;
  color: var(--gray-700);
}

.tank-stat { white-space: nowrap; }
.tank-stat strong { font-weight: 700; }
.tank-stat.muted  { color: var(--gray-400); }
.dte-capped { color: var(--gray-400); font-style: italic; }

/* ── Throttle notice ──────────────────────────────────────────────────────── */
.throttle-notice {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--white);
  font-size: .8125rem;
  padding: .625rem 1rem;
  border-radius: var(--radius);
  max-width: calc(100vw - 2rem);
  text-align: center;
  z-index: 200;
}

/* ── Responsive tweaks for wider screens ──────────────────────────────────── */
@media (min-width: 600px) {
  .tank-card-bot { gap: 1.5rem; }
  .data-stamp { max-width: 260px; }
  .filters-bar { padding: .75rem 1.5rem; }
  .tank-list { padding: 1rem 1.5rem; }
  .sub-header { padding: .5rem 1.5rem .375rem; }
}

@media (min-width: 860px) {
  .app-header { padding: .5rem 2rem; }
  .sub-header { padding: .5rem 2rem .375rem; }
  .filters-bar { padding: .75rem 2rem; }
  .tank-list { padding: 1rem 2rem; }
}
