/* bh-panel — стили по макетам docs/design/*.dc.html */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --muted-2: #4b5563;
  --border: #e5e7eb;
  --border-2: #d1d5db;
  --row-border: #f0f1f3;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-soft: #e8efff;
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2 { margin: 0; }
p { margin: 0; }

/* ---------- каркас ---------- */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }

.sidebar {
  flex: 1 1 220px;
  max-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  text-decoration: none; font-size: 14px; color: var(--text-2);
  white-space: nowrap;
}
.nav-link:hover { background: #f3f4f6; color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link svg { flex: none; }

.sidebar-foot {
  margin-top: auto; padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: flex; flex-direction: column; gap: 10px;
}
.user-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.main {
  flex: 999 1 560px; min-width: 0;
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 20px;
}

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { display: flex; flex-direction: column; gap: 4px; }
.page-title h1 { font-size: 24px; font-weight: 700; }
.page-title p { font-size: 14px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #f9fafb; color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { border: 0; background: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #1e40af; color: #fff; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn-link {
  background: none; border: 0; padding: 8px 0;
  font: inherit; font-size: 14px; color: var(--primary); cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted-2); }
.field-lg { gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
  min-height: 40px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface);
  font: inherit; font-size: 14px; color: var(--text); width: 100%;
}
.field-lg .input { min-height: 44px; font-size: 15px; font-weight: 400; }
.textarea { padding: 12px; font-size: 15px; line-height: 1.55; resize: vertical; font-weight: 400; }
.input:focus, .select:focus, .textarea:focus, .btn:focus-visible, .nav-link:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.input-search { width: 240px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- карточки, таблицы ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-size: 16px; font-weight: 600; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.cards > .card { flex: 1 1 360px; }

.stats { display: flex; flex-wrap: wrap; gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px;
}
.stat-label, .stat-note { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th {
  text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--row-border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.empty { padding: 40px 16px !important; text-align: center; color: var(--muted); }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #eef2f7; color: var(--text-2);
}
.badge-email, .badge-progress { background: #e0ecff; color: #1e40af; }
.badge-max { background: #efe7ff; color: #5b21b6; }
.badge-telegram { background: #dff4fb; color: #075985; }
.badge-new { background: #fff1d6; color: #92400e; }
.badge-done { background: #dcf5e3; color: #166534; }
.badge-closed { background: #eceff3; color: var(--text-2); }

.note { font-size: 13px; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: var(--radius); background: #fff7e6; font-size: 13px; line-height: 1.5; color: #78350f; }
.alert-error { padding: 10px 12px; border-radius: var(--radius); background: #fde8e8; color: #991b1b; font-size: 14px; }

/* новая рассылка */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main { flex: 999 1 520px; min-width: 0; padding: 24px; gap: 20px; }
.split-side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 96px; border: 1.5px dashed #c5cad3; border-radius: 10px; background: #fafbfc;
  font-size: 14px; color: var(--muted-2); text-align: center; padding: 14px;
}
.summary { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; font-size: 14px; }
.summary dt { color: var(--muted-2); }
.summary dd { margin: 0; text-align: right; }

.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px; display: flex; flex-direction: column; gap: 18px;
}
.auth-card .brand { padding: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- телефон ---------- */
@media (max-width: 760px) {
  .layout { flex-direction: column; flex-wrap: nowrap; }
  .sidebar {
    max-width: none; flex: none; border-right: 0; border-bottom: 1px solid var(--border);
    padding: 10px 12px; position: sticky; top: 0; z-index: 10;
  }
  .brand { padding: 2px 4px 8px; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .nav-link { padding: 8px 10px; font-size: 13px; }
  .sidebar-foot { display: none; }
  .sidebar .mobile-logout { display: block; }
  .main { padding: 18px 14px; gap: 16px; }
  .page-title h1 { font-size: 20px; }
  .input-search { width: 100%; }
  .toolbar > * { width: 100%; }
}
.mobile-logout { display: none; position: absolute; top: 12px; right: 12px; }
