.bg-shell {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1024px) {
  .bg-shell {
    grid-template-columns: 1fr;
  }
}

.bg-panel {
  border: 1px solid var(--border, #d0d7de);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(150deg, #f8fbff, #eef4ff);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.bg-panel--result {
  background: linear-gradient(160deg, #0b1220, #111b32);
  color: #e2e8f0;
  border-color: rgba(226, 232, 240, 0.2);
  box-shadow: 0 18px 44px rgba(10, 19, 35, 0.55);
}

.bg-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 520px) {
  .bg-grid-2 {
    grid-template-columns: 1fr;
  }
}

.bg-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}

.bg-field input,
.bg-field select,
.bg-field textarea {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border, #d0d7de);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 24px rgba(15, 23, 42, 0.06);
  font-size: 15px;
  line-height: 1.5;
}

.bg-field textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.bg-field input:focus-visible,
.bg-field select:focus-visible,
.bg-field textarea:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

.bg-checkline {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  margin: 4px 0 12px;
}

.bg-checkline input[type='checkbox'] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.bg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 0;
}

.bg-actions .button {
  min-width: 140px;
}

.bg-panel--result .button {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(226, 232, 240, 0.22);
  color: #e2e8f0;
}

.bg-panel--result .button:hover {
  border-color: rgba(148, 197, 255, 0.9);
  transform: translateY(-1px);
}

.bg-panel--result .button:focus-visible {
  outline-color: #8bb4ff;
}

.bg-panel--result .button.primary {
  background: #245dff;
  border-color: #245dff;
  color: #ffffff;
}

.bg-panel--result .button.primary:hover {
  background: #1a4be8;
  border-color: #1a4be8;
}

.bg-note {
  margin: 8px 0 0;
  color: rgba(226, 232, 240, 0.88);
}

.bg-panel--result .bg-note {
  color: rgba(226, 232, 240, 0.88);
}

.bg-flash {
  animation: bgFlash 260ms ease-out;
}

@keyframes bgFlash {
  0% { box-shadow: 0 0 0 rgba(14, 165, 233, 0); }
  35% { box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.18); }
  100% { box-shadow: 0 0 0 rgba(14, 165, 233, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-flash {
    animation: none;
  }
}

.bg-banner {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(226, 232, 240, 0.7);
  color: #0f172a;
  margin: 10px 0 0;
  font-size: 14px;
}

.bg-banner--error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #7f1d1d;
}

.bg-banner--warn {
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.12);
  color: #0f172a;
}

.bg-panel--result .bg-banner {
  border-color: rgba(226, 232, 240, 0.24);
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

.bg-panel--result .bg-banner--error {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.14);
  color: #fee2e2;
}

.bg-panel--result .bg-banner--warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
}

.bg-last {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(226, 232, 240, 0.86);
  margin: 6px 0 10px;
}

.bg-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .bg-cards {
    grid-template-columns: 1fr;
  }
}

.bg-card {
  border: 1px solid rgba(226, 232, 240, 0.16);
  border-radius: 14px;
  padding: 12px;
  background: rgba(2, 6, 23, 0.22);
}

.bg-card-head {
  font-weight: 700;
  margin: 0 0 10px;
  color: rgba(226, 232, 240, 0.95);
}

.bg-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bg-table th,
.bg-table td {
  border: 1px solid rgba(226, 232, 240, 0.34);
  padding: 10px 6px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #e2e8f0;
}

.bg-table th {
  background: rgba(148, 163, 184, 0.14);
}

.bg-cell-free {
  background: rgba(34, 197, 94, 0.14);
}

.bg-cell-blank {
  background: rgba(148, 163, 184, 0.06);
}

.bg-calllist {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.2);
  background: rgba(2, 6, 23, 0.35);
  color: rgba(226, 232, 240, 0.92);
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
}

textarea.bg-calllist {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.bg-calllist-view {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.bg-call-chip {
  border: 1px solid rgba(226, 232, 240, 0.24);
  background: rgba(148, 163, 184, 0.10);
  color: rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
}

.bg-call-chip:focus-visible {
  outline: 2px solid #8bb4ff;
  outline-offset: 2px;
}

.bg-call-chip[aria-pressed='true'] {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.4);
  color: #eafff2;
}

.bg-call-chip.is-long {
  white-space: normal;
  border-radius: 12px;
}

@media print {
  @page { margin: 10mm; }

  header,
  nav,
  footer,
  .lang-switch,
  .ad-slot,
  #comments,
  .bg-actions,
  .bg-panel:not(.bg-panel--result),
  #related {
    display: none !important;
  }

  .container {
    max-width: none;
  }

  .bg-shell {
    grid-template-columns: 1fr;
  }

  .bg-panel--result {
    background: #ffffff !important;
    color: #000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .bg-card {
    break-inside: avoid;
    border: 1px solid #111 !important;
    background: #fff !important;
  }

  .bg-card-head {
    color: #000 !important;
  }

  .bg-table th,
  .bg-table td {
    border: 1px solid #111 !important;
    color: #000 !important;
  }

  .bg-cell-free,
  .bg-cell-blank {
    background: #fff !important;
  }

  .bg-calllist-view {
    display: block !important;
  }

  .bg-call-chip {
    display: inline-block;
    margin: 0 6px 6px 0;
    border: 1px solid #111 !important;
    background: #fff !important;
    color: #000 !important;
  }

  .bg-calllist {
    border: 1px solid #111 !important;
    background: #fff !important;
    color: #000 !important;
  }
}
