/* ЦБС admin — strict edition. Sharp corners, tighter spacing, monospace numbers. */

.cbs, .cbs * { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
.cbs { color: #1a1d21; font-size: 12.5px; line-height: 1.4; background: #f3f4f6; height: 100%; }

/* ── Topbar ─────────────────────────────────────────── */
.cbs-navbar { background: #1c1c1c; color: #fff; height: 44px; display: flex; align-items: center; padding: 0 14px; gap: 20px; border-bottom: 1px solid #000; }
.cbs-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14px; letter-spacing: 0.3px; color: #fff; }
.cbs-brand-mark { width: 26px; height: 26px; border-radius: 2px; background: #1B3A6B; display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 800; color: #fff; letter-spacing: 0.4px; border: 1px solid #2a4f90; }
.cbs-brand-img { width: 26px; height: 26px; object-fit: contain; display: block; flex-shrink: 0; }
.cbs-brand-name { font-size: 13px; font-weight: 700; line-height: 1; }
.cbs-brand-sub { font-size: 9.5px; font-weight: 500; color: #888; letter-spacing: 0.4px; margin-left: 1px; line-height: 1.2; margin-top: 2px; text-transform: uppercase; }
.cbs-nav { display: flex; gap: 0; height: 100%; }
.cbs-nav a { color: #b8b8b8; padding: 0 12px; display: flex; align-items: center; font-size: 12.5px; text-decoration: none; height: 100%; border-bottom: 2px solid transparent; transition: color .1s; font-weight: 500; }
.cbs-nav a:hover { color: #fff; background: #2a2a2a; }
.cbs-nav a.active { color: #fff; background: #2a2a2a; border-bottom-color: #04AA6D; font-weight: 600; }
.cbs-navbar .ms-auto { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #888; font-size: 11px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.cbs-user-pill { display: flex; align-items: center; gap: 7px; padding: 3px 9px 3px 3px; background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 2px; color: #fff; font-size: 11.5px; font-family: -apple-system, system-ui; }
.cbs-user-pill .av { width: 20px; height: 20px; border-radius: 2px; background: #04AA6D; display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; }

/* ── Layout ─────────────────────────────────────────── */
.cbs-main { padding: 14px 18px; }
.cbs-crumbs { display: flex; align-items: center; gap: 6px; color: #5a6068; font-size: 11.5px; margin-bottom: 8px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.cbs-crumbs a { color: #5a6068; text-decoration: none; }
.cbs-crumbs a:hover { color: #04AA6D; text-decoration: underline; }
.cbs-pagehead { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #d6dadf; }
.cbs-pagehead h1 { font-size: 17px; font-weight: 700; margin: 0; color: #0d1117; letter-spacing: -0.1px; display: flex; align-items: center; gap: 9px; }
.cbs-pagehead .lede { color: #5a6068; font-size: 12px; margin-top: 3px; }

/* ── Card ───────────────────────────────────────────── */
.cbs-card { background: #fff; border: 1px solid #d6dadf; border-radius: 2px; }
.cbs-card-head { padding: 7px 12px; border-bottom: 1px solid #d6dadf; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fafbfc; min-height: 32px; }
.cbs-card-head h2 { font-size: 10.5px; font-weight: 700; margin: 0; color: #0d1117; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.6px; }
.cbs-card-head .muted { font-size: 10.5px; color: #5a6068; font-weight: 500; text-transform: none; letter-spacing: 0; }
.cbs-card-body { padding: 12px; }
.cbs-card-body.tight { padding: 8px 12px; }
.cbs-card-body.flush { padding: 0; }

/* ── Buttons ───────────────────────────────────────── */
.cbs-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 12px; font-weight: 500; border-radius: 2px; border: 1px solid transparent; background: #fff; color: #1a1d21; cursor: pointer; line-height: 1.4; height: 26px; }
.cbs-btn.sm { padding: 2px 7px; font-size: 11.5px; height: 22px; }
.cbs-btn-primary { background: #04AA6D; color: #fff; border-color: #04AA6D; font-weight: 600; }
.cbs-btn-primary:hover { background: #038B5A; border-color: #038B5A; }
.cbs-btn-secondary { background: #fff; border-color: #b8bdc4; color: #1a1d21; }
.cbs-btn-secondary:hover { background: #f3f4f6; border-color: #6c757d; }
.cbs-btn-danger-outline { background: #fff; border-color: #b02a37; color: #b02a37; }
.cbs-btn-danger-outline:hover { background: #fdf1f2; }
.cbs-btn-ghost { background: transparent; color: #495057; border-color: transparent; }
.cbs-btn-ghost:hover { background: #ededef; }

/* ── Badges ────────────────────────────────────────── */
.cbs-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 2px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.5; border: 1px solid transparent; }
.cbs-badge.dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cbs-b-pending { background: #ededef; color: #495057; border-color: #d6dadf; }
.cbs-b-progress { background: #e0ecfb; color: #0a58ca; border-color: #b6cef5; }
.cbs-b-done { background: #d3eede; color: #04663F; border-color: #a9d8bf; }
.cbs-b-error { background: #fadbe0; color: #842029; border-color: #f1adb6; }
.cbs-b-rerun { background: #fff0c2; color: #6a5119; border-color: #f0d176; }
.cbs-b-soft { background: #ededef; color: #495057; font-weight: 600; text-transform: none; letter-spacing: 0; border-color: #d6dadf; }
.cbs-b-info { background: #e0ecfb; color: #0a58ca; border-color: #b6cef5; }

/* ── Tables ────────────────────────────────────────── */
.cbs-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.cbs-table thead th { background: #ededef; color: #495057; font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; padding: 6px 12px; border-bottom: 1px solid #b8bdc4; border-top: 1px solid #d6dadf; text-align: left; white-space: nowrap; }
.cbs-table tbody td { padding: 5px 12px; border-bottom: 1px solid #ededef; color: #1a1d21; vertical-align: middle; }
.cbs-table tbody tr:hover td { background: #fafbfc; }
.cbs-table tbody tr:last-child td { border-bottom: none; }
.cbs-table td.num { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; color: #1a1d21; text-align: right; }
.cbs-table td.muted { color: #5a6068; font-size: 11.5px; }
.cbs-table td.right { text-align: right; }
.cbs-table.compact tbody td { padding: 4px 12px; }
.cbs-table .row-actions { display: inline-flex; gap: 0; border: 1px solid #d6dadf; border-radius: 2px; overflow: hidden; }
.cbs-table .row-actions .cbs-btn { border-radius: 0; height: 20px; padding: 0 6px; border: none; border-right: 1px solid #d6dadf; }
.cbs-table .row-actions .cbs-btn:last-child { border-right: none; }
.cbs-id { color: #5a6068; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11px; }

/* ── Forms ─────────────────────────────────────────── */
.cbs-form-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; padding: 7px 0; border-bottom: 1px solid #ededef; }
.cbs-form-row:last-child { border-bottom: none; }
.cbs-form-row .lbl { font-size: 11.5px; color: #495057; padding-top: 6px; display: flex; align-items: center; gap: 5px; font-weight: 500; }
.cbs-form-row .lbl .req { color: #b02a37; }
.cbs-form-row .lbl .lock { color: #6a5119; font-size: 10px; }
.cbs-form-row .hint { font-size: 11px; color: #5a6068; margin-top: 4px; line-height: 1.4; }
.cbs-input { width: 100%; padding: 4px 8px; font-size: 12.5px; border: 1px solid #b8bdc4; border-radius: 2px; background: #fff; line-height: 1.4; color: #1a1d21; height: 28px; }
.cbs-input:focus { outline: none; border-color: #04AA6D; box-shadow: 0 0 0 2px rgba(4,170,109,0.18); }
.cbs-input.encrypted { font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; background: #fff8e6; border-color: #d4b758; }
.cbs-input.short { max-width: 200px; }
.cbs-input::placeholder { color: #9aa0a6; }
.cbs-select { padding-right: 24px; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23495057' stroke-width='1.5' fill='none'/></svg>"); background-repeat: no-repeat; background-position: right 8px center; }
textarea.cbs-input { height: auto; min-height: 56px; }
.cbs-input-group { display: flex; }
.cbs-input-group .cbs-input { border-radius: 2px 0 0 2px; }
.cbs-input-group .addon { padding: 4px 9px; background: #ededef; border: 1px solid #b8bdc4; border-left: none; border-radius: 0 2px 2px 0; color: #495057; font-size: 12px; display: flex; align-items: center; }

/* ── Filter bar ───────────────────────────────────── */
.cbs-filter { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; padding: 8px 12px; background: #ededef; border-bottom: 1px solid #d6dadf; }
.cbs-filter .cbs-input, .cbs-filter .cbs-select { font-size: 12px; padding: 3px 7px; height: 24px; min-width: 0; }
.cbs-filter .grow { flex: 1; max-width: 280px; }
.cbs-filter .lbl-mini { font-size: 10px; color: #495057; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }

/* ── Status pills (dashboard) ─────────────────────── */
.cbs-svc { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border: 1px solid #d6dadf; border-radius: 2px; min-height: 50px; }
.cbs-svc .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cbs-svc .dot.ok { background: #04AA6D; }
.cbs-svc .dot.warn { background: #cc8a18; }
.cbs-svc .dot.err { background: #b02a37; }
.cbs-svc .label { font-size: 10px; color: #5a6068; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.cbs-svc .val { font-size: 13px; font-weight: 600; color: #0d1117; margin-top: 2px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: -0.2px; }
.cbs-svc .val small { font-weight: 400; color: #5a6068; font-size: 11px; font-family: -apple-system, system-ui; }

/* ── KPI tile ─────────────────────────────────────── */
.cbs-kpi { background: #fff; border: 1px solid #d6dadf; border-radius: 2px; padding: 10px 12px; }
.cbs-kpi .label { font-size: 10px; color: #5a6068; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.cbs-kpi .val { font-size: 19px; font-weight: 600; color: #0d1117; margin-top: 4px; letter-spacing: -0.4px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; line-height: 1.1; }
.cbs-kpi .delta { font-size: 10.5px; color: #04663F; margin-top: 4px; display: flex; align-items: center; gap: 3px; font-weight: 500; }
.cbs-kpi .delta.neg { color: #b02a37; }

/* ── Misc ─────────────────────────────────────────── */
.cbs-empty { text-align: center; padding: 28px 14px; color: #5a6068; font-size: 12px; }
.cbs-sep { height: 1px; background: #d6dadf; margin: 8px 0; }
.cbs-kbd { padding: 1px 5px; background: #ededef; border: 1px solid #b8bdc4; border-bottom-width: 2px; border-radius: 2px; font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: #495057; }
.cbs-link { color: #04663F; text-decoration: none; font-weight: 500; }
.cbs-link:hover { text-decoration: underline; }
.cbs-link-muted { color: #495057; text-decoration: none; }
.cbs-link-muted:hover { color: #04663F; text-decoration: underline; }
.cbs-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; }
.cbs-lock { color: #6a5119; }
.cbs-encbar { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; background: #fff0c2; color: #6a5119; border: 1px solid #f0d176; border-radius: 2px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.cbs-checkbox { width: 13px; height: 13px; border: 1.5px solid #b8bdc4; border-radius: 1px; display: inline-block; vertical-align: middle; background: #fff; position: relative; }
.cbs-checkbox.on { background: #04AA6D; border-color: #04AA6D; }
.cbs-checkbox.on::after { content: ''; position: absolute; left: 3px; top: 0px; width: 4px; height: 8px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }

/* Drag-n-drop */
.cbs-drop { border: 1.5px dashed #b8bdc4; border-radius: 2px; padding: 36px 24px; text-align: center; background: #fafbfc; transition: all .12s; }
.cbs-drop.active { border-color: #04AA6D; background: #f0faf5; border-style: solid; }
.cbs-drop .big-icon { width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 2px; background: #ededef; display: flex; align-items: center; justify-content: center; color: #495057; font-size: 22px; }
.cbs-drop.active .big-icon { background: #d3eede; color: #04663F; }

/* legacy compatibility — оставляем 2 правила из v7 (используются в base layout) */
body.cbs-page { background: #f3f4f6; }
.cbs a { color: inherit; }

/* ── Login page (sessions/new.html.erb) ──────────────────── */
body.login-body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(900px 500px at 50% -5%, #fff8e6 0%, #f3f4f6 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #1a1d21;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #d6dadf;
  border-radius: 2px;
  padding: 32px 32px 24px;
  box-shadow: 0 1px 0 #fff inset, 0 2px 24px rgba(13,17,23,.05);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #ededef;
}

.login-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  object-fit: contain;
}

.login-brand {
  font-size: 17px;
  font-weight: 700;
  color: #0d1117;
  letter-spacing: -0.1px;
  line-height: 1.1;
}

.login-tag {
  font-size: 10.5px;
  font-weight: 500;
  color: #5a6068;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 3px;
}

.login-form { display: flex; flex-direction: column; gap: 4px; }

.login-label {
  font-size: 10px;
  font-weight: 700;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 10px 0 4px;
}

.login-form .cbs-input {
  height: 34px;
  font-size: 13px;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 18px;
  font-size: 12px;
  color: #5a6068;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.login-remember input { margin: 0; cursor: pointer; }

.login-submit {
  width: 100%;
  height: 36px;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.login-alert {
  padding: 8px 12px;
  background: #fadbe0;
  border: 1px solid #f1adb6;
  border-radius: 2px;
  color: #842029;
  font-size: 12px;
  margin-bottom: 14px;
}

.login-foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #ededef;
  display: flex;
  justify-content: flex-end;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: #888;
}
