/* =========================================================
   GABBRO — antenna.css
   Antenna lab (tools/antenna.html).
   Layout and controls come from sampling.css; this file only
   adds what is specific to this tool.
   ========================================================= */

[data-section][hidden], .lab-wrap[hidden], .drop[hidden], .ctl-group[hidden], .field[hidden], .toggle[hidden],
.panel[hidden], .plot[hidden], .panel-empty[hidden], .meas-notes[hidden], .meas-flags[hidden], .dialog-list[hidden],
.pack[hidden], .pack-results[hidden], .pkgs-demo[hidden], .td-notes[hidden], .field-note[hidden], .gate-fields[hidden] { display: none; }

/* =========================================================
   SECTIONS AND DROP AREAS
   ========================================================= */
.modes { display: inline-grid; width: auto; margin: 0 0 20px; }
.modes button { padding: 0 18px; height: 34px; font-size: 13.5px; }

.drop {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s, background 0.2s;
}
.drop.is-over { border-color: rgba(var(--glow), 0.7); background: rgba(var(--glow), 0.06); }
.drop-inner { max-width: 640px; margin: 0 auto; padding: 56px 24px; text-align: center; }
.drop h2 { margin: 18px 0 10px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.drop p { margin: 0 0 22px; font-family: var(--text-font); font-size: 14px; line-height: 1.65; color: var(--text-dim); }
.drop code { font-family: var(--mono); font-size: 0.9em; color: var(--accent-3); }
.drop a { color: var(--accent-3); }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.drop-actions .btn { cursor: pointer; }
.drop .drop-error { margin: 18px 0 0; color: #f87171; font-family: var(--mono); font-size: 12.5px; }
.drop-error:empty { display: none; }
/* upload arrow drawn with gradients */
/* full-page target while files are dragged over the analysis */
.drop-overlay {
  position: fixed;
  inset: 14px;
  z-index: 300;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(var(--glow), 0.75);
  border-radius: var(--radius-lg);
  background: rgba(7, 8, 10, 0.84);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
}
.drop-overlay p { margin: 0; padding: 0 24px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; text-align: center; }
.drop-overlay code { font-family: var(--mono); font-size: 0.9em; color: var(--accent-3); }
body.is-dropping:not([data-mode="pack"]) .drop-overlay { opacity: 1; visibility: visible; }

.drop-icon {
  display: inline-block;
  width: 44px; height: 44px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background:
    linear-gradient(var(--text-dim), var(--text-dim)) center 13px / 2px 14px no-repeat,
    linear-gradient(45deg, transparent 45%, var(--text-dim) 45% 60%, transparent 60%) 15px 11px / 8px 8px no-repeat,
    linear-gradient(-45deg, transparent 45%, var(--text-dim) 45% 60%, transparent 60%) 21px 11px / 8px 8px no-repeat,
    linear-gradient(var(--text-faint), var(--text-faint)) center 31px / 20px 2px no-repeat,
    rgba(255, 255, 255, 0.02);
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */
input[type="number"], input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  font-size: 13.5px;
  color: var(--text);
}
input[type="number"] { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
input[type="text"] { font-family: var(--font); }
input[type="number"]:focus-visible, input[type="text"]:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }
input::placeholder { color: var(--text-faint); }
.unit { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-3);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.add-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.add-row .field-note { margin: 0; }
.readout {
  display: block;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

.seg-sm button { height: 26px; font-size: 12px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; font-family: var(--font); cursor: pointer; }
input[type="range"]:disabled { opacity: 0.35; cursor: default; }
.toggle-inline { margin: 0; }
.seg-inline { display: inline-grid; padding: 2px; }
.seg-inline button { padding: 0 12px; height: 24px; }

/* play / pause */
.play-row { display: grid; gap: 8px; }
.play { justify-content: center; width: 100%; cursor: pointer; font-family: var(--font); }
.play-icon {
  width: 0; height: 0;
  border-left: 9px solid currentColor;
  border-top: 5.5px solid transparent;
  border-bottom: 5.5px solid transparent;
}
.play[aria-pressed="true"] { border-color: rgba(var(--glow), 0.6); background: rgba(var(--glow), 0.12); }
.play[aria-pressed="true"] .play-icon {
  width: 9px; height: 11px;
  border: 0;
  background: linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px, currentColor 6px 9px);
}

/* overlay checklist */
.checklist { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.checklist:empty::before { content: "Carica altre misure per sovrapporle."; font-size: 12px; color: var(--text-faint); }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
}
.check:hover { background: rgba(255, 255, 255, 0.03); color: var(--text); }
.check input { accent-color: var(--accent-3); margin: 0; }
.check:has(input:disabled) { opacity: 0.45; cursor: default; }
.check .sw { margin-left: auto; }

/* =========================================================
   PACKAGES BAR
   ========================================================= */
.lab-wrap { display: grid; gap: 16px; }
.lab-error, .lab-msg { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.lab-error { color: #f87171; }
.lab-msg { color: var(--text-dim); }
.lab-error:empty, .lab-msg:empty { display: none; }

.pkgs {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.pkgs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.pkgs-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.pkgs-count { margin-left: 6px; letter-spacing: 0.04em; text-transform: none; color: var(--text-dim); }
.pkgs-hint { flex: 1 1 320px; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-faint); }
.pkgs-key { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.pkgs-add { margin-left: auto; }

.pkg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.pkg {
  --c: var(--text-faint);
  display: flex;
  min-width: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: rgba(10, 11, 14, 0.72);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.pkg:hover { border-color: rgba(255, 255, 255, 0.22); }
.pkg.is-active {
  border-color: color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 6%, rgba(10, 11, 14, 0.72));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent), 0 10px 26px -14px var(--c);
}
.pkg-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.pkg.is-active .pkg-main { cursor: default; }
.pkg-dot { width: 10px; height: 10px; border: 1.5px solid var(--text-faint); border-radius: 50%; }
.pkg.is-active .pkg-dot, .pkg.is-overlay .pkg-dot { border-color: var(--c); background: var(--c); box-shadow: 0 0 8px var(--c); }
.pkg.is-muted .pkg-dot { box-shadow: none; opacity: 0.4; }
.pkg-name {
  display: -webkit-box;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pkg-badge {
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--c);
}
.pkg-badge.is-demo { border-color: rgba(167, 139, 250, 0.35); color: var(--accent-4); }
.pkg-meta { grid-column: 2; min-width: 0; font-family: var(--mono); font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-btn {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border: 0;
  border-left: 1px solid var(--border);
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.pkg-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.pkg-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.pkg-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.pkg-btn:disabled { opacity: 0.3; cursor: default; }
.pkg-ov[aria-pressed="true"] { color: var(--c); }
.pkg-ov[aria-pressed="true"] svg { fill: color-mix(in srgb, var(--c) 22%, transparent); }
.pkg-x:hover:not(:disabled) { color: #f87171; }
.pkg button:focus-visible { outline: 2px solid var(--accent-3); outline-offset: -2px; }
.pkgs-demo {
  margin: 0;
  padding: 9px 12px 9px 14px;
  border-left: 2px solid var(--accent-4);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(167, 139, 250, 0.06);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* =========================================================
   MEASUREMENT CARD
   ========================================================= */

.meas {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr);
  gap: 20px 36px;
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.meas-id { min-width: 0; }
.meas-name {
  margin: 10px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.meas-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.meas-flags .tag { text-transform: none; }
.meas-notes {
  margin: 14px 0 0;
  padding: 10px 14px 10px 16px;
  border-left: 2px solid rgba(var(--glow), 0.8);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(var(--glow), 0.06);
  font-family: var(--text-font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.meas-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 24px;
  align-content: start;
  margin: 0;
}
.meas-info > div { min-width: 0; padding-left: 14px; border-left: 1px solid var(--border-2); }
.meas-info dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.meas-info dd { margin: 5px 0 0; font-family: var(--mono); font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.meas-info dd.sub { margin-top: 3px; font-size: 12px; color: var(--text-dim); }

/* =========================================================
   TABS (sticky under the site navbar)
   ========================================================= */
.tabs {
  position: sticky;
  top: calc(var(--nav-h) + 10px);
  z-index: 40;
  display: flex;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: rgba(13, 14, 17, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 0 auto;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.tabs button svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color 0.2s, filter 0.2s;
}
.tabs button:hover { color: var(--text-dim); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"] svg { color: rgb(var(--glow)); filter: drop-shadow(0 0 6px rgba(var(--glow), 0.6)); }
.tabs button:focus-visible { outline: 2px solid var(--accent-3); outline-offset: -2px; }
/* sliding highlight under the active tab, positioned from antenna.js */
.tabs-indicator {
  position: absolute;
  top: 5px; left: 0;
  height: 40px;
  width: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(var(--glow), 0.95), 0 6px 18px -6px rgba(var(--glow), 0.55);
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
  pointer-events: none;
}

/* tabs without controls use the whole width */
.lab.no-side { grid-template-columns: minmax(0, 1fr); }
.lab.no-side > .lab-side { display: none; }

/* the side panel sticks below the tab bar */
.lab-wrap .lab-side { top: calc(var(--nav-h) + 72px); max-height: calc(100vh - var(--nav-h) - 88px); }

/* =========================================================
   PANELS AND CHARTS
   ========================================================= */
.panel { display: grid; gap: 14px; }
.panel-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  color: var(--text-dim);
}
.plot-sub { margin: 0; padding: 10px 16px 0; }

.chart { width: 100%; }
.chart-sm { height: 240px; }
.chart-md { height: 380px; }
.chart-lg { height: 480px; }
.chart-xl { height: 620px; }
.chart-ov { height: 540px; }
.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 24px;
  font-size: 13.5px;
  color: var(--text-faint);
  text-align: center;
}
.plot .modebar { background: none !important; }
.plot .modebar-btn path { fill: var(--text-faint) !important; }
.plot .modebar-btn:hover path, .plot .modebar-btn.active path { fill: var(--text) !important; }

/* =========================================================
   OVERVIEW
   ========================================================= */
.ov-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ov-stats .stat { gap: 4px; min-width: 0; }
.ov-stats .stat-value { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--text-faint); }
.stat.is-ok .stat-value { color: var(--accent-ok); }
.stat.is-warn .stat-value { color: var(--accent-2); }
.stat.is-bad .stat-value { color: #f87171; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ov-side { display: grid; gap: 14px; }

/* =========================================================
   TIME DOMAIN
   ========================================================= */
.td-notes {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(10, 11, 14, 0.92);
}
.td-notes .diag { gap: 8px; }
.td-notes b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.td-help {
  padding: 16px 18px 18px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
}
.td-help h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.td-help ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.td-help li { font-family: var(--text-font); font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }
.td-help b { font-weight: 600; color: var(--text); }

/* =========================================================
   TABLES
   ========================================================= */
.lab-main .table-wrap { margin: 0; background: rgba(10, 11, 14, 0.92); border-radius: var(--radius-lg); }
.data-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.data-table caption {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.data-table th, .data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  color: var(--text-dim);
}
.data-table th {
  background: rgba(255, 255, 255, 0.025);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table th:first-child, .data-table td:first-child { text-align: left; color: var(--text); }
.data-table td.ok, .data-table td.bad { font-weight: 600; }
.data-table td.ok { color: var(--accent-ok); }
.data-table td.ok::before { content: "✓ "; }
.data-table td.bad { color: #f87171; }
.data-table td.bad::before { content: "✕ "; }
.data-table .caption-note { display: block; margin-top: 3px; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-faint); }
.data-table-click tbody tr { cursor: pointer; transition: background 0.15s; }
.data-table-click tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.data-table-click tr.is-current { background: rgba(34, 211, 238, 0.05); }
.data-table-click tr.is-current td:first-child { font-weight: 600; }
.cell-name { display: inline-flex; align-items: center; gap: 9px; }
.cell-name .sw { border: 1px solid var(--border-2); }

/* =========================================================
   PACK SECTION
   ========================================================= */
.pack, .pack-items { display: grid; gap: 16px; }

.pack-card {
  display: grid;
  gap: 20px;
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.2s, border-color 0.2s;
}
.pack-card:focus-within { border-color: var(--border-2); }
.pack-card.is-off { opacity: 0.45; }
.pack-card.is-error { border-color: rgba(230, 57, 70, 0.4); }
.pack-card.is-error strong { font-size: 15px; overflow-wrap: anywhere; }
.pack-error { margin: 0; font-family: var(--mono); font-size: 13px; color: #f87171; }

.pack-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.pack-include { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-3); cursor: pointer; }
.pack-title { display: grid; gap: 4px; min-width: 0; }
.pack-name.pack-name { height: 44px; padding: 0 14px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.pack-dir {
  padding-left: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pack-kind { text-transform: none; white-space: nowrap; }

.pack-body { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 28px; }
.pack-facts {
  display: grid;
  align-content: start;
  gap: 16px;
  margin: 0;
  padding-right: 28px;
  border-right: 1px solid var(--border);
}
.pack-facts dt {
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.pack-facts dd { margin: 0; font-family: var(--mono); font-size: 14px; line-height: 1.5; color: var(--text); font-variant-numeric: tabular-nums; }
.pack-facts .dim { color: var(--text-dim); font-size: 12.5px; }
.pack-facts .bad { color: #f87171; }

.pack-form { display: grid; align-content: start; gap: 16px; }
.pack-label { display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.pack-label .unit::before { content: "["; }
.pack-label .unit::after { content: "]"; }
.pack-hint { font-size: 12.5px; color: var(--text-faint); }

.pack-model { display: grid; grid-template-columns: auto minmax(0, 360px) 1fr; align-items: center; gap: 8px 16px; }
.pack-model .seg button { height: 34px; padding: 0 12px; font-size: 13px; }

.pack-fields { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 14px; }
.pack-fields.no-distance { grid-template-columns: repeat(3, minmax(110px, 1fr)); }
.pack-field { display: grid; gap: 7px; }
.pack-field input { height: 42px; font-size: 14.5px; }
/* an empty required field is outlined in amber; the optional notes are not */
.pack-field input:placeholder-shown { border-color: rgba(245, 165, 36, 0.35); }
.pack-notes input:placeholder-shown { border-color: var(--border-2); }
.pack-detected { margin: -4px 0 0; font-family: var(--mono); font-size: 12px; color: var(--accent-2); }

.pack-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.pack-actions .btn { cursor: pointer; font-family: var(--font); }
.pack-clear { color: var(--text-faint); }
.pack-status { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }

/* ready packages */
.pack-results {
  display: grid;
  gap: 18px;
  margin-top: 8px;
  padding: 24px 26px;
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.045), transparent 140px), var(--surface);
}
.pack-results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.pack-results-head .eyebrow { color: var(--accent-ok); }
.pack-results-head .eyebrow::before { background: var(--accent-ok); }
.pack-results-head h2 { margin: 8px 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.pack-results-head p { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.pack-results-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pack-results-actions .btn { cursor: pointer; font-family: var(--font); }

.pack-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pack-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 28px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(10, 11, 14, 0.7);
}
.pack-file-name { display: grid; gap: 8px; min-width: 0; }
.pack-file-name strong { font-family: var(--mono); font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.pack-file-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pack-file-tags .tag { text-transform: none; }
.pack-download { cursor: pointer; }

/* =========================================================
   CONFIRMATION DIALOG
   ========================================================= */
.dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(var(--glow), 0.08);
}
.dialog[open] { animation: dialog-in 0.28s var(--ease); }
.dialog::backdrop { background: rgba(7, 8, 10, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog-inner { display: grid; gap: 14px; padding: 26px 28px 24px; }
.dialog h2 { margin: 2px 0 0; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.dialog-text { margin: 0; font-family: var(--text-font); font-size: 14.5px; line-height: 1.65; color: var(--text-dim); }
.dialog-list {
  display: grid;
  max-height: 300px;
  margin: 4px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}
.dialog-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
}
.dialog-list li:last-child { border-bottom: 0; }
.dialog-list li span:first-child { color: var(--text); overflow-wrap: anywhere; }
.dialog-list li span:last-child { color: var(--text-faint); white-space: nowrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dialog-actions .btn { cursor: pointer; font-family: var(--font); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-ov { height: 480px; }
}

@media (max-width: 900px) {
  .ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meas { grid-template-columns: minmax(0, 1fr); padding: 20px 18px; }
  .meas-name { font-size: 24px; }
  .meas-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meas-info dd { font-size: 13.5px; }
  .meas-info dd.sub { font-size: 11.5px; }
}

@media (max-width: 760px) {
  .pack-card { padding: 18px; }
  .pack-head { grid-template-columns: auto minmax(0, 1fr); }
  .pack-kind { grid-column: 2; justify-self: start; }
  .pack-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .pack-facts { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .pack-fields, .pack-fields.no-distance { grid-template-columns: 1fr 1fr; }
  .pack-model { grid-template-columns: minmax(0, 1fr); }
  .pack-results { padding: 20px 18px; }
  .pack-file { grid-template-columns: minmax(0, 1fr); }
  .pack-download { justify-self: start; }
  .dialog-inner { padding: 22px 20px 20px; }
  .dialog-list li { flex-direction: column; gap: 2px; }
}

@media (max-width: 640px) {
  .drop-inner { padding: 40px 18px; }
  .pkgs { padding: 14px; }
  .pkg-list { grid-template-columns: minmax(0, 1fr); }
  .pkgs-add { margin-left: 0; }
  .chart-ov { height: 400px; }
  .ov-stats .stat-value { font-size: 17px; }
  .chart-xl { height: 440px; }
  .chart-lg { height: 380px; }
  .chart-md { height: 300px; }
  .tabs { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); border-radius: 0; border-left: 0; border-right: 0; }
  .tabs button { padding: 0 12px; font-size: 13px; }
  .lab-main .table-wrap {
    margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
    border-radius: 0; border-left: 0; border-right: 0;
  }
}
