/* dsign admin portal */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
.hidden { display: none !important; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.25);
}
.site-header-compact { box-shadow: none; }
.site-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  object-fit: contain;
}
.brand-name { font-weight: 700; font-size: 18px; }
.site-nav { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 13px; opacity: 0.95; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.halcom-test-ok { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #86efac; }
.halcom-test-ok:hover { background: #bbf7d0 !important; }
.halcom-test-fail { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fca5a5; }
.halcom-test-fail:hover { background: #fecaca !important; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; border: none; cursor: pointer; font-weight: 600; }
.btn-xs.btn-edit { background: #e0e7ff; color: #4338ca; }
.btn-xs.btn-edit:hover { background: #c7d2fe; }
.btn-xs.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-xs.btn-danger:hover { background: #fecaca; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Landing ─────────────────────────────────────────────── */
.landing-main { max-width: 900px; margin: 0 auto; padding: 64px 24px; }
.hero { text-align: center; }
.badge-ok {
  display: inline-block; background: #d1fae5; color: #065f46;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; margin-bottom: 20px;
}
.hero h1 { font-size: 36px; margin-bottom: 16px; color: #1e3a8a; }
.hero-lead { font-size: 17px; color: #64748b; line-height: 1.6; max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Auth page ───────────────────────────────────────────── */
.auth-page { background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 40%); }
.auth-card-wrap { display: flex; justify-content: center; padding: 40px 16px 64px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 12px; padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: #64748b; margin-bottom: 20px; }
.social-btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  padding: 10px; margin-bottom: 8px; border: 1px solid #cbd5e1;
  border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
}
.social-btn:hover { background: #f8fafc; }
.ms-btn { background: #2f2f2f; color: #fff; border-color: #2f2f2f; }
.ms-btn:hover { background: #1a1a1a; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.login-form label { font-size: 12px; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 4px; }
.login-form input { padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }
.link-btn { background: none; border: none; color: #2563eb; font-size: 12px; cursor: pointer; margin-bottom: 8px; }
.msg { font-size: 12px; margin-top: 12px; padding: 8px; border-radius: 6px; display: none; }
.msg.show { display: block; }
.msg.error { background: #fee2e2; color: #991b1b; }
.msg.info { background: #eff6ff; color: #1e40af; }
.msg.success { background: #d1fae5; color: #065f46; }

/* ── Admin shell ─────────────────────────────────────────── */
.admin-shell { max-width: 1200px; margin: 0 auto; padding: 24px; }
.admin-title { font-size: 24px; margin-bottom: 4px; }
.admin-sub { color: #64748b; font-size: 14px; margin-bottom: 20px; }

.tab-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 2px solid #e2e8f0; margin-bottom: 20px;
}
.tab-bar button {
  padding: 10px 16px; border: none; background: none;
  font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab-bar button.active { color: #1e40af; border-bottom-color: #1e40af; }

.panel { display: none; }
.panel.active { display: block; }

.section {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 20px; margin-bottom: 16px;
}
.section h3 { font-size: 16px; margin-bottom: 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h3 { margin-bottom: 0; }

.help { font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.5; }
.help.warn { color: #92400e; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row label { font-size: 12px; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 4px; }
.form-row input, .form-row select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.form-grid label {
  font-size: 12px; font-weight: 600; color: #475569;
  display: flex; flex-direction: column; gap: 4px;
}
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px;
}
.form-grid input:focus, .form-grid select:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

.form-checkboxes { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; font-weight: 500; }
.checkbox-label input { width: auto; cursor: pointer; }

.req { color: #dc2626; }

/* ── Table ───────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 10px; text-align: left; border-bottom: 1px solid #e2e8f0; }
table.data th { background: #f8fafc; font-weight: 600; color: #374151; }
table.data tr:hover td { background: #f8fafc; }
/* Compact variant for dense, read-only listings (e.g. Onboarding activity). */
table.data.compact { font-size: 12px; }
table.data.compact th, table.data.compact td { padding: 6px 8px; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }
.badge-role { background: #eff6ff; padding: 2px 8px; border-radius: 4px; font-size: 11px; color: #1e40af; font-weight: 600; }
.active-yes { color: #16a34a; font-weight: 600; }
.active-no  { color: #dc2626; font-weight: 600; }

.status-line { font-size: 13px; margin-top: 10px; min-height: 18px; }
.status-line.error { color: #dc2626; }
.status-line.success { color: #059669; }
.status-line.info { color: #2563eb; }

/* ── Summary cards ───────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.summary-card { padding: 16px; border-radius: 8px; color: #fff; }
.summary-card .label { font-size: 12px; opacity: 0.9; }
.summary-card .value { font-size: 28px; font-weight: 700; }
.card-blue { background: linear-gradient(135deg, #1e40af, #2563eb); }
.card-green { background: linear-gradient(135deg, #059669, #10b981); }
.card-red { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ── TSA ─────────────────────────────────────────────────── */
.tsa-item {
  padding: 14px; border: 1px solid #e2e8f0; border-radius: 8px;
  margin-bottom: 10px; background: #fafafa;
}
.tsa-item label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 4px;
}
.tsa-item input[type=radio] { width: auto; cursor: pointer; accent-color: #2563eb; }
.tsa-unavailable { opacity: 0.55; }
.tsa-unavailable label { cursor: not-allowed; color: #6b7280; }
.badge-warn {
  font-size: 10px; font-weight: 700; background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; border-radius: 4px; padding: 1px 6px;
}
.badge-active {
  font-size: 10px; font-weight: 700; background: #d1fae5; color: #065f46;
  border: 1px solid #6ee7b7; border-radius: 4px; padding: 1px 6px;
}
.mono-small { font-size: 11px; color: #64748b; font-family: monospace; margin-top: 2px; }

/* ── CRL cards ───────────────────────────────────────────── */
.crl-card {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px;
  margin-bottom: 10px; background: #fff;
}
.crl-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px; flex-wrap: wrap;
}
.crl-status { font-weight: 700; font-size: 12px; }
.crl-issuer { font-weight: 600; font-size: 13px; }
.crl-expiry { font-size: 12px; color: #64748b; }
.crl-revoked { font-size: 12px; color: #64748b; }
.crl-filename { font-size: 11px; color: #94a3b8; font-family: monospace; margin-bottom: 8px; }
.crl-url-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.crl-url-label { font-size: 11px; color: #64748b; flex-shrink: 0; }
.crl-url-input {
  flex: 1; padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 4px;
  font-size: 11px; font-family: monospace; min-width: 0;
}
.crl-url-input:focus { outline: none; border-color: #2563eb; }
.crl-actions { display: flex; align-items: center; gap: 10px; }
.crl-action-status { font-size: 12px; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 999;
}
.modal-overlay.show { display: block; }

.modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(580px, 94vw); max-height: 90vh; overflow-y: auto;
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); z-index: 1000;
}
.modal.show { display: block; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 18px; color: #64748b;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: #f1f5f9; color: #1e293b; }
.modal-body { padding: 18px 20px; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
}
.modal-wide { width: min(640px, 94vw); }

/* ── Modal sections (grouped fields with a small caption) ──── */
.modal-section { margin-bottom: 22px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #94a3b8; margin-bottom: 10px;
}

/* ── Toggle switches (account status — visually distinct from
     the signing-method checkboxes below) ─────────────────────── */
.switch-row { display: flex; flex-direction: column; gap: 12px; }
.switch-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: #1e293b; cursor: pointer;
}
.switch-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-label .switch {
  position: relative; flex-shrink: 0; width: 38px; height: 22px;
  background: #cbd5e1; border-radius: 999px; transition: background .15s;
}
.switch-label .switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s;
}
.switch-label input:checked + .switch { background: #2563eb; }
.switch-label input:checked + .switch::after { transform: translateX(16px); }
.switch-label input:disabled + .switch { opacity: .5; cursor: not-allowed; }
.switch-label input:disabled ~ * { cursor: not-allowed; }
.switch-hint { font-weight: 400; color: #64748b; }

/* ── Certificate/signing-method table (Edit User modal) ─────── */
.cert-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.cert-table tr:not(:last-child) td { border-bottom: 1px solid #eef2f7; }
.cert-table tr:hover td { background: #f8fafc; }
.cert-table td { padding: 12px 14px; vertical-align: top; }
.cert-table td.cert-check { width: 20px; padding-top: 14px; vertical-align: top; }
.cert-table td.cert-check input[type=checkbox] {
  width: 17px; height: 17px; cursor: pointer; accent-color: #2563eb;
}
.cert-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.cert-desc { font-size: 12px; color: #64748b; margin-top: 2px; }
.cert-extra { margin-top: 10px; }

/* ── Audit detail table ──────────────────────────────────── */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th, .detail-table td {
  text-align: left; vertical-align: top; padding: 7px 10px;
  border-bottom: 1px solid #eef2f7; word-break: break-word;
}
.detail-table th {
  width: 150px; color: #64748b; font-weight: 600; white-space: nowrap;
}
.mono-pre {
  margin: 0; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px; white-space: pre-wrap; word-break: break-word;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px;
}

/* ── Denied box ──────────────────────────────────────────── */
.denied-box {
  max-width: 520px; margin: 80px auto; text-align: center;
  background: #fff; padding: 32px; border-radius: 12px; border: 1px solid #e2e8f0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .site-header-inner { padding: 12px 16px; }
  .admin-shell { padding: 12px; }
  .section { padding: 14px; }
}

/* ── Sub-tabs (within panels, e.g. Downloads) ───────────── */
.sub-tab-bar {
  display: flex; gap: 4px; padding: 16px 0 0;
  border-bottom: 2px solid #e2e8f0; margin-bottom: 0;
}
.sub-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 18px; font-size: 13px; font-weight: 500; color: #64748b;
  cursor: pointer; margin-bottom: -2px; border-radius: 4px 4px 0 0;
  transition: color .15s, border-color .15s;
}
.sub-tab:hover { color: #1e40af; }
.sub-tab.active { color: #1e40af; border-bottom-color: #1e40af; background: #eff6ff; }
.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* ── Signature stamp preview: real fonts + alignment tiles ──────────────
   (2026-09-10) Same TTFs backend/routes/specimen.py::_register_unicode_font()
   embeds in the actual signed PDF, so the "Signing policy" preview shows the
   real typeface at true scale instead of a scaled-down browser approximation.
   Ported from the extension's own Visual Signature widget (options.html /
   options.js), which had this design first. */
@font-face { font-family: 'dsign-helvetica'; src: url('../fonts/LiberationSans-Regular.ttf') format('truetype'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'dsign-helvetica'; src: url('../fonts/LiberationSans-Bold.ttf') format('truetype'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'dsign-helvetica'; src: url('../fonts/LiberationSans-Italic.ttf') format('truetype'); font-weight: normal; font-style: italic; }
@font-face { font-family: 'dsign-helvetica'; src: url('../fonts/LiberationSans-BoldItalic.ttf') format('truetype'); font-weight: bold; font-style: italic; }
@font-face { font-family: 'dsign-times'; src: url('../fonts/LiberationSerif-Regular.ttf') format('truetype'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'dsign-times'; src: url('../fonts/LiberationSerif-Bold.ttf') format('truetype'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'dsign-times'; src: url('../fonts/LiberationSerif-Italic.ttf') format('truetype'); font-weight: normal; font-style: italic; }
@font-face { font-family: 'dsign-times'; src: url('../fonts/LiberationSerif-BoldItalic.ttf') format('truetype'); font-weight: bold; font-style: italic; }
@font-face { font-family: 'dsign-courier'; src: url('../fonts/LiberationMono-Regular.ttf') format('truetype'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'dsign-courier'; src: url('../fonts/LiberationMono-Bold.ttf') format('truetype'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'dsign-courier'; src: url('../fonts/LiberationMono-Italic.ttf') format('truetype'); font-weight: normal; font-style: italic; }
@font-face { font-family: 'dsign-courier'; src: url('../fonts/LiberationMono-BoldItalic.ttf') format('truetype'); font-weight: bold; font-style: italic; }

.position-option, .align-option { border: 2px solid #cbd5e1; border-radius: 6px; padding: 12px; cursor: pointer; text-align: center; transition: all 0.2s; background: white; }
.position-option:hover, .align-option:hover { border-color: #2563eb; background: #eff6ff; }
.position-option.selected, .align-option.selected { border-color: #2563eb; background: #dbeafe; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2); }
.position-option-icon { font-size: 22px; letter-spacing: 2px; margin-bottom: 5px; }
.position-option-label { font-size: 12px; font-weight: 500; color: #334155; }
