* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f5f7;
  color: #1c1e21;
}

.nav {
  background: #1c1e21;
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav a { color: #cfd3d8; text-decoration: none; font-size: 14px; }
.nav a.active, .nav a:hover { color: #fff; }
.nav .brand { font-weight: 700; margin-right: 8px; }

.page { padding: 24px 28px; max-width: 1200px; margin: 0 auto; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: #6b7280; margin-top: 4px; }
.stat-card .label-note { display: block; font-size: 11px; color: #b0b4ba; margin-top: 2px; }

.panel { background: #fff; border-radius: 10px; padding: 20px 22px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 20px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; color: #374151; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-row .bar-label { width: 170px; flex-shrink: 0; color: #374151; }
.bar-row .bar-track { flex: 1; background: #eef0f2; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 6px; background: #4f7cff; }
.bar-row .bar-count { width: 30px; text-align: right; color: #6b7280; }

.line-chart { width: 100%; height: 140px; display: block; overflow: visible; }
.chart-fill { fill: rgba(79, 124, 255, .12); stroke: none; }
.chart-line { fill: none; stroke: #4f7cff; stroke-width: 2; }
.chart-dot { fill: #4f7cff; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: #9aa0a6; }

.pill-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: #eef0f2; color: #374151; font-size: 13px; text-decoration: none; font-weight: 500;
  transition: background .15s;
}
.pill:hover { background: #e2e5e9; }
.pill--active { background: #1c1e21; color: #fff; }
.pill-count { font-size: 12px; opacity: .75; }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters select, .filters a.reset {
  padding: 7px 10px; border: 1px solid #d7dae0; border-radius: 6px; background: #fff; font-size: 13px; color: #1c1e21;
}
.filters a.reset { text-decoration: none; color: #6b7280; }

.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.order-card {
  background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06);
  text-decoration: none; color: inherit; display: block; transition: box-shadow .15s;
}
.order-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.order-card .thumb {
  width: 100%; aspect-ratio: 1; background: #eef0f2; display: flex; align-items: center; justify-content: center;
  color: #9aa0a6; font-size: 12px; overflow: hidden;
}
.order-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.order-card .body { padding: 12px 14px; }
.order-card .order-id { font-weight: 700; font-size: 14px; }
.order-card .product { font-size: 13px; color: #374151; margin-top: 2px; font-weight: 600; }
.order-card .product-sub { font-size: 11px; color: #9aa0a6; margin-top: 1px; }
.order-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.order-card .date { font-size: 11px; color: #9aa0a6; }
.order-card .price { font-size: 13px; font-weight: 600; color: #147a2e; margin-top: 4px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge--grey { background: #eef0f2; color: #4b5563; }
.badge--blue { background: #e0ecff; color: #2452c8; }
.badge--orange { background: #fff1de; color: #a35b00; }
.badge--teal { background: #dcf7f0; color: #0f7a5f; }
.badge--purple { background: #ede4ff; color: #6b34c9; }
.badge--green { background: #dcf6e0; color: #147a2e; }
.badge--red { background: #ffe2e2; color: #c02929; }

.channel-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }

.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.detail-grid .thumb-big { width: 100%; border-radius: 10px; background: #eef0f2; }
.detail-grid .thumb-big img { width: 100%; border-radius: 10px; display: block; }
.back-link { display: inline-block; margin-bottom: 14px; color: #4f7cff; text-decoration: none; font-size: 13px; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 70%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.msg.in { background: #eef0f2; align-self: flex-start; }
.msg.out { background: #e0ecff; align-self: flex-end; }
.msg .who { font-size: 11px; color: #6b7280; margin-bottom: 3px; }
.msg img { max-width: 200px; border-radius: 8px; margin-top: 6px; display: block; }

table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv td { padding: 6px 4px; border-bottom: 1px solid #f0f1f3; }
table.kv td:first-child { color: #6b7280; width: 40%; }

.empty { color: #9aa0a6; font-size: 13px; padding: 20px 0; text-align: center; }

.catalog-header { margin-bottom: 16px; }
.btn-primary {
  display: inline-block; padding: 9px 16px; border-radius: 8px; background: #1c1e21; color: #fff;
  text-decoration: none; font-size: 13px; font-weight: 600; border: none; cursor: pointer;
}
.btn-danger {
  padding: 9px 16px; border-radius: 8px; background: #fff; color: #c02929; border: 1px solid #f3c9c9;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

.catalog-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.catalog-table th { text-align: left; font-size: 12px; color: #6b7280; padding: 12px 14px; border-bottom: 1px solid #eef0f2; }
.catalog-table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #f5f6f7; }
.catalog-table tr:last-child td { border-bottom: none; }
.catalog-table a { color: #4f7cff; text-decoration: none; }
.catalog-row--inactive { opacity: .5; }

.catalog-form { display: flex; flex-direction: column; gap: 14px; }
.catalog-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #374151; }
.catalog-form input[type="text"], .catalog-form select {
  padding: 8px 10px; border: 1px solid #d7dae0; border-radius: 6px; font-size: 13px; color: #1c1e21;
}
.catalog-form .checkbox-label { flex-direction: row; align-items: center; gap: 8px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.form-error { background: #ffe2e2; color: #c02929; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* login + logout */
.login-page { display: flex; justify-content: center; padding-top: 12vh; }
.login-form {
  background: #fff; border-radius: 10px; padding: 28px; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.login-form h1 { margin: 0 0 4px; font-size: 20px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #374151; }
.login-form input { padding: 9px 10px; border: 1px solid #d7dae0; border-radius: 6px; font-size: 14px; }
.login-form button { padding: 10px; border: 0; border-radius: 6px; background: #1c1e21; color: #fff; font-size: 14px; cursor: pointer; }
.login-error { background: #ffe2e2; color: #c02929; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin: 0; }
.nav .logout { margin-left: auto; }
.nav .logout button { background: none; border: 0; color: #cfd3d8; font-size: 14px; cursor: pointer; padding: 0; }
.nav .logout button:hover { color: #fff; }

/* shipping deadline on order cards */
.ship-by { font-size: 12px; color: #4b5563; margin-top: 4px; }
.ship-by--overdue { color: #c02929; font-weight: 600; }
.pill--warn { background: #fff1de; color: #a35b00; }

/* «Сегодня», «На подтверждение», «Настройки» — must work on a phone */
.banner { background: #fff1de; color: #a35b00; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.today-block { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.today-block h2 { font-size: 16px; margin: 0 0 10px; }
.today-row { display: block; padding: 9px 0; border-bottom: 1px solid #f0f1f3; color: #1c1e21; text-decoration: none; font-size: 14px; }
.today-row:last-child { border-bottom: none; }
.today-row--late b, .today-row--alarm { color: #c02929; }
.muted { color: #6b7280; font-size: 13px; }
.stage-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stage { background: #f4f5f7; border-radius: 8px; padding: 10px 12px; text-decoration: none; color: #1c1e21; font-size: 13px; min-width: 120px; }
.stage-count { display: block; font-size: 22px; font-weight: 700; }
.action-card { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.action-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.action-reason { font-size: 13px; color: #374151; margin-bottom: 8px; white-space: pre-wrap; }
.action-text { white-space: pre-wrap; background: #f4f5f7; padding: 10px; border-radius: 6px; font-size: 14px; margin: 6px 0; }
.action-form textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px; border: 1px solid #d7dae0; border-radius: 6px; }
.action-form button, .policy-form button { padding: 9px 16px; border: 0; border-radius: 6px; background: #1c1e21; color: #fff; font-size: 14px; cursor: pointer; }
.action-form button.secondary { background: #e5e7eb; color: #1c1e21; }
.policy-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.policy-form label { font-size: 13px; }
@media (max-width: 640px) {
  .nav { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .nav .logout { margin-left: 0; }
  .page { padding: 16px; }
  .settings-table td { display: block; }
}
.stop-all { background: #c02929; color: #fff; border: 0; border-radius: 8px; padding: 14px 28px; font-size: 18px; font-weight: 700; cursor: pointer; }

/* left menu (ЗАДАНИЕ-CRM «Интерфейс панели»); on a phone it folds into a top bar */
body.with-sidebar { display: flex; min-height: 100vh; }
body.with-sidebar .nav { flex-direction: column; align-items: stretch; gap: 2px; width: 210px; flex-shrink: 0;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.with-sidebar .nav a { padding: 8px 10px; border-radius: 6px; }
body.with-sidebar .nav a.active { background: #2d3035; }
body.with-sidebar .nav .brand { padding: 0 10px 12px; }
body.with-sidebar .nav .logout { margin: auto 0 0; padding: 8px 10px; }
body.with-sidebar .page { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  body.with-sidebar { display: block; }
  body.with-sidebar .nav { flex-direction: row; flex-wrap: wrap; width: auto; height: auto; position: static; padding: 10px 12px; }
  body.with-sidebar .nav .brand { width: 100%; padding-bottom: 4px; }
  body.with-sidebar .nav .logout { margin: 0; }
}

/* production kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #eceef1; border-radius: 10px; padding: 10px; min-width: 210px; flex: 0 0 210px; }
.kanban-col h3 { font-size: 13px; margin: 2px 4px 10px; color: #374151; }
.kcard { display: block; background: #fff; border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; text-decoration: none;
  color: #1c1e21; font-size: 13px; border-left: 4px solid #9aa0a6; }
.kcard--ozon { border-left-color: #005bff; } .kcard--wildberries { border-left-color: #cb11ab; }
.kcard--site { border-left-color: #0f7a5f; } .kcard--test { border-left-color: #9aa0a6; }
.kcard .timer { font-size: 12px; color: #6b7280; } .kcard .timer--late { color: #c02929; font-weight: 600; }
.stars { color: #e3a008; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; background: #f4f5f7; }
.kv td { word-break: break-word; }
