/* NurLab — обновлённый дизайн (общий для сайта и админ-панели).
   Подключается после встроенных стилей и переопределяет их. */
:root {
  color-scheme: light;
  --primary: #0F766E;
  --primary-dark: #0B3B3C;
  --primary-soft: #E6F4F1;
  --accent: #14B8A6;
  --danger: #DC2626;
  --danger-dark: #B91C1C;
  --success: #15803D;
  --warning: #D97706;
  --info: #0369A1;
  --bg-main: #F3F6F8;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E3E8EE;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 24px rgba(15, 23, 42, .05);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .08);
  --ring: 0 0 0 3px rgba(20, 184, 166, .22);
}

body { background: var(--bg-main); color: var(--text-main); letter-spacing: -0.005em; }
::selection { background: #99F6E4; }

/* ---------- Шапка ---------- */
.header, .admin-header {
  background:
    radial-gradient(1200px 300px at 85% -40%, rgba(45, 212, 191, .28), transparent 60%),
    linear-gradient(120deg, #0B3B3C 0%, #0F5E58 55%, #0F766E 100%) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 8px 24px rgba(11, 59, 60, .18) !important;
  padding-top: 14px; padding-bottom: 14px;
}
.logo-badge, .brand-badge { border-radius: 14px !important; box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 4px 12px rgba(0,0,0,.18) !important; }
.logo-title h1, .brand-info h1 { font-weight: 800 !important; letter-spacing: -0.02em !important; }
.logo-title p, .brand-info p { opacity: .75 !important; letter-spacing: .12em !important; }
.header-contacts > div { background: rgba(255,255,255,.08); padding: 5px 10px; border-radius: 999px; }
#authArea { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.auth-user, .user-chip {
  color: #fff; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.12);
  padding: 6px 12px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center;
}
.auth-user small, .user-chip small { opacity: .7; font-weight: 500; }

/* ---------- Навигация ---------- */
.nav-tabs { background: rgba(255,255,255,.92) !important; backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-color) !important; padding: 0 16px !important; gap: 4px; position: sticky; top: 0; z-index: 600; }
.tab { color: #64748B !important; font-weight: 600 !important; padding: 14px 16px !important; border-bottom: 2px solid transparent !important; }
.tab:hover { color: var(--primary) !important; }
.tab.active { color: var(--primary-dark) !important; border-bottom-color: var(--primary) !important; background: transparent !important; }

.sub-tabs { border-bottom: 1px solid var(--border-color) !important; }
.sub-tab { background: transparent !important; color: #475569 !important; border: 1px solid var(--border-color) !important; border-radius: 999px !important; font-weight: 600 !important; }
.sub-tab:hover { background: #F1F5F9 !important; color: var(--text-main) !important; }
.sub-tab.active { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; color: #fff !important; box-shadow: 0 4px 12px rgba(11, 59, 60, .22) !important; }

/* ---------- Карточки ---------- */
.view-section, .card-section { border-radius: var(--radius-lg) !important; border: 1px solid var(--border-color) !important; box-shadow: var(--shadow) !important; }
.content { padding-top: 20px !important; }
.stat-card { border-radius: var(--radius-lg) !important; box-shadow: var(--shadow) !important; }
.stat-card:hover { box-shadow: var(--shadow-hover) !important; }
.stat-data h3 { color: var(--text-main) !important; letter-spacing: -0.02em; }
.stat-icon { border-radius: 14px !important; }

#aboutViewContent, #prepViewContent { font-size: 15px; line-height: 1.7; color: #1E293B; max-width: 860px; }
#aboutViewContent h3, #prepViewContent h3 { color: var(--primary-dark); font-size: 19px; letter-spacing: -0.01em; margin: 1.2em 0 .5em; }
#aboutViewContent img, #prepViewContent img { max-width: 100%; height: auto; border-radius: 12px; }

/* ---------- Кнопки ---------- */
.btn { border-radius: 10px !important; font-weight: 600 !important; box-shadow: none !important; transition: background .15s, transform .15s, box-shadow .15s, filter .15s !important; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .12) !important; }
.btn:focus-visible { outline: none; box-shadow: var(--ring) !important; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-teal { background: var(--primary) !important; color: #fff !important; }
.btn-teal:hover { background: #0D9488 !important; }
.btn-primary { background: #fff !important; color: var(--primary-dark) !important; }
.btn-success { background: var(--success) !important; color: #fff !important; }
.btn-danger { background: var(--danger) !important; color: #fff !important; }
.btn-warning { background: var(--warning) !important; color: #fff !important; }
.btn-excel { background: #166534 !important; color: #fff !important; }
.btn-outline { background: #fff !important; border: 1px solid var(--border-color) !important; color: var(--text-main) !important; }
.btn-outline:hover { background: #F8FAFC !important; border-color: #CBD5E1 !important; }
.btn-ghost { background: #F1F5F9 !important; color: #334155 !important; }
.btn-ghost-light { background: rgba(255,255,255,.12) !important; color: #fff !important; border: 1px solid rgba(255,255,255,.18) !important; }
.btn-ghost-light:hover { background: rgba(255,255,255,.2) !important; }
.btn-xs { padding: 5px 9px !important; font-size: 11px !important; min-height: 28px !important; }
.btn-cart { background: #EA580C !important; }
.pulse-save { animation: nlPulse 1.8s infinite; }
@keyframes nlPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(15,118,110,.45) !important; } 50% { box-shadow: 0 0 0 6px rgba(15,118,110,0) !important; } }

/* ---------- Поля ---------- */
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font-family: inherit;
}
.form-field input, .form-field select, .modal-box input, .modal-box select, .inline-form input, .inline-form select, .filter-bar select, .date-field input, #view-users input, #view-users select {
  border: 1px solid #D5DCE4 !important; border-radius: 10px !important; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus, .form-field select:focus, .modal-box input:focus, .inline-form input:focus, .search-box input:focus, .search-input-wrapper input:focus {
  border-color: var(--accent) !important; box-shadow: var(--ring) !important; outline: none;
}
.search-box input, .search-input-wrapper input { border: 1px solid #D5DCE4 !important; border-radius: 999px !important; background: #F8FAFC !important; }
.form-container { border-radius: var(--radius-lg) !important; border: 1px solid var(--border-color) !important; background: #FAFCFD !important; }
.form-container.editing { background: #FFFBEB !important; border-color: #FCD34D !important; }

/* ---------- Таблицы ---------- */
.table-wrapper, .table-container { border: 1px solid var(--border-color) !important; border-radius: var(--radius-lg) !important; }
@media (min-width: 821px) and (min-height: 501px) {
  table.resizable-table th { background: #F8FAFC !important; color: #64748B !important; border-bottom: 1px solid var(--border-color) !important; letter-spacing: .06em !important; }
  table.resizable-table tbody tr:nth-child(even) { background: #FCFDFE !important; }
  table.resizable-table tbody tr:hover { background: #F0FDFA !important; }
  table.resizable-table tbody tr.active-row { background: #FEF9C3 !important; }
}
table.plain-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain-table th { text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748B; background: #F8FAFC; border-bottom: 1px solid var(--border-color); }
table.plain-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
table.plain-table td select { padding: 6px 8px; border: 1px solid #D5DCE4; border-radius: 8px; font-size: 12px; }
table.plain-table td .btn + .btn { margin-left: 4px; }
.empty-cell { text-align: center; padding: 28px !important; color: #94A3B8; }
.dup-row td { background: #FFF7ED !important; }
.dup-badge { background: #FFEDD5; color: #9A3412; border: 1px solid #FED7AA; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.price-val { font-weight: 700; color: var(--primary); }
.price-zero { font-weight: 600; color: #B45309; background: #FEF3C7; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.count-badge { font-size: 12px; color: #475569; font-weight: 600; background: #F1F5F9; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }

/* ---------- Админка: инструменты ---------- */
.view-title { margin: 0 0 4px; font-size: 18px; color: var(--text-main); letter-spacing: -0.01em; }
.view-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-muted); max-width: 760px; }
.tools-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tools-sep { flex: 1; }
.chk-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #334155; background: #F8FAFC; border: 1px solid var(--border-color); padding: 7px 12px; border-radius: 999px; cursor: pointer; user-select: none; }
.chk-pill input { accent-color: var(--primary); margin: 0; }
.bulk-panel { background: #F0FDFA; border: 1px solid #99F6E4; border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px; }
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.bulk-grid select, .bulk-grid input { padding: 9px 10px; }
.bulk-grid small { color: #64748B; font-size: 11px; }
.bulk-preview { margin-top: 12px; font-size: 13px; background: #fff; border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 12px; }
.dup-hint { font-size: 12px; color: #9A3412; align-self: center; }
.dup-hint a { color: #9A3412; font-weight: 700; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: #F8FAFC; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-color); margin-bottom: 12px; }
.filter-bar select, .date-field input { padding: 8px 10px; font-size: 12px; }
.date-field { font-size: 12px; color: #64748B; display: inline-flex; align-items: center; gap: 6px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: #F8FAFC; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 12px; }
.inline-form input, .inline-form select { padding: 9px 12px; font-size: 13px; min-width: 160px; }

/* ---------- Обзор ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.dash-card { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 16px 18px; }
.dash-card h3 { margin: 0 0 12px; font-size: 14px; color: var(--text-main); }
.dash-wide { grid-column: 1 / -1; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #EEF2F6; font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: #475569; }
.kv b.warn, .kv b.warn a { color: #C2410C; }
.muted { color: #94A3B8; font-size: 13px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.bar-track { height: 8px; background: #F1F5F9; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; }
.recent-row { display: grid; grid-template-columns: 120px auto 100px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #F1F5F9; font-size: 12.5px; }
.recent-row:last-child { border-bottom: none; }
.recent-time { color: #64748B; white-space: nowrap; }
.recent-user { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.recent-det { color: #334155; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .recent-row { grid-template-columns: 1fr auto; }
  .recent-det { grid-column: 1 / -1; }
  .recent-user { text-align: right; }
}

/* ---------- Экран входа в админку ---------- */
.login-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(900px 500px at 80% -10%, rgba(45,212,191,.35), transparent 60%), linear-gradient(140deg, #0B3B3C, #0F766E); z-index: 5000; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 20px; padding: 28px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.25); text-align: center; }
.login-card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 18px; color: #64748B; font-size: 13px; }
.login-card input { width: 100%; box-sizing: border-box; padding: 12px 14px; margin-bottom: 10px; border: 1px solid #D5DCE4; border-radius: 12px; font-size: 15px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.login-card .btn { min-height: 44px; font-size: 14px; }
.gate-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.gate-back { display: inline-block; margin-top: 14px; font-size: 12px; color: #64748B; text-decoration: none; }

/* ---------- Модалки и редактор страниц ---------- */
.modal { backdrop-filter: blur(4px); }
.modal-box { border-radius: 18px !important; box-shadow: 0 24px 60px rgba(0,0,0,.2) !important; }
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; padding: 6px; background: #F8FAFC; border: 1px solid var(--border-color); border-radius: 10px; }
.editor-toolbar button { min-width: 34px; height: 32px; border: 1px solid transparent; background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; color: #334155; font-family: inherit; }
.editor-toolbar button:hover { border-color: #CBD5E1; background: #F1F5F9; }

/* ---------- Уведомления ---------- */
#nlToastBox { position: fixed; right: 16px; bottom: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.nl-toast { background: #0F172A; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: translateY(10px); opacity: 0; transition: all .25s ease; max-width: 380px; }
.nl-toast.show { transform: none; opacity: 1; }
.nl-toast-ok { border-left: 4px solid var(--accent); }
.nl-toast-err { border-left: 4px solid #F87171; }

/* ---------- Подвал ---------- */
.footer-ad { background: #0B1F20 !important; }

/* ---------- Телефоны ---------- */
@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) {
  .header-contacts > div { padding: 3px 8px; }
  .sub-tabs-group { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tools-sep { display: none; }
  .inline-form input, .inline-form select { min-width: 0; flex: 1 1 140px; font-size: 16px; }
  .filter-bar select, .date-field input { font-size: 16px; }
  .login-card input { font-size: 16px; }
  .plain-table td { border-bottom: none !important; }
}

/* ---------- Умный помощник ---------- */
.assistant-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.assistant-btn:hover { background: rgba(255,255,255,.24); }
.assistant-btn.has-errors { animation: asGlow 2.2s infinite; }
@keyframes asGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.6); } 50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); } }
.as-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.as-badge.sev-error { background: #EF4444; color: #fff; }
.as-badge.sev-warn { background: #F59E0B; color: #fff; }
.as-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 4000; }
.as-overlay.open { opacity: 1; pointer-events: auto; }
.as-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: #F8FAFC; z-index: 4001; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s cubic-bezier(.16,1,.3,1); box-shadow: -10px 0 40px rgba(0,0,0,.15); }
.as-panel.open { transform: none; }
.as-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(16px, env(safe-area-inset-top)) 18px 14px; background: linear-gradient(120deg, #0B3B3C, #0F766E); color: #fff; }
.as-head h3 { margin: 0; font-size: 17px; }
.as-head p { margin: 3px 0 0; font-size: 12px; opacity: .8; }
.as-close { width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.18); color: #fff; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.as-summary { display: flex; gap: 6px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.as-chip { border: 1px solid var(--border-color); background: #fff; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 12px; font-weight: 600; color: #334155; cursor: pointer; white-space: nowrap; }
.as-chip b { margin-left: 4px; }
.as-chip.sev-error b { color: #DC2626; } .as-chip.sev-warn b { color: #D97706; } .as-chip.sev-info b { color: #0369A1; }
.as-chip.active { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.as-chip.active b { color: #fff; }
.as-body { flex: 1; overflow-y: auto; padding: 14px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.as-group { background: #fff; border: 1px solid var(--border-color); border-left: 4px solid #94A3B8; border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.as-group.sev-error { border-left-color: #EF4444; } .as-group.sev-warn { border-left-color: #F59E0B; } .as-group.sev-info { border-left-color: #0EA5E9; }
.as-group header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none; }
.as-gicon { font-size: 20px; width: 28px; text-align: center; }
.as-gtitle { flex: 1; font-weight: 700; font-size: 14px; }
.as-gtitle small { display: block; font-weight: 600; font-size: 11px; color: #64748B; text-transform: uppercase; letter-spacing: .05em; }
.as-gcount { background: #F1F5F9; border-radius: 999px; padding: 3px 10px; font-weight: 800; font-size: 13px; }
.sev-error .as-gcount { background: #FEE2E2; color: #B91C1C; } .sev-warn .as-gcount { background: #FEF3C7; color: #92400E; } .sev-info .as-gcount { background: #E0F2FE; color: #075985; }
.as-caret { color: #94A3B8; }
.as-hint { margin: 0 14px 10px; font-size: 12.5px; color: #475569; }
.as-bulk { margin: 0 14px 10px; }
.as-more { margin: 4px 14px 12px; }
.as-issue { border-top: 1px solid #F1F5F9; padding: 10px 14px; }
.as-line { min-width: 0; }
.as-name { font-weight: 600; font-size: 13.5px; color: var(--text-main); overflow-wrap: anywhere; }
.as-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 11.5px; color: #64748B; margin-top: 3px; align-items: center; }
.as-code { background: #F1F5F9; padding: 1px 7px; border-radius: 6px; font-weight: 600; color: #334155; }
.as-price { font-weight: 700; color: var(--primary); }
.as-member { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #EEF2F6; }
.as-member:last-child { border-bottom: none; }
.as-member-btns { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.as-keep { font-size: 11px; color: #15803D; font-weight: 700; padding: 0 6px; }
.as-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.as-inline { display: inline-flex; gap: 6px; }
.as-inline input { width: 110px; padding: 6px 10px; border: 1px solid #D5DCE4; border-radius: 8px; font: inherit; font-size: 13px; }
.as-inline input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.as-ignore { margin-left: auto; background: none; border: none; color: #94A3B8; font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.as-ignore:hover { color: #475569; }
.as-diff, .as-fill, .as-note { margin-top: 6px; font-size: 12.5px; color: #334155; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.as-empty { text-align: center; padding: 50px 20px; color: #475569; }
.as-empty div { font-size: 44px; }
.as-empty b { display: block; font-size: 16px; margin: 8px 0 4px; color: var(--text-main); }
.as-foot { display: flex; gap: 10px; align-items: center; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border-color); background: #fff; font-size: 11.5px; color: #64748B; }
.row-ai { border: none; background: none; cursor: pointer; font-size: 13px; padding: 0 0 0 4px; }
tr.row-sev-error td:first-child { box-shadow: inset 3px 0 0 #EF4444; }
tr.row-sev-warn td:first-child { box-shadow: inset 3px 0 0 #F59E0B; }
tr.flash-row td { animation: rowFlash 2s ease; }
@keyframes rowFlash { 0%, 40% { background: #FEF08A; } 100% { background: transparent; } }
.nl-toast-click { cursor: pointer; }
.nl-toast-click::after { content: ' ›'; font-weight: 700; }
@media (max-width: 820px) {
  .as-btn-label { display: none; }
  .as-member { flex-direction: column; align-items: stretch; }
  .as-member-btns { justify-content: flex-end; }
  tr.row-sev-error { border-left: 4px solid #EF4444 !important; }
  tr.row-sev-warn { border-left: 4px solid #F59E0B !important; }
}
