/* Admin UI styles — ported from docs-service's styles.css so both services' admin pages feel
   identical. Plain light theme, no external fonts, no CDN. */

:root {
  color-scheme: light;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 1000px;
  margin: 40px auto;
  padding: 20px;
  background: #f5f5f5;
  color: #1c1c1c;
}

h1 {
  margin-top: 0;
  color: #333;
}

h2 {
  color: #333;
}

.nav {
  margin-bottom: 16px;
  font-size: 14px;
}

.nav a {
  color: #2563eb;
  text-decoration: none;
  margin-right: 16px;
}

.nav a.active {
  font-weight: 600;
  color: #111;
}

.card {
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.info {
  margin: 16px 0;
}

.label {
  color: #666;
  font-size: 14px;
}

.value {
  font-family: monospace;
  font-size: 16px;
  color: #111;
}

.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 500;
}

.status.ok {
  background: #d4edda;
  color: #155724;
}

.status.error {
  background: #f8d7da;
  color: #721c24;
}

/* Amber, not red: a not_configured dependency is a deployment gap, not a failure. */
.status.not-configured {
  background: #fef3c7;
  color: #92400e;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.filter-row .form-group {
  margin-bottom: 0;
}

label {
  font-size: 14px;
  color: #444;
  margin-bottom: 4px;
}

input[type='text'],
input[type='email'],
input[type='file'],
input[type='datetime-local'],
select,
textarea {
  font: inherit;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

textarea {
  min-height: 60px;
  resize: vertical;
}

button {
  font: inherit;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: #e5e7eb;
  color: #111;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

table.admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.admin th,
table.admin td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

table.admin th {
  background: #f3f4f6;
}

table.admin tr.clickable {
  cursor: pointer;
}

table.admin tr.clickable:hover td {
  background: #f0f6ff;
}

pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 6px;
  max-height: 320px;
  overflow: auto;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.output {
  margin-top: 12px;
}

.small {
  font-size: 13px;
  color: #555;
}

.small.warning {
  color: #b45309;
  margin-top: 4px;
}

.auth-hint {
  color: #b91c1c;
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}

/* "You have not pasted a token yet" is the normal opening state of every page, not a failure.
   Alarm-red there trains you to ignore the colour by the time it means something. */
.auth-hint.auth-hint-neutral {
  color: #57606a;
  font-weight: 400;
}

summary {
  cursor: pointer;
  list-style-position: outside;
  margin-bottom: 8px;
}

summary .auth-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 12px;
}

.stat {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 12px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: #111;
  margin: 2px 0;
}

/* Status badges — one class per yousign wire status. */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
}

.badge-draft {
  background: #e5e7eb;
  color: #374151;
}

.badge-ongoing {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-done {
  background: #d4edda;
  color: #155724;
}

.badge-declined {
  background: #f8d7da;
  color: #721c24;
}

.badge-expired {
  background: #fef3c7;
  color: #92400e;
}

.badge-canceled {
  background: #f3f4f6;
  color: #6b7280;
}

/* Log level colouring. */
.level-INFO {
  color: #1d4ed8;
  font-weight: 600;
}

.level-WARN {
  color: #b45309;
  font-weight: 600;
}

.level-ERROR {
  color: #b91c1c;
  font-weight: 600;
}

/* Key/value grid used for status details and the request detail overview. */
dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 8px 0;
  font-size: 14px;
}

dl.kv dt {
  color: #666;
}

dl.kv dd {
  margin: 0;
  font-family: monospace;
  word-break: break-word;
}

/* Event timeline on the request detail page. */
.timeline {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border-left: 2px solid #e5e7eb;
}

.timeline li {
  position: relative;
  padding: 0 0 14px 18px;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

.timeline .event-kind {
  font-weight: 600;
}

.timeline .event-ts {
  font-family: monospace;
  font-size: 12px;
  color: #666;
}

.timeline details {
  margin-top: 4px;
}

.timeline details summary {
  font-size: 12px;
  color: #2563eb;
  margin-bottom: 4px;
}

/* Tiny horizontal bars in the per-day stats table. */
.bar {
  display: flex;
  height: 14px;
  background: #eef2f7;
  border-radius: 3px;
  overflow: hidden;
}

.bar-created {
  background: #2563eb;
}

.bar-completed {
  background: #16a34a;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* --- test ceremony page ---------------------------------------------------------------------
   The 1000px reading width the other pages use is too narrow here: the ceremony iframe carries a
   full PDF viewer and a signature pad and sits next to a live status panel. Opted into per page
   via <body class="wide"> rather than widening every admin page. */
body.wide {
  max-width: 1400px;
}

.test-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}

/* Below this width the two columns would each be too narrow to be usable, so stack them and let
   the ceremony keep the full measure. */
@media (max-width: 900px) {
  .test-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ceremony-frame {
  width: 100%;
  height: 800px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}

.test-pane {
  min-width: 0;
}

/* The timeline grows for the life of the ceremony; cap it so the panel does not push the
   downloads below the fold. */
.timeline-scroll {
  max-height: 420px;
  overflow-y: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

/* Expected-event checklist: pending is grey rather than red because every kind is legitimately
   absent until the signer reaches that step. */
.checklist {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
  font-family: monospace;
}

.checklist li {
  padding: 1px 0;
}

.checklist .seen {
  color: #15803d;
  font-weight: 600;
}

.checklist .pending {
  color: #9ca3af;
}

.outcome {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 24px;
  background: #fafafa;
}

/* The local-only OTP box on the test page. Deliberately loud and monospaced: it exists to be read
   off the screen at a glance, and the amber border is a standing reminder that this only ever
   appears on a laptop — no deployed environment serves the field that fills it. */
.otp-box {
  border: 1px solid #d4a72c;
  background: #fff8e5;
}

.otp-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #7a5d00;
}
