/* В.ПОЛЯХ — user cabinet (web). Dark engineering theme, mobile-first. */
:root {
  --dark-blue: #0B3A6E;
  --turquoise: #1FA3C6;
  --light-blue: #5CC3E6;
  --silver: #C9D3DD;
  --pink: #E68BB7;

  --bg: #061526;
  --bg-2: #0A2138;
  --panel: #0E2A45;
  --panel-2: #103458;
  --line: #1C415F;
  --text: #E6EEF5;
  --muted: #8AA2B6;
  --ok: #3FB68B;
  --warn: #E6B450;

  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Montserrat', system-ui, Arial, sans-serif;
  background: #04101d;
  color: var(--text);
  font-size: 15px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--pink); min-height: 18px; margin: 8px 0 0; font-size: 13.5px; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }
.link { background: none; border: none; color: var(--light-blue); cursor: pointer; font: inherit; padding: 0; }

/* phone frame (centers the app on desktop, full-width on mobile) */
.phone {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: radial-gradient(900px 500px at 80% -10%, #0d2b49 0%, var(--bg) 55%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-lg { gap: 14px; }
.brand-mark {
  width: 42px; height: 42px; object-fit: contain; display: inline-block;
}
.brand-mark.sm { width: 32px; height: 32px; }
.brand-name { font-weight: 700; letter-spacing: .5px; }
.brand-sub { color: var(--muted); font-size: 12px; }

/* buttons / inputs */
.btn {
  width: 100%; border: none; border-radius: 12px; padding: 15px; font: inherit; font-weight: 600;
  cursor: pointer; color: #fff; background: var(--panel); transition: .15s; margin-top: 4px;
}
.btn-primary { background: linear-gradient(135deg, var(--turquoise), var(--dark-blue)); color: #04121d; }
.btn-primary:active { filter: brightness(.94); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--light-blue); }
.btn-pink { background: var(--pink); color: #2a0d1d; }
.btn:disabled { opacity: .55; cursor: default; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 18px; cursor: pointer;
}

input, textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 13px; border-radius: 11px; font: inherit; outline: none; margin-top: 6px;
}
input:focus, textarea:focus { border-color: var(--turquoise); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.section-title { color: var(--turquoise); font-size: 12px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; }

/* segment control */
.segment {
  display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; margin: 14px 0;
}
.seg {
  flex: 1; border: none; background: transparent; color: var(--silver); font: inherit; font-weight: 600;
  padding: 11px; border-radius: 9px; cursor: pointer;
}
.seg.active { background: var(--turquoise); color: #04121d; }

/* ---- AUTH ---- */
.screen { padding: 18px; }
.auth-wrap { padding: 28px 20px; max-width: 460px; margin: 0 auto; }
.auth-wrap .brand-lg { margin-bottom: 22px; }
.form .reg-only { display: none; }
.form.show-reg .reg-only { display: block; }
.form.show-reg .login-only { display: none; }
.segment.seg-sm { margin: 0 0 14px; }
.segment.seg-sm .seg { padding: 9px; font-size: 13px; }

/* ---- topbar / layout ---- */
#main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  position: sticky; top: 0; z-index: 5;
}
#content { flex: 1; padding-bottom: 86px; }
.screen-h { font-size: 19px; margin: 4px 0 0; }
h1#hello { font-size: 23px; margin: 6px 0 8px; }

/* scan CTA */
.scan-cta {
  width: 100%; border: none; cursor: pointer; text-align: left; color: #fff;
  margin: 18px 0; padding: 22px 18px; border-radius: 20px; display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--dark-blue), var(--turquoise));
  box-shadow: 0 12px 28px rgba(31,163,198,.25);
}
.scan-ic { font-size: 30px; width: 56px; height: 56px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); border-radius: 16px; }
.scan-tx { flex: 1; display: flex; flex-direction: column; }
.scan-tx b { font-size: 18px; }
.scan-tx i { font-style: normal; color: rgba(255,255,255,.8); font-size: 13px; margin-top: 2px; }
.chev { font-size: 26px; opacity: .9; }

/* steps */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 12px 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; margin-bottom: 14px; }
.steps li::before {
  content: counter(s, decimal-leading-zero); grid-row: span 2;
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--light-blue); font-weight: 700; font-size: 13px;
}
.steps li b { display: block; }
.steps li span { color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 12.5px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; line-height: 1.4; }

/* topbar burger + menu sheet (about + supported brands) */
.topbar-actions { display: flex; gap: 6px; }
.menu-sheet { position: absolute; inset: 0; z-index: 50; }
.menu-sheet.hidden { display: none; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.menu-card {
  position: absolute; left: 0; right: 0; top: 0; background: var(--bg-2);
  border-bottom: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.menu-head b { font-size: 16px; }
.brand-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.brand-chips span {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
}

/* keep autofilled inputs on the dark theme (browser otherwise paints them white) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

/* recognition-status pills + request badge in scan history */
.pill.rec-identified { background: rgba(63, 182, 139, .16); color: var(--ok); }
.pill.rec-partial { background: rgba(230, 180, 80, .16); color: var(--warn); }
.pill.rec-not_found { background: rgba(230, 139, 183, .16); color: var(--pink); }
.hist-req { color: var(--light-blue); }

/* photo tips on the scan screen */
.tips { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 14px; }
.tips-h { color: var(--turquoise); font-size: 12px; font-weight: 600; letter-spacing: .7px;
  text-transform: uppercase; margin-bottom: 8px; }
.tips ul { margin: 0; padding-left: 18px; }
.tips li { color: var(--silver); font-size: 13px; line-height: 1.45; margin-bottom: 5px; }
.tips li:last-child { margin-bottom: 0; }
.tips li b { color: var(--text); font-weight: 600; }

/* scan view */
.scan-pane { margin-top: 4px; }
.viewport {
  position: relative; width: 100%; aspect-ratio: 3/4; max-height: 56vh; background: #000;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 14px;
}
#cam { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 14px; border: 2px dashed rgba(92,195,230,.5); border-radius: 12px; pointer-events: none; }
.cam-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 24px; color: var(--silver); background: var(--bg-2); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line); border-radius: 16px; padding: 40px 18px; cursor: pointer; color: var(--text);
  background: var(--bg-2); margin: 0;
}
.dropzone .dz-ic { font-size: 34px; color: var(--turquoise); }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; }
.preview-img { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; margin-bottom: 12px; }

/* recognition banner */
.banner { display: flex; gap: 12px; padding: 14px; border-radius: 14px; align-items: flex-start; font-weight: 600; line-height: 1.35; }
.banner.identified { background: rgba(63,182,139,.13); border: 1px solid rgba(63,182,139,.5); color: var(--ok); }
.banner.partial { background: rgba(230,180,80,.13); border: 1px solid rgba(230,180,80,.5); color: var(--warn); }
.banner.not_found { background: rgba(230,139,183,.13); border: 1px solid rgba(230,139,183,.5); color: var(--pink); }
.banner .bic { font-size: 20px; line-height: 1; }

/* equipment card */
.eq-title { font-size: 21px; font-weight: 700; margin: 16px 0 2px; }
.eq-type { color: var(--muted); margin-bottom: 14px; }
.specs { margin-top: 10px; }
.spec { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; padding: 7px 0; border-top: 1px solid rgba(28,65,95,.5); }
.spec:first-child { border-top: none; }
.spec .k { color: var(--muted); font-size: 13px; }
.spec .v { font-weight: 500; }
.conf-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.conf-bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.conf-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--turquoise), var(--light-blue)); }
.raw { white-space: pre-wrap; font-family: 'Consolas', ui-monospace, monospace; font-size: 12.5px; color: var(--silver);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; line-height: 1.4; }
.stack > * { margin-top: 14px; }
.stack > *:first-child { margin-top: 0; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: inline-block; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; }
.tchip b { color: var(--muted); font-weight: 600; }

/* status pill */
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.new { background: rgba(92,195,230,.18); color: var(--light-blue); }
.pill.in_progress { background: rgba(230,139,183,.18); color: var(--pink); }
.pill.quotation_sent { background: rgba(31,163,198,.20); color: var(--turquoise); }
.pill.closed { background: rgba(138,162,182,.18); color: var(--muted); }

/* history */
.req-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; cursor: pointer; }
.req-top { display: flex; justify-content: space-between; align-items: center; }
.req-id { color: var(--light-blue); font-weight: 700; }
.req-eq { font-weight: 600; margin: 8px 0 2px; }
.req-meta { color: var(--muted); font-size: 12.5px; }

/* success */
.success { text-align: center; padding-top: 30px; }
.success .circle { width: 84px; height: 84px; border-radius: 50%; background: rgba(63,182,139,.14); color: var(--ok);
  display: grid; place-items: center; font-size: 44px; margin: 0 auto 20px; }

/* profile */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 22px; }
.avatar { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 22px;
  background: linear-gradient(135deg, var(--turquoise), var(--dark-blue)); }
.kv { display: flex; gap: 12px; padding: 9px 0; align-items: center; }
.kv .k { color: var(--muted); width: 84px; font-size: 13px; }

/* bottom nav */
.bottomnav {
  position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-2); border-top: 1px solid var(--line); z-index: 5;
}
.nav { border: none; background: none; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer;
  padding: 9px 4px 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nav span { font-size: 19px; }
.nav.active { color: var(--turquoise); }
.nav.scan span { color: var(--pink); }

/* overlay + toast */
.overlay { position: fixed; inset: 0; background: rgba(4,16,29,.94); display: grid; place-items: center;
  z-index: 50; gap: 16px; grid-auto-flow: row; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--turquoise); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 12px; z-index: 60;
  max-width: 90%; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
