/* admin.savdosistem.uz. Fokusda faqat 1px ko'k chegara (halqa, qalin outline yo'q). Yozuv 12px dan kichik emas. */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #dbe1ea;
  --line-strong: #c3ccd9;
  --text: #0f172a;
  --text-2: #475569;
  --blue: #1d4ed8;
  --blue-600: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --amber: #b45309;
  --amber-soft: #fff4e0;
  --red: #b91c1c;
  --red-soft: #fdeceb;
  --radius: 10px;
  --control: 38px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0; line-height: 1.3; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 0; }

/* ---------- Boshqaruv elementlari ---------- */

input, select, textarea, button { font: inherit; color: inherit; }

input, select, textarea {
  width: 100%;
  min-height: var(--control);
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  box-shadow: none;
}

textarea { resize: vertical; min-height: 76px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
input::placeholder, textarea::placeholder { color: #94a3b8; }

input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--blue-600);
  outline: none;
  box-shadow: none;
}

select.invalid { border-color: var(--red); }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--blue-600);
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control);
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-wide { width: 100%; }
.btn:disabled, .icon-btn:disabled { opacity: .55; cursor: default; }

.btn:focus, .btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .navlink:focus-visible,
.row-link:focus-visible, .check-row:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: var(--blue-600);
}
.btn-primary:focus-visible { border-color: #0b2a8a; box-shadow: none; }

.icon-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Bildirishnoma (faqat tepada) ---------- */

#notices {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.notice {
  padding: 11px 16px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
  animation: notice-in .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.notice-success { background: var(--green); }
.notice-error { background: var(--red); }
.notice-info { background: #1e293b; }
.notice-out { opacity: 0; transform: translateY(-8px); }
@keyframes notice-in { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Kirish ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.login-card h1 { font-size: 18px; margin-bottom: 4px; }

.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand img { width: 26px; height: 26px; }
.brand:hover { text-decoration: none; }

/* ---------- Qobiq ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topnav { display: flex; gap: 4px; flex: 1; }
.navlink {
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 600;
}
.navlink:hover { background: var(--surface-2); text-decoration: none; }
.navlink.active { background: var(--blue-soft); color: var(--blue); }

.content { max-width: 1280px; margin: 0 auto; padding: 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

.back { display: inline-block; margin-bottom: 12px; color: var(--text-2); font-weight: 600; }

/* ---------- Ro'yxat ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-label { color: var(--text-2); font-size: 13px; }
.stat-value { margin-top: 4px; font-size: 20px; font-weight: 700; line-height: 1.4; overflow-wrap: break-word; }
.stat-danger .stat-value { color: var(--red); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.row-link { cursor: pointer; outline: none; }
.row-link:hover td { background: #f6f9ff; }
.row-link:focus-visible td { background: var(--blue-soft); }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--text-2); font-size: 13px; }
.empty { padding: 28px; text-align: center; color: var(--text-2); }
.text-danger { color: var(--red); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.chip-success { background: var(--green-soft); color: var(--green); }
.chip-warning { background: var(--amber-soft); color: var(--amber); }
.chip-danger { background: var(--red-soft); color: var(--red); white-space: normal; }
.chip-muted { background: #eef2f7; color: var(--text-2); }

/* ---------- Kompaniya kartasi ---------- */

.company-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.company-url { color: var(--text-2); font-weight: 600; }
.head-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue-600); }

.step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex-shrink: 0;
}
.step-dot.done { background: var(--green); border-color: var(--green); }

.stack { display: flex; flex-direction: column; gap: 18px; }

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.suffix-input { display: flex; align-items: stretch; }
.suffix-input input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}

.actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.stack > .actions { margin-top: 0; }
.spacer { flex: 1; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.check-card:hover { border-color: var(--line-strong); }
.check-card:has(input:checked) { background: var(--blue-soft); border-color: #bfd3ff; }
.check-card:has(input:focus-visible) { border-color: var(--blue-600); }
.check-card.locked { cursor: default; }
.check-card.locked:has(input:checked) { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }

.section-title { margin-bottom: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head > div:first-child { flex: 1; min-width: 0; }
.card-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

.bot-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }

.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.chat-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: break-word; }
.chat-meta { color: var(--text-2); font-size: 13px; white-space: nowrap; }

.link-box {
  padding: 14px;
  border: 1px dashed #9db8f5;
  border-radius: 10px;
  background: #f5f8ff;
}
.link-box ol { margin: 0 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.command-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.command-line code {
  padding: 6px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font: 700 16px/1.4 Consolas, "Cascadia Mono", monospace;
  letter-spacing: .04em;
}
.link-wait { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-2); font-size: 13px; }
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #bfd3ff;
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
}
.check-row:hover { text-decoration: none; background: var(--surface-2); }
.check-row.done { color: var(--green); }

/* ---------- Tor ekran ---------- */

@media (max-width: 860px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .brand span { display: none; }
}
@media (max-width: 600px) {
  .companies-table th:nth-child(n+3):nth-child(-n+5), .companies-table td:nth-child(n+3):nth-child(-n+5),
  .companies-table th:nth-child(8), .companies-table td:nth-child(8) { display: none; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
