:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #142028;
  --muted: #53626f;
  --accent: #0c6d73;
  --accent-strong: #084f53;
  --danger: #9d2a2a;
  --border: #d4dde3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, #e6eef3 0%, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  width: min(860px, 94vw);
  margin: 28px auto 48px;
  display: grid;
  gap: 14px;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 1.9vw, 2.1rem);
}

.subtle {
  color: var(--muted);
  margin: 6px 0 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(11, 25, 37, 0.06);
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  font-weight: 600;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fcfdff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

.danger-button {
  background: #a03232;
}

.danger-button:hover {
  background: #872727;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row > label {
  flex: 1 1 180px;
}

#signature-canvas {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px dashed #9ab0bc;
  background: #fff;
  touch-action: none;
}

#status-box.error {
  border-color: #efbcbc;
  color: var(--danger);
}

.staff-container {
  width: min(980px, 94vw);
}

.staff-form h2 {
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: 500;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.button-link {
  display: inline-block;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  background: #e4edf3;
  color: #113247;
}

.button-link:hover {
  background: #d5e3ec;
}

.text-error {
  color: var(--danger);
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfdff;
}

.recent-item p {
  margin: 4px 0;
}

.recent-item a {
  word-break: break-all;
}

.request-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.request-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfdff;
}

.request-item-header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
}

.request-item p {
  margin: 6px 0 0;
}

.request-item-ids {
  word-break: break-word;
}

.request-actions {
  margin-top: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #e9eff3;
  color: #263842;
}

.status-pending {
  background: #dff0ee;
  color: #07575b;
}

.status-submitted {
  background: #e1ecfa;
  color: #1b4a7b;
}

.status-revoked,
.status-expired {
  background: #f2e4e4;
  color: #8a2424;
}

.audit-table-wrap {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}

.audit-table th,
.audit-table td {
  border-bottom: 1px solid #e5ecf1;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  white-space: nowrap;
  background: #f4f8fb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.audit-table td {
  word-break: break-word;
}

.submission-shell {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.submission-list-panel,
.submission-preview-panel {
  min-width: 0;
}

.submission-list {
  display: grid;
  gap: 10px;
}

.submission-item {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, #fcfeff 0%, #f1f7fa 100%);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(11, 25, 37, 0.05);
}

.submission-item:hover {
  background: linear-gradient(180deg, #f6fbfd 0%, #e8f2f6 100%);
}

.submission-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(12, 109, 115, 0.12);
}

.submission-item p {
  margin: 4px 0 0;
}

.submission-item-emails,
.submission-item-ids {
  word-break: break-word;
}

.submission-preview {
  display: grid;
  gap: 12px;
}

.submission-preview-header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
}

.submission-preview-header h3 {
  margin: 0;
}

.submission-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 12px;
  background: #f7fbfd;
  border: 1px solid #dce8ee;
  border-radius: 12px;
}

.submission-detail-grid p {
  margin: 0;
  word-break: break-word;
}

.submission-pdf-frame {
  width: 100%;
  min-height: 820px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #eef3f6;
}

@media (max-width: 680px) {
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .submission-shell {
    grid-template-columns: 1fr;
  }

  .submission-detail-grid {
    grid-template-columns: 1fr;
  }

  .submission-pdf-frame {
    min-height: 560px;
  }
}
