/* ============================================================
   ОБОРОНСПЕЦПЛАВ — Design System v2
   Font: Inter (Google Fonts)
   ============================================================ */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark brand (charcoal-black) */
  --n950: #0a0a0a;
  --n900: #111111;
  --n800: #1a1a1a;
  --n700: #222222;
  --n600: #2d2d2d;
  --n500: #404040;
  /* Корпоративный красный (из логотипа ОСС) */
  --cr:    #A92828;
  --cr-h:  #8c1f1f;
  --cr-l:  rgba(169,40,40,.08);
  --cr-b:  rgba(169,40,40,.25);
  /* Gold accent (оставлен для совместимости) */
  --gold:  #A92828;
  --gold2: #c93232;
  /* Action (neutral dark for focus rings) */
  --act:   #444444;
  --act-h: #222222;
  /* Ink scale */
  --i0:  #0f172a;
  --i1:  #1e293b;
  --i2:  #334155;
  --i3:  #475569;
  --i4:  #64748b;
  --i5:  #94a3b8;
  --i6:  #cbd5e1;
  --i7:  #e2e8f0;
  --i8:  #f1f5f9;
  --i9:  #f8fafc;
  /* Semantic */
  --bg:      #edf2f7;
  --surface: #ffffff;
  --border:  #dde4ef;
  /* Status colors */
  --g6: #16a34a; --g1: #f0fdf4; --gb: #bbf7d0;
  --b6: #0369a1; --b1: #f0f9ff; --bb: #bae6fd;
  --y6: #b45309; --y1: #fffbeb; --yb: #fde68a;
  --r6: #dc2626; --r1: #fef2f2; --rb: #fecaca;
  /* Radii */
  --r2: 4px;  --r3: 6px;  --r4: 8px;
  --r5: 10px; --r6: 14px; --r7: 20px;
  /* Shadows */
  --s1: 0 1px 2px rgba(0,0,0,.05);
  --s2: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --s3: 0 4px 8px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);
  --s4: 0 12px 24px -4px rgba(0,0,0,.10), 0 4px 8px -4px rgba(0,0,0,.05);
  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Legacy aliases */
  --primary:    var(--n700);
  --text-muted: var(--i4);
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--i0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: linear-gradient(180deg, var(--n950) 0%, var(--n900) 100%);
  position: sticky; top: 0; z-index: 300;
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 2px 16px rgba(0,0,0,.35);
}

/* Top bar */
.header-top {
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 52px;
  gap: 16px;
}
.header-spacer { flex: 1; }

.nav-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 17px; font-weight: 800; letter-spacing: -.3px;
  color: #fff; text-decoration: none;
}
.nav-brand .brand-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r4);
  background: linear-gradient(135deg, var(--n600), var(--n500));
  border: 1px solid rgba(255,255,255,.12);
  font-size: 15px;
}
.nav-brand .brand-text { color: #fff; }
.nav-brand .brand-accent { color: var(--gold); }

/* Logo in header */
.nav-logo-wrap {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--r3);
  transition: opacity .15s;
}
.nav-logo-wrap:hover { opacity: .8; }
.nav-logo-img {
  height: 36px; width: auto;
  display: block;
}

/* User bar */
.nav-user {
  display: flex; align-items: center; gap: 4px;
}
.nav-user-name {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.7);
  padding: 0 10px;
}
.nav-user-link {
  font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: var(--r3);
  border: 1px solid rgba(255,255,255,.12);
  transition: all .15s;
  white-space: nowrap;
}
.nav-user-link:hover {
  background: rgba(255,255,255,.1); color: #fff;
  border-color: rgba(255,255,255,.2);
}
.nav-user-logout { border-color: rgba(220,60,60,.3); color: rgba(255,160,155,.85); }
.nav-user-logout:hover { background: rgba(180,40,40,.25); color: #fff; }

/* Tab navigation */
.tab-nav {
  display: flex; align-items: stretch;
  padding: 0 20px;
  border-top: 1px solid rgba(255,255,255,.05);
  height: 44px;
  gap: 2px;
}
.tab-link {
  display: flex; align-items: center; gap: 7px;
  padding: 0 16px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  position: relative;
}
.tab-link:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); }
.tab-link.active {
  color: #fff; font-weight: 600;
  border-bottom-color: var(--gold);
  background: rgba(255,255,255,.07);
}
.tab-icon { font-size: 14px; line-height: 1; }

/* ============================================================
   LAYOUT
   ============================================================ */
main { max-width: 1520px; margin: 0 auto; padding: 22px 24px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r5);
  box-shadow: var(--s2);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px; font-weight: 700;
  color: var(--i1);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--i7);
  display: flex; align-items: center; gap: 7px;
}

/* ============================================================
   SEARCH PANEL
   ============================================================ */
.search-panel {
  padding: 18px 20px 16px;
  margin-bottom: 14px;
}

.search-main-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}

.search-input-main {
  flex: 1;
  height: 46px;
  padding: 0 18px;
  font-size: 15px; font-weight: 400;
  border: 1.5px solid var(--i7);
  border-radius: var(--r4);
  background: var(--i9);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  color: var(--i0);
}
.search-input-main::placeholder { color: var(--i5); font-size: 14px; }
.search-input-main:focus {
  border-color: var(--act);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,0,0,.10);
}

/* Filters */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end;
}
.filter-group {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 130px;
}
.filter-group-wide { min-width: 200px; flex: 1; }
.filter-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--i5);
}
.filter-select, .filter-input {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  border: 1.5px solid var(--i7);
  border-radius: var(--r3);
  background: var(--surface);
  color: var(--i0);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.filter-select:focus, .filter-input:focus {
  border-color: var(--act);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 18px; height: 36px;
  font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--r4);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: all .15s;
  line-height: 1;
}
.btn-lg { height: 46px; padding: 0 24px; font-size: 14px; border-radius: var(--r4); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; border-radius: var(--r3); }

.btn-primary {
  background: var(--cr); color: #fff;
  box-shadow: 0 1px 3px rgba(169,40,40,.3), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-primary:hover { background: var(--cr-h); box-shadow: 0 2px 8px rgba(169,40,40,.35); }

/* Синяя (action) кнопка для форм где нужен нейтральный цвет */
.btn-navy {
  background: var(--n700); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-navy:hover { background: var(--n800); box-shadow: var(--s2); }

.btn-secondary {
  background: var(--surface); color: var(--i2);
  border: 1.5px solid var(--i7);
  box-shadow: var(--s1);
}
.btn-secondary:hover { background: var(--i9); border-color: var(--i6); }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ============================================================
   RESULTS HEADER
   ============================================================ */
.results-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; font-size: 13px;
  padding: 0 2px;
}
.results-count strong { font-size: 16px; font-weight: 700; color: var(--n700); }
.results-query { color: var(--i4); }
.results-page { color: var(--i5); }
.results-empty { color: var(--r6); font-weight: 600; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r5);
  box-shadow: var(--s2);
  overflow: hidden; overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }

thead tr {
  background: linear-gradient(180deg, var(--n800) 0%, var(--n900) 100%);
}
thead th {
  padding: 11px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: rgba(255,255,255,.8);
  text-align: left; white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.06);
}
thead th:last-child { border-right: none; }

tbody tr {
  border-bottom: 1px solid #f0f4fa;
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover { background: #f0f6ff; }

tbody td {
  padding: 10px 14px;
  font-size: 13px; vertical-align: middle;
  color: var(--i1);
}

/* Grade cell */
.grade-cell {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 13px; font-weight: 700;
  color: var(--n700); letter-spacing: .2px;
}

/* Price cell */
.price-cell {
  font-size: 13px; font-weight: 700;
  color: var(--g6); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.qty-cell { color: var(--i3); font-variant-numeric: tabular-nums; }
.size-cell { color: var(--i2); max-width: 130px; }
.mfr-cell  { font-size: 12px; }
.city-hint { color: var(--i5); font-size: 11px; }

/* Supplier link in table */
.supplier-link {
  display: inline-flex; align-items: center;
  background: var(--i9); color: var(--n700);
  border: 1px solid var(--i7);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px; font-weight: 600;
  text-decoration: none;
  max-width: 180px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  transition: all .14s;
}
.supplier-link:hover {
  background: var(--n700); color: #fff;
  border-color: var(--n700);
}

/* ============================================================
   AVAILABILITY BADGES
   ============================================================ */
.avail-badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.avail-много      { background: var(--g1); color: var(--g6); border-color: var(--gb); }
.avail-достаточно { background: var(--b1); color: var(--b6); border-color: var(--bb); }
.avail-уточняйте  { background: var(--y1); color: var(--y6); border-color: var(--yb); }
.avail-заказ      { background: var(--r1); color: var(--r6); border-color: var(--rb); }
.avail-наличии    { background: var(--g1); color: var(--g6); border-color: var(--gb); }
.avail-default    { background: var(--i8); color: var(--i3); border-color: var(--i7); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; gap: 4px; align-items: center;
  justify-content: center; margin-top: 20px;
}
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--i7); border-radius: var(--r3);
  text-decoration: none; font-size: 13px; font-weight: 500;
  color: var(--i2); background: var(--surface);
  transition: all .13s;
}
.pagination a:hover { background: var(--i9); border-color: var(--i6); }
.pagination .current {
  background: var(--n700); color: #fff;
  border-color: var(--n700); font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.30);
}

/* ============================================================
   SUGGESTIONS
   ============================================================ */
.suggestions-card {
  border-left: 3px solid var(--gold);
  background: #fffdf5;
  border-radius: var(--r4);
}
.suggestions-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.suggestions-list  { display: flex; flex-wrap: wrap; gap: 7px; }
.suggestion-chip {
  background: #fff; color: var(--n700);
  border: 1.5px solid var(--gold);
  border-radius: 20px; padding: 4px 14px;
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  font-family: 'Courier New', monospace;
  transition: all .13s;
}
.suggestion-chip:hover { background: var(--gold); color: #fff; border-color: var(--gold); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 64px 20px;
  color: var(--i4);
}
.empty-icon { font-size: 52px; margin-bottom: 14px; display: flex; justify-content: center; }
.empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: var(--i1); }
.empty-state p  { font-size: 14px; line-height: 1.7; color: var(--i4); }

.quick-examples {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: center;
  margin-top: 20px;
}
.quick-examples > span { font-size: 13px; color: var(--i5); }
.example-chip {
  background: var(--surface);
  border: 1.5px solid var(--i7);
  border-radius: 20px; padding: 5px 14px;
  font-size: 13px; font-weight: 700; color: var(--n700);
  text-decoration: none;
  font-family: 'Courier New', monospace;
  transition: all .13s; box-shadow: var(--s1);
}
.example-chip:hover { background: var(--n700); color: #fff; border-color: var(--n700); }
.stat-hint { margin-top: 18px; font-size: 13px; color: var(--i4); }
.stat-hint a { color: var(--act); font-weight: 600; text-decoration: none; }
.stat-hint a:hover { text-decoration: underline; }

/* ============================================================
   EMPTY SECTION
   ============================================================ */
.empty-section {
  text-align: center; padding: 120px 20px;
  color: var(--i4);
}
.empty-section-icon { font-size: 72px; margin-bottom: 20px; opacity: .6; }
.empty-section h2  { font-size: 26px; font-weight: 700; color: var(--i1); margin-bottom: 8px; }
.empty-section p   { font-size: 15px; }

/* ============================================================
   LOGIN PAGE — Split screen
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Left brand panel */
.login-left {
  background: linear-gradient(160deg, var(--n950) 0%, var(--n800) 60%, var(--n700) 100%);
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: 60px 64px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-brand { position: relative; z-index: 1; }
.login-brand-mark {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}
.login-brand h1 {
  font-size: 30px; font-weight: 800; letter-spacing: -.5px;
  color: #fff; line-height: 1.1; margin-bottom: 12px;
}
.login-brand h1 span { color: var(--gold); }
.login-brand p {
  font-size: 15px; color: rgba(255,255,255,.55);
  line-height: 1.6; max-width: 340px;
}
.login-features {
  margin-top: 48px; display: flex; flex-direction: column; gap: 14px;
  position: relative; z-index: 1;
}
.login-feature {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,.7);
}
.login-feature-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--gold); flex-shrink: 0;
}

/* Right form panel */
.login-right {
  background: var(--i9);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}
.login-form-wrap {
  width: 100%; max-width: 380px;
}
.login-form-title {
  font-size: 22px; font-weight: 800; color: var(--i0);
  margin-bottom: 6px;
}
.login-form-sub {
  font-size: 13px; color: var(--i4); margin-bottom: 32px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--i3); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px;
}
.form-input {
  display: block; width: 100%;
  padding: 10px 13px;
  font-size: 14px; color: var(--i0);
  border: 1.5px solid var(--i7); border-radius: var(--r4);
  background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  border-color: var(--act);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
.form-input::placeholder { color: var(--i5); }
textarea.form-input { resize: vertical; min-height: 88px; line-height: 1.5; }
.form-select {
  display: block; width: 100%;
  padding: 10px 13px; font-size: 14px; color: var(--i0);
  border: 1.5px solid var(--i7); border-radius: var(--r4);
  background: var(--surface); outline: none; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.form-select:focus { border-color: var(--act); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px; border-radius: var(--r4); margin-bottom: 14px;
  font-size: 13px; font-weight: 500; border: 1px solid;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--g1); color: #14532d; border-color: var(--gb); }
.alert-error   { background: var(--r1); color: #7f1d1d; border-color: var(--rb); }
.alert-info    { background: var(--b1); color: #0c4a6e; border-color: var(--bb); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.page-title { font-size: 20px; font-weight: 800; color: var(--i0); letter-spacing: -.3px; }
.back-link {
  font-size: 12px; color: var(--i5);
  text-decoration: none; font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.back-link:hover { color: var(--n700); }

/* ============================================================
   SUPPLIER CARDS GRID
   ============================================================ */
.suppliers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.supplier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r5);
  padding: 18px 20px;
  text-decoration: none; color: var(--i0);
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--s2);
  border-left: 4px solid var(--n600);
  transition: box-shadow .18s, border-color .18s, transform .15s;
}
.supplier-card:hover {
  box-shadow: var(--s4);
  border-left-color: var(--gold);
  transform: translateY(-2px);
}

.sc-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px;
}
.sc-name {
  font-size: 14px; font-weight: 700; color: var(--i0);
  line-height: 1.35; flex: 1;
}
.sc-badge {
  background: var(--n700); color: #fff;
  border-radius: 20px; padding: 2px 10px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
  letter-spacing: .2px;
}

.sc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.sc-meta-item { font-size: 12px; color: var(--i4); }
.sc-meta-icon { display: inline-flex; align-items: center; gap: 5px; }

.sc-grades { display: flex; flex-wrap: wrap; gap: 4px; }

.grade-tag {
  background: var(--i8); color: var(--n700);
  border: 1px solid var(--i7);
  border-radius: var(--r2); padding: 2px 7px;
  font-size: 11px; font-weight: 700;
  font-family: 'Courier New', monospace;
}
.grade-tag-more { background: #f0f4f8; color: var(--i4); border-color: var(--i7); }
.grade-tag-link { text-decoration: none; transition: all .12s; }
.grade-tag-link:hover { background: var(--n700); color: #fff; border-color: var(--n700); }

.sc-metal-types { font-size: 11px; color: var(--i5); font-style: italic; }

.sc-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid var(--i8);
  margin-top: auto;
}
.sc-date  { font-size: 11px; color: var(--i5); }
.sc-arrow { font-size: 14px; color: var(--n600); font-weight: 700; transition: transform .15s; }
.supplier-card:hover .sc-arrow { transform: translateX(4px); }

/* ============================================================
   SUPPLIER DETAIL
   ============================================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px; align-items: start;
}
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 13px;
  border-bottom: 1px solid var(--i8);
}
.stat-row:last-child { border-bottom: none; }
.stat-row span:first-child { color: var(--i4); }
.stat-row strong { font-weight: 700; color: var(--i1); }

.grades-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--i6);
  border-radius: var(--r5); padding: 36px;
  text-align: center; cursor: pointer;
  background: var(--i9);
  transition: border-color .15s, background .15s;
}
.upload-zone:hover { border-color: var(--n700); background: #edf4ff; }
.upload-zone input[type=file] { display: none; }
.upload-zone-icon { font-size: 40px; margin-bottom: 10px; }
.upload-zone-label { font-size: 15px; font-weight: 600; color: var(--i1); margin-bottom: 4px; }
.upload-zone-hint  { font-size: 12px; color: var(--i5); }

/* ============================================================
   BADGES (misc)
   ============================================================ */
.badge-count {
  background: var(--n700); color: #fff;
  border-radius: 20px; padding: 2px 10px;
  font-size: 12px; font-weight: 700;
}
.badge-fmt {
  background: var(--i8); color: var(--i3);
  border: 1px solid var(--i7);
  border-radius: var(--r2); padding: 2px 8px;
  font-size: 11px; font-weight: 600; font-family: 'Courier New', monospace;
}

/* ============================================================
   ADMIN
   ============================================================ */
.user-role-admin   { color: #9333ea; font-weight: 700; }
.user-role-manager { color: var(--n700); font-weight: 600; }

/* ============================================================
   MODAL — современный дизайн с toggle-chips
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(7,15,26,.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 64px -8px rgba(0,0,0,.28), 0 8px 24px -4px rgba(0,0,0,.12);
  width: 580px; max-width: 96vw;
  max-height: 84vh;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,.8);
  animation: slideUp .18s cubic-bezier(.22,1,.36,1);
}
@keyframes slideUp { from { transform: translateY(12px); opacity:.6; } to { transform: none; opacity:1; } }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header-title {
  font-size: 16px; font-weight: 800; color: var(--i0); letter-spacing: -.2px;
}
.modal-header-sub {
  font-size: 12px; color: var(--i5); margin-top: 1px;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--i8); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--i3); transition: all .13s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--cr-l); color: var(--cr); }

.modal-search-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.modal-search-row .modal-search-icon {
  position: absolute; left: 33px; top: 50%; transform: translateY(-50%);
  color: var(--i5); pointer-events: none;
}
.modal-search-row input {
  width: 100%;
  padding-left: 36px;
}

/* Toggle-chips grid */
.modal-chips-grid {
  flex: 1; overflow-y: auto; padding: 14px 20px;
  display: flex; flex-wrap: wrap; gap: 7px;
  align-content: flex-start;
}
.modal-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--i6);
  background: var(--surface);
  font-size: 12px; font-weight: 600;
  font-family: 'Courier New', 'Lucida Console', monospace;
  cursor: pointer; color: var(--i2);
  transition: border-color .13s, background .13s, color .13s, box-shadow .13s;
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
}
.modal-chip:hover {
  border-color: var(--cr);
  color: var(--cr);
  background: var(--cr-l);
}
.modal-chip.selected {
  background: var(--cr);
  border-color: var(--cr);
  color: #fff;
  box-shadow: 0 2px 6px var(--cr-b);
}
.modal-chip.hidden { display: none; }

/* Для ГОСТ — список с чекбоксами (более читабельно) */
.modal-list {
  flex: 1; overflow-y: auto; padding: 8px 12px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.modal-check-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r3);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--i1); transition: background .1s;
}
.modal-check-item:hover { background: var(--i9); }
.modal-check-item input[type=checkbox] {
  cursor: pointer; flex-shrink: 0;
  width: 15px; height: 15px;
  accent-color: var(--cr);
}
.modal-check-item.selected { background: var(--cr-l); }

.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
  background: var(--i9);
  border-radius: 0 0 16px 16px;
}
.modal-selected-count {
  font-size: 13px; font-weight: 600; color: var(--i3); white-space: nowrap;
}
.modal-selected-count strong { color: var(--cr); }

/* ============================================================
   CHIP INPUT (мульти-значения в фильтрах)
   ============================================================ */
.chip-input-wrap { display: flex; flex-direction: column; gap: 5px; }
.chip-list       { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.chip-item {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--n700); color: #fff;
  border-radius: 20px; padding: 2px 5px 2px 10px;
  font-size: 12px; font-weight: 600;
  font-family: 'Courier New', monospace;
}
.chip-item button {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.65); font-size: 12px;
  padding: 1px 4px; border-radius: 50%; line-height: 1;
  transition: all .1s;
}
.chip-item button:hover { background: rgba(255,255,255,.2); color: #fff; }
.chip-input-row  { display: flex; gap: 4px; }
.chip-text-input { flex: 1; }
.chip-add-btn    { flex-shrink: 0; }
.chip-open-btn   { width: 100%; justify-content: flex-start; gap: 6px; }

/* Chip-picker — поле, которое выглядит как input, но открывает модалку */
.chip-picker {
  min-height: 34px;
  padding: 3px 10px;
  border: 1.5px solid var(--i7);
  border-radius: var(--r3);
  background: var(--surface);
  cursor: pointer;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
.chip-picker:hover  { border-color: var(--i5); }
.chip-picker:focus  { outline: none; border-color: var(--act); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.chip-picker-ph     { font-size: 13px; color: var(--i5); pointer-events: none; }

/* Кнопка открытия выбора видов металла (dropdown) */
.mt-dropdown-wrap { position: relative; }
.mt-dropdown-panel {
  display: none;
  position: absolute; top: 100%; left: 0; z-index: 200;
  margin-top: 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r4);
  box-shadow: var(--s3);
  min-width: 220px; max-height: 240px;
  overflow-y: auto; padding: 6px 0;
}
.mt-dropdown-panel.open { display: block; }
.mt-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  transition: background .1s;
}
.mt-dropdown-item:hover { background: var(--i9); }
.mt-dropdown-item input { cursor: pointer; accent-color: var(--n700); }

/* ============================================================
   MULTI-FIELD (несколько телефонов / email)
   ============================================================ */
.multi-field-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.multi-field-row .form-input { margin-bottom: 0; }
.btn-remove-field {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--i8); border: 1.5px solid var(--i7);
  color: var(--i3); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .13s; line-height: 1;
}
.btn-remove-field:hover { background: var(--r1); border-color: var(--rb); color: var(--r6); }

/* ============================================================
   SORTAMENT LINK (кликабельный сортамент в карточке поставщика)
   ============================================================ */
.sortament-link {
  color: var(--n700); text-decoration: none; font-weight: 500;
  border-bottom: 1px dashed var(--i6);
  transition: color .13s, border-color .13s;
}
.sortament-link:hover { color: var(--gold); border-bottom-color: var(--gold); }

/* OSM map link */
.osm-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--act);
  text-decoration: none; margin-top: 4px;
}
.osm-link:hover { text-decoration: underline; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Tablet landscape ≤1024px ──────────────────────────────── */
@media (max-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr; }
  .form-grid     { grid-template-columns: 1fr; }
  .login-left    { display: none; }
  .login-page    { grid-template-columns: 1fr; }
}

/* ── Tablet portrait ≤768px ────────────────────────────────── */
@media (max-width: 768px) {
  .header-top   { padding: 0 14px; height: 46px; }
  .nav-logo-img { height: 28px; }

  .tab-nav  { padding: 0 6px; overflow-x: auto; scrollbar-width: none; height: 38px; gap: 0; }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-link { padding: 0 10px; font-size: 12px; gap: 5px; }

  main          { padding: 12px 12px; }
  .card         { padding: 16px 16px; }
  .search-panel { padding: 14px 16px 12px; }

  .search-main-row   { flex-wrap: wrap; }
  .filter-row        { flex-direction: column; }
  .filter-group,
  .filter-group-wide { min-width: 100%; }

  .suppliers-grid { grid-template-columns: 1fr; }
  .nav-user-name  { display: none; }
  .login-right    { padding: 32px 20px; }
  .page-header    { flex-wrap: wrap; gap: 10px; }
  .modal-box      { max-height: 92vh; }
}

/* ── Phone ≤480px ──────────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 13px; }

  /* Header compact */
  .header-top   { padding: 0 10px; height: 44px; }
  .nav-logo-img { height: 26px; }

  /* Nav user: иконки без текста */
  .nav-link-text  { display: none; }
  .nav-user-link  { padding: 5px 8px; }
  .nav-user-name  { display: none; }

  /* Табы: иконки без подписей */
  .tab-link-text { display: none; }
  .tab-link      { padding: 0 12px; }

  /* Layout */
  main  { padding: 10px 10px; }
  .card { padding: 12px 14px; margin-bottom: 12px; }
  .search-panel    { padding: 12px 14px 10px; }
  .search-input-main { height: 42px; font-size: 14px; }
  .btn-lg { height: 42px; }

  /* Фильтры: скрыты по умолчанию, открываются кнопкой */
  .filter-row { display: none !important; }
  .filter-row.filters-open { display: flex !important; }
  .filter-toggle { display: inline-flex !important; }

  /* Таблицы: принудительная ширина → горизонтальный скролл */
  .table-wrap table { min-width: 580px; }
  .table-wrap       { border-radius: var(--r4); }
  /* Визуальная тень справа — подсказка о скролле */
  .table-wrap::after {
    content: '';
    position: absolute; right: 0; top: 0; bottom: 0; width: 24px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,.06));
    pointer-events: none; border-radius: 0 var(--r4) var(--r4) 0;
  }
  .table-wrap { position: relative; }

  /* Модалки — bottom-sheet */
  .modal-overlay { align-items: flex-end; }
  .modal-box {
    width: 100%; max-width: 100%;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
  }
  .modal-footer { border-radius: 0; }
  .modal-chips-grid { padding: 10px 14px; gap: 6px; }
  .modal-chip { padding: 5px 11px; font-size: 12px; }

  /* Пагинация компактная */
  .pagination { flex-wrap: wrap; gap: 3px; }
  .pagination a, .pagination span {
    min-width: 30px; height: 30px; font-size: 12px; padding: 0 7px;
  }

  /* Supplier cards: скрыть теги марок (слишком много места) */
  .sc-grades { display: none; }

  /* Быстрые примеры на стартовом экране */
  .quick-examples  { gap: 6px; }
  .example-chip    { font-size: 12px; padding: 4px 10px; }
  .empty-state     { padding: 40px 16px; }
  .empty-state h3  { font-size: 17px; }

  /* Upload zone */
  .upload-zone { padding: 24px 16px; }

  /* Page header: кнопка во всю ширину */
  .page-header > div:last-child { width: 100%; }
  .page-header > div:last-child > .btn { width: 100%; justify-content: center; }

  /* Results header: перенос */
  .results-header { flex-wrap: wrap; gap: 4px; }

  /* Admin: форма сброса пароля — стекируем на маленьких экранах */
  .table-wrap form[method="post"] { flex-wrap: wrap; gap: 4px; width: 100%; }
  .table-wrap form[method="post"] .form-input { width: 100% !important; font-size: 12px; }
}

/* Filter toggle — скрыт на десктопе, показывается через .filter-toggle на mobile */
.filter-toggle { display: none; }
