:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #5c667a;
  --line: #dde2ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.bid-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 69px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.bid-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  min-height: 69px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand,
.top-actions a,
.top-actions button {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  font-weight: 700;
}

.brand-logo {
  display: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.brand-symbol {
  display: inline-block;
  width: 36px;
  height: 36px;
  background: #fff url("../assets/doc365ai-logo.png") left center / auto 40px no-repeat;
  font-size: 0;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  line-height: 1.1;
}

.brand-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-caption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 18px;
  font-size: 14px;
}

.top-actions [hidden] {
  display: none !important;
}

.top-actions button {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.top-actions .login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.top-actions .login-link:hover {
  background: #1d4ed8;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.12);
}

.bid-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.summary,
.section-title p,
.upload-panel p {
  color: var(--muted);
}

.limits {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}

.project-band {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.field {
  display: grid;
  gap: 8px;
  max-width: 520px;
  margin-bottom: 22px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.upload-panel {
  display: grid;
  gap: 14px;
  min-height: 270px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  text-align: center;
}

.status-pill.pending {
  color: var(--warn);
  border-color: #f5c16c;
}

.status-pill.uploaded {
  color: var(--ok);
  border-color: #9bd3ad;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #f0fdfa;
  font-weight: 700;
  cursor: pointer;
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.file-list {
  display: grid;
  gap: 8px;
  min-height: 90px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-state {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  min-height: 24px;
  margin-top: 18px;
  color: var(--danger);
  font-weight: 700;
}

.notice.ok {
  color: var(--ok);
}

.command-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.matrix-shell {
  width: min(1360px, calc(100% - 32px));
}

.matrix-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.matrix-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats-grid span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.stats-grid small {
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.filters label,
.compact-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.matrix-table-wrap {
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 14px;
}

.matrix-table th,
.matrix-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.matrix-table th {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.matrix-table td {
  max-width: 260px;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.matrix-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.matrix-pill.not_responded,
.matrix-pill.negative_deviation,
.matrix-pill.risk-high {
  background: #fee2e2;
  color: var(--danger);
}

.matrix-pill.evidence_insufficient,
.matrix-pill.partial,
.matrix-pill.risk-medium {
  background: #fef3c7;
  color: var(--warn);
}

.matrix-pill.responded,
.matrix-pill.risk-low {
  background: #dcfce7;
  color: var(--ok);
}

.side-stack {
  display: grid;
  gap: 18px;
}

.evidence-panel h3 {
  margin-top: 12px;
}

.evidence-list {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.evidence-list div {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.evidence-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.evidence-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.remediation-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding-left: 22px;
}

.remediation-list li span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.compact-title {
  margin-bottom: 4px;
}

.hidden {
  display: none;
}

.report-params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}

.report-params div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.report-params dt {
  color: var(--muted);
  font-size: 13px;
}

.report-params dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

@media (max-width: 760px) {
  .bid-topbar-inner {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding: 10px 16px;
  }

  .section-title,
  .command-row {
    align-items: stretch;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .brand-caption {
    display: none;
  }

  .top-actions {
    flex: 0 1 auto;
    gap: 8px 12px;
    white-space: nowrap;
  }

  .top-actions .login-link {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-head,
  .upload-grid,
  .report-params,
  .matrix-head,
  .stats-grid,
  .filters,
  .matrix-layout {
    grid-template-columns: 1fr;
  }

  .matrix-actions {
    justify-content: stretch;
  }

  h1 {
    font-size: 28px;
  }
}
