/* Hudud Nazorati — Admin panel zamonaviy, tezkor va yuqori kontrastli dizayn tizimi */

:root {
  /* Light Theme */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --panel: #ffffff;
  --panel-elevated: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-soft: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-contrast: #ffffff;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --accent-shadow: rgba(37, 99, 235, 0.22);

  --ok: #16a34a;
  --ok-hover: #15803d;
  --ok-contrast: #ffffff;
  --ok-soft: #f0fdf4;
  --ok-border: #bbf7d0;

  --warn: #d97706;
  --warn-contrast: #ffffff;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-contrast: #ffffff;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);

  color-scheme: light;
}

/* Dark Theme */
html.dark, :root[data-theme="dark"] {
  --bg: #090d16;
  --bg-subtle: #111726;
  --panel: #141c2e;
  --panel-elevated: #1a243c;
  --line: #222f4b;
  --line-soft: #172138;
  --line-strong: #2f4066;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --muted-soft: #64748b;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --accent-border: rgba(59, 130, 246, 0.35);
  --accent-shadow: rgba(59, 130, 246, 0.35);

  --ok: #22c55e;
  --ok-hover: #4ade80;
  --ok-contrast: #ffffff;
  --ok-soft: rgba(34, 197, 94, 0.16);
  --ok-border: rgba(34, 197, 94, 0.35);

  --warn: #f59e0b;
  --warn-contrast: #0f172a;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --warn-border: rgba(245, 158, 11, 0.35);

  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-contrast: #ffffff;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --danger-border: rgba(239, 68, 68, 0.35);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 14px 28px -4px rgba(0, 0, 0, 0.75);

  color-scheme: dark;
}

html.light, :root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --panel: #ffffff;
  --panel-elevated: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-soft: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-contrast: #ffffff;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --accent-shadow: rgba(37, 99, 235, 0.22);

  --ok: #16a34a;
  --ok-hover: #15803d;
  --ok-contrast: #ffffff;
  --ok-soft: #f0fdf4;
  --ok-border: #bbf7d0;

  --warn: #d97706;
  --warn-contrast: #ffffff;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-contrast: #ffffff;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #090d16;
    --bg-subtle: #111726;
    --panel: #141c2e;
    --panel-elevated: #1a243c;
    --line: #222f4b;
    --line-soft: #172138;
    --line-strong: #2f4066;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --muted: #94a3b8;
    --muted-soft: #64748b;

    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-contrast: #ffffff;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --accent-border: rgba(59, 130, 246, 0.35);

    --ok: #22c55e;
    --ok-contrast: #ffffff;
    --ok-soft: rgba(34, 197, 94, 0.16);
    --ok-border: rgba(34, 197, 94, 0.35);

    --warn: #f59e0b;
    --warn-contrast: #0f172a;
    --warn-soft: rgba(245, 158, 11, 0.16);
    --warn-border: rgba(245, 158, 11, 0.35);

    --danger: #f87171;
    --danger-contrast: #ffffff;
    --danger-soft: rgba(239, 68, 68, 0.16);
    --danger-border: rgba(239, 68, 68, 0.35);

    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 6px; }
h3 { font-size: 16px; margin: 0; }
p { margin: 0 0 10px; color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
a { color: var(--accent); text-decoration: none; font-weight: 500; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  background: var(--bg-subtle);
  color: var(--text);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.error { color: var(--danger); font-size: 13px; font-weight: 500; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.noscript { padding: 32px; text-align: center; }

/* --- kirish ekrani (Auth) --- */
.center-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.auth-theme-bar {
  margin-bottom: 14px;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 410px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2px;
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
}

.brand-icon.small {
  width: 30px;
  height: 30px;
}

.auth-card label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-card input {
  width: 100%;
}

.auth-card .btn {
  width: 100%;
  margin-top: 20px;
  min-height: 42px;
  font-size: 14.5px;
}

/* --- umumiy tuzilma (Layout) --- */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 62px 1fr;
  min-height: 100%;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.topbar-title strong {
  font-size: 15.5px;
  letter-spacing: -0.015em;
  color: var(--text);
}

.topbar-status {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar a, .sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9.5px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar a:hover, .sidebar .nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.sidebar a[aria-current="page"], .sidebar .nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar .nav-icon {
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.sidebar .nav-title {
  flex: 1;
}

.sidebar .count-pill {
  margin-left: auto;
}

.sidebar .nav-sep {
  border-top: 1px solid var(--line-soft);
  margin: 10px 8px;
}

.content {
  padding: 24px 32px 80px;
  max-width: 1240px;
  width: 100%;
  min-width: 0;
  outline: none;
}

/* --- bo'limlar va sahifa elementlari --- */
.page-head {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.page-head h2 {
  font-size: 20px;
  margin: 0 0 6px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
}

.section-head .grow {
  flex: 1;
  min-width: 200px;
}

.section-head h3 {
  font-size: 15.5px;
}

.section-body {
  padding: 18px 20px;
}

.section-body.flush {
  padding: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  transition: background-color 0.12s ease;
}

.row:first-child {
  border-top: 0;
}

.row:hover {
  background: var(--bg-subtle);
}

.row .grow {
  flex: 1;
  min-width: 250px;
}

.row-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

/* --- kartalar (Overview Grid) --- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.card-icon {
  font-size: 18px;
}

.card .big {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}

.card a {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 13px;
}

/* --- formlar va boshqaruv panellari --- */
.form-grid {
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: end;
}

.form-grid label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-grid input, .form-grid select {
  width: 100%;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar .grow {
  flex: 1;
  min-width: 220px;
}

.toolbar.tight {
  margin: 0;
  gap: 8px;
}

.toolbar.inset {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.toolbar .grow input {
  width: 100%;
}

.num-input {
  width: 120px;
}

/* --- boshqaruv elementlari (Inputs & Buttons) --- */
input, select, textarea, button {
  font: inherit;
  color: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 38px;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
  opacity: 1;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input.invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-soft) !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 15px;
  min-height: 38px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  background: var(--line-soft);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Primary Button — matn rangi har doim yuqori kontrastli (--accent-contrast) */
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast) !important;
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px var(--accent-shadow);
  color: var(--accent-contrast) !important;
}

/* Danger Button */
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger) !important;
  border-color: var(--danger-border);
  font-weight: 500;
}

.btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff !important;
}

.btn.small {
  padding: 4px 10px;
  min-height: 30px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

/* --- Segment almashtirgich (.seg) --- */
.seg {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
  overflow: hidden;
}

.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  min-height: 30px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.seg button:hover:not([aria-pressed="true"]) {
  background: var(--panel);
  color: var(--text);
}

.seg button[aria-pressed="true"] {
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Active State Colors with WCAG AAA Contrast */
.seg button[aria-pressed="true"][data-state="all"] {
  background: #0284c7;
  color: #ffffff !important;
}

.seg button[aria-pressed="true"][data-state="pro"] {
  background: #7c3aed;
  color: #ffffff !important;
}
html.dark .seg button[aria-pressed="true"][data-state="pro"],
:root[data-theme="dark"] .seg button[aria-pressed="true"][data-state="pro"] {
  background: #8b5cf6;
  color: #ffffff !important;
}

.seg button[aria-pressed="true"][data-state="off"] {
  background: #64748b;
  color: #ffffff !important;
}
html.dark .seg button[aria-pressed="true"][data-state="off"],
:root[data-theme="dark"] .seg button[aria-pressed="true"][data-state="off"] {
  background: #475569;
  color: #f8fafc !important;
}

.seg button[aria-pressed="true"][data-state="default"] {
  background: var(--panel);
  color: var(--text) !important;
  border: 1px solid var(--line-strong);
}

/* --- Tanlov (Radio Card) --- */
.choice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.choice:first-child {
  border-top: 0;
}

.choice:hover {
  background: var(--bg-subtle);
}

.choice input {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.choice.selected {
  background: var(--accent-soft);
}

/* --- Belgilar (Badges) --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.015em;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-border);
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-border);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.badge.accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.badge.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

/* --- Ogohlantirishlar (Notices) --- */
.notice {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  line-height: 1.5;
}

.notice strong {
  font-weight: 600;
}

.notice.warn {
  border-color: var(--warn-border);
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.notice.danger {
  border-color: var(--danger-border);
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.notice.ok {
  border-color: var(--ok-border);
  border-left-color: var(--ok);
  background: var(--ok-soft);
}

.notice.info {
  border-color: var(--accent-border);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
}

.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ok-soft);
}

/* --- Jadvallar (Tables) --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  text-align: left;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}

thead th {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg-subtle);
  white-space: nowrap;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: var(--line-soft);
}

td.actions {
  white-space: nowrap;
  text-align: right;
}

td.actions .btn {
  margin-left: 6px;
}

.empty {
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* --- Xabarlar va Dialog Oyna (Toasts & Dialog) --- */
.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  max-width: min(440px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--panel);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  line-height: 1.45;
  /* Ko'p qatorli xabar (masalan, "o'tkazib yuborilgan qatorlar" ro'yxati) qatorlarga bo'linsin */
  white-space: pre-line;
  overflow-wrap: anywhere;
  animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(6px);
}

.toast.error {
  background: #991b1b;
  color: #ffffff !important;
  border-color: #b91c1c;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.dialog-body {
  padding: 22px 24px;
}

.dialog-body h3 {
  font-size: 17.5px;
  font-weight: 700;
  margin: 0;
}

.dialog-body hr {
  margin: 14px 0 18px;
}

.dialog-body label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 14px 0 5px;
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea {
  width: 100%;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--line);
}

/* --- Moslashuvchanlik (Responsive) --- */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
  }
  .topbar {
    padding: 12px 16px;
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .sidebar a, .sidebar .nav-item {
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 7px 11px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
  }
  .sidebar a[aria-current="page"], .sidebar .nav-item[aria-current="page"] {
    border-bottom-color: var(--accent);
  }
  .sidebar .nav-sep {
    display: none;
  }
  .content {
    padding: 18px 16px 60px;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .row .seg {
    align-self: flex-start;
  }
}

/* --- Yordamchi sinflar ---
   CSP (style-src 'self') ichki style="" atributlarini bloklaydi, shuning uchun interfeys kodida
   inline stil ishlatilmaydi — kerakli oraliqlar shu sinflar orqali beriladi. */
.no-margin { margin: 0; }
.hint.tight { margin: 4px 0 8px; }
.hint.mt-xs { margin-top: 2px; }
.toolbar.mb-sm { margin-bottom: 8px; }
.btn.ml-sm { margin-left: 10px; }
.dialog-body hr.soft { margin: 14px 0 10px; border-color: var(--line); }
.btn.confirming { background: var(--danger, #b91c1c); border-color: var(--danger, #b91c1c); color: #fff; }

/* ==========================================================================
   XAVFSIZLIK MARKAZI (SENTINEL SECURITY CENTER)
   ========================================================================== */
.sec-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.sec-tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.sec-tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.sec-tab-btn[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-shadow);
}
.sec-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.sec-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--line);
}
.sec-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.sec-pulse-dot.live {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: secPulse 1.8s infinite;
}
.sec-pulse-dot.offline {
  background: var(--warn);
}
@keyframes secPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.sec-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, box-shadow 0.15s;
}
.sec-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.sec-card-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin: 6px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.sec-card-lbl {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-threat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.sec-threat-normal { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border); }
.sec-threat-elevated { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-border); }
.sec-threat-high { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.sec-threat-critical { background: var(--danger); color: #fff; animation: secPulse 1.5s infinite; }

.sec-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-feed-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s;
}
.sec-feed-item.critical { border-left-color: var(--danger); }
.sec-feed-item.high { border-left-color: #f97316; }
.sec-feed-item.medium { border-left-color: var(--warn); }
.sec-feed-item.low { border-left-color: var(--accent); }

.sec-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.sec-feed-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.sec-feed-sample {
  background: var(--bg-subtle);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text-secondary);
}

.sec-map-container {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.sec-map-svg {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--bg-subtle);
}
.sec-map-land {
  fill: var(--line);
  stroke: var(--panel);
  stroke-width: 0.5;
}
.sec-map-dot {
  fill: var(--danger);
  r: 5;
  transition: r 0.2s;
}
.sec-map-dot:hover {
  r: 8;
}

.sec-impact-box {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
  border: 1px solid var(--line);
}
.sec-impact-box.forbidden { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.sec-impact-box.danger { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.sec-impact-box.safe { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }

.sec-mfa-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
}
.sec-recovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.sec-recovery-code {
  padding: 6px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.sec-timeline {
  border-left: 2px solid var(--line);
  padding-left: 14px;
  margin: 14px 0 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sec-timeline-step {
  position: relative;
  font-size: 13px;
}
.sec-timeline-step::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
