:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --border: #dbe3ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1d4ed8;
  --primary-dark: #163ea8;
  --secondary: #e5e7eb;
  --danger: #b91c1c;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --neutral-bg: #e5e7eb;
  --neutral-text: #374151;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
}

.subtext {
  color: var(--muted);
  margin: 6px 0 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.controls-panel {
  padding: 18px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(3, 220px) auto;
  gap: 12px;
  margin-bottom: 14px;
}

.tabs-row {
  display: flex;
  gap: 10px;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px;
}

.summary-card {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.summary-label {
  color: var(--muted);
  font-size: 14px;
}

.summary-value {
  font-size: 28px;
  font-weight: bold;
  margin-top: 8px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: #111827;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.full-width {
  width: 100%;
}

.tab-btn {
  background: var(--secondary);
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: bold;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.list-header,
.vendor-row {
  display: grid;
  grid-template-columns: 130px 1.5fr 1.4fr 180px 180px 160px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
}

.list-header {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: bold;
}

.vendor-row {
  border-bottom: 1px solid #edf1f7;
  cursor: pointer;
}

.vendor-row:hover {
  background: #f8fbff;
}

.vendor-row:last-child {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.cert-yes,
.status-complete {
  background: var(--success-bg);
  color: var(--success-text);
}

.cert-no {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-progress {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.status-notstarted {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.hidden {
  display: none !important;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 22px;
  width: min(100%, 920px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-lg {
  width: min(100%, 920px);
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.close-btn {
  border: none;
  background: var(--secondary);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
}

.detail-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fbfcff;
}

.field-block {
  margin-bottom: 16px;
}

.field-block label {
  display: block;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 6px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.inline-row {
  display: flex;
  gap: 10px;
}

.inline-row input {
  flex: 1;
}

.modal-actions,
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login-card {
  width: min(100%, 460px);
  padding: 28px;
}

.login-form {
  margin-top: 16px;
}

.login-help {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.error,
.error-box {
  color: #b91c1c;
  min-height: 20px;
}

.error-box {
  background: #fee2e2;
  padding: 12px;
  border-radius: 12px;
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .controls-grid,
  .summary-panel,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .list-header,
  .vendor-row {
    grid-template-columns: 120px 1.3fr 1.2fr 150px 150px 150px;
  }
}

@media (max-width: 800px) {
  .controls-grid,
  .summary-panel,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .list-header {
    display: none;
  }

  .vendor-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}