:root {
  --ink: #e7f6ea;
  --muted: #8fb89a;
  --line: #1c4630;
  --bg: #070907;
  --panel: #101610;
  --nav: #050705;
  --accent: #22c55e;
  --accent-dark: #15803d;
  --accent-soft: #12321c;
  --warn: #d6b15a;
  --warn-bg: #2a2414;
  --danger: #f0a0a0;
  --danger-bg: #3a1717;
  --info: #8ec5ff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { overflow-x: clip; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
img, video { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--info); }

.login-screen {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: #000;
}
.login-tint { display: none; }
.login-stage {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 0.95fr);
  width: 100%;
  height: 100%;
  margin: 0;
}
.login-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 36px 56px 48px;
  background: #000;
}
.login-logo { width: min(220px, 70%); height: auto; display: block; }
.login-copy-body { max-width: 640px; }
.login-copy h1 {
  margin: 0 0 18px;
  color: #fff;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: clamp(36px, 3.2vw, 56px);
  font-weight: 700;
  line-height: 1.02;
}
.login-copy h1 span { display: block; }
.login-copy-body p { margin: 0; max-width: 520px; color: #d5ddd8; font-size: 18px; line-height: 1.45; }
.login-aside {
  display: grid;
  place-items: center;
  padding: 32px 28px;
  background: #000;
}
.brand-mark { letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; color: var(--accent); }
.login-card {
  width: min(440px, 100%);
  background: #fff;
  color: #142018;
  border: 0;
  border-radius: 22px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 60px rgba(8, 24, 14, 0.18);
}
.login-card .brand-mark { color: #8b978f; }
.login-card h2 { margin: 10px 0 16px; color: #142018; font-size: 34px; line-height: 1.1; font-weight: 700; }
.login-card label { color: #243028; font-size: 14px; }
.login-card input {
  background: #fff;
  color: #142018;
  border: 1.5px solid #1ea34a;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.login-card .btn {
  margin-top: 8px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #3ddc57;
  color: #073012;
  font-size: 16px;
  font-weight: 700;
}
.login-card .btn:hover { background: #2fc94c; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px; }
.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #14913d;
  display: grid;
  place-items: center;
  padding: 0;
}
.eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.shell { min-height: 100vh; position: relative; z-index: 1; }
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--nav);
  color: #d7e3ec;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 4;
}
.nav strong { color: white; display: block; font-size: 16px; }
.step-label { margin: 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb89a; }
.nav nav { display: flex; flex-direction: column; gap: 6px; }
.nav a, .nav button.linkish {
  color: #d7e3ec;
  text-decoration: none;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.nav a:hover { background: #12321c; color: white; }
.nav a.active,
.nav a.active:hover {
  background: #22c55e;
  color: #041208;
  font-weight: 700;
  box-shadow: none;
}
.nav-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card-icon { color: #3f9d5a; display: block; margin-bottom: 8px; }
.card-icon .ico { width: 22px; height: 22px; }
.step-no { font-weight: 800; color: #22c55e; }
.nav .user {
  margin-top: auto;
  font-size: 13px;
  color: #adc0cd;
  background: transparent;
}
.user-box {
  background: #13261a;
  border: 1px solid #2a5a3c;
  border-radius: 12px;
  padding: 12px;
}
.user-name { color: #e7f6ea; font-weight: 700; }
.signout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #d7e3ec;
  padding-left: 0;
}
.nav-backdrop { display: none; }
.top-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #12321c;
  align-items: center;
  justify-content: center;
}
.hamburger { position: relative; width: 18px; height: 14px; }
.hamburger span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: #e7f6ea;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 6px; }
.hamburger span:nth-child(3) { top: 12px; }
.shell.nav-open .hamburger span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.shell.nav-open .hamburger span:nth-child(2) { opacity: 0; }
.shell.nav-open .hamburger span:nth-child(3) { top: 6px; transform: rotate(-45deg); }
.menu-toggle-float {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 6;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.main { margin-left: 260px; padding: 28px; min-height: 100vh; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.top h1 { margin: 0 0 4px; font-size: 28px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 16px; }
.card span { display: block; color: var(--muted); font-size: 13px; }
.card strong { display: block; margin-top: 6px; font-size: 28px; }
.panel { padding: 18px; margin-top: 16px; }
.call-section { margin-top: 72px; }
.quote-section { margin-top: 72px; }
.supplier-search {
  position: relative;
  width: min(420px, 100%);
  margin: 0 auto 16px;
}
.supplier-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #22c55e;
  display: flex;
  pointer-events: none;
}
.supplier-search input {
  padding-left: 40px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}
.pager-dots { align-self: center; padding: 0 4px; color: #8fb89a; font-weight: 700; letter-spacing: 0.12em; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #12321c; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: #184828; }
.btn.ghost { background: transparent; color: #d7e3ec; padding-left: 0; }
.btn:disabled { opacity: 0.6; cursor: wait; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #07110b;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 400;
}
select.search-highlight,
.rfq-picker-button.search-highlight {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}
.rfq-picker { position: relative; flex: 1; min-width: 260px; display: grid; gap: 6px; }
.rfq-label { font-size: 14px; font-weight: 600; }
.rfq-picker-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: #07110b;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 400;
}
.rfq-picker-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfq-picker-arrow {
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #d7efe0;
}
.rfq-picker-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  background: #07110b;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.rfq-option {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  font-weight: 400;
}
.rfq-option:hover,
.rfq-option:focus,
.rfq-option.is-selected {
  background: linear-gradient(90deg, #14532d 0%, #22c55e 100%);
  color: #f7fff8;
  outline: none;
}
.rfq-picker-list:hover .rfq-option.is-selected:not(:hover) {
  background: transparent;
  color: inherit;
}
mark.hit { background: #22c55e; color: #041208; border-radius: 4px; padding: 0 3px; font-weight: 700; }
tr.row-hit { background: rgba(34, 197, 94, 0.12); }
textarea { min-height: 80px; resize: vertical; }
.paste-box { min-height: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.item-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #07110b;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #12321c; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 650;
  background: #12321c;
  color: #b7f7c8;
}
.badge-completed, .badge-sent, .badge-verified { background: var(--accent-soft); color: var(--accent-dark); }
.badge-needs_review, .badge-failed, .badge-search_failed, .badge-no_suppliers { background: var(--warn-bg); color: var(--warn); }
.badge-searching, .badge-in_progress, .badge-submitted { background: #e7f0fa; color: var(--info); }
.badge-imported, .badge-manual, .badge-unverified_web { background: var(--warn-bg); color: var(--warn); }

.banner { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: #6d4700; margin-bottom: 14px; }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.ok { background: var(--accent-soft); color: var(--accent-dark); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 3px 8px; font-size: 12px; }
.reason { margin: 0 0 6px; }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
iframe.preview { width: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.quote-best { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.quote-best .card { display: grid; gap: 6px; }
.quote-best h3 { margin: 0; }
.quote-best .step-no { justify-self: end; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.pager .btn { min-width: 40px; padding: 8px 10px; }
.markup-bottom { margin-top: 16px; display: grid; gap: 12px; justify-items: start; }
.is-hidden { display: none !important; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }

@media (max-width: 1100px) {
  .nav { width: 220px; padding: 16px 12px; }
  .main { margin-left: 220px; padding: 20px; }
  .quote-best { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-copy { padding: 28px 32px 36px; }
}

@media (max-width: 800px) {
  .menu-toggle { display: inline-flex; }
  .shell.scrolled .menu-toggle-float {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  .nav {
    width: min(300px, 88vw);
    height: 100dvh;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    overflow: auto;
  }
  .shell.nav-open .nav { transform: translateX(0); }
  .shell.nav-open .nav-backdrop { display: block; }
  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.55);
  }
  .nav a, .nav button.linkish { min-height: 44px; }
  .main { margin-left: 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .top { flex-direction: column; align-items: stretch; }
  .top h1 { font-size: 24px; }
  .top .actions, .top .btn:not(.menu-toggle) { width: 100%; }
  .login-stage, .split, .form-grid, .quote-best { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .login-screen { height: auto; min-height: 100dvh; overflow: auto; }
  .login-stage { height: auto; }
  .login-copy { min-height: auto; padding: 24px 20px 12px; }
  .login-copy h1 { font-size: 34px; }
  .login-copy-body p { font-size: 16px; }
  .login-aside { padding: 12px 16px 28px; }
  .login-card { padding: 24px 18px 20px; }
  .login-card h2 { font-size: 28px; }
  .card strong { font-size: 22px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .rfq-picker { min-width: 0; width: 100%; }
  .call-section, .quote-section { margin-top: 28px; }
  .actions .btn, .pager .btn, .btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .paste-box { min-height: 140px; }
  iframe.preview { min-height: 280px; }
  table { min-width: 560px; }
}

@media (max-width: 520px) {
  .grid, .quote-best { grid-template-columns: 1fr; }
  .main { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .panel, .card { padding: 14px; }
  .login-copy h1 { font-size: 30px; }
  .pager { align-items: flex-start; }
}
