@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f3f1ee;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --line: rgba(48, 40, 36, 0.12);
  --text: #2c2623;
  --muted: #756b66;
  --bhp: #e25200;
  --bhp-dark: #b84000;
  --bhp-soft: rgba(226, 82, 0, 0.1);
  --green: #138655;
  --green-soft: rgba(19, 134, 85, 0.11);
  --yellow: #c98200;
  --yellow-soft: rgba(201, 130, 0, 0.12);
  --red: #cf2e3b;
  --red-soft: rgba(207, 46, 59, 0.1);
  --gray: #827b77;
  --gray-soft: rgba(130, 123, 119, 0.12);
  --cyan: var(--bhp);
  font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(226, 82, 0, 0.08), transparent 30rem),
    radial-gradient(circle at 94% 18%, rgba(104, 85, 75, 0.06), transparent 26rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 6px;
  background: linear-gradient(90deg, #b84000, var(--bhp) 55%, #f18700);
}

button, input { font: inherit; }

button:focus-visible { outline: 3px solid rgba(226, 82, 0, 0.28); outline-offset: 3px; }

.client-dashboard {
  width: calc(100% - 24px);
  max-width: 1920px;
  margin: 0 auto;
  padding: 20px 0 14px;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 2px 2px 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font: 700 11px/1.2 "Manrope", sans-serif;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 4px;
  font: 800 clamp(27px, 2.4vw, 38px)/1.05 "Manrope", sans-serif;
  letter-spacing: -0.045em;
}

.intro { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.head-actions { display: flex; align-items: center; gap: 16px; }

.ecora-logo {
  position: relative;
  width: 184px;
  height: 58px;
  flex: 0 0 auto;
  overflow: hidden;
  background: transparent;
}

.ecora-logo img {
  position: absolute;
  top: -76px;
  left: -94px;
  width: 360px;
  max-width: none;
  height: auto;
  filter: contrast(1.06) saturate(1.08);
  image-rendering: auto;
  mix-blend-mode: multiply;
}

.last-update { color: var(--muted); font-size: 12px; white-space: nowrap; }

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--bhp);
  border: 1px solid var(--bhp);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.refresh-button:hover { background: var(--bhp-dark); transform: translateY(-1px); }
.is-loading .refresh-button { opacity: 0.6; pointer-events: none; }

.logout-button {
  min-height: 42px;
  padding: 0 13px;
  color: var(--bhp-dark);
  background: #ffffff;
  border: 1px solid rgba(226, 82, 0, 0.26);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.logout-button:hover { background: var(--bhp-soft); }
.logout-button:disabled { opacity: 0.55; cursor: wait; }

.back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--bhp-dark);
  background: #ffffff;
  border: 1px solid rgba(226, 82, 0, 0.26);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.back-dashboard:hover { background: var(--bhp-soft); }

.summary-strip {
  display: grid;
  grid-template-columns: 1.45fr repeat(3, minmax(120px, 0.7fr)) 1.8fr;
  align-items: stretch;
  background: linear-gradient(100deg, #ffffff, #faf8f5);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(70, 51, 40, 0.08);
}

.summary-title, .summary-stat, .legend {
  min-height: 64px;
  padding: 11px 17px;
  border-right: 1px solid var(--line);
}

.summary-title { display: flex; align-items: center; gap: 14px; }
.summary-title strong { display: block; font: 800 22px/1 "Manrope"; }
.summary-title small { color: var(--muted); font-size: 10px; letter-spacing: 0.13em; }

.live-pulse {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(64, 216, 137, 0.12), 0 0 22px rgba(64, 216, 137, 0.42);
}

.summary-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  column-gap: 10px;
  align-items: center;
}

.summary-stat .status-dot { grid-row: 1 / span 2; }
.summary-stat strong { align-self: end; font: 800 22px/1 "Manrope"; }
.summary-stat span:last-child { align-self: start; color: var(--muted); font-size: 11px; }

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px 15px;
  border-right: 0;
  color: var(--muted);
  font-size: 10px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gray);
  box-shadow: 0 0 0 4px var(--gray-soft);
}

.status-dot.green, .summary-stat.green .status-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-dot.yellow, .summary-stat.yellow .status-dot { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-soft); }
.status-dot.red, .summary-stat.red .status-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.status-dot.gray, .summary-stat.gray .status-dot { background: var(--gray); box-shadow: 0 0 0 4px var(--gray-soft); }

.cards-section { padding: 18px 0 8px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 9px;
}

.section-heading h2 {
  margin: 0;
  font: 700 17px/1.2 "Manrope";
  letter-spacing: -0.025em;
}

.section-heading > span { color: var(--muted); font-size: 10px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.probe-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(150deg, #ffffff, #fbfaf8);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gray);
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(70, 51, 40, 0.08);
}

.probe-card.red { border-top-color: var(--red); }
.probe-card.yellow { border-top-color: var(--yellow); }
.probe-card.green { border-top-color: var(--green); }
.probe-card.gray { border-top-color: var(--gray); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
}

.equipment-id { display: flex; align-items: center; gap: 6px; min-width: 0; }

.vehicle-badge {
  display: grid;
  place-items: center;
  min-width: 51px;
  height: 31px;
  padding: 0 5px;
  background: var(--bhp-soft);
  border: 1px solid rgba(226, 82, 0, 0.22);
  border-radius: 7px;
  color: var(--cyan);
  font: 800 11px/1 "Manrope";
  letter-spacing: 0.04em;
}

.equipment-id p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.equipment-id h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font: 700 14px/1.15 "Manrope";
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overall-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.overall-state.green { color: var(--green); background: var(--green-soft); }
.overall-state.yellow { color: var(--yellow); background: var(--yellow-soft); }
.overall-state.red { color: var(--red); background: var(--red-soft); }
.overall-state.gray { color: var(--gray); background: var(--gray-soft); }

.card-metrics { padding: 3px 8px 0; }

.metric-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
  min-height: 55px;
  border-bottom: 1px solid var(--line);
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--gray);
  background: var(--gray-soft);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 800;
}

.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.yellow { color: var(--yellow); background: var(--yellow-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }
.metric-icon.gray { color: var(--gray); background: var(--gray-soft); }
.metric-icon.neutral { color: var(--bhp); background: var(--bhp-soft); }

.metric-copy { min-width: 0; }
.metric-label { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; }
.metric-copy small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.metric-number {
  justify-self: end;
  min-width: 29px;
  color: var(--text);
  font: 800 21px/1 "Manrope";
  text-align: center;
}

.state-circle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  justify-self: end;
  border: 1px solid rgba(112, 129, 139, 0.25);
  border-radius: 50%;
  color: var(--gray);
  background: var(--gray-soft);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.58);
}

.state-circle span { font: 800 16px/1 "Manrope"; }
.state-circle.green { color: var(--green); background: var(--green-soft); border-color: rgba(19, 134, 85, 0.3); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 0 12px rgba(19, 134, 85, 0.08); }
.state-circle.yellow { color: var(--yellow); background: var(--yellow-soft); border-color: rgba(201, 130, 0, 0.32); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 0 12px rgba(201, 130, 0, 0.08); }
.state-circle.red { color: var(--red); background: var(--red-soft); border-color: rgba(207, 46, 59, 0.3); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 0 12px rgba(207, 46, 59, 0.08); }

.progress {
  width: 100%;
  max-width: 100px;
  height: 3px;
  margin: 4px 0;
  overflow: hidden;
  background: rgba(48, 40, 36, 0.09);
  border-radius: 99px;
}

.progress span { display: block; height: 100%; border-radius: inherit; background: var(--gray); }
.progress span.green { background: var(--green); }
.progress span.yellow { background: var(--yellow); }
.progress span.red { background: var(--red); }

.card-recommendations {
  margin: auto 7px 0;
  min-height: 94px;
  padding: 9px;
  background: rgba(207, 46, 59, 0.055);
  border: 1px solid rgba(207, 46, 59, 0.16);
  border-radius: 8px;
}

.card-recommendations.yellow { background: rgba(201, 130, 0, 0.06); border-color: rgba(201, 130, 0, 0.17); }
.card-recommendations.green { background: rgba(19, 134, 85, 0.055); border-color: rgba(19, 134, 85, 0.16); }
.card-recommendations.gray { background: var(--gray-soft); border-color: rgba(112, 129, 139, 0.2); }
.actions-header { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; color: var(--red); }
.card-recommendations.yellow .actions-header { color: var(--yellow); }
.card-recommendations.green .actions-header { color: var(--green); }
.card-recommendations.gray .actions-header { color: var(--gray); }
.actions-alert { display: grid; place-items: center; width: 17px; height: 17px; color: #ffffff; background: var(--red); border-radius: 5px; font-size: 10px; font-weight: 800; }
.card-recommendations.yellow .actions-alert { background: var(--yellow); }
.card-recommendations.green .actions-alert { background: var(--green); }
.card-recommendations.gray .actions-alert { background: var(--gray); }
.actions-header strong { font: 700 11px/1 "Manrope"; letter-spacing: 0.05em; text-transform: uppercase; }
.recommendation-list { display: grid; gap: 6px; }
.recommendation-item { display: grid; grid-template-columns: 8px 1fr; gap: 8px; align-items: start; }
.recommendation-item .status-dot { width: 6px; height: 6px; margin-top: 4px; box-shadow: none; }
.recommendation-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.recommendation-item p strong { color: var(--text); }
.no-action { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--green); font-size: 10px; }

.card-foot { padding: 7px 9px 8px; color: #8b817c; font-size: 8px; text-align: right; }

.dashboard-footer { padding: 20px 0 0; color: #8b817c; font-size: 10px; text-align: center; }

.login-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(226, 82, 0, 0.1), transparent 34%),
    linear-gradient(135deg, #f6f1ed 0%, #f3f1ee 48%, #ece8e3 100%);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 410px);
  padding: 34px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-top: 4px solid var(--bhp);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(70, 51, 40, 0.14);
}

.login-brand {
  position: relative;
  width: 180px;
  height: 62px;
  margin: 0 auto 22px;
  overflow: hidden;
}

.login-brand img {
  position: absolute;
  top: -76px;
  left: -90px;
  width: 360px;
  max-width: none;
  mix-blend-mode: multiply;
}

.login-panel h1 {
  margin: 7px 0 8px;
  color: var(--text);
  font: 800 30px/1.08 "Manrope", sans-serif;
}

.login-intro { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: var(--text); font-size: 12px; font-weight: 700; }
.login-form input {
  min-height: 46px;
  padding: 0 13px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid rgba(48, 40, 36, 0.2);
  border-radius: 10px;
  outline: none;
  font: 500 14px/1 "DM Sans", sans-serif;
}
.login-form input:focus { border-color: var(--bhp); box-shadow: 0 0 0 3px var(--bhp-soft); }
.login-message { min-height: 18px; margin: -2px 0 0; color: var(--muted); font-size: 11px; }
.login-message.failed { color: var(--red); font-weight: 700; }
.login-submit { width: 100%; justify-content: center; font-weight: 800; }
.login-submit:disabled { opacity: 0.6; cursor: wait; }

.csv-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.back-dashboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--bhp);
  background: #ffffff;
  border: 1px solid rgba(226, 82, 0, 0.2);
  border-radius: 10px;
  font: 700 11px/1 "Manrope", sans-serif;
  text-decoration: none;
}

.back-dashboard:hover { background: var(--bhp-soft); }

.csv-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.upload-module-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.upload-module-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px 16px;
  color: var(--muted);
  text-align: left;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-module-tab:hover { transform: translateY(-1px); border-color: rgba(226, 82, 0, .35); }
.upload-module-tab > span { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; color: var(--bhp); background: var(--bhp-soft); border-radius: 10px; font: 800 11px/1 "Manrope", sans-serif; }
.upload-module-tab strong, .upload-module-tab small { display: block; }
.upload-module-tab strong { color: var(--text); font: 800 14px/1.2 "Manrope", sans-serif; }
.upload-module-tab small { margin-top: 4px; font-size: 10px; }
.upload-module-tab.is-active { background: #fff; border-color: var(--bhp); box-shadow: 0 10px 24px rgba(70, 51, 40, .1); }
.upload-module-tab.is-active > span { color: #fff; background: var(--bhp); }

[data-upload-module-panel][hidden] { display: none; }

.video-report-upload {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr);
  gap: 22px;
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #102f45 0%, #174861 100%);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(16, 47, 69, .18);
}

.video-report-copy { align-self: center; color: rgba(255, 255, 255, .8); }
.video-report-copy .eyebrow { color: #75d5b1; }
.video-report-copy h2 { margin: 7px 0 10px; color: #fff; font: 800 24px/1.15 "Manrope", sans-serif; }
.video-report-copy > p:not(.eyebrow) { margin: 0; font-size: 12px; line-height: 1.65; }
.video-report-safety-note { display: grid; gap: 3px; margin-top: 16px; padding: 12px 13px; color: rgba(255, 255, 255, .78); background: rgba(255, 255, 255, .08); border-left: 3px solid #f4b544; border-radius: 8px; font-size: 10px; line-height: 1.45; }
.video-report-safety-note strong { color: #fff; }

.video-report-form { display: grid; gap: 12px; padding: 17px; background: rgba(255, 255, 255, .98); border-radius: 14px; }
.video-report-picker { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 14px; color: var(--muted); background: var(--surface-2); border: 1.5px dashed rgba(226, 82, 0, .42); border-radius: 11px; cursor: pointer; }
.video-report-picker:hover { background: var(--bhp-soft); border-color: var(--bhp); }
.video-report-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.video-report-picker > span { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; color: var(--bhp); background: #fff; border-radius: 10px; font-size: 22px; box-shadow: 0 7px 16px rgba(70, 51, 40, .08); }
.video-report-picker strong, .video-report-picker small { display: block; }
.video-report-picker strong { color: var(--text); font-size: 12px; }
.video-report-picker small { margin-top: 4px; font-size: 10px; }
.video-report-preview { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; color: var(--muted); background: #fbfaf8; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; }
.video-report-preview strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.video-report-preview span { flex: 0 0 auto; }
.video-report-selection { display: grid; gap: 8px; width: 100%; }
.video-report-file-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.video-report-selected-files { display: grid; gap: 5px; max-height: 116px; overflow-y: auto; }
.video-report-selected-files > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.video-report-selected-files > div strong { min-width: 0; }
.video-report-submit { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.video-report-submit p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.video-report-submit p.success { color: var(--green); font-weight: 700; }
.video-report-submit p.failed { color: var(--red); font-weight: 700; }
.video-report-submit .refresh-button { flex: 0 0 auto; }
.video-report-submit .refresh-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.video-imports-list { max-height: 110px; }

.preventive-alert-shell {
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #102f45 0%, #174861 100%);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(16, 47, 69, .18);
}

.preventive-alert-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .48fr);
  align-items: end;
  gap: 24px;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, .8);
}

.preventive-alert-head .eyebrow { color: #75d5b1; }
.preventive-alert-head h2 { margin: 7px 0 9px; color: #fff; font: 800 26px/1.15 "Manrope", sans-serif; }
.preventive-alert-head p:not(.eyebrow) { max-width: 720px; margin: 0; font-size: 12px; line-height: 1.6; }
.preventive-alert-head .video-report-safety-note { margin: 0; }

.preventive-alert-form {
  display: grid;
  grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr);
  gap: 14px;
  padding: 16px;
  background: rgba(250, 250, 249, .99);
  border-radius: 14px;
}

.preventive-form-section {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.preventive-evidence-section { grid-row: span 2; }
.preventive-section-title { display: flex; align-items: flex-start; gap: 10px; }
.preventive-section-title > span { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; color: #fff; background: #174861; border-radius: 8px; font: 800 11px/1 "Manrope", sans-serif; }
.preventive-section-title strong, .preventive-section-title small { display: block; }
.preventive-section-title strong { color: var(--text); font: 800 13px/1.25 "Manrope", sans-serif; }
.preventive-section-title small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }

.preventive-image-picker { min-height: 86px; }
.preventive-image-preview { display: grid; gap: 9px; min-height: 180px; place-items: center; overflow: hidden; color: var(--muted); background: #f4f6f7; border: 1px solid var(--line); border-radius: 10px; font-size: 10px; }
.preventive-image-preview img { width: 100%; max-height: 260px; object-fit: contain; background: #1b2328; }
.preventive-image-preview > div { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 0 10px 10px; }
.preventive-image-preview strong { min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }

.preventive-fields-grid, .preventive-manual-iot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 12px;
}

.preventive-fields-grid label,
.preventive-manual-iot label,
.preventive-wide-field { display: grid; gap: 6px; color: var(--text); font-size: 10px; font-weight: 700; }

.preventive-fields-grid input,
.preventive-fields-grid select,
.preventive-manual-iot input,
.preventive-manual-iot select,
.preventive-wide-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(48, 40, 36, .2);
  border-radius: 8px;
  outline: none;
  font: 500 11px/1.3 "DM Sans", sans-serif;
}

.preventive-wide-field textarea { min-height: 72px; resize: vertical; }
.preventive-wide-field small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.preventive-fields-grid input:focus,
.preventive-fields-grid select:focus,
.preventive-manual-iot input:focus,
.preventive-manual-iot select:focus,
.preventive-wide-field textarea:focus { border-color: var(--bhp); box-shadow: 0 0 0 3px var(--bhp-soft); }

.preventive-observations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.preventive-observations legend { padding: 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.preventive-observations label { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 10px; }
.preventive-observations input { width: 15px; height: 15px; accent-color: var(--bhp); }

.preventive-iot-note { display: grid; gap: 3px; padding: 11px 12px; color: #255b48; background: #edf8f4; border: 1px solid #cfe8df; border-radius: 9px; font-size: 10px; line-height: 1.4; }
.preventive-iot-note strong { font-size: 10px; }
.preventive-manual-iot { padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.preventive-manual-iot[hidden], .preventive-iot-note[hidden] { display: none; }

.preventive-submit-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
  color: rgba(255, 255, 255, .82);
  background: #102f45;
  border-radius: 11px;
}

.preventive-submit-bar strong, .preventive-submit-bar span { display: block; }
.preventive-submit-bar strong { color: #fff; font-size: 11px; }
.preventive-submit-bar span { margin-top: 3px; font-size: 9px; }
.preventive-submit-bar p { margin: 7px 0 0; font-size: 10px; }
.preventive-submit-bar p.success { color: #75d5b1; font-weight: 700; }
.preventive-submit-bar p.failed { color: #ffc5b8; font-weight: 700; }
.preventive-submit-bar .refresh-button { flex: 0 0 auto; }
.preventive-submit-bar .refresh-button:disabled { opacity: .55; cursor: wait; }
.preventive-analysis-result { grid-column: 1 / -1; display: grid; gap: 12px; padding: 16px; background: #fff; border: 1px solid #cfe1eb; border-left: 4px solid #0070af; border-radius: 11px; box-shadow: 0 10px 28px rgba(20, 45, 60, .08); }
.preventive-analysis-result[hidden] { display: none; }
.preventive-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preventive-result-head > span { color: #386278; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.preventive-result-head strong { padding: 7px 10px; color: #7c4c00; background: #fff4d8; border-radius: 999px; font-size: 10px; }
.preventive-result-head strong[data-level="CRITICA"], .preventive-result-head strong[data-level="URGENT"] { color: #fff; background: #c92c38; }
.preventive-result-head strong[data-level="ALTA"], .preventive-result-head strong[data-level="HIGH"] { color: #fff; background: #c65300; }
.preventive-result-head strong[data-level="MEDIA"], .preventive-result-head strong[data-level="MEDIUM"] { color: #3f3100; background: #f2bd18; }
.preventive-result-head strong[data-level="BAJA"], .preventive-result-head strong[data-level="LOW"], .preventive-result-head strong[data-level="INFORMATIVE"] { color: #fff; background: #18794e; }
.preventive-result-head strong[data-level="POR_DETERMINAR"] { color: #29475e; background: #e7edf1; }
.preventive-facts-grid { margin-top: 12px; padding-top: 12px; border-top: 1px solid #dce6eb; }
.preventive-analysis-result dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.preventive-analysis-result dl > div { padding: 10px 11px; background: var(--surface-2); border-radius: 8px; }
.preventive-analysis-result dt { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.preventive-analysis-result dd { margin: 5px 0 0; color: var(--text); font-size: 10px; line-height: 1.5; }
.preventive-analysis-result > p { margin: 0; color: var(--muted); font-size: 9px; font-weight: 700; }

.batch-upload-details { margin-top: 14px; padding: 12px 14px; background: rgba(255, 255, 255, .96); border-radius: 11px; }
.batch-upload-details summary { color: var(--text); cursor: pointer; font: 800 11px/1.3 "Manrope", sans-serif; }
.batch-upload-details[open] summary { margin-bottom: 12px; }
.batch-upload-details .video-report-form { padding: 0; }
.batch-trace-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; padding: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.batch-trace-fields label { display: grid; gap: 5px; min-width: 0; }
.batch-trace-fields label > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .02em; }
.batch-trace-fields input, .batch-trace-fields select { width: 100%; min-height: 36px; padding: 8px 9px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 8px; font: 600 10px/1.2 "Inter", sans-serif; }
.batch-trace-fields input:focus, .batch-trace-fields select:focus { border-color: var(--bhp); outline: 2px solid rgba(226, 82, 0, .12); }
.video-report-selected-files > div[data-state="uploading"] { border-color: rgba(0, 112, 175, .4); background: rgba(0, 112, 175, .06); }
.video-report-selected-files > div[data-state="success"] { border-color: rgba(24, 128, 86, .35); background: var(--green-soft); }
.video-report-selected-files > div[data-state="failed"] { border-color: rgba(211, 47, 61, .35); background: var(--red-soft); }
.video-report-selected-files > div[data-state="success"] b { color: var(--green); }
.video-report-selected-files > div[data-state="failed"] b { color: var(--red); }
.preventive-imports { margin-top: 14px; padding: 13px 14px; background: rgba(255, 255, 255, .96); border-radius: 11px; }
.preventive-imports .video-imports-list { max-height: 170px; }
.alert-code-search { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 7px 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.alert-code-search[hidden] { display: none; }
.alert-code-search label { display: grid; gap: 5px; }
.alert-code-search label > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.alert-code-search input { width: 100%; min-height: 36px; padding: 8px 10px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 8px; font: 700 10px/1.2 "Inter", sans-serif; text-transform: uppercase; }
.alert-code-search input:focus { border-color: #1a6f91; outline: 3px solid rgba(26, 111, 145, .14); }
.alert-code-search button { min-height: 36px; padding: 0 12px; border: 1px solid #1a6f91; border-radius: 8px; color: #155a77; background: #fff; font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.alert-code-search small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.preventive-edit-banner { align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; padding: 13px 15px; border: 1px solid rgba(15, 91, 125, .3); border-left: 4px solid #0f5b7d; border-radius: 10px; background: #eef8fc; }
.preventive-edit-banner:not([hidden]) { display: flex; }
.preventive-edit-banner > div { display: grid; gap: 3px; }
.preventive-edit-banner strong { color: #123f55; font-size: 13px; }
.preventive-edit-banner span { color: #526d7a; font-size: 11px; }
.preventive-edit-banner button { flex: 0 0 auto; min-height: 34px; padding: 0 13px; border: 1px solid #0f5b7d; border-radius: 8px; color: #0f5b7d; background: #fff; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }

.starlink-upload-guide {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 13px 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
}

.starlink-module-panel { padding: 22px; background: rgba(255, 255, 255, .74); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 38px rgba(70, 51, 40, .08); }
.starlink-module-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(440px, 1.15fr); align-items: end; gap: 22px; margin-bottom: 18px; }
.starlink-module-head h2 { margin: 6px 0 8px; color: var(--text); font: 800 24px/1.15 "Manrope", sans-serif; }
.starlink-module-head p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.starlink-module-head .starlink-upload-guide { margin: 0; }

.starlink-upload-guide strong { margin-right: 4px; color: var(--text); }
.starlink-upload-guide span { padding: 5px 8px; background: var(--surface-2); border-radius: 7px; }

.vehicle-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.vehicle-upload-card {
  min-width: 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-top: 3px solid var(--bhp);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(70, 51, 40, 0.07);
}

.vehicle-upload-card > header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 13px;
}

.vehicle-upload-card > header small {
  display: block;
  color: var(--muted);
  font: 700 8px/1 "Manrope", sans-serif;
  letter-spacing: 0.12em;
}

.vehicle-upload-card > header h2 {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text);
  font: 800 13px/1.2 "Manrope", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1.5px dashed rgba(226, 82, 0, 0.35);
  border-radius: 11px;
  cursor: pointer;
}

.vehicle-file-picker:hover { background: var(--bhp-soft); border-color: var(--bhp); }
.vehicle-file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.vehicle-file-picker > span { display: grid; place-items: center; width: 34px; height: 34px; color: var(--bhp); background: #ffffff; border-radius: 9px; font-size: 19px; }
.vehicle-file-picker strong, .vehicle-file-picker small { display: block; }
.vehicle-file-picker strong { color: var(--text); font-size: 11px; }
.vehicle-file-picker small { margin-top: 3px; font-size: 9px; }

.vehicle-upload-card .csv-preview-placeholder {
  max-height: 150px;
  min-height: 48px;
  margin-top: 10px;
  padding: 10px;
  overflow: auto;
  font-size: 9px;
}

.vehicle-upload-submit {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.vehicle-upload-submit p { min-height: 28px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.vehicle-upload-submit p.success { color: var(--green); font-weight: 700; }
.vehicle-upload-submit p.failed { color: var(--red); font-weight: 700; }
.vehicle-upload-submit .refresh-button { width: 100%; min-height: 34px; }
.vehicle-upload-submit .refresh-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.csv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 20px;
}

.csv-upload-card,
.csv-history-card {
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(70, 51, 40, 0.08);
}

.csv-upload-card h2,
.csv-history-card h2 {
  margin: -23px 0 5px 42px;
  font: 800 20px/1.2 "Manrope", sans-serif;
}

.csv-upload-card > div:first-child p,
.csv-history-card > div:first-child p {
  margin: 0 0 20px 42px;
  color: var(--muted);
  font-size: 12px;
}

.csv-step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: var(--bhp);
  border-radius: 9px;
  font: 800 13px/1 "Manrope";
}

.csv-drop-zone {
  display: grid;
  place-items: center;
  min-height: 168px;
  padding: 24px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1.5px dashed rgba(226, 82, 0, 0.35);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
}

.csv-drop-zone:hover { background: var(--bhp-soft); border-color: var(--bhp); }
.csv-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.csv-drop-zone strong { margin: 8px 0 2px; color: var(--text); }
.csv-drop-zone small { font-size: 11px; }
.csv-upload-icon { display: grid; place-items: center; width: 42px; height: 42px; color: var(--bhp); background: #ffffff; border-radius: 12px; font-size: 22px; box-shadow: 0 8px 20px rgba(70, 51, 40, 0.08); }

.csv-preview-placeholder {
  margin-top: 16px;
  min-height: 62px;
  padding: 14px;
  overflow: hidden;
  color: var(--muted);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
}

.csv-file-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.csv-file-summary strong { color: var(--text); }
.csv-selected-files {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}
.csv-selected-files div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.csv-selected-files strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.csv-selected-files span { flex: 0 0 auto; color: var(--muted); }
.csv-preview-label { display: block; margin: 2px 0 6px; color: var(--muted); font-weight: 700; }
.csv-preview-table { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.csv-preview-table table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
.csv-preview-table th, .csv-preview-table td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; }
.csv-preview-table th { color: var(--bhp-dark); background: var(--bhp-soft); font-weight: 800; }

.csv-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; }
.csv-submit-row p { margin: 0; color: var(--muted); font-size: 11px; }
.csv-submit-row p.success { color: var(--green); font-weight: 700; }
.csv-submit-row p.failed { color: var(--red); font-weight: 700; }
.csv-submit-row .refresh-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.card-imports-section { display: grid; gap: 7px; padding-top: 2px; }
.card-imports-section > strong { color: var(--bhp-dark); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.card-imports-list { display: grid; gap: 6px; max-height: 132px; overflow-y: auto; }
.card-import-file { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.card-import-file.failed { border-color: rgba(211, 47, 61, .35); background: var(--red-soft); }
.card-import-file > div { min-width: 0; display: grid; gap: 2px; flex: 1; }
.card-import-file strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.card-import-file small { color: var(--muted); font-size: 8px; }
.card-import-file .import-trace { color: var(--text); font-weight: 700; white-space: normal; }
.card-import-file.failed small { color: var(--red); }
.import-actions { display: flex; align-items: center; gap: 6px; }
.edit-alert-button { min-height: 28px; padding: 0 10px; border: 1px solid #1a6f91; border-radius: 14px; color: #155a77; background: #fff; font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.edit-alert-button:hover { color: #fff; background: #1a6f91; }
.edit-alert-button:focus-visible, .preventive-edit-banner button:focus-visible { outline: 3px solid rgba(26, 111, 145, .24); outline-offset: 2px; }
.card-imports-empty { display: block; padding: 8px; color: var(--muted); background: var(--surface-2); border-radius: 8px; font-size: 9px; text-align: center; }
.card-imports-empty.failed { color: var(--red); }
.card-imports-error { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; color: var(--red); background: var(--red-soft); border: 1px solid rgba(211, 47, 61, .25); border-radius: 8px; }
.card-imports-error small { font-size: 9px; font-weight: 700; }
.card-imports-error button { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--red); color: var(--red); background: #fff; border-radius: 7px; font: inherit; font-size: 9px; font-weight: 800; cursor: pointer; }
.card-imports-error button:hover { color: #fff; background: var(--red); }
.card-imports-error button:disabled { opacity: .5; cursor: wait; }
.delete-import-button { display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border: 1px solid var(--red); color: var(--red); background: #fff; border-radius: 50%; font: inherit; font-size: 16px; font-weight: 800; line-height: 1; cursor: pointer; }
.delete-import-button:hover { color: #fff; background: var(--red); }
.delete-import-button:disabled { opacity: .45; cursor: wait; }

.error-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.error-box {
  width: min(480px, 100%);
  padding: 38px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
}

.error-box > span { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 20px; color: var(--red); background: var(--red-soft); border-radius: 50%; font-size: 24px; font-weight: 800; }
.error-box h1 { font-size: 24px; }
.error-box p:not(.eyebrow) { color: var(--muted); }
.error-box .refresh-button { margin-top: 12px; }

.boot-screen {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(48, 40, 36, 0.1);
  border-top-color: var(--bhp);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .summary-strip { grid-template-columns: repeat(4, 1fr); }
  .summary-title { grid-column: span 2; }
  .legend { grid-column: span 3; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-upload-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .client-dashboard { width: min(100% - 28px, 620px); padding-top: 22px; }
  .dashboard-head { align-items: flex-start; flex-direction: column; gap: 18px; }
  .head-actions { width: 100%; justify-content: space-between; }
  .ecora-logo { width: 150px; height: 48px; border-radius: 8px; }
  .ecora-logo img { top: -63px; left: -78px; width: 300px; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-title { grid-column: span 2; }
  .summary-stat { min-height: 72px; }
  .legend { grid-column: span 2; min-height: 62px; }
  .cards-grid { grid-template-columns: 1fr; }
  .csv-page { padding-top: 28px; }
  .csv-page-head { align-items: flex-start; flex-direction: column; }
  .starlink-module-head { grid-template-columns: 1fr; }
  .video-report-upload { grid-template-columns: 1fr; }
  .preventive-alert-head, .preventive-alert-form { grid-template-columns: 1fr; }
  .preventive-evidence-section { grid-row: auto; }
  .preventive-submit-bar { grid-column: 1; }
  .csv-layout { grid-template-columns: 1fr; }
  .vehicle-upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  h1 { font-size: 29px; }
  .last-update { display: none; }
  .head-actions { justify-content: flex-end; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-title, .summary-stat, .legend { padding-left: 16px; padding-right: 16px; }
  .card-head { align-items: flex-start; }
  .overall-state span:last-child { display: none; }
  .state-circle { width: 38px; height: 38px; }
  .csv-submit-row { align-items: stretch; flex-direction: column; }
  .video-report-upload { padding: 17px; }
  .upload-module-switcher { grid-template-columns: 1fr; }
  .upload-module-tab { min-height: 66px; }
  .starlink-module-panel { padding: 14px; }
  .preventive-alert-shell { padding: 14px; }
  .preventive-alert-head { gap: 14px; }
  .preventive-alert-head h2 { font-size: 22px; }
  .preventive-alert-form { padding: 10px; }
  .preventive-form-section { padding: 14px; }
  .preventive-fields-grid, .preventive-manual-iot, .preventive-observations, .batch-trace-fields, .preventive-analysis-result dl { grid-template-columns: 1fr; }
  .preventive-submit-bar { align-items: stretch; flex-direction: column; }
  .preventive-submit-bar .refresh-button { width: 100%; }
  .video-report-submit { align-items: stretch; flex-direction: column; }
  .video-report-submit .refresh-button { width: 100%; }
  .video-report-preview { flex-direction: column; }
  .video-report-file-summary { align-items: flex-start; flex-direction: column; }
  .vehicle-upload-grid { grid-template-columns: 1fr; }
}

/* Centro operacional modular */
.portal-shell {
  width: min(calc(100% - 48px), 1540px);
  margin: 0 auto;
  padding: 24px 0 18px;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 64px;
  padding: 0 2px 18px;
  border-bottom: 1px solid var(--line);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--bhp);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(226, 82, 0, 0.22);
  font: 800 20px/1 "Manrope", sans-serif;
}

.portal-brand > span:last-child { display: grid; gap: 3px; }
.portal-brand small { color: var(--muted); font: 700 9px/1 "Manrope", sans-serif; letter-spacing: 0.17em; }
.portal-brand strong { font: 750 15px/1.15 "Manrope", sans-serif; }

.portal-top-actions { display: flex; align-items: center; gap: 18px; }
.portal-live { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 11px; font-weight: 700; }
.portal-live i, .technical-source > i, .grafana-frame-label i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--green-soft);
}

.portal-refresh {
  width: 38px;
  height: 38px;
  color: var(--bhp-dark);
  background: #fff;
  border: 1px solid rgba(226, 82, 0, 0.24);
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: transform 160ms ease, background 160ms ease;
}
.portal-refresh:hover { background: var(--bhp-soft); transform: rotate(30deg); }

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  padding: 46px 4px 30px;
}

.portal-kicker {
  margin: 0 0 10px;
  color: var(--bhp);
  font: 800 10px/1.2 "Manrope", sans-serif;
  letter-spacing: 0.17em;
}

.portal-hero h1 { max-width: 760px; margin: 0 0 12px; font-size: clamp(38px, 5vw, 68px); line-height: 0.98; }
.portal-hero-copy > p:last-child { max-width: 680px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }

.portal-hero-status {
  display: grid;
  min-width: 292px;
  padding: 17px 19px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-left: 4px solid var(--yellow);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(70, 51, 40, 0.06);
}
.portal-hero-status > span { color: var(--muted); font: 800 9px/1.2 "Manrope", sans-serif; letter-spacing: 0.15em; }
.portal-hero-status strong { margin: 6px 0 5px; font: 750 17px/1.2 "Manrope", sans-serif; }
.portal-hero-status small { color: var(--muted); font-size: 10px; }

.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.module-card {
  min-width: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(70, 51, 40, 0.08);
}

.module-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-height: 88px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.module-number { color: rgba(226, 82, 0, 0.5); font: 800 13px/1 "Manrope", sans-serif; }
.module-heading > div:nth-child(2) { display: grid; gap: 4px; }
.module-heading > div:nth-child(2) > span { color: var(--muted); font: 800 9px/1.2 "Manrope", sans-serif; letter-spacing: 0.14em; }
.module-heading h2 { margin: 0; color: #211c19; font: 750 20px/1.15 "Manrope", sans-serif; letter-spacing: -0.035em; }
.module-state { padding: 6px 9px; border-radius: 999px; font: 800 8px/1 "Manrope", sans-serif; letter-spacing: 0.1em; }
.module-state.live { color: var(--green); background: var(--green-soft); }
.module-state.review { color: #7c5900; background: #fff3cf; }

.cars-overview { display: grid; grid-template-columns: 0.8fr 2fr; border-bottom: 1px solid var(--line); }
.fleet-total { display: grid; align-content: center; padding: 24px; background: var(--surface-2); border-right: 1px solid var(--line); }
.fleet-total strong { color: var(--bhp); font: 800 46px/1 "Manrope", sans-serif; }
.fleet-total span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.fleet-statuses { display: grid; grid-template-columns: repeat(3, 1fr); }
.fleet-status { display: grid; place-items: center; align-content: center; gap: 6px; padding: 18px 8px; border-right: 1px solid var(--line); }
.fleet-status:last-child { border-right: 0; }
.fleet-status strong { font: 800 25px/1 "Manrope", sans-serif; }
.fleet-status span:last-child { color: var(--muted); font-size: 9px; }

.fleet-mini-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 20px; }
.fleet-mini-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 8px 10px; border-bottom: 1px solid rgba(48,40,36,0.07); font-size: 10px; }
.fleet-mini-list > div:nth-last-child(-n+2) { border-bottom: 0; }
.fleet-mini-list span { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fleet-mini-list strong { color: var(--muted); font-size: 9px; font-weight: 700; white-space: nowrap; }

.module-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 20px;
  color: var(--bhp-dark);
  background: rgba(226, 82, 0, 0.055);
  border-top: 1px solid rgba(226, 82, 0, 0.1);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  transition: background 160ms ease, padding 160ms ease;
}
.module-link:hover { padding-right: 16px; background: var(--bhp-soft); }
.module-link b { font-size: 18px; }

.module-safety { color: #eef5fa; background: #10283f; border-color: rgba(255,255,255,0.09); }
.module-safety .module-heading { border-color: rgba(255,255,255,0.1); }
.module-safety .module-heading h2 { color: #fff; }
.module-safety .module-heading > div:nth-child(2) > span { color: #9eb0bf; }
.module-safety .module-number { color: #ff9b61; }

.safety-visual { display: grid; grid-template-columns: 124px 1fr; align-items: center; gap: 4px; min-height: 136px; padding: 18px 24px; background: linear-gradient(125deg, #173650, #0e2133); border-bottom: 1px solid rgba(255,255,255,0.1); }
.safety-orbit { position: relative; display: grid; place-items: center; width: 86px; height: 86px; margin: auto; border: 1px solid rgba(242,106,33,0.32); border-radius: 50%; }
.safety-orbit::before, .safety-orbit::after { content: ""; position: absolute; inset: 13px; border: 1px solid rgba(255,255,255,0.12); border-radius: 50%; }
.safety-orbit::after { inset: 27px; background: rgba(242,106,33,0.15); border-color: rgba(242,106,33,0.28); }
.safety-orbit span { z-index: 1; color: #f26a21; font: 800 23px/1 "Manrope", sans-serif; }
.safety-orbit i { position: absolute; width: 7px; height: 7px; background: #f26a21; border-radius: 50%; box-shadow: 0 0 12px #f26a21; }
.safety-orbit i:nth-of-type(1) { top: 8px; left: 16px; }
.safety-orbit i:nth-of-type(2) { right: 2px; bottom: 29px; }
.safety-orbit i:nth-of-type(3) { left: 5px; bottom: 20px; background: #34ba7c; box-shadow: 0 0 12px #34ba7c; }
.safety-copy { display: grid; gap: 6px; }
.safety-copy span { color: #8ea2b3; font: 800 8px/1.2 "Manrope", sans-serif; letter-spacing: 0.14em; }
.safety-copy strong { font: 750 17px/1.2 "Manrope", sans-serif; }
.safety-copy p { margin: 0; color: #aebdca; font-size: 10px; line-height: 1.45; }

.safety-events { padding: 8px 20px; }
.safety-events > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.09); }
.safety-events > div:last-child { border-bottom: 0; }
.safety-events i { width: 8px; height: 8px; border-radius: 50%; }
.safety-events i.critical { background: #ff5260; box-shadow: 0 0 0 4px rgba(255,82,96,0.12); }
.safety-events i.high { background: #f2aa22; box-shadow: 0 0 0 4px rgba(242,170,34,0.12); }
.safety-events span { display: grid; gap: 3px; }
.safety-events strong { color: #fff; font-size: 10px; }
.safety-events small { color: #94a6b5; font-size: 9px; }
.safety-events b { color: #ffb66f; font-size: 8px; letter-spacing: 0.08em; }

.human-control { display: flex; align-items: center; gap: 10px; margin: 3px 20px 14px; padding: 10px 12px; background: rgba(51,186,124,0.1); border: 1px solid rgba(51,186,124,0.18); border-radius: 9px; }
.human-control > span { display: grid; place-items: center; width: 22px; height: 22px; color: #65dfa3; border: 1px solid rgba(101,223,163,0.4); border-radius: 50%; font-size: 11px; }
.human-control p { display: grid; gap: 2px; margin: 0; color: #9eb0bf; font-size: 9px; }
.human-control strong { color: #dceae3; font-size: 9px; }
.module-link.dark { color: #ffb278; background: rgba(242,106,33,0.09); border-color: rgba(242,106,33,0.16); }
.module-link.dark:hover { background: rgba(242,106,33,0.15); }

.module-technical { grid-column: 1 / -1; }
.grafana-open { color: var(--bhp-dark); font-size: 10px; font-weight: 800; text-decoration: none; }
.grafana-open:hover { text-decoration: underline; }
.technical-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 470px; }
.grafana-frame-wrap { position: relative; min-width: 0; background: #161a1f; }
.grafana-frame-label { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 42px; padding: 0 15px; color: #b6bdc5; background: #22272d; border-bottom: 1px solid #30363d; font-size: 8px; letter-spacing: 0.1em; }
.grafana-frame-label span { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.grafana-frame-label small { color: #7e8994; font-size: 8px; letter-spacing: 0; }
.grafana-frame-wrap iframe { display: block; width: 100%; height: 428px; border: 0; background: #11161c; }
.technical-summary { padding: 28px 24px; background: var(--surface-2); border-left: 1px solid var(--line); }
.technical-summary h3 { margin: 0 0 24px; font: 750 19px/1.25 "Manrope", sans-serif; }
.technical-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.technical-metric span { color: var(--muted); font-size: 10px; }
.technical-metric strong { font: 800 24px/1 "Manrope", sans-serif; }
.technical-source { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.technical-source span { display: grid; gap: 3px; }
.technical-source strong { font-size: 10px; }
.technical-source small { color: var(--muted); font-size: 8px; }

.portal-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 4px 0; color: #8b817c; font-size: 9px; }
.portal-footer span:last-child { text-align: right; }

@media (max-width: 980px) {
  .portal-hero { grid-template-columns: 1fr; gap: 24px; }
  .portal-hero-status { min-width: 0; }
  .module-grid { grid-template-columns: 1fr; }
  .module-technical { grid-column: auto; }
  .technical-body { grid-template-columns: 1fr; }
  .technical-summary { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 680px) {
  .portal-shell { width: min(calc(100% - 26px), 560px); padding-top: 16px; }
  .portal-topbar { align-items: flex-start; }
  .portal-top-actions { justify-content: flex-end; }
  .portal-top-actions .portal-live, .portal-top-actions .last-update { display: none; }
  .portal-hero { padding-top: 32px; }
  .portal-hero h1 { font-size: 41px; }
  .module-heading { grid-template-columns: auto 1fr; min-height: 82px; padding: 16px; }
  .module-heading > :last-child { grid-column: 2; justify-self: start; }
  .cars-overview { grid-template-columns: 1fr; }
  .fleet-total { grid-template-columns: auto 1fr; align-items: center; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .fleet-total strong { font-size: 34px; }
  .fleet-mini-list { grid-template-columns: 1fr; }
  .fleet-mini-list > div:nth-last-child(2) { border-bottom: 1px solid rgba(48,40,36,0.07); }
  .safety-visual { grid-template-columns: 92px 1fr; padding-left: 16px; padding-right: 16px; }
  .safety-orbit { width: 72px; height: 72px; }
  .technical-body { min-height: 0; }
  .grafana-frame-wrap iframe { height: 360px; }
  .grafana-frame-label small { display: none; }
  .portal-footer { flex-direction: column; }
  .portal-footer span:last-child { text-align: left; }
}
