:root {
  --bid-bg: #f1f5f9;
  --bid-card: #ffffff;
  --bid-border: #cbd5e1;
  --bid-text: #0f172a;
  --bid-muted: #64748b;
  --bid-accent: #0f766e;
  --bid-accent-soft: #ccfbf1;
  --bid-danger: #b91c1c;
  --bid-header: #134e4a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bid-bg);
  color: var(--bid-text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.hidden { display: none !important; }

.bid-denied {
  max-width: 560px;
  margin: 4rem auto;
  background: var(--bid-card);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  text-align: center;
}

.bid-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.bid-topbar {
  background: var(--bid-header);
  color: #fff;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.bid-topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.bid-topbar .meta {
  font-size: 0.8rem;
  opacity: 0.85;
}

.bid-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bid-top-actions select,
.bid-top-actions input[type="text"] {
  padding: 0.4rem 0.55rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color: #fff;
  min-width: 160px;
}

.bid-top-actions select option { color: #0f172a; }

.btn {
  border: none;
  border-radius: 0.375rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: #14b8a6; color: #042f2e; }
.btn-secondary { background: rgba(255,255,255,.16); color: #fff; }
.btn-danger { background: #fecaca; color: #7f1d1d; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.bid-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.65rem 1rem 0;
  background: #e2e8f0;
  border-bottom: 1px solid var(--bid-border);
}

.bid-tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem 0.5rem 0 0;
  cursor: pointer;
  color: var(--bid-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.bid-tab.active {
  background: var(--bid-card);
  color: var(--bid-accent);
  border-color: var(--bid-border);
  border-bottom-color: var(--bid-card);
}

.bid-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1rem 0;
}

.bid-subtab {
  border: 1px solid var(--bid-border);
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--bid-muted);
}

.bid-subtab.active {
  background: var(--bid-accent-soft);
  border-color: #5eead4;
  color: #115e59;
  font-weight: 700;
}

.bid-main {
  padding: 1rem;
  flex: 1;
}

.bid-card {
  background: var(--bid-card);
  border: 1px solid var(--bid-border);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}

.bid-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.bid-card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: #334155;
}

.bid-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--bid-muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--bid-border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: #fff;
}

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

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--bid-border);
  border-radius: 0.5rem;
}

table.bid-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  font-size: 0.8rem;
}

table.bid-table th,
table.bid-table td {
  border: 1px solid #e2e8f0;
  padding: 0.3rem 0.35rem;
  vertical-align: middle;
}

table.bid-table th {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

table.bid-table input {
  width: 100%;
  min-width: 64px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.2rem;
  font-size: 0.8rem;
}

table.bid-table input:focus {
  outline: none;
  border-color: #14b8a6;
  background: #f0fdfa;
}

table.bid-table td.readonly {
  background: #f8fafc;
  color: #334155;
  white-space: nowrap;
}

table.bid-table tr.totals td {
  background: #ecfdf5;
  font-weight: 700;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  background: linear-gradient(180deg, #f0fdfa, #fff);
  border: 1px solid #99f6e4;
  border-radius: 0.65rem;
  padding: 0.85rem;
}

.summary-card .label {
  font-size: 0.75rem;
  color: var(--bid-muted);
  font-weight: 600;
}

.summary-card .value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #115e59;
  margin-top: 0.25rem;
}

.status-msg {
  margin: 0.5rem 1rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}

.status-msg.ok { background: #dcfce7; color: #166534; }
.status-msg.err { background: #fee2e2; color: #991b1b; }

.row-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}

.muted { color: var(--bid-muted); font-size: 0.85rem; }

@media (max-width: 800px) {
  .bid-topbar { align-items: flex-start; }
  .bid-top-actions { width: 100%; }
}


/* In-app (SPA main-content) layout */
.main-content .bid-app,
.main-content .bid-tool-page {
  min-height: auto;
  background: transparent;
}

.main-content .bid-topbar {
  position: sticky;
  top: 0;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
}

.main-content .bid-main {
  padding: 0;
}

.main-content .bid-tabs {
  border-radius: 0.75rem 0.75rem 0 0;
}
