/* ===== NGCO — фирменный стиль (палитра из brand.md) ===== */
:root {
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --text: #14202E;
  --accent: #0E5EA8;
  --accent-dark: #0B2545;
  --neutral: #6B7A8F;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(11, 37, 69, 0.08);
  --ease-in: cubic-bezier(0.4, 0.0, 0.2, 1.0);
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1.0);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text); letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: 40px; line-height: 1.15; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.muted { color: var(--neutral); }
.inline-icon { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 200ms var(--ease-in), border-color 200ms var(--ease-in), transform 200ms var(--ease-in), box-shadow 200ms var(--ease-in);
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: rgba(14, 94, 168, 0.08); }
.btn-lg { padding: 13px 26px; font-size: 16px; }

/* ===== Шапка витрины ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid rgba(11, 37, 69, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 20px; }
.logo { width: 36px; height: 36px; }
.logo-lg { width: 56px; height: 56px; }
.brand-name { color: var(--accent-dark); }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--text); font-weight: 500; }
.nav a:hover { color: var(--accent); }
.header-actions { display: flex; gap: 10px; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-dark) 0%, #12345e 60%, #0d3a66 100%);
  color: #fff;
  padding: 48px 24px;
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.hero-text h1 { color: #fff; }
.hero-sub { color: rgba(255, 255, 255, 0.85); font-size: 18px; }
.hero-media { border-radius: var(--radius); overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,0.3); }
.hero-img { width: 100%; height: auto; }

/* ===== Секции ===== */
.section { max-width: 1200px; margin: 0 auto; padding: 48px 24px; }
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.section-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.section-text h2 { color: var(--accent-dark); }

/* ===== Отделы ===== */
.departments { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.departments li { display: flex; align-items: center; gap: 10px; background: var(--surface); padding: 10px 12px; border-radius: 10px; box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 50%; }

/* ===== Продукция ===== */
.products-banner { width: 100%; border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 200ms var(--ease-in), box-shadow 200ms var(--ease-in);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(11, 37, 69, 0.14); }
.card h3 { margin: 0; color: var(--accent-dark); }
.card .price { font-weight: 700; color: var(--accent); }
.card p { color: var(--neutral); margin: 0; font-size: 14px; }

/* ===== Форма ===== */
.lead-grid { align-items: start; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d4dde8;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 94, 168, 0.15);
}
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: #c0392b; }
.field-error { color: #c0392b; font-size: 13px; min-height: 16px; display: block; }
.consent { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--neutral); margin-bottom: 12px; cursor: pointer; }
.form-status { min-height: 22px; font-weight: 600; }
.form-status.ok { color: #1e7d46; }
.form-status.err { color: #c0392b; }

/* ===== Футер ===== */
.site-footer {
  background: var(--accent-dark);
  color: #fff;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 100%;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand .brand-name { color: #fff; }
.footer-block h3 { color: #fff; margin-bottom: 12px; }
.footer-block a { display: block; color: rgba(255,255,255,0.8); margin-bottom: 6px; }
.footer-block a:hover { color: #fff; }
.footer-block .muted { color: rgba(255,255,255,0.7); }
.footer-block .inline-icon { filter: brightness(0) invert(1); }

/* ===== Панель: логин ===== */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card {
  background: var(--surface);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.login-card .logo { margin: 0 auto; }
.login-error { color: #c0392b; min-height: 20px; font-size: 14px; }
.demo-hint { font-size: 13px; }

/* ===== Панель ===== */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--accent-dark);
  color: #fff;
}
.panel-header .brand-name { color: #fff; }
.panel-user { display: flex; align-items: center; gap: 10px; }
.panel-user #panel-user-name { font-weight: 600; }
.role-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.panel-header .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.6); }

.panel-tabs { display: flex; gap: 4px; padding: 8px 24px 0; background: var(--surface); border-bottom: 1px solid rgba(11,37,69,0.08); flex-wrap: wrap; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--neutral);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 200ms var(--ease-in), border-color 200ms var(--ease-in);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-body { max-width: 1200px; margin: 0 auto; padding: 24px; }
.pane { display: none; }
.pane.active { display: block; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pane-head-actions { display: flex; gap: 10px; }

.toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search, .filter { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid #d4dde8; border-radius: 10px; padding: 8px 12px; }
.search input { border: none; outline: none; font-size: 15px; background: transparent; color: var(--text); min-width: 180px; }
.filter select { border: none; outline: none; background: transparent; font-size: 15px; color: var(--text); }

/* ===== Списки и карточки панели ===== */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.list-item .li-main { display: flex; flex-direction: column; gap: 4px; }
.list-item .li-title { font-weight: 700; color: var(--accent-dark); }
.list-item .li-sub { font-size: 13px; color: var(--neutral); }
.list-item .li-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge img { width: 14px; height: 14px; }
.badge-new { background: rgba(14, 94, 168, 0.12); color: var(--accent); }
.badge-inprogress { background: rgba(11, 37, 69, 0.12); color: var(--accent-dark); }
.badge-closed { background: rgba(107, 122, 143, 0.15); color: var(--neutral); }

/* ===== Счётчики ===== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat .num { font-size: 36px; font-weight: 800; color: var(--accent); }
.stat .lbl { color: var(--neutral); font-size: 14px; }

.pane-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pane-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* ===== Пустое состояние ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--neutral); }
.empty-state img { margin: 0 auto 12px; width: 140px; }

/* ===== Переключатели ===== */
.switch-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(11,37,69,0.06); font-size: 15px; }
.switch-row span { flex: 1; }
.switch { width: 44px; height: 24px; appearance: none; background: #d4dde8; border-radius: 20px; position: relative; cursor: pointer; transition: background 200ms var(--ease-in); }
.switch:checked { background: var(--accent); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 200ms var(--ease-in); }
.switch:checked::after { left: 23px; }

/* ===== Модал карточки ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 37, 69, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 460px; box-shadow: var(--shadow); }

/* ===== Анимации ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { animation: fadeUp 350ms var(--ease-in) both; }
.hero-text { animation: fadeUp 350ms var(--ease-in) both; }
.hero-media { animation: fadeUp 350ms var(--ease-in) 80ms both; }

/* ===== Адаптив ===== */
@media (max-width: 768px) {
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .site-header { flex-wrap: wrap; padding: 10px 16px; }
  .nav { order: 3; width: 100%; justify-content: space-between; gap: 8px; }
  .hero-inner, .section-grid, .pane-row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .site-footer { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .panel-tabs { padding: 8px 12px 0; overflow-x: auto; }
  /* Панель на телефоне: шапка и заголовки разделов переносятся, ничего не обрезается */
  .panel-header { flex-wrap: wrap; padding: 10px 16px; row-gap: 8px; }
  .panel-header .brand { flex-shrink: 0; }
  .panel-header .logo { flex-shrink: 0; }
  .panel-user { flex-wrap: wrap; gap: 8px; min-width: 0; }
  .panel-body { padding: 16px; }
  .pane-head { flex-wrap: wrap; align-items: flex-start; }
  .pane-head-actions { flex-wrap: wrap; }
  .list-item { flex-direction: column; }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .departments { grid-template-columns: 1fr; }
  .header-actions { width: 100%; justify-content: space-between; }
}

/* ===== Доступность: reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal, .hero-text, .hero-media { animation: none !important; }
  .card:hover, .btn:hover { transform: none; }
}
