/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f5f7;
  color: #333;
  min-height: 100vh;
}

/* ── Shared helpers ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.btn {
  display: inline-block;
  padding: 9px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary  { background: #1a3c6e; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #245090; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-ghost    { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff; }
.btn-ghost:hover:not(:disabled)   { background: rgba(255,255,255,0.28); }
.btn-outline  { background: transparent; border: 1.5px solid #1a3c6e; color: #1a3c6e; }
.btn-outline:hover:not(:disabled) { background: #1a3c6e; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

.error-msg { color: #dc2626; font-size: 0.84rem; margin-top: 8px; }
.success-msg { color: #16a34a; font-size: 0.84rem; margin-top: 8px; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 28px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  margin-bottom: 24px;
}
.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a3c6e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
  background: #fff;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: #1a3c6e; }
.field textarea { resize: vertical; min-height: 70px; }
.field-hint { font-size: 0.77rem; color: #888; margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════════════════ */
/*  CLIENT PORTAL                                                             */
/* ══════════════════════════════════════════════════════════════════════════ */

/* ── Login overlay ───────────────────────────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#login-box {
  background: #fff;
  border-radius: 10px;
  padding: 40px 44px;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
}
#login-box h2 { font-size: 1.35rem; font-weight: 700; color: #1a3c6e; margin-bottom: 6px; }
#login-box .sub { font-size: 0.88rem; color: #666; margin-bottom: 28px; }
#login-box .login-hint { margin-top: 16px; font-size: 0.78rem; color: #aaa; }
#login-btn { width: 100%; }

/* ── Client header ───────────────────────────────────────────────────────── */
#client-header {
  background: #1a3c6e;
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
#client-header .firm-name { font-size: 1.2rem; font-weight: 700; }

/* ── Main content ────────────────────────────────────────────────────────── */
#client-main {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 20px;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-wrapper {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 0 0;
}
.progress-track {
  position: absolute;
  top: 22px;
  left: calc(100% / 22);
  right: calc(100% / 22);
  height: 4px;
  background: #ddd;
  z-index: 0;
}
.progress-track-fill { height: 100%; background: #27ae60; transition: width 0.5s ease; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.stage-node {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  border: 3px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  background: #ccc;
  position: relative;
}
.stage:hover .stage-node, .stage.open .stage-node {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.stage-node.green  { background: #27ae60; border-color: #1e8449; }
.stage-node.yellow { background: #f39c12; border-color: #d68910; }
.stage-node.red    { background: #e74c3c; border-color: #c0392b; }
.stage-node.gray   { background: #bdc3c7; border-color: #a0a6aa; }
.stage-node.green::after {
  content: "✓";
  position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px;
  background: #fff; color: #27ae60;
  border-radius: 50%; font-size: 9px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  line-height: 14px; text-align: center;
}
.stage-label {
  margin-top: 8px;
  font-size: 0.64rem;
  color: #555;
  text-align: center;
  max-width: 72px;
  line-height: 1.3;
}

/* ── Stage detail popup ──────────────────────────────────────────────────── */
.detail-popup {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #dde;
  border-radius: 8px;
  padding: 16px 18px;
  width: 260px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
  font-size: 0.84rem;
  line-height: 1.55;
  color: #333;
  z-index: 100;
  text-align: left;
}
.detail-popup::before {
  content: "";
  position: absolute; top: -7px; left: 50%;
  width: 13px; height: 13px;
  background: #fff;
  border-left: 1px solid #dde; border-top: 1px solid #dde;
  transform: translateX(-50%) rotate(45deg);
}
.detail-popup h4 { font-size: 0.85rem; font-weight: 700; color: #1a3c6e; margin-bottom: 8px; }
.detail-popup a  { color: #1a3c6e; font-weight: 600; }
.detail-popup ul { padding-left: 16px; margin-top: 4px; }
.detail-popup ul li { margin-bottom: 3px; }
.stage.open .detail-popup { display: block; }

/* ── Legend ──────────────────────────────────────────────────────────────── */
.legend {
  display: flex; gap: 20px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid #eee; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #555; }
.legend-dot  { width: 12px; height: 12px; border-radius: 50%; }

/* ── Videos ──────────────────────────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 620px) { .video-grid { grid-template-columns: 1fr; } }
.video-block h4 { font-size: 1rem; font-weight: 700; color: #1a3c6e; margin-bottom: 10px; }
.video-block p  { font-size: 0.85rem; color: #666; margin-bottom: 12px; line-height: 1.5; }
.video-block video { width: 100%; border-radius: 8px; background: #111; aspect-ratio: 16/9; }
.video-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: #1a1a2e; border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6); font-size: 0.82rem; font-style: italic;
}

/* ── Zoom info ───────────────────────────────────────────────────────────── */
.zoom-info p { font-size: 0.9rem; color: #555; margin-bottom: 8px; line-height: 1.6; }
.zoom-info a {
  display: inline-block; margin-top: 4px;
  color: #1a3c6e; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; border-bottom: 1px solid #1a3c6e;
}
.zoom-info a:hover { color: #245090; }
.zoom-details {
  margin-top: 12px; background: #f0f4fb;
  border-radius: 6px; padding: 12px 16px;
  font-size: 0.84rem; color: #444;
  display: grid; grid-template-columns: auto 1fr;
  gap: 4px 14px;
}
.zoom-details dt { font-weight: 600; color: #1a3c6e; }

/* ── Fireworks ───────────────────────────────────────────────────────────── */
#fireworks-overlay {
  display: none; position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
}
.firework {
  position: absolute; border-radius: 50%;
  animation: burst 1s ease-out forwards;
}
@keyframes burst {
  0%   { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* ── Client footer ───────────────────────────────────────────────────────── */
#client-footer {
  text-align: center; padding: 20px;
  font-size: 0.78rem; color: #aaa;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/*  ADMIN & FIRM ADMIN PORTALS                                               */
/* ══════════════════════════════════════════════════════════════════════════ */

#admin-app, #firm-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Admin header ────────────────────────────────────────────────────────── */
.admin-header {
  background: #1e293b;
  color: #fff;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 54px;
  flex-shrink: 0;
}
.admin-header .logo { font-size: 0.95rem; font-weight: 700; letter-spacing: 0.03em; margin-right: auto; }
.admin-header .logo span { color: #60a5fa; }

/* ── Admin nav ───────────────────────────────────────────────────────────── */
.admin-nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.admin-nav a:hover, .admin-nav a.active { color: #fff; border-bottom-color: #60a5fa; }
.admin-nav { display: flex; gap: 20px; }

/* ── Admin body ──────────────────────────────────────────────────────────── */
.admin-body { flex: 1; max-width: 1100px; width: 100%; margin: 32px auto; padding: 0 24px; }

/* ── Admin login ─────────────────────────────────────────────────────────── */
#admin-login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #f4f5f7;
}
.admin-login-box {
  background: #fff; border-radius: 10px;
  padding: 40px 44px; width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.admin-login-box h2 { font-size: 1.2rem; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.admin-login-box .sub { font-size: 0.85rem; color: #888; margin-bottom: 28px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left; padding: 10px 14px;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
  font-size: 0.75rem; font-weight: 700;
  color: #64748b; text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; }
.data-table tr:hover td { background: #f8fafc; }

/* ── Status badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px;
  border-radius: 99px; font-size: 0.74rem; font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Page header row ─────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h2 { font-size: 1.2rem; font-weight: 700; color: #1e293b; }

/* ── Stat row (billing) ──────────────────────────────────────────────────── */
.stat-row { display: flex; gap: 20px; margin-bottom: 24px; }
.stat-card {
  flex: 1; background: #fff; border-radius: 10px;
  padding: 20px 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-card .label { font-size: 0.78rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: #1e293b; margin-top: 6px; }

/* ── Section divider ─────────────────────────────────────────────────────── */
.section-divider {
  font-size: 0.74rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px; margin: 28px 0 18px;
}

/* ── MFA QR block ────────────────────────────────────────────────────────── */
.qr-block {
  background: #f8fafc; border-radius: 8px;
  padding: 20px; text-align: center; margin: 16px 0;
}
.qr-block p { font-size: 0.84rem; color: #555; margin-bottom: 12px; }
.qr-block .uri-box {
  font-size: 0.68rem; word-break: break-all;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 6px; padding: 10px; color: #334155;
  text-align: left; margin-bottom: 12px;
}

/* ── Video upload ────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #cbd5e1; border-radius: 8px;
  padding: 32px; text-align: center;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  background: #f8fafc;
}
.upload-zone:hover { border-color: #1a3c6e; background: #eff6ff; }
.upload-zone input[type=file] { display: none; }
.upload-zone p { font-size: 0.88rem; color: #64748b; margin-top: 8px; }
.upload-zone .icon { font-size: 2rem; }

/* ── Trustee zoom table ──────────────────────────────────────────────────── */
.kv-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.kv-table td { padding: 6px 8px; }
.kv-table input { width: 100%; padding: 6px 8px; border: 1.5px solid #cbd5e1; border-radius: 5px; font-size: 0.85rem; font-family: inherit; }
.kv-table input:focus { outline: none; border-color: #1a3c6e; }
