/* styles.css — NTC Solutions RFQ PWA. Mobile-first, industrial aerospace theme. */
:root {
  --navy: #0a111c;
  --navy-2: #0f1c2e;
  --steel: #16273d;
  --steel-2: #1d3550;
  --panel: #12203380;
  --line: #26405e;
  --accent: #4d82c0;
  --accent-2: #6fa3d8;
  --accent-deep: #2f5d86;
  --silver: #c8d2dd;
  --text: #eaf1f8;
  --muted: #93a6bd;
  --danger: #e26d6d;
  --ok: #58c08a;
  --field-bg: #0d1826;
  --field-line: #2a486b;
  --radius: 12px;
  --tap: 46px;
  --maxw: 940px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, #16273d 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #12253b 0%, transparent 55%),
    var(--navy);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
h1,h2,h3,h4 { line-height: 1.25; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);border:0; }

/* ---------- App shell ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(10,17,28,.96), rgba(10,17,28,.82));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-header .logo { height: 40px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.app-header .brand { display: flex; flex-direction: column; }
.app-header .brand .name { font-weight: 700; letter-spacing: .3px; font-size: 15px; }
.app-header .brand .sub { font-size: 11px; color: var(--muted); }
.app-header .spacer { flex: 1; }
.header-badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 14px 14px 150px; }
/* Review step can be tall (multi-line aerial + summary) — let it flow & stay clear of the action bar */
.step[data-stepkey="review"] { min-height: 40vh; }
#aerialPreview { overflow-x: auto; }

/* Customer-mode banner */
.customer-banner {
  display: flex; gap: 10px; align-items: center;
  background: linear-gradient(135deg, #14324f, #0f2138);
  border: 1px solid var(--accent-deep); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px;
}
.customer-banner .ico { font-size: 20px; }

/* ---------- Progress / stepper ---------- */
.progress { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.progress::-webkit-scrollbar { display: none; }
.step-dot {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--field-bg);
  color: var(--muted); border-radius: 999px; padding: 7px 12px; font-size: 12.5px;
  cursor: pointer; white-space: nowrap; min-height: 38px;
}
.step-dot .n { width: 20px; height: 20px; border-radius: 50%; background: var(--steel); color: var(--silver);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.step-dot.active { border-color: var(--accent); color: var(--text); background: #12283f; }
.step-dot.active .n { background: var(--accent); color: #06101d; }
.step-dot.done .n { background: var(--ok); color: #06101d; }

/* ---------- Cards / sections ---------- */
.card {
  background: linear-gradient(180deg, rgba(22,39,61,.6), rgba(13,24,38,.6));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.card > h2 .num { background: var(--accent); color: #06101d; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.card > .hint { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; color: var(--silver); margin-bottom: 5px; font-weight: 600; }
label .req { color: var(--accent-2); margin-left: 2px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=number], input[type=email], input[type=tel], select, textarea {
  width: 100%; min-height: var(--tap);
  background: var(--field-bg); color: var(--text);
  border: 1px solid var(--field-line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77,130,192,.28);
}
input::placeholder, textarea::placeholder { color: #5c7690; }
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2393a6bd' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(226,109,109,.2); }
.err-msg { color: var(--danger); font-size: 11.5px; margin-top: 4px; min-height: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.row-3 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }

/* Segmented toggle (unit system) */
.seg { display: inline-flex; background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 9px 14px; min-height: 40px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent); color: #06101d; }

/* Checkbox / option chips */
.opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--field-line); border-radius: 10px; background: var(--field-bg); cursor: pointer;
  min-height: var(--tap);
}
.opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.opt .opt-body { flex: 1; }
.opt .opt-title { font-size: 14px; color: var(--text); font-weight: 600; }
.opt.checked { border-color: var(--accent); background: #11273e; }
.opt .note-input { margin-top: 8px; }

/* ---------- Tanks ---------- */
.tank {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
  background: rgba(13,24,38,.55);
}
.tank-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tank-head .badge { background: var(--accent); color: #06101d; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; }
.tank-head .t-name { flex: 1; font-weight: 700; font-size: 15px; }
.tank-vol {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.vol-chip { background: #0e2036; border: 1px solid var(--field-line); border-radius: 10px; padding: 9px 11px; }
.vol-chip .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.vol-chip .v { font-size: 16px; font-weight: 700; color: var(--accent-2); }
.vol-chip .v small { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ---------- Spec picker ---------- */
.spec-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.spec-search { flex: 1; min-width: 160px; }
.spec-count { font-size: 12px; color: var(--muted); align-self: center; }
.spec-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.spec-group > summary { list-style: none; cursor: pointer; padding: 12px 14px; background: #10233a;
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; min-height: var(--tap); }
.spec-group > summary::-webkit-details-marker { display: none; }
.spec-group > summary .chev { transition: transform .2s; color: var(--muted); }
.spec-group[open] > summary .chev { transform: rotate(90deg); }
.spec-group .sg-count { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.spec-list { padding: 6px 10px 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 11px 16px; border-radius: 11px; font-size: 14.5px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; font-family: inherit; text-decoration: none;
}
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #06101d; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border-color: var(--field-line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: transparent; border-color: #6e3a3a; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

/* ---------- Sticky action bar ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(10,17,28,.98), rgba(10,17,28,.86));
  border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.actionbar .save-state { font-size: 11.5px; color: var(--muted); flex: 1; }
.actionbar .btn { flex: 0 0 auto; }

/* ---------- Aerial preview ---------- */
.aerial-wrap { background: #fff; border-radius: 10px; padding: 8px; overflow-x: auto; }
.aerial-svg { display: block; width: 100%; min-width: 320px; height: auto; }
.aerial-empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(4,9,16,.72); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: linear-gradient(180deg, #14263c, #0e1b2c); border: 1px solid var(--line); border-radius: 16px;
  width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; padding: 20px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .qr-box { background: #fff; padding: 12px; border-radius: 12px; display: grid; place-items: center; margin: 14px 0; }
.modal .qr-box canvas { max-width: 100%; height: auto; image-rendering: pixelated; }
.link-field { display: flex; gap: 8px; }
.link-field input { font-size: 12.5px; }
.share-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.modal .close-x { float: right; background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #16324e; color: var(--text);
  border: 1px solid var(--accent); border-radius: 10px; padding: 10px 16px; font-size: 13px; z-index: 80; box-shadow: var(--shadow); }

/* ---------- Review summary ---------- */
.summary-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.summary-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: rgba(13,24,38,.5); }
.summary-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.summary-item .v { font-size: 14px; margin-top: 3px; }
.pill { display: inline-block; background: #12283f; border: 1px solid var(--field-line); border-radius: 999px; padding: 3px 10px; font-size: 12px; margin: 2px 4px 2px 0; }

.section-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }

/* ---------- Responsive up-scaling ---------- */
@media (min-width: 620px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .app-header .logo { height: 46px; }
}
@media (min-width: 900px) {
  .wrap { padding-top: 20px; }
  .tank-vol { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Focus visibility for keyboard users */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ============================================================
   v3 — professional polish, address block, footer, custom specs
   ============================================================ */

/* Header: make the NTC logo prominent */
.app-header {
  background: linear-gradient(180deg, rgba(10,17,28,.98), rgba(12,22,36,.90));
  box-shadow: 0 2px 18px rgba(0,0,0,.45);
}
.app-header .logo {
  height: 46px; width: 46px; border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, #1c2f49, #0a111c);
  padding: 3px; box-shadow: 0 0 0 1px rgba(120,160,210,.28), 0 4px 12px rgba(0,0,0,.5);
}
.app-header .brand .name {
  font-size: 16px;
  background: linear-gradient(90deg, #eaf1f8, #9fc0e0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.header-badge {
  background: linear-gradient(180deg, rgba(77,130,192,.18), rgba(47,93,134,.12));
  border-color: var(--accent-deep); color: var(--accent-2); font-weight: 600;
}

/* Card header accent + subtle depth */
.card { position: relative; overflow: hidden; }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent-2), transparent 70%); opacity: .8;
}
.card > h2 .num {
  box-shadow: 0 3px 10px rgba(77,130,192,.4);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

/* Address sub-heading inside Details */
.subhead {
  margin: 20px 0 12px; font-size: 13px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--accent-2); border-bottom: 1px solid var(--line); padding-bottom: 7px;
}

/* Stepper refinements */
.step-dot { transition: background .15s, border-color .15s, color .15s; }
.step-dot.active { box-shadow: 0 4px 14px rgba(77,130,192,.28); }

/* Spec group polish */
.spec-group { transition: border-color .15s; }
.spec-group[open] { border-color: var(--accent-deep); }
.spec-group .sg-name { font-weight: 700; }
.opt-custom { border-style: dashed; }
.opt-custom .opt-title { color: var(--accent-2); }
.opt-custom.checked { border-style: solid; }

/* Buttons: gentle lift */
.btn-primary { box-shadow: 0 6px 16px rgba(77,130,192,.32); }
.btn-primary:hover { filter: brightness(1.05); }

/* App footer — "Powered by NTC Solutions" */
.app-foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 26px auto 4px; padding: 16px; color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--line);
}
.app-foot .foot-logo {
  height: 26px; width: 26px; border-radius: 7px; padding: 2px;
  background: radial-gradient(circle at 50% 35%, #1c2f49, #0a111c);
  box-shadow: 0 0 0 1px rgba(120,160,210,.22);
}
.app-foot strong { color: var(--silver); font-weight: 700; }

/* Volume chips: subtle gradient */
.vol-chip { background: linear-gradient(180deg, #10233b, #0c1a2c); }
.vol-chip .v { text-shadow: 0 1px 6px rgba(77,130,192,.25); }

/* ---------- AI suggestion box ---------- */
.suggest-box {
  border: 1px solid var(--accent-deep); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20,50,79,.5), rgba(12,26,44,.5));
  padding: 14px; margin-bottom: 16px;
}
.suggest-head { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-badge {
  background: linear-gradient(135deg, #6fa3d8, #2f5d86); color: #06101d; font-weight: 800;
  font-size: 10px; letter-spacing: .5px; padding: 3px 8px; border-radius: 6px;
}
.suggest-opts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.suggest-opt {
  border: 1px solid var(--field-line); border-radius: 10px; padding: 12px; background: var(--field-bg);
}
.suggest-opt.recommended { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(77,130,192,.25); }
.suggest-opt .so-title { font-size: 13px; font-weight: 700; color: var(--silver); margin-bottom: 8px; }
.suggest-opt .btn { margin-top: 10px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.flow-chip {
  display: inline-block; background: #12283f; border: 1px solid var(--field-line);
  border-radius: 7px; padding: 4px 9px; font-size: 11.5px; color: var(--text); white-space: nowrap;
}
.flow-chip.dry { border-style: dashed; color: var(--muted); }
.flow-arrow { color: var(--accent-2); font-weight: 700; font-size: 12px; }

/* Process-flow preview area on the Tanks step */
.flow-wrap { margin-top: 16px; }
@media (min-width: 720px) { .suggest-opts { grid-template-columns: 1fr 1fr; } }

/* ---------- Tank description dropdown + apply-size ---------- */
.tank-head { align-items: flex-start; }
.tank-head .badge { margin-top: 4px; }
.tank-head .tank-rm { margin-top: 2px; }
.tank-name-field { flex: 1; margin-bottom: 0; }
.tank-name-field select { min-height: 42px; font-weight: 600; }
.tank-name-field input { margin-top: 8px; }
.apply-size-wrap { margin-top: 10px; }
.apply-size-btn { width: 100%; border-style: dashed; font-weight: 600; color: var(--accent-2); }
.apply-size-btn:hover { border-color: var(--accent); border-style: solid; }

/* Equipment card with sub-questions (Ovens) */
.opt-card { border: 1px solid var(--field-line); border-radius: 10px; background: var(--field-bg); margin-bottom: 8px; padding: 11px 12px; }
.opt-card.checked { border-color: var(--accent); background: #11273e; }
.opt-head { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-height: 24px; }
.opt-head > input[type=checkbox] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
/* Make equipment options match the Quality/Support look (full-width note + title) */
.opt-card .opt-body { flex: 1 1 auto; min-width: 0; }
.opt-card .opt-title { font-size: 14px; color: var(--text); font-weight: 600; }
.opt-card .note-input { margin-top: 8px; width: 100%; }
.opt-extras { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--field-line); }
.opt-extras.hidden { display: none; }
.mini-check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mini-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.mini-check label { margin: 0; font-weight: 600; color: var(--text); }
.mini-label { display: block; font-size: 12px; color: var(--accent-2); margin: 6px 0 4px; }

/* Process-line header + separator on the Tanks page */
.line-header {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 14px; padding: 11px 14px;
  border: 1px solid var(--accent-deep);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(77,130,192,.18), rgba(12,26,44,.35));
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.line-header:first-child { margin-top: 6px; }
.line-badge { background: var(--accent); color: #06101d; font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; white-space: nowrap; }
.line-name { font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: .2px; }
.line-count { margin-left: auto; font-size: 12px; color: var(--muted); border: 1px solid var(--field-line); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

/* Rectifier cards (Real Estate step) */
.rect-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: rgba(13,24,38,.55); }
.rect-card .field { margin-bottom: 10px; }
.rect-card .btn-danger { min-height: 36px; }

/* Reorder controls */
.tank-ctrls { display: flex; gap: 4px; margin-top: 2px; flex: 0 0 auto; }
.tank-move { min-height: 36px; padding: 6px 10px; line-height: 1; font-size: 15px; font-weight: 700; }
.tank-move:disabled { opacity: .35; }
.tank-add { color: var(--ok); border-color: #2e6b48; }
.tank-add:hover { border-color: var(--ok); background: #12281c; }

/* ============================================================
   App shell — flex column so the header, scrollable content and
   action bar always fit the viewport on every platform/size.
   ============================================================ */
html { height: 100%; }
body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.app-header { position: static; flex: 0 0 auto; }
.wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 28px; }
.actionbar { position: static; flex: 0 0 auto; }
/* stepper stays pinned at the top of the scrolling content */
.progress { position: sticky; top: 0; z-index: 20; background: linear-gradient(180deg, rgba(10,17,28,.98), rgba(10,17,28,.86)); backdrop-filter: blur(6px); margin: 0 -14px; padding: 6px 14px 10px; }
.step[data-stepkey="review"] { min-height: auto; }
