/* ═══════════════════════════════════════════════════════
   ERM Components — « Le Registre »
   Shared by the dashboard, the portal, the recipient area and the public pages.
   ═══════════════════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--sans);
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 14px 30px -14px rgba(28, 27, 24, 0.6);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-mid); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  border-color: rgba(28, 27, 24, 0.6);
}
.btn-secondary:hover:not(:disabled) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-success {
  background: var(--ok);
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(31, 106, 74, 0.6);
}
.btn-success:hover:not(:disabled) { background: #185a3e; transform: translateY(-1px); }
.btn-danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad-border);
}
.btn-danger:hover:not(:disabled) { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  padding-left: 6px; padding-right: 6px;
}
.btn-ghost:hover:not(:disabled) { color: var(--ink); }
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

/* ─── Form fields ─── */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.field input.otp-input {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 10px;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 16px;
  background: var(--surface);
}

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.5;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--ink);
}
.alert-error { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.alert-info { background: var(--paper-deep); border-color: var(--border-light); color: var(--ink); }
.alert-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }

/* ─── Status: a serif word with a dot ─── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 400 13px/1 var(--serif);
  color: var(--ink-faint);
  white-space: nowrap;
}
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.status-pending { color: var(--ink-faint); }
.status-notified { color: var(--warn); }
.status-delivered { color: var(--ok); }
.status-refused { color: var(--bad); }
.status-negligence { color: var(--bad); }
.status-notification_failed { color: var(--bad); }

/* Status pill variant (portal) */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.5);
}

/* ─── Info boxes ─── */
.info-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 12px;
}
.info-box .info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 3px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.info-box .info-value {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
}

/* ─── Security badge ─── */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 28px;
}
.security-badge svg {
  width: 14px;
  height: 14px;
  stroke: var(--ink-muted);
  fill: none;
  stroke-width: 2;
}

/* ─── Hash display ─── */
.hash-block {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-secondary);
  word-break: break-all;
  line-height: 1.6;
  background: var(--paper-deep);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ink);
}
.hash-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 3px;
  display: block;
  font-family: var(--sans);
}
.hash-value { color: var(--ink); }
.hash-mono {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  word-break: break-all;
  background: var(--paper-deep);
  padding: 4px 8px;
  border-radius: 6px;
}

/* ─── Header / Logo brand (portal, public) ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 36px;
  border-bottom: 1px solid var(--rule);
  background: rgba(244, 239, 230, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}
.logo-brand img {
  height: 36px;
  width: auto;
  object-fit: contain;
}
.logo-brand-divider {
  width: 1px;
  height: 26px;
  background: var(--rule);
}
.logo-brand-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}
.logo-brand-badge svg { width: 15px; height: 15px; color: var(--ink); flex-shrink: 0; }
.logo-brand-badge span {
  font: 400 13px/1 var(--serif);
  color: var(--ink);
}

/* ─── Prospect logo area ─── */
.prospect-logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}
.prospect-divider {
  width: 1px;
  height: 26px;
  background: var(--rule);
}
.prospect-logo {
  height: 32px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

/* ─── Footer ─── */
.portal-footer, .footer {
  text-align: center;
  padding: 24px;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.7;
  border-top: 1px solid var(--rule);
}

/* ─── Attachments ─── */
.attachment-list { list-style: none; }
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: background 0.15s;
}
.attachment-item:hover { background: #fff; }
.attachment-item .att-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.attachment-item .att-size { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-family: var(--mono); }
.attachment-item a {
  font-size: 13px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}
.attachment-item a:hover { color: var(--bad); }

/* ─── Message content ─── */
.message-content {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 26px 28px;
  margin: 20px 0;
  line-height: 1.75;
  font-size: 15px;
  color: var(--ink);
}

/* ─── Selects (dashboard forms) ─── */
.main-content .form-group select, .field select {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 42px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.55);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
                    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.main-content .form-group select:hover:not(:disabled) { border-color: var(--ink); }
.main-content .form-group select:focus, .field select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.main-content .form-group select:disabled {
  background-color: var(--paper-deep);
  color: var(--ink-muted);
  cursor: not-allowed;
}
.main-content .form-group select[multiple],
.main-content .form-group select[size]:not([size="1"]) {
  background-image: none;
  padding-right: 14px;
}
@media (max-width: 768px) {
  .main-content .form-group select { font-size: 16px; }
}
@media (forced-colors: active) {
  .main-content .form-group select { appearance: auto; background-image: none; }
}

/* ─── Responsive ─── */
@media (max-width: 560px) {
  .header { padding: 14px 16px; }
  .logo-brand img { height: 30px; }
  .logo-brand-divider { display: none; }
  .prospect-divider { display: none; }
  .prospect-logo { height: 24px; }
  .btn-group { gap: 8px; }
  .info-box { padding: 10px 14px; }
  .info-box .info-value { font-size: 13px; }
  .field input { padding: 10px 14px; font-size: 14px; }
  .field input.otp-input { font-size: 22px; letter-spacing: 8px; }
  .attachment-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; }
  .attachment-item a { padding: 4px 0; }
  .hash-block { font-size: 10px; padding: 8px 12px; }
  .message-content { padding: 16px; font-size: 14px; }
}
