/* Reset & base */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 16px/1.5 system-ui, sans-serif;
  color: #222;
  background: #f5f5f5;
}

/* Layout */

.page {
  min-height: 100vh;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
}

.page > * {
  width: 100%;
  margin: auto;
}

.shell-sm { max-width: 30rem; }
.shell-md { max-width: 42rem; }
.shell-lg { max-width: 60rem; }

/* Headers */

.head h1 {
  margin: 0;
  font-size: 1.5rem;
}

.head--center {
  text-align: center;
  margin-bottom: 1.5rem;
}

.head--center p {
  margin: 0.5rem 0 0;
  color: #666;
}

.head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.head--split .brand-logo {
  margin: 0 0 0.75rem;
}

.brand-logo {
  display: block;
  height: 2rem;
  width: auto;
  margin: 0 auto 1.5rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1rem;
}

.section + .section {
  margin-top: 2rem;
}

/* Utilities */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[x-cloak] {
  display: none !important;
}

.muted { color: #666; }
.text-center { text-align: center; }

/* Panels */

.panel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1.25rem;
}

.panel + .panel {
  margin-top: 1.5rem;
}

.panel--soft {
  background: #fafafa;
  border-color: #eee;
  padding: 1rem;
}

.panel--table {
  padding: 0;
  overflow-x: auto;
}

/* Read-only & summary */

.readout,
.rows {
  margin: 0;
}

.readout dt,
.rows dt {
  color: #666;
}

.readout dd,
.rows dd {
  margin: 0.125rem 0 0;
}

.readout > div + div {
  margin-top: 0.75rem;
}

.rows > div {
  padding: 0.75rem 0;
  border-top: 1px solid #eee;
}

.rows > div:first-child {
  border-top: none;
}

.row-edit,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.actions {
  margin-top: 1.5rem;
}

form .actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Forms */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
}

.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.field textarea {
  min-height: 6rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid #666;
  outline-offset: 1px;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #c00;
}

.hint,
.error {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
}

.error {
  color: #c00;
}

.form-stack > * + * {
  margin-top: 1rem;
}

.consent {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Injected agreement body — dossier/agreement.html #agreement-content */

.agreement-body {
  line-height: 1.7;
  font-size: 0.9375rem;
}

.agreement-body > * + * {
  margin-top: 1rem;
}

.agreement-body h2 {
  margin: 1.75rem 0 0;
  font-size: 1rem;
}

.agreement-body h3 {
  margin: 1.5rem 0 0;
  font-size: 0.9375rem;
}

.agreement-body ul {
  list-style: disc;
  padding-left: 1.25rem;
}

.agreement-body ol {
  list-style: decimal;
  padding-left: 1.25rem;
}

.agreement-body li + li {
  margin-top: 0.25rem;
}

/* Buttons */

.btn {
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.625rem;
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  line-height: 1.5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  font: inherit;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
}

.btn-ghost:hover {
  background: #eee;
}

.panel > .btn,
a.btn {
  display: inline-flex;
  text-decoration: none;
  background: #222;
  color: #fff;
  border-color: #222;
}

.panel > .btn {
  display: block;
  width: 100%;
  text-align: center;
}

/* Alerts */

.alert {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.alert h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.alert p {
  margin: 0;
}

.alert--error {
  border-color: #f0c0c0;
  background: #fff5f5;
}

/* Tables */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-top: 1px solid #eee;
}

.table thead th {
  border-top: none;
  font-weight: 600;
  color: #666;
  font-size: 0.8125rem;
}

.table tbody tr:first-child td {
  border-top: none;
}

.table tr.clickable {
  cursor: pointer;
}

.table tr.clickable:hover {
  background: #fafafa;
}

/* Badges */

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 999px;
  background: #eee;
  color: #333;
}

.badge--signed {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge--denied {
  background: #ffebee;
  color: #c62828;
}

/* Combobox */

.combobox-wrap {
  position: relative;
}

.combobox-list {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow: auto;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.combobox-option {
  display: block;
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}

.combobox-option:hover {
  background: #f0f0f0;
}
