* { box-sizing: border-box; }
body {
  font-family: Manrope, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  background: #f3f6f9;
  color: #0b0f14;
}
/* ---- боковое меню (стиль A) ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 232px;
  background: #fff; border-right: 1px solid #e3e8ee;
  display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
.side-brand { padding: 0 8px 16px; }
.side-brand img { height: 30px; display: block; }
.side-sub { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #f49739; font-weight: 700; margin-top: 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a, .side-nav .nv-off {
  padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: #3e4c59; text-decoration: none; display: flex; justify-content: space-between; align-items: center;
}
.side-nav a:hover { background: #f1f5f9; }
.side-nav a.on { background: #e3f0f9; color: #1b6498; font-weight: 700; }
.side-nav .nv-off { color: #9aa5b1; cursor: default; }
.side-nav .nv-off i { font-style: normal; font-size: 10px; background: #f1f5f9; color: #7b8794; padding: 1px 7px; border-radius: 10px; }
.side-group { margin: 16px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9aa5b1; font-weight: 700; }
.side-foot { border-top: 1px solid #e3e8ee; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.lang { display: flex; gap: 4px; }
.lang button { flex: 1; border: 1px solid #d5dde5; background: #fff; border-radius: 6px; padding: 5px 0; font-size: 12px; cursor: pointer; color: #3e4c59; }
.lang button.on { background: #2a87c7; color: #fff; border-color: #2a87c7; font-weight: 700; }
.profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #f49739; color: #fff; display: grid; place-items: center; font-weight: 700; }
.pname { font-size: 13px; font-weight: 700; }
.prole { font-size: 11px; color: #7b8794; }
.logout { font-size: 13px; color: #7b8794; text-decoration: none; padding-left: 4px; }
.logout:hover { color: #b3261e; }
body.with-side .container { margin-left: 232px; max-width: none; padding: 28px 32px; }
body.bare .container { max-width: 480px; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

h1 { font-size: 1.5em; margin-bottom: 4px; }
h2 { font-size: 1.15em; margin-top: 28px; }

.hint { color: #6b7280; font-size: 0.9em; }

.flashes { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; font-size: 0.9em; }
.flash-success { background: #e3f6e8; color: #16793a; }
.flash-error { background: #fdeaea; color: #b3261e; }

.login-box {
  max-width: 340px;
  margin: 80px auto;
  background: #fff;
  padding: 28px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.login-box h1 { text-align: center; margin: 14px 0 12px; }
.login-logo { height: 34px; display: block; margin: 0 auto; }
.login-sub { text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #f49739; font-weight: 700; margin-top: 6px; }
.lang-login { margin-top: 18px; }
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid #e3e8ee; }
  body.with-side .container { margin-left: 0; padding: 16px; }
}

form label { display: block; font-size: 0.85em; color: #4b5563; margin: 10px 0 4px; }
form input[type=text], form input[type=password], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95em;
}
form .row { display: flex; gap: 16px; }
form .row > div { flex: 1; }
form button {
  margin-top: 14px;
  background: #2a87c7;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
}
form button:hover { background: #1b6498; }

.btn-small {
  display: inline-block;
  padding: 5px 10px;
  font-size: 0.82em;
  background: #eef1f5;
  color: #1c1f26;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
}
.btn-danger { background: #fdeaea !important; color: #b3261e !important; border-color: #f3c6c6 !important; }

.events-sync-form {
  background: #f8f9fb;
  padding: 12px;
  border-radius: 6px;
  margin-top: 6px;
  max-width: 420px;
}
.events-sync-form label { font-size: 0.8em; }
.events-sync-form input { padding: 5px 8px; font-size: 0.85em; }
details summary { cursor: pointer; }

.funnel { background: #fff; padding: 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 16px; }
.funnel-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.funnel-label { width: 170px; font-size: 0.88em; color: #4b5563; flex-shrink: 0; }
.funnel-bar-track { flex: 1; background: #eef1f5; border-radius: 4px; height: 18px; overflow: hidden; }
.funnel-bar-fill { background: #2a87c7; height: 100%; border-radius: 4px; transition: width 0.3s; }
.funnel-count { width: 100px; text-align: right; font-size: 0.85em; color: #374151; flex-shrink: 0; }

.pager { display: flex; align-items: center; gap: 14px; margin: 16px 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #e5e7eb; }
.tab {
  padding: 9px 18px;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.92em;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab:hover { color: #1c1f26; }
.tab-active { color: #2a87c7; border-bottom-color: #2a87c7; font-weight: 600; }

.stat-cards { display: flex; gap: 14px; margin-bottom: 20px; }
.stat-card {
  flex: 1;
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  text-align: center;
}
.stat-value { font-size: 1.8em; font-weight: 700; color: #2a87c7; }
.stat-label { font-size: 0.8em; color: #6b7280; margin-top: 4px; }

.cred-form {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  max-width: 640px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.filters input[type=text] { width: 220px; }
.filters select { width: auto; }
.checkbox { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; font-size: 0.9em; }
.checkbox input { width: auto !important; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  font-size: 0.88em;
  text-align: left;
}
.table th { background: #f0f2f5; color: #4b5563; }
.table th a { color: #4b5563; text-decoration: none; }
.table tr:hover { background: #fafbfc; }
.row-flagged { background: #fffaf0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.78em;
  background: #e5e7eb;
  color: #374151;
}
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-confirmed { background: #dcfce7; color: #166534; }

.flag {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.78em;
  margin: 1px 3px 1px 0;
}
.flag-list { padding-left: 18px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 24px;
  background: #fff;
  padding: 18px;
  border-radius: 8px;
  margin: 16px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  font-size: 0.92em;
}

.raw-json {
  background: #1c1f26;
  color: #d1e7ff;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.5;
}

.cnt { display:inline-block; margin-left:4px; font-size:11px; background:#eef1f5; color:#52606d; padding:0 7px; border-radius:10px; }
.tab-active .cnt { background:#e3f0f9; color:#1b6498; }
.filters .inl { margin:0; font-size:13px; color:#52606d; }
.filters input[type=date] { padding:7px 8px; border:1px solid #d1d5db; border-radius:6px; font-size:.9em; }

/* ---- подгонка под прототип ---- */
.sidebar { width: 240px; padding: 24px 20px; }
.side-brand { padding: 0 0 22px; }
.side-brand img { height: 74px; }
.side-sub { font-size: 12px; letter-spacing: .2em; padding-bottom: 10px; border-bottom: 3px solid #f49739; display: inline-block; margin-top: 10px; }
.side-nav { margin-top: 14px; gap: 4px; }
.side-nav a, .side-nav .nv-off { padding: 11px 12px; font-size: 15px; border-radius: 12px; }
.side-foot .lang { display: none; }
body.with-side .container { margin-left: 240px; padding: 22px 40px 40px; position: relative; }
.lang-top { position: absolute; top: 22px; right: 40px; width: auto; background: #fff; border: 1px solid #e3e8ee; border-radius: 12px; padding: 4px; gap: 0; }
.lang-top button { border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 700; font-size: 13px; background: transparent; }
.lang-top button.on { background: #2a87c7; color: #fff; }
h1 { font-size: 34px; font-weight: 800; margin: 24px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 800; margin-top: 30px; }
.page-head { margin-top: 36px; }
.page-head h1 { margin-top: 0; }
.stat-cards { gap: 18px; margin: 22px 0 26px; }
.stat-card { text-align: left; padding: 20px 22px; border-radius: 16px; box-shadow: none; border: 1px solid #e6ebf0; }
.stat-label { font-size: 14px; font-weight: 600; color: #52606d; margin: 0 0 6px; }
.stat-value { font-size: 40px; font-weight: 800; color: #0b0f14; line-height: 1.1; }
.stat-warn { background: #fff3e3; border-color: #fbe0bd; }
.stat-warn .stat-label, .stat-warn .stat-value { color: #b45f06; }
.funnel, .filters, .cred-form, .detail-grid { border-radius: 16px; box-shadow: none; border: 1px solid #e6ebf0; }
.table { border-radius: 16px; box-shadow: none; border: 1px solid #e6ebf0; }
.table th { background: #f7f9fb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table td { font-size: 14px; padding: 12px 14px; }
.tabs { border-bottom: 0; gap: 8px; }
.tab { border: 1px solid #e3e8ee; background: #fff; border-radius: 999px; padding: 8px 16px; margin: 0; }
.tab-active { background: #2a87c7; color: #fff; border-color: #2a87c7; }
.tab-active .cnt { background: rgba(255,255,255,.25); color: #fff; }
form button, .filters button { border-radius: 10px; }
.funnel-bar-fill { background: #2a87c7; }
.login-box { border-radius: 20px; }
.lang button { white-space: nowrap; }
.lang-top button { min-width: 48px; }
.side-brand img { height: 60px; }
.side-brand { padding-bottom: 12px; }
.side-nav { margin-top: 6px; gap: 2px; }
.side-nav a, .side-nav .nv-off { padding: 8px 12px; font-size: 14.5px; }
.side-nav .nv-off i { display: none; }
.tabs { margin-top: 14px; }
.filters .btn-small { margin: 0; }
.sidebar { padding-bottom: 14px; }

/* ---- экраны Ядро Китай ---- */
.card { background:#fff; border:1px solid #e6ebf0; border-radius:16px; padding:18px 20px; margin:14px 0; }
.card-title { font-weight:800; font-size:16px; cursor:pointer; }
details.card[open] .card-title { margin-bottom:10px; }
.cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:16px; }
.cards .card { margin:0; }
.big { font-size:34px; font-weight:800; margin:6px 0 2px; }
.big small { font-size:14px; font-weight:600; color:#52606d; }
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.two-col .card { margin:0; }
.grid-form { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:4px 16px; align-items:end; }
.grid-form input, .grid-form select, .card input[type=text], .card input[type=date], .card input[type=password], .card select, .card input[type=datetime-local], .table input[type=text], .table select { width:100%; padding:8px 10px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; background:#fff; }
.table input[type=text] { min-width:70px; }
.pill { display:inline-block; font-size:12px; font-weight:700; padding:2px 10px; border-radius:999px; background:#eef1f5; color:#52606d; margin-left:4px; }
.pill-green { background:#dcf5e5; color:#17803d; } .pill-amber { background:#fff1d6; color:#a15c07; }
.pill-red { background:#fde6e4; color:#b3261e; } .pill-blue { background:#e3f0f9; color:#1b6498; }
.muted { color:#aab4be; }
.cb { width:auto !important; margin-right:6px; }
.ship-bar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.ship-bar select { width:auto; }
.btn-light { background:#eef1f5 !important; color:#1c1f26 !important; }
.cal td { vertical-align:top; white-space:nowrap; }
.blk-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:14px; }
.pt-card { background:#fff; border:1px solid #e6ebf0; border-radius:16px; padding:16px 18px; }
.pt-card.risk { background:#fff6f5; border-color:#f3c6c1; }
.pt-head { display:flex; justify-content:space-between; align-items:baseline; font-weight:800; font-size:17px; }
.pt-head small { font-weight:600; color:#7b8794; font-size:12px; }
.pt-row { display:flex; justify-content:space-between; align-items:center; margin-top:6px; font-size:14px; }
@media (max-width:900px){ .two-col{grid-template-columns:1fr;} }
a.profile, a.profile:hover { text-decoration:none; color:inherit; }

body.with-side .container > .flashes { margin-top: 60px; max-width: calc(100% - 340px); }
.flash { transition: opacity .4s; cursor: pointer; }
.flash:hover { filter: brightness(.97); }
.events-sync-form input[type=date] { width:100%; padding:8px 10px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; background:#fff; }
