
:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dde5;
  --text: #1c2430;
  --muted: #647084;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --soft: #e8f3f1;
  --warn: #9a5b10;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, system-ui, -apple-system, sans-serif;
  font-size: 14px;
}
.appShell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
[hidden] { display: none !important; }
.loginScreen {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 76px;
  padding: 28px;
  background:
    linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.72)),
    linear-gradient(90deg, rgba(15,23,42,.06) 1px, transparent 1px),
    linear-gradient(rgba(15,23,42,.06) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}
.loginTop {
  width: min(860px, 100%);
  margin: 0 auto;
}
.loginBrand {
  width: fit-content;
  padding: 0;
  color: var(--text);
}
.loginBrand .mark {
  background: #1f2933;
  color: #f8fafc;
  border-radius: 999px;
}
.loginCard {
  width: min(560px, 100%);
  display: grid;
  gap: 20px;
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .08);
}
.loginCard h2 {
  font-size: 34px;
}
.loginIntro {
  max-width: 420px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}
.loginCard input {
  min-width: 0;
  width: 100%;
  min-height: 50px;
}
.loginButton {
  min-height: 66px;
  justify-content: space-between;
  padding: 0 26px;
  border-radius: 12px;
  background: #0f766e;
  font-size: 18px;
}
.sidebar {
  background: #1f2933;
  color: white;
  padding: 20px 14px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 22px;
}
.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #8cbdb6;
  color: #b8e7df;
  font-weight: 700;
}
h1, h2, p { margin: 0; }
h1 { font-size: 17px; }
h2 { font-size: 26px; letter-spacing: 0; }
.brand p, header p, .note, .mutedLine { color: var(--muted); }
.versionBadge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #4c6174;
  color: #cfe8e1;
  font-size: 12px;
  font-weight: 800;
}
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 4px;
}
nav { display: grid; gap: 6px; }
button, .button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  min-height: 38px;
  padding: 0 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}
button:hover, .button:hover { background: var(--accent-dark); }
button:disabled { opacity: .55; cursor: wait; }
.secondary { background: #edf1f5; color: #23303f; border: 1px solid var(--line); }
.secondary:hover { background: #e1e7ee; }
.danger { background: #b91c1c; color: white; }
.danger:hover { background: #991b1b; }
.nav {
  justify-content: start;
  background: transparent;
  color: #dce6ef;
  border: 1px solid transparent;
}
.nav.active { background: #31404f; border-color: #4c6174; }
main { padding: 22px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.topbarActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}
.view { display: none; }
.view.active { display: block; }
.searchBand {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
}
.searchBand h3 {
  font-size: 20px;
  margin-bottom: 6px;
}
.switchLine {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #f8fafc;
  font-size: 13px;
}
.switchLine input {
  min-width: 18px;
  width: 18px;
  height: 18px;
}
.inlineSwitch {
  min-height: 38px;
  margin: 0;
}
.inlineToolbar {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
}
.toolbar.compact { margin-top: -4px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  min-height: 38px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
  background: white;
}
textarea {
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  color: var(--text);
  background: white;
  resize: vertical;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.metrics div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.metrics span { display: block; font-size: 24px; font-weight: 750; }
.metrics small { color: var(--muted); }
.adminMetrics {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}
.adminTableWrap {
  margin-top: 14px;
}
.adminTable {
  min-width: 1120px;
  table-layout: fixed;
}
.adminTable td:nth-child(3),
.adminTable td:nth-child(4),
.adminTable td:nth-child(5) {
  white-space: normal;
}
.sourceAudit {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.sourceAudit summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}
.sourceAudit summary strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}
.sourceAuditBody {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
}
.sourceAuditMetrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.sourceAuditMetric {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.sourceAuditTableWrap {
  overflow: auto;
}
.sourceAuditTable {
  min-width: 880px;
  table-layout: fixed;
}
.sourceAuditTable td {
  font-size: 12px;
}
.sourceAuditSource {
  font-weight: 800;
}
.sourceAuditUrl {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.statusChip {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
}
.statusChip.changed {
  background: #dcfce7;
  color: #166534;
}
.statusChip.unchanged {
  background: #e0f2fe;
  color: #075985;
}
.statusChip.error {
  background: #fee2e2;
  color: #991b1b;
}
.statusChip.waiting {
  background: #fef3c7;
  color: #92400e;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}
.tableWrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tenderTable { table-layout: fixed; }
table { width: 100%; border-collapse: collapse; min-width: 1060px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); background: #f1f4f7; }
.tenderTable tbody tr {
  cursor: pointer;
}
.tenderTable tbody tr:hover {
  background: #f8fafc;
}
.tenderTable tbody tr.selectedRow {
  background: #e8f3f1;
  box-shadow: inset 3px 0 0 var(--accent);
}
td:first-child { font-weight: 700; white-space: nowrap; }
td:nth-child(2) { white-space: nowrap; color: var(--muted); font-weight: 700; }
.tenderTable td:nth-child(3) { white-space: normal; }
.tenderTitle {
  max-width: 360px;
  white-space: normal;
  font-weight: 750;
}
.authorityCell {
  max-width: 300px;
  white-space: normal;
  color: #334155;
}
.deadlineCell, .budgetCell {
  white-space: nowrap;
}
.actionStack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tinyButton {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.pill {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}
.previewPane {
  position: sticky;
  top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 440px;
  overflow: hidden;
}
.previewHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.iconLink {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 800;
}
.previewBody {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.docItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}
.docItem h4 {
  margin: 0 0 4px;
  font-size: 14px;
}
.docItem p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.docActions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.commandLog {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.commandLog summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 800;
}
.emptyState {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
pre {
  margin: 0;
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  background: #151b22;
  color: #dce6ef;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
}
.note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.rulesGrid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.panelHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
h3 {
  margin: 0;
  font-size: 16px;
}
.ruleList {
  display: grid;
  gap: 8px;
}
.ruleItem {
  width: 100%;
  min-height: 54px;
  justify-content: start;
  text-align: left;
  background: #f5f7fa;
  color: var(--text);
  border: 1px solid var(--line);
}
.ruleItem.active {
  background: #dcefeb;
  border-color: #8ac1b8;
}
.ruleItem small {
  color: var(--muted);
  font-weight: 600;
}
.editorGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}
.editorGrid .wide {
  grid-column: 1 / -1;
}
.inlineControls {
  display: grid;
  grid-template-columns: 92px minmax(120px, 1fr);
  gap: 8px;
}
.inlineControls select,
.inlineControls input {
  min-width: 0;
}
.editorActions {
  margin: 14px 0 0;
}
.noteText {
  color: var(--muted);
  font-size: 13px;
}
.busyOverlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .48);
  z-index: 20;
}
.busyOverlay.active {
  display: grid;
}
.busyPanel {
  width: min(420px, 100%);
  border-radius: 8px;
  border: 1px solid rgba(184, 231, 223, .55);
  background: #101820;
  color: #edf7f5;
  padding: 24px;
  text-align: center;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
}
.busyPanel h3 {
  font-size: 18px;
  margin: 12px 0 6px;
}
.busyPanel p {
  color: #a8b6c5;
  line-height: 1.45;
}
.radarPulse {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border: 1px solid rgba(140, 189, 182, .5);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(15, 118, 110, .9) 0 5px, transparent 6px),
    repeating-radial-gradient(circle at center, rgba(184, 231, 223, .12) 0 1px, transparent 1px 18px);
  overflow: hidden;
}
.radarPulse::before {
  content: "";
  position: absolute;
  inset: 50% 50% 0 50%;
  width: 44px;
  height: 44px;
  background: linear-gradient(45deg, rgba(45, 212, 191, .85), transparent 62%);
  transform-origin: 0 0;
  animation: sweep 1.45s linear infinite;
}
.radarPulse span {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(45, 212, 191, .45);
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes sweep {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  50% { transform: scale(1.28); opacity: .45; }
}
@media (max-width: 820px) {
  .appShell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(4, 1fr); }
  main { padding: 14px; }
  .searchBand,
  .workspace {
    grid-template-columns: 1fr;
  }
  .metrics,
  .adminMetrics { grid-template-columns: 1fr; }
  .rulesGrid,
  .editorGrid {
    grid-template-columns: 1fr;
  }
  .editorGrid .wide {
    grid-column: auto;
  }
  .loginScreen {
    gap: 54px;
    padding: 22px;
  }
  .loginCard {
    padding: 28px 24px;
    border-radius: 16px;
  }
  .loginCard h2 {
    font-size: 29px;
  }
  .workspace {
    display: block;
  }
  .tableWrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  table,
  .tenderTable,
  .adminTable,
  .sourceAuditTable {
    min-width: 0;
  }
  .tenderTable thead {
    display: none;
  }
  .tenderTable,
  .tenderTable tbody,
  .tenderTable tr,
  .tenderTable td {
    display: block;
    width: 100%;
  }
  .tenderTable tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    overflow: hidden;
  }
  .tenderTable td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
    white-space: normal;
  }
  .tenderTable td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .tenderTitle,
  .authorityCell {
    max-width: none;
  }
  .deadlineCell,
  .budgetCell {
    white-space: normal;
  }
  .previewPane {
    position: static;
    margin-top: 14px;
  }
}
