:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #101827;
  --muted: #607086;
  --line: #dce4ee;
  --primary: #0b3b75;
  --primary-2: #0f5ed7;
  --accent: #ff8a1f;
  --success: #137a52;
  --danger: #c03434;
  --shadow: 0 18px 50px rgba(15, 34, 59, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, Manrope, Onest, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #07111f;
  --surface: #0d1b2f;
  --surface-2: #132641;
  --text: #eef5ff;
  --muted: #9eb0c6;
  --line: #263b58;
  --primary: #7ab3ff;
  --primary-2: #3f8cff;
  --accent: #ff9b3d;
  --success: #45c08a;
  --danger: #ff6b6b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.88);
  backdrop-filter: blur(18px);
}

[data-theme="dark"] .topnav {
  background: rgba(7, 17, 31, 0.9);
}

.nav-inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 10px 28px rgba(15, 94, 215, 0.28);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 14px 32px rgba(15, 94, 215, 0.24);
}

.btn.accent {
  background: var(--accent);
  color: #111827;
}

.btn.ghost {
  border-color: var(--line);
  background: transparent;
}

.btn.danger {
  background: rgba(192, 52, 52, 0.12);
  color: var(--danger);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 68px;
  background:
    radial-gradient(circle at 75% 18%, rgba(15, 94, 215, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(15, 94, 215, 0.06));
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  align-items: center;
  gap: 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(40px, 7vw, 78px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 700px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.mockup {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mockup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.mockup-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.pulse-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 94, 215, 0.08), transparent);
}

.score {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: rgba(19, 122, 82, 0.12);
  color: var(--success);
  font-weight: 800;
}

.section {
  padding: 58px 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 32px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(15, 34, 59, 0.06);
}

.tender-card {
  cursor: pointer;
  padding: 16px 18px;
}

.tender-card:hover {
  border-color: rgba(15, 94, 215, 0.35);
  box-shadow: var(--shadow);
}

.tender-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.tender-card .page-head {
  margin-bottom: 12px;
}

.tender-card p {
  margin-bottom: 12px;
}

.card.featured {
  border-color: var(--primary-2);
  box-shadow: var(--shadow);
}

.muted {
  color: var(--muted);
}

.kpi {
  font-size: 30px;
  font-weight: 800;
}

.tender-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-2);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.meta-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: start;
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
}

.detail-title-block {
  min-width: 0;
}

.detail-hero h1 {
  max-width: 980px;
  margin: 14px 0 10px;
  font-size: clamp(28px, 3.3vw, 42px);
  line-height: 1.12;
}

.detail-summary {
  max-width: 980px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.detail-highlights {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.highlight-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
}

.highlight-item.primary {
  border-color: rgba(15, 94, 215, 0.28);
  background: rgba(15, 94, 215, 0.08);
}

.highlight-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.highlight-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.detail-main {
  display: grid;
  gap: 16px;
}

.detail-section h2 {
  margin: 0 0 18px;
  font-size: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  margin: 0;
}

.detail-list div {
  border-bottom: 1px solid var(--line);
  padding: 0 0 14px;
  margin-bottom: 14px;
}

.detail-list dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-list dd {
  display: block;
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.description-box {
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

.action-panel {
  position: sticky;
  top: 96px;
  padding: 20px;
}

.action-panel .btn {
  width: 100%;
}

.checkout-shell {
  display: grid;
  gap: 18px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.checkout-main {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.checkout-main h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.plan-summary div,
.freedom-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
}

.plan-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.plan-summary strong {
  display: block;
  font-size: 18px;
}

.checkout-aside {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
}

.checkout-aside .btn {
  width: 100%;
}

.stat-list {
  display: grid;
  gap: 10px;
}

.stat-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.stat-list span {
  color: var(--muted);
}

.stat-list strong {
  text-align: right;
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.chat-card {
  display: grid;
  gap: 14px;
  min-height: 560px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-bubble {
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.5;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--surface-2);
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(15, 94, 215, 0.1);
  border-color: rgba(15, 94, 215, 0.24);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.activity-row {
  padding: 14px 18px;
}

.activity-row p {
  margin-bottom: 0;
}

.telegram-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
}

.telegram-box strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 14px;
}

.side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--muted);
}

.side-link.active,
.side-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.content {
  min-width: 0;
  padding: 26px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(15, 94, 215, 0.14);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.tag.ok {
  background: rgba(19, 122, 82, 0.12);
  color: var(--success);
}

.reason-line {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.reason-grid {
  display: grid;
  gap: 12px;
}

.reason-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-2);
}

.reason-grid span {
  color: var(--muted);
  font-size: 12px;
}

.reason-grid strong {
  line-height: 1.45;
}

.admin-kpi {
  min-height: 108px;
}

.admin-table table {
  min-width: 1120px;
}

.admin-table td {
  min-width: 150px;
}

.admin-table p {
  margin: 6px 0 0;
}

.admin-plan-select {
  min-width: 130px;
}

.admin-actions {
  display: grid;
  gap: 8px;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-stats {
  margin-bottom: 20px;
}

.compact-stats .card {
  min-height: 104px;
}

.finance-selector {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.tender-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tender-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.tender-check strong,
.tender-check small {
  display: block;
  overflow-wrap: anywhere;
}

.tender-check small {
  margin-top: 4px;
  color: var(--muted);
}

.tag.warn {
  background: rgba(255, 138, 31, 0.16);
  color: #985100;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 16px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .hero-grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .filter-panel,
  .tender-check-grid,
  .split,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .detail-hero,
  .detail-layout,
  .checkout-grid,
  .assistant-layout {
    grid-template-columns: 1fr;
  }

  .detail-highlights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-panel,
  .checkout-aside {
    position: static;
  }

  .tender-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: sticky;
    top: 72px;
    z-index: 9;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  .side-link {
    white-space: nowrap;
  }

  .nav-links {
    display: none;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 20px, 1160px);
  }

  .nav-inner,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .content {
    padding: 18px 12px;
  }

  .hero {
    padding: 44px 0;
  }

  .hero h1 {
    font-size: 42px;
  }

  .tender-meta {
    grid-template-columns: 1fr;
  }

  .detail-list,
  .detail-highlights,
  .plan-summary,
  .filter-actions,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .chat-bubble {
    max-width: 100%;
  }
}
