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

.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;
}

/* Certificate view */
.cert-body {
  margin: 0;
  padding: 14px 16px 32px;
  background: #ffffff;
  color: #1f1f1f;
  font-family: 'Times New Roman', Times, Georgia, serif;
}

.cert-page {
  max-width: 1120px;
  margin: 0 auto;
}

.cert-card {
  background: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  padding: 10px 24px 26px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #222222;
}

.cert-title {
  margin: 2px 0 18px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: #111111;
}

.cert-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.cert-top-left {
  display: flex;
  flex-direction: column;
}

.cert-row--spaced {
  margin-top: 22px;
}

.cert-top-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.cert-verify-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.cert-verify-label {
  margin-left: 6px;
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.share-btn {
  background: transparent;
  border: 0;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.share-btn:hover {
  background: #f3f4f6;
}

.copy-toast {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  color: #15803d;
  margin-left: 4px;
}

.cert-date-line {
  margin-top: 18px;
}

.cert-date-line--sub {
  margin-top: 14px;
}

.cert-divider {
  border: 0;
  border-top: 1px solid #d4d4d4;
  margin: 0 0 16px;
}

.cert-section {
  margin-bottom: 16px;
}

.cert-section--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.cert-s2-left {
  flex: 1;
}

.cert-s2-right {
  text-align: right;
  white-space: nowrap;
}

.cert-row {
  margin-bottom: 2px;
  word-break: break-word;
}

.cert-section--bottom {
  margin-bottom: 0;
}

.cert-subtitle {
  margin: 0 0 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #111111;
}

.cert-bar {
  background: #f5f5f5;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 12px;
}

.cert-details {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cert-not-found {
  padding: 32px 24px;
  text-align: center;
}

.cert-nf-text {
  margin: 18px 0;
}

.cert-nf-actions a {
  color: #111827;
}

@media (max-width: 680px) {
  .cert-card {
    padding: 10px 14px 20px;
  }

  .cert-top-row,
  .cert-section--split {
    flex-direction: column;
    align-items: flex-start;
  }

  .cert-top-right,
  .cert-s2-right {
    text-align: left;
    align-items: flex-start;
    white-space: normal;
  }
}

@media print {
  .cert-body {
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .cert-card {
    border-color: #cccccc;
  }
}

/* Lookup & Admin UI */
.lookup-body,
.admin-body {
  margin: 0;
  background: #f5f6f8;
  color: #18181b;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}

.lookup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lookup-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lookup-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #15803d;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.lookup-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.lookup-subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: #52525b;
}

.lookup-form {
  display: flex;
  gap: 8px;
}

.lookup-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  font-size: 14px;
}

.lookup-input:focus {
  outline: 2px solid #18181b;
  outline-offset: -1px;
}

.lookup-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #f4f4f5;
  text-align: right;
}

.lookup-admin-link {
  font-size: 12px;
  color: #71717a;
  text-decoration: none;
}

.lookup-admin-link:hover {
  color: #18181b;
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: #18181b;
  color: #ffffff;
}

.btn-primary:hover {
  background: #27272a;
}

.btn-secondary {
  background: #ffffff;
  color: #18181b;
  border-color: #d4d4d8;
}

.btn-secondary:hover {
  background: #f4f4f5;
}

.btn-danger {
  background: #ffffff;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

/* Admin shell */
.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: #ffffff;
  border-bottom: 1px solid #e4e4e7;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.admin-env-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #52525b;
}

.admin-env-tag--warn {
  background: #fef3c7;
  color: #92400e;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-user-label {
  font-size: 13px;
  color: #52525b;
}

.admin-nav {
  background: #ffffff;
  border-bottom: 1px solid #e4e4e7;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.admin-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #71717a;
  cursor: pointer;
  white-space: nowrap;
}

.admin-tab:hover {
  color: #18181b;
}

.admin-tab.is-active {
  color: #18181b;
  border-bottom-color: #18181b;
}

.admin-main {
  max-width: 1140px;
  width: 100%;
  margin: 24px auto;
  padding: 0 20px 48px;
}

.panel {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.panel-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #71717a;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: #3f3f46;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  background: #ffffff;
  color: #18181b;
}

.field textarea {
  min-height: 74px;
  resize: vertical;
}

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

.field-hint {
  font-size: 11.5px;
  color: #71717a;
}

.section-box {
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  padding: 16px;
  margin-top: 16px;
  background: #fafafa;
}

.section-box-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #3f3f46;
}

.form-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.alert-warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e4e4e7;
  vertical-align: middle;
}

.data-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #71717a;
  background: #fafafa;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.status-pill--ok {
  background: #dcfce7;
  color: #166534;
}

.status-pill--off {
  background: #fee2e2;
  color: #991b1b;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select {
  padding: 8px 10px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  font-size: 13.5px;
}

.toolbar input {
  flex: 1;
  min-width: 220px;
}

.is-hidden {
  display: none !important;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.inline-flex {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
