/* Shared components, forms, banners and search base rules. */
.hero,
.detail-hero,
.search-panel,
.detail-card,
.recipe-card,
.admin-table-card,
.document-card,
.empty-state {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 18px;
  padding: 22px;
}

.hero-copy h1,
.detail-hero h1 {
  margin: 0;
  font-family: "Georgia", serif;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.05;
}

.lede,
.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.64rem;
  color: var(--accent);
  font-weight: 700;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.hero-stats article,
.document-card dl div,
.nutrition-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(24, 48, 45, 0.08);
}

.hero-stats strong {
  display: block;
  font-size: 1.42rem;
}

.hero-panel,
.stacked-form,
.compact-form {
  display: grid;
  gap: 14px;
}

.form-hint {
  margin: -4px 0 0;
}

.upload-limits-form {
  padding-top: 14px;
  border-top: 1px solid rgba(24, 48, 45, 0.1);
}

.upload-limits-form p {
  margin: 4px 0 0;
}

.upload-limits-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 150px);
  gap: 10px;
  align-items: center;
}

.banner {
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 600;
}

.banner-success {
  background: rgba(142, 164, 79, 0.18);
  color: #30451d;
}

.banner-error {
  background: rgba(178, 76, 64, 0.16);
  color: #6f2c24;
}

label {
  font-weight: 700;
}

input[type="file"],
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid rgba(24, 48, 45, 0.18);
  border-radius: 14px;
  background: white;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #e58f58);
  color: white;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-row input {
  width: auto;
}

.permission-fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(24, 48, 45, 0.1);
  border-radius: 16px;
  display: grid;
  gap: 10px;
}

.permission-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  color: var(--muted);
}

.permission-checklist {
  display: grid;
  gap: 8px;
}

.permission-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 48, 45, 0.08);
}

.permission-option input {
  margin-top: 2px;
}

.permission-option span {
  display: grid;
  gap: 4px;
}

.permission-option small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.permission-option-readonly {
  opacity: 0.82;
}

.stacked-actions {
  display: grid;
  gap: 12px;
}

.chip-link {
  text-decoration: none;
}

.danger-button {
  background: linear-gradient(135deg, var(--danger), #d46858);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(24, 48, 45, 0.16);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.sample-list,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sample-list span,
.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(24, 48, 45, 0.08);
  color: var(--ink);
  font-size: 0.8rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.section-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.section-heading-compact {
  align-items: start;
}

.section-heading h2,
.detail-card h2 {
  margin: 0;
  font-family: "Georgia", serif;
  font-size: 1.32rem;
  line-height: 1.1;
}

.search-panel {
  padding: 18px;
}

.chat-thread {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  margin: 14px 0;
}

.message {
  display: grid;
  gap: 8px;
}

.message-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.message-body {
  padding: 13px 15px;
  border-radius: 18px;
  max-width: min(960px, 100%);
}

.message.user .message-body {
  margin-left: auto;
  background: linear-gradient(135deg, #1f4e48, #285b54);
  color: white;
}

.message.assistant .message-body {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(24, 48, 45, 0.08);
}

.message.assistant .message-body > p:first-child {
  margin-top: 0;
}

.message.assistant .message-body > p:last-child {
  margin-bottom: 0;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.search-form-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
  align-self: stretch;
}

.search-mode-panel {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.search-mode-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.search-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(24, 48, 45, 0.08);
}

.search-mode-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-mode-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.search-mode-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border-radius: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.search-mode-option input:checked + span {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(24, 48, 45, 0.1);
}

.search-mode-option-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.search-form button[type="submit"] {
  min-width: 160px;
}
