:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f8fbfd;
  --ink: #17212b;
  --muted: #667684;
  --line: #d9e2ea;
  --blue: #2f6fed;
  --cyan: #00a5b8;
  --sun: #ffad0a;
  --green: #1b7f55;
  --red: #be3b3b;
  --shadow: 0 20px 45px rgba(23, 33, 43, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 173, 10, .16), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(0, 165, 184, .12), transparent 28%),
    linear-gradient(135deg, #f8fbfd 0%, var(--bg) 52%, #f1f6f8 100%);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 24px;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  min-height: calc(100vh - 36px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 18px;
  background: rgba(255, 255, 255, .76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: grid;
  gap: 8px;
  margin-top: 30px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 12px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.nav-button span {
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--blue);
}

.nav-button.active {
  background: #eef5ff;
  color: var(--ink);
}

.nav-button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.sidebar-note {
  margin-top: 28px;
  padding: 14px;
  border-radius: 14px;
  background: #17212b;
  color: #fff;
}

.sidebar-note p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
}

.workspace-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 14px;
  font-size: 17px;
}

.head-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.location-panel,
.equipment-card,
.metric-card,
.analysis-panel,
.controls-band,
.form-panel,
.library-panel {
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 18px;
  background: rgba(255, 255, 255, .84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.location-panel {
  display: grid;
  grid-template-columns: minmax(220px, .6fr) minmax(0, 1.4fr);
  gap: 18px;
  margin: 14px 0 0;
  padding: 22px;
}

.location-panel.is-hidden {
  display: none;
}

.location-panel p,
.section-title p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.equipment-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
}

.equipment-picker > :first-child {
  grid-column: 1 / -1;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd7e2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 3px solid rgba(47, 111, 237, .22);
  outline-offset: 2px;
}

.input-addon {
  position: relative;
}

.input-addon small {
  position: absolute;
  right: 12px;
  bottom: 13px;
  color: var(--muted);
}

.input-addon input {
  padding-right: 42px;
}

.status-line {
  grid-column: 2;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.selector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.equipment-card {
  min-height: 405px;
  padding: 22px;
}

.card-title,
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 173, 10, .16);
  color: #8a5b00;
  font-weight: 900;
}

.type-pill.inverter {
  background: rgba(0, 165, 184, .12);
  color: #006977;
}

.asset-stage {
  display: grid;
  place-items: center;
  min-height: 170px;
  margin: 18px 0;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(47, 111, 237, .06), rgba(255, 173, 10, .08)),
    var(--surface-soft);
}

.asset-stage img {
  width: min(150px, 48%);
  max-height: 150px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.connection-mark {
  display: grid;
  place-items: center;
  height: 405px;
}

.connection-mark span {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 20%, var(--cyan) 20% 80%, transparent 80%) center / 32px 3px no-repeat,
    radial-gradient(circle, #fff 0 56%, transparent 58%),
    linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 14px 26px rgba(0, 165, 184, .24);
}

.spec-list,
.summary-list {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px 16px;
  margin: 0;
  font-size: 13px;
}

.spec-list:empty::before {
  content: "Selecione um equipamento para ver os dados técnicos.";
  grid-column: 1 / -1;
  color: var(--muted);
}

.spec-list dt,
.summary-list dt {
  color: var(--muted);
}

.spec-list dd,
.summary-list dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

/* ── Summary list override ──────────────────────────────── */
.summary-list {
  gap: 0;
  font-size: 13px;
}

.summary-list dt,
.summary-list dd {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
}

.summary-list dt:last-of-type,
.summary-list dd:last-of-type {
  border-bottom: none;
}

.summary-list dt:nth-of-type(even),
.summary-list dd:nth-of-type(even) {
  background: rgba(47, 111, 237, .04);
}

.summary-list dt {
  font-weight: 600;
  border-radius: 6px 0 0 6px;
}

.summary-list dd {
  color: var(--blue);
  font-size: 14px;
  border-radius: 0 6px 6px 0;
}

.results-area {
  margin-top: 18px;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: 1px dashed #b6c5d3;
  border-radius: 14px;
  background: rgba(255, 255, 255, .52);
  color: var(--muted);
  font-size: 14px;
}

.empty-state::before {
  content: "☀";
  font-size: 20px;
  flex-shrink: 0;
  opacity: 0.5;
}

.empty-state strong {
  color: var(--ink);
  display: block;
  margin-bottom: 2px;
}

.empty-state span {
  font-size: 13px;
}

.results-area.is-empty .results-content {
  display: none;
}

.pre-calc-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results-area:not(.is-empty) .empty-state {
  display: none;
}

.results-area.is-fatal .section-title,
.results-area.is-fatal .metric-grid,
.results-area.is-fatal .controls-band,
.results-area.is-fatal .location-panel,
.results-area.is-fatal .quantity-picker,
.results-area.is-fatal .analysis-grid {
  display: none;
}

.metric-grid,
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 20px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--blue);
  font-size: 34px;
  font-weight: 900;
}

.controls-band {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: end;
  gap: 18px;
  margin-top: 14px;
  padding: 18px;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink);
  font-weight: 800;
}

.toggle-field input {
  width: 18px;
  min-height: 18px;
}

.quantity-picker {
  margin-top: 22px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quantity-button,
.primary-button,
.ghost-button,
.text-button {
  border-radius: 12px;
  cursor: pointer;
  font-weight: 900;
}

.quantity-button {
  min-width: 46px;
  height: 38px;
  padding: 0 12px;
  background: #eef5ff;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.quantity-button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.quantity-button.disabled,
.quantity-button:disabled {
  background: #f4f4f4;
  color: #bbb;
  border-color: #ddd;
  cursor: not-allowed;
  opacity: 0.45;
  font-weight: 500;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:disabled {
  background: #b0c4e8;
  cursor: not-allowed;
}

.calc-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin: 8px 0 4px;
}

.calc-hint-icon {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  cursor: default;
}

.calc-hint-icon:hover .calc-hint-tooltip,
.calc-hint-icon:focus-within .calc-hint-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.calc-hint-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.calc-hint-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 6px;
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.text-button.danger {
  color: var(--red);
}

.analysis-grid {
  grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr);
  margin-top: 16px;
}

.results-grid {
  grid-template-columns: minmax(260px, .48fr) minmax(0, 1.52fr);
}

.analysis-panel {
  min-width: 0;
  padding: 20px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.string-results {
  display: grid;
  gap: 14px;
}

.string-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbfd);
  overflow: hidden;
}

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

.string-card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.string-card-title strong {
  font-size: 16px;
}

.string-card-title small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.string-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, .9fr);
  gap: 16px;
  padding: 16px;
}

.string-visual {
  display: grid;
  gap: 12px;
  align-content: start;
}

.string-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.string-label {
  width: 72px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.module-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.mini-module {
  width: 18px;
  height: 26px;
  border: 2px solid var(--blue);
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 45%, rgba(47, 111, 237, .35) 47% 53%, transparent 55%),
    linear-gradient(0deg, transparent 45%, rgba(47, 111, 237, .35) 47% 53%, transparent 55%),
    #eef5ff;
}

.string-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-tile {
  padding: 10px;
  border-radius: 12px;
  background: #f3f7fb;
}

.detail-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.compat-line {
  grid-column: 1 / -1;
  padding: 10px;
  border-radius: 12px;
  background: rgba(27, 127, 85, .10);
  color: var(--green);
  font-weight: 900;
}

.compat-line.warn {
  background: rgba(255, 173, 10, .16);
  color: #8a5b00;
}

.compat-line.bad {
  background: rgba(190, 59, 59, .12);
  color: var(--red);
}

.status.ok {
  background: rgba(27, 127, 85, .12);
  color: var(--green);
}

.status.warn {
  background: rgba(255, 173, 10, .18);
  color: #8a5b00;
}

.status.bad {
  background: rgba(190, 59, 59, .12);
  color: var(--red);
}

.register-layout {
  max-width: 680px;
  margin: 0 auto;
}

.form-panel,
.library-panel {
  padding: 22px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 14px;
  background: #e8eff7;
}

.segmented.subtle {
  background: #f3f6f8;
}

.segmented button {
  min-height: 34px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.segmented button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(23, 33, 43, .08);
}

.upload-box {
  margin: 10px 0 16px;
  padding: 16px;
  border: 1px dashed #aab9c7;
  border-radius: 16px;
  background: #f8fbfd;
}

.upload-box.hidden {
  display: none;
}

.upload-box label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.upload-box p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.meta-grid {
  margin: 14px 0;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.datasheet-preview {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.datasheet-preview.hidden {
  display: none;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
}

.preview-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbfd;
}

.preview-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.preview-item strong,
.preview-item small {
  display: block;
}

.preview-item small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.library-item strong,
.library-item small {
  display: block;
}

.library-item small {
  margin-top: 4px;
  color: var(--muted);
}

.compat-banner {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  border-left: 4px solid;
  background: #f8fbfd;
  font-size: 14px;
  line-height: 1.5;
}

.compat-banner.ok {
  border-left-color: var(--green);
  background: rgba(27, 127, 85, .08);
  color: var(--green);
}

.compat-banner.warn {
  border-left-color: var(--sun);
  background: rgba(255, 173, 10, .08);
  color: #b8860e;
}

.compat-banner.bad {
  border-left-color: var(--red);
  background: rgba(190, 59, 59, .08);
  color: var(--red);
}

.compat-banner strong {
  font-weight: 600;
}

/* Status badge com texto (substitui o .status sem texto) */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge.ok {
  background: rgba(27, 127, 85, .12);
  color: var(--green);
}

.status-badge.warn {
  background: rgba(255, 173, 10, .18);
  color: #8a5b00;
}

.status-badge.bad {
  background: rgba(190, 59, 59, .12);
  color: var(--red);
}

/* ── Custom Select ──────────────────────────────────────── */
.custom-select {
  position: relative;
  font-family: inherit;
}

.custom-select {
  min-width: 0;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
}

.custom-select-trigger:hover:not(:disabled) {
  border-color: var(--blue);
}

.custom-select.is-open .custom-select-trigger {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .15);
  border-radius: 10px 10px 0 0;
}

.custom-select.is-disabled .custom-select-trigger {
  opacity: .5;
  cursor: not-allowed;
}

.cs-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .18s;
}

.custom-select.is-open .cs-chevron {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--blue);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  z-index: 200;
  scrollbar-width: thin;
}

.cs-option {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background .1s;
}

.cs-option:hover {
  background: rgba(47, 111, 237, .08);
}

.cs-option.cs-selected {
  font-weight: 600;
  color: var(--blue);
  background: rgba(47, 111, 237, .06);
}

.cs-option.cs-placeholder {
  color: var(--muted);
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .location-panel,
  .selector-grid,
  .register-layout {
    grid-template-columns: 1fr;
  }

  .status-line {
    grid-column: auto;
  }

  .connection-mark {
    height: 48px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 520px);
    padding-top: 12px;
  }

  .workspace-head,
  .section-title,
  .card-title,
  .library-head {
    align-items: start;
    flex-direction: column;
  }

  .main-nav,
  .equipment-picker,
  .location-grid,
  .metric-grid,
  .controls-band,
  .analysis-grid,
  .string-card-body,
  .string-details,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .asset-stage img {
    width: min(140px, 55%);
  }
}

/* ── Metric card color accents ──────────────────────────── */
.metric-grid .metric-card:nth-child(1) { border-top: 3px solid var(--sun); }
.metric-grid .metric-card:nth-child(2) { border-top: 3px solid var(--cyan); }
.metric-grid .metric-card:nth-child(3) { border-top: 3px solid var(--blue); }

/* ── Metric card tooltip ────────────────────────────────── */
.metric-card[data-tooltip] {
  position: relative;
  cursor: default;
}

.metric-card[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.metric-card[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Input validation ───────────────────────────────────── */
input.input-invalid {
  border-color: var(--red) !important;
  outline: 3px solid rgba(190, 59, 59, .14) !important;
  outline-offset: 1px;
}

input.input-valid {
  border-color: var(--green) !important;
}

/* ── Button loading spinner ─────────────────────────────── */
@keyframes ds-spin {
  to { transform: rotate(360deg); }
}

.is-loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: not-allowed;
}

.is-loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ds-spin 0.65s linear infinite;
  margin-left: 7px;
  vertical-align: middle;
}

/* ── Toast notification ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e293b;
  color: #f1f5f9;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media print {
  body {
    background: #fff;
  }

  .toast,
  .sidebar,
  .head-actions,
  .text-button,
  .location-panel,
  .controls-band,
  .quantity-picker {
    display: none;
  }

  .app-shell {
    display: block;
    width: 100%;
  }

  .equipment-card,
  .metric-card,
  .analysis-panel {
    box-shadow: none;
    border: 1px solid #d7d7d7;
  }
}
