/* ====== Базовая разметка экрана ====== */
:root {
  --fg: #1b1b1b;
  --muted: #6a737d;
  --border: #cfd5db;
  --border-strong: #9aa3ad;
  --bg: #ffffff;
  --accent: #2066b0;
  --accent-fg: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f4f6f8;
  color: var(--fg);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* ====== Панель управления ====== */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ctrl-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.ctrl-lang select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  color: var(--fg);
}

.btn {
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  transition: background .12s ease, opacity .12s ease;
}
.btn:hover:not(:disabled) { background: #eef2f6; }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover:not(:disabled) { background: #1a5697; }

/* ====== Статусы ====== */
.status {
  padding: 12px 18px;
  color: var(--muted);
}
.status.error { color: #b3261e; }
.status:empty { display: none; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== Отчёт ====== */
.report {
  max-width: 900px;
  margin: 18px auto;
  padding: 28px 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--fg);
}
.report-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}
.report-deal {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

table.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
table.report-table th,
table.report-table td {
  border: 1px solid var(--border-strong);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
table.report-table thead th {
  background: #eef2f6;
  font-weight: 700;
}
table.report-table td.col-name { width: 38%; font-weight: 600; }
table.report-table td.col-desc { white-space: pre-wrap; }

.report-total {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  font-size: 16px;
  font-weight: 700;
}
.report-total .total-label { color: var(--fg); }
.report-total .total-value { white-space: nowrap; }

/* ====== Печать ====== */
@media print {
  html, body { background: #fff; }
  .controls,
  .status { display: none !important; }
  .report {
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
  }
  table.report-table th,
  table.report-table td {
    border: 1px solid #000;
  }
  /* Не рвать строки таблицы между страницами */
  table.report-table tr { page-break-inside: avoid; }
  thead { display: table-header-group; }
}
