/* Tender Hub — цифровая платформа для работы с тендерами */
:root {
  --bg: #f3f6f8;
  --bg-accent: #e8eef3;
  --surface: #ffffff;
  --ink: #1a2b36;
  --muted: #5b6b76;
  --line: #d5dee5;
  --brand: #0b5f73;
  --brand-2: #14808f;
  --ok: #1f7a4c;
  --warn: #9a6b00;
  --danger: #a33b3b;
  --info: #2c5aa0;
  --shadow: 0 10px 30px rgba(26, 43, 54, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "PT Sans", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9eef2 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e7eef8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--brand); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(120deg, #0b5f73, #14808f 55%, #2c6b8a);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand-block h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.brand-block p {
  margin: 4px 0 0;
  opacity: 0.9;
  font-size: 0.92rem;
}
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.72);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 20;
}
/* Навигация стилизуется в web.css (.nav a) — ссылки, не кнопки. */

.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 16px 20px 40px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h2, .panel h3 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}
.field label { font-size: 0.8rem; color: var(--muted); }
.field input, .field select, .field textarea,
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 100px; width: 100%; resize: vertical; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
}
.btn:hover { border-color: #b7c6d0; }
/* Варианты .btn.primary/.btn.danger/.btn.ghost — в web.css. */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.kpi-card {
  background: linear-gradient(180deg, #fff, var(--bg-accent));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.kpi-card .label { font-size: 0.8rem; color: var(--muted); }
.kpi-card .value { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.kpi-card .hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.kpi-card.na .value { color: var(--warn); font-size: 1rem; }

.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 12px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
}
table.data th, table.data td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  position: sticky;
  top: 0;
  background: #eef4f7;
  z-index: 1;
  cursor: pointer;
  white-space: nowrap;
}
table.data tr:hover td { background: #f7fbfd; }
table.data tr.selected td { background: #e4f4f6; }
table.data th:first-child,
table.data td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  box-shadow: 2px 0 0 var(--line);
}
table.data th:first-child {
  background: #eef4f7;
  z-index: 3;
}
table.data tr:hover td:first-child { background: #f7fbfd; }
table.data tr.selected td:first-child { background: #e4f4f6; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  background: #f4f7f9;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-Договор-заключен, .badge-Договор-подписан { background: #e8f7ee; color: var(--ok); border-color: #b9e0c7; }
.badge-Завершена { background: #eee; color: #555; }
.badge-Подведения-итогов, .badge-Торги { background: #fff7e8; color: var(--warn); }
.badge-Заявка-подана, .badge-Прием-заявок, .badge-Заключение-договора { background: #eef4ff; color: var(--info); }

.btn-paid {
  min-width: 3.2rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}
.btn-paid.paid-yes {
  background: #e8f7ee;
  border-color: #b9e0c7;
  color: var(--ok);
}
.btn-paid.paid-no {
  background: #fdeeee;
  border-color: #ebc3c3;
  color: #7a2a2a;
}
.btn-paid.paid-empty {
  background: #f3f3f3;
  color: #666;
}

.row-edit-actions {
  white-space: nowrap;
  min-width: 9.5rem;
}
.row-edit-actions .btn {
  margin: 2px 0;
}
.enrich-html-box summary {
  cursor: pointer;
  font-weight: 600;
}
.enrich-html-box textarea {
  width: 100%;
  margin-top: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
@media (max-width: 980px) {
  .layout-2 { grid-template-columns: 1fr; }
}

.card-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.meta-item {
  background: var(--bg-accent);
  border-radius: 10px;
  padding: 10px;
}
.meta-item .k { font-size: 0.75rem; color: var(--muted); }
.meta-item .v { margin-top: 3px; word-break: break-word; }

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fafcfd;
}

.chart-box {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.chart-box canvas { width: 100%; height: 100%; display: block; }

.checklist-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.agent-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfdfe;
}
.agent-io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 800px) { .agent-io { grid-template-columns: 1fr; } }
.pre {
  white-space: pre-wrap;
  background: #0f2430;
  color: #d7e8ef;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.82rem;
  max-height: 280px;
  overflow: auto;
}
.notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e8;
  border: 1px solid #ecd9a8;
  color: #6d5200;
  margin-bottom: 12px;
}
.notice.ok { background: #eaf7ef; border-color: #b7dfc4; color: #1f5d3a; }
.notice.err { background: #fdeeee; border-color: #ebc3c3; color: #7a2a2a; }
.hidden { display: none !important; }
.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 8px 16px 24px;
}
.tabs-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.subject-cell { max-width: 280px; }

.header-more {
  position: relative;
}
.header-more > summary {
  list-style: none;
  cursor: pointer;
}
.header-more > summary::-webkit-details-marker { display: none; }
.header-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.header-more-menu .btn { width: 100%; text-align: left; color: var(--ink); }

table.data th:first-child,
table.data td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 2px 0 0 var(--line);
}

.row-actions .btn {
  padding: 2px 6px;
  font-size: 0.72rem;
  min-width: 28px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 43, 54, 0.45);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }


.new-tender-form {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbfd, #eef5f7);
}
.new-tender-form h3 { margin: 0 0 6px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.form-span-2 { grid-column: span 2; }
@media (max-width: 700px) {
  .form-span-2 { grid-column: span 1; }
}
.new-tender-form textarea { min-height: 64px; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  white-space: nowrap;
}
.row-actions .btn {
  padding: 4px 8px;
  font-size: 0.78rem;
}
.row-actions a.btn {
  text-decoration: none;
  display: inline-block;
}
.links-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}
.links-panel .link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.links-panel .link-row .field { flex: 1; min-width: 220px; }
