:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #697386;
  --line: #dce2ea;
  --brand: #0f6b99;
  --brand-dark: #094d73;
  --success: #15855f;
  --warning: #b7791f;
  --danger: #bd3d3a;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #0b344c;
  color: #ffffff;
}

.topbar h1,
.section-heading h2,
.sidebar h2,
.modal h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: currentColor;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.72;
  text-transform: uppercase;
}

.primary-action {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 16px;
}

.primary-action:hover {
  background: var(--brand-dark);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 40px;
}

.sidebar,
.workspace,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  display: grid;
  gap: 28px;
  padding: 22px;
}

.sidebar h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0 7px;
}

select,
input[type="text"],
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
}

.keyword-input {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.keyword-input button,
.close-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.chip,
.status {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.chip {
  background: #e6f2f7;
  color: var(--brand-dark);
}

.chip button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  padding: 0;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.api-status {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.api-status.mock {
  background: #fff4df;
  color: var(--warning);
}

.api-status.live {
  background: #e8f6ef;
  color: var(--success);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 34px;
  margin-top: 8px;
}

.tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  margin-top: 22px;
}

.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 14px 12px;
}

.tab.active {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.view {
  display: none;
  padding-top: 22px;
}

.view.active {
  display: block;
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading input {
  max-width: 420px;
}

.tenders-list,
.documents-grid,
.recommendation-list {
  display: grid;
  gap: 14px;
}

.tender-card,
.document-card,
.recommendation-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.tender-top {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.tender-card h3,
.document-card h3,
.recommendation-list h3 {
  margin: 0 0 8px;
}

.tender-card p,
.document-card p,
.recommendation-list p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.tender-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0;
}

.tender-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
}

.status.open {
  background: #e6f2f7;
  color: var(--brand-dark);
}

.status.applied,
.status.won,
.document-card.ready {
  background: #e8f6ef;
  color: var(--success);
}

.status.lost,
.document-card.missing {
  background: #faebea;
  color: var(--danger);
}

.status.draft {
  background: #fff4df;
  color: var(--warning);
}

.document-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.modal {
  align-items: center;
  background: rgba(12, 22, 35, 0.58);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
}

.modal.open {
  display: flex;
}

.modal-panel {
  max-width: 620px;
  padding: 24px;
  position: relative;
  width: 100%;
}

.close-btn {
  height: 36px;
  position: absolute;
  right: 16px;
  top: 16px;
  width: 36px;
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.checklist-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.upload-box {
  border: 1px dashed var(--brand);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 16px;
}

.full {
  width: 100%;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

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

@media (max-width: 640px) {
  .topbar,
  .section-heading,
  .tender-top {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .document-card {
    grid-template-columns: 1fr;
  }
}
