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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: #111827;
  background: #f3f4f6;
  min-height: 100vh;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.1rem;
  color: #111827;
  letter-spacing: -0.3px;
}

.navbar-brand strong { color: #0066cc; }

.navbar-right { display: flex; align-items: center; gap: 1rem; }

.navbar-user { font-size: 0.875rem; color: #6b7280; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-container { margin-bottom: 1.25rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: #0066cc;
  color: #fff;
}
.btn-primary:hover { background: #0052a3; color: #fff; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: #0066cc;
  border: 1px solid #0066cc;
}
.btn-outline:hover { background: #eff6ff; text-decoration: none; }

.btn-outline-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}
.btn-outline-sm:hover { background: #f3f4f6; text-decoration: none; color: #111827; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-full { width: 100%; justify-content: center; padding: 0.65rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: #374151;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

.form-control.is-invalid { border-color: #dc2626; }

.form-error {
  display: block;
  font-size: 0.8rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input { width: 16px; height: 16px; cursor: pointer; accent-color: #0066cc; }
.form-check-label { font-size: 0.875rem; color: #6b7280; cursor: pointer; }

/* ── Auth Page ────────────────────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* When there's no navbar (login page) */
body:not(:has(.navbar)) .auth-wrapper { min-height: 100vh; }

.auth-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-text {
  font-size: 1.4rem;
  color: #111827;
}

.logo-text strong { color: #0066cc; }

.auth-title {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.75rem;
  color: #111827;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { font-size: 0.875rem; color: #6b7280; margin-top: 0.2rem; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

/* ── Table ────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead { background: #f9fafb; }

.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e5e7eb;
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f9fafb; }

.td-name { font-weight: 500; }
.td-center { text-align: center; }
.td-actions { display: flex; gap: 0.5rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-draft    { background: #f3f4f6; color: #6b7280; }
.badge-active   { background: #dbeafe; color: #1e40af; }
.badge-archived { background: #fef3c7; color: #92400e; }
.badge-signed   { background: #d1fae5; color: #065f46; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.1rem; color: #111827; margin-bottom: 0.5rem; }
.empty-state p  { margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ── Misc shared ──────────────────────────────────────────── */
.back-link { display: inline-block; font-size: 0.875rem; color: #6b7280; margin-bottom: 0.4rem; }
.back-link:hover { color: #111827; text-decoration: none; }
.btn-disabled { opacity: 0.45; pointer-events: none; }
.btn-danger-outline {
  background: transparent; color: #dc2626;
  border: 1px solid #dc2626; border-radius: 6px; cursor: pointer;
}
.btn-danger-outline:hover { background: #fef2f2; }
.btn-cancel-place {
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fecaca; border-radius: 6px; cursor: pointer;
  padding: 0.35rem 0.75rem; font-size: 0.8rem; font-weight: 500;
}
kbd {
  display: inline-block; padding: 0.1rem 0.4rem;
  background: #374151; color: #e5e7eb;
  border-radius: 4px; font-size: 0.75rem; font-family: monospace;
}

/* ── Upload page ──────────────────────────────────────────── */
.upload-card { max-width: 620px; padding: 2rem 2rem; }

.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  transition: border-color 0.15s, background 0.15s;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
}
.drop-zone.drag-over { border-color: #0066cc; background: #eff6ff; }
.drop-zone.has-file  { border-color: #065f46; background: #f0fdf4; }

.drop-zone-inner { text-align: center; padding: 2rem; }
.drop-zone-icon  { font-size: 2.5rem; margin-bottom: 0.75rem; }
.drop-zone-text  { font-size: 0.95rem; color: #374151; margin-bottom: 0.25rem; }
.drop-zone-sub   { font-size: 0.8rem; color: #9ca3af; margin-bottom: 0.75rem; }
.hidden-file-input { display: none; }

.drop-zone-selected {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.5rem; font-size: 0.9rem; color: #065f46; font-weight: 500;
}
.drop-file-icon  { font-size: 1.3rem; }
.drop-clear-btn  {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: #6b7280; font-size: 1rem; line-height: 1;
}
.drop-clear-btn:hover { color: #dc2626; }

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Place page — mobile-first layout ────────────────────── */
/*
   Mobile  : vertical stack — PDF on top, controls below
   Desktop : side-by-side — PDF left, controls right (≥768px)
*/

.place-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
  padding: 0;
}

.place-layout {
  display: flex;
  flex-direction: column;   /* mobile: stacked */
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── PDF panel ────────────────────────────────────────────── */
.place-pdf-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1f2937;
  min-height: 0;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: #111827;
  border-bottom: 1px solid #374151;
  flex-shrink: 0;
}

.pdf-doc-name {
  flex: 1;
  font-size: 0.82rem;
  color: #d1d5db;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Banner shown while in draw-placement mode */
.drawing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: #451a03;
  border-bottom: 1px solid #92400e;
  font-size: 0.82rem;
  color: #fde68a;
  flex-shrink: 0;
}
.drawing-banner.hidden { display: none; }
.drawing-banner strong { color: #fbbf24; }

.pdf-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.pdf-loading { color: #9ca3af; font-size: 0.9rem; margin-top: 2rem; }
.pdf-error   { color: #f87171; font-size: 0.9rem; margin-top: 2rem; text-align: center; }

.pdf-page-wrapper {
  position: relative;
  width: 100%;             /* fill container */
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
  border-radius: 2px;
  flex-shrink: 0;
}

.pdf-canvas {
  display: block;
  width: 100%;             /* scale to container width */
  height: auto;            /* maintain aspect ratio */
}

.pdf-overlay {
  position: absolute;
  inset: 0;
  user-select: none;
}
.pdf-overlay.draw-mode { cursor: crosshair; }

.pdf-page-label {
  text-align: center;
  padding: 0.35rem 0;
  font-size: 0.72rem;
  color: #6b7280;
}

/* ── Signature boxes on overlay ──────────────────────────── */
.sig-box {
  position: absolute;
  border: 2.5px solid;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  padding: 3px 5px;
  cursor: grab;
  touch-action: none;
  pointer-events: all;
}
.sig-box.moving { cursor: grabbing; opacity: 0.85; z-index: 20; }

.sig-box-ghost {
  position: absolute;
  border: 2.5px dashed;
  border-radius: 4px;
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0.75;
}

.sig-box-label {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 24px);
  line-height: 1.2;
}

.sig-box-delete {
  position: absolute;
  top: -11px; right: -11px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
/* Show on hover (desktop) or always (touch devices) */
.sig-box:hover .sig-box-delete,
.sig-box.moving .sig-box-delete { opacity: 1; }

/* ── Controls panel ───────────────────────────────────────── */
.place-controls-panel {
  flex-shrink: 0;
  height: 44vh;            /* mobile: fixed height at bottom */
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.controls-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.controls-title  { font-size: 0.95rem; font-weight: 700; }

.controls-hint {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 0.9rem;
}

.controls-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.box-count-label { font-size: 0.78rem; color: #065f46; font-weight: 600; text-align: center; }

/* ── Signatory cards ──────────────────────────────────────── */
.sig-card {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  background: #f9fafb;
  overflow: hidden;
  transition: border-color 0.15s;
}
.sig-card.is-active { border-color: #0066cc; background: #eff6ff; }

.sig-card-header {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
}

.sig-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.sig-info { display: flex; flex-direction: column; min-width: 0; }
.sig-info strong { font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-info span   { font-size: 0.73rem; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-place {
  background: #eff6ff; color: #0066cc;
  border: 1px solid #bfdbfe; border-radius: 6px; cursor: pointer;
  padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 600;
  white-space: nowrap;
}
.btn-place:hover { background: #dbeafe; }

/* ── Placed-box list (inside signatory card) ─────────────── */
.sig-placed-list {
  list-style: none;
  border-top: 1px solid #e5e7eb;
  padding: 0.4rem 0.8rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sig-placed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sig-placed-page {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: #0066cc;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-weight: 500;
}
.sig-placed-page:hover { background: #eff6ff; text-decoration: underline; }
.sig-placed-page::before { content: '↗ '; font-size: 0.65rem; }

.sig-placed-del {
  background: none;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
}
.sig-placed-del:hover { background: #fef2f2; }

/* ── Modal ────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }

.modal-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  z-index: 1;
}

.modal-heading { font-size: 1.05rem; font-weight: 700; margin-bottom: 1.1rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.1rem; }

/* ── Desktop overrides (≥ 768px) ─────────────────────────── */
@media (min-width: 768px) {
  .place-layout {
    flex-direction: row;   /* side by side */
  }

  .place-controls-panel {
    width: 300px;
    height: auto;          /* fill full height */
    border-top: none;
    border-left: 1px solid #e5e7eb;
  }

  /* Always-visible delete on touch, hover-only on desktop */
  .sig-box-delete { opacity: 0; }
  .sig-box:hover .sig-box-delete { opacity: 1; }
}

/* ── Touch devices: always show delete button ─────────────── */
@media (hover: none) {
  .sig-box-delete { opacity: 1; }
}

/* ── Very small phones ────────────────────────────────────── */
@media (max-width: 380px) {
  .pdf-doc-name { display: none; }
  .place-controls-panel { height: 46vh; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 0.3 — Signing & Send pages
   ═══════════════════════════════════════════════════════════ */

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

/* ── Extra badges & buttons ───────────────────────────────── */
.badge-signed  { background: #d1fae5; color: #065f46; }

.btn-success {
  background: #059669; color: #fff; border: 1.5px solid #059669;
  border-radius: 6px; padding: 0.3rem 0.7rem;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem;
}
.btn-success:hover { background: #047857; border-color: #047857; text-decoration: none; color: #fff; }

.btn-link {
  background: none; border: none; color: #4f46e5;
  cursor: pointer; font-weight: 600; padding: 0;
  text-decoration: underline; font-size: inherit;
}

.sig-progress { font-size: 0.72rem; color: #6b7280; }

/* ── Sign page — two-panel layout ────────────────────────── */
.sign-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

/* Body has no navbar on signing pages (no session.user_id) */
body:not(:has(.navbar)) .sign-wrapper { height: 100vh; }

.sign-layout {
  display: flex;
  flex-direction: column;   /* mobile: stacked */
  flex: 1;
  overflow: hidden;
  height: 100%;
}

/* Mobile: form panel fixed on top, PDF scrolls below */
.sign-panel-form {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 56vh;
}

.sign-panel-pdf {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #374151;
}

/* Desktop: PDF left, form right */
@media (min-width: 768px) {
  .sign-layout      { flex-direction: row; }
  .sign-panel-pdf   { flex: 1; height: 100%; }
  .sign-panel-form  {
    width: 320px;
    flex-shrink: 0;
    border-bottom: none;
    border-left: 1px solid #e5e7eb;
    overflow-y: auto;
    max-height: none;
    height: 100%;
  }
}

/* ── PDF toolbar ──────────────────────────────────────────── */
.sign-pdf-toolbar {
  background: #1f2937;
  color: #e5e7eb;
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.sign-pdf-docname {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sign-pdf-note { flex-shrink: 0; color: #9ca3af; font-size: 0.72rem; }

.sign-pdf-container { padding: 10px; }

.sign-pdf-loading {
  color: #9ca3af;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.88rem;
}

.sign-pdf-page {
  background: #fff;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  position: relative;
}

/* ── Signature box highlights ─────────────────────────────── */
.sign-box-highlight {
  position: absolute;
  border: 2px solid #4f46e5;
  background: rgba(79, 70, 229, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: pulse-box 2.5s ease-in-out infinite;
}
@keyframes pulse-box {
  0%, 100% { background: rgba(79,70,229,0.10); }
  50%       { background: rgba(79,70,229,0.24); }
}
.sign-here-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #4338ca;
  white-space: nowrap;
  user-select: none;
}

/* ── Form panel inner ─────────────────────────────────────── */
.sign-form-inner {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sign-form-title {
  font-size: 0.88rem;
  color: #4b5563;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

/* ── OTP status ───────────────────────────────────────────── */
.sign-otp-status { font-size: 0.82rem; min-height: 1.25rem; }
.otp-msg         { }
.otp-msg-info    { color: #6b7280; }
.otp-msg-ok      { color: #065f46; font-weight: 600; }
.otp-msg-err     { color: #dc2626; }

/* ── OTP input ────────────────────────────────────────────── */
.otp-input {
  width: 100%;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 0.5rem 0.4rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.otp-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ── Signature name input ─────────────────────────────────── */
.sig-name-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  transition: border-color 0.15s;
}
.sig-name-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ── Signature preview ────────────────────────────────────── */
.sig-preview-box {
  min-height: 52px;
  border: 1.5px dashed #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
}
.sig-preview-placeholder {
  font-size: 0.8rem;
  color: #a5b4fc;
  font-style: italic;
}
.sig-preview-name {
  font-family: "Brush Script MT", "Segoe Script", cursive, serif;
  font-size: 1.5rem;
  color: #1e40af;
  word-break: break-all;
  text-align: center;
}

.sign-legal-note {
  font-size: 0.72rem;
  color: #9ca3af;
  line-height: 1.5;
  text-align: center;
}

/* ── Done / Error pages (centred card) ───────────────────── */
.sign-done-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: #f3f4f6;
}
.sign-done-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}
.sign-done-icon { font-size: 3rem; margin-bottom: 1rem; }
.sign-done-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.75rem;
}
.sign-done-text {
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
.sign-done-meta {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  margin-bottom: 1.25rem;
}
.sign-done-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.83rem;
  border-bottom: 1px solid #f3f4f6;
}
.sign-done-meta-row:last-child { border-bottom: none; }
.sign-done-meta-label { color: #6b7280; }
.sign-done-meta-value { font-weight: 600; color: #111827; text-align: right; word-break: break-all; }
.sign-done-legal {
  font-size: 0.73rem;
  color: #9ca3af;
  line-height: 1.5;
}

/* ── Send links page ──────────────────────────────────────── */
.send-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.send-card  { padding: 1.25rem 1.5rem; }
.send-intro { font-size: 0.88rem; color: #4b5563; margin-bottom: 1.25rem; line-height: 1.6; }

.send-sig-card {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: #fff;
}
.send-sig-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid #f3f4f6;
}
.send-sig-name  { font-size: 0.93rem; font-weight: 700; color: #111827; }
.send-sig-email { font-size: 0.8rem;  color: #6b7280;   margin-top: 0.1rem; }
.send-sig-boxes { font-size: 0.73rem; color: #9ca3af;   margin-top: 0.15rem; }
.send-sig-status { flex-shrink: 0; padding-top: 0.05rem; }

.send-link-area { padding: 0.7rem 1rem; }
.send-link-placeholder { font-size: 0.8rem; color: #9ca3af; font-style: italic; }
.send-link-row  { display: flex; gap: 0.5rem; align-items: center; }
.send-link-input {
  flex: 1; min-width: 0;
  font-size: 0.76rem; color: #374151;
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 6px; padding: 0.38rem 0.6rem;
  cursor: text;
}
.copy-btn { flex-shrink: 0; }

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 380px) {
  .sign-panel-form  { max-height: 60vh; }
  .otp-input        { font-size: 1.4rem; letter-spacing: 0.25em; }
  .send-header-actions { flex-direction: column; align-items: flex-end; }
}

/* ── Navbar links ─────────────────────────────────────────── */
.navbar-link {
  font-size: 0.875rem;
  color: #4b5563;
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}
.navbar-link:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

/* ── Auth subtitle (force-password-change) ────────────────── */
.auth-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 1.25rem;
  padding: 0.6rem 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

/* ── Form hint (under fields) ─────────────────────────────── */
.form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
}
.form-hint strong { color: #374151; }

/* ── Form card (admin user form wrapper) ──────────────────── */
.form-card { max-width: 560px; }

/* ── Data table (admin user list) ─────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table thead th {
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.data-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table .row-disabled { opacity: 0.55; }
.data-table .actions-col {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}
.data-table .actions-col .btn { margin-left: 0.3rem; }

/* ── Inline form (for action buttons inside tables) ───────── */
.inline-form { display: inline-block; margin: 0; }

/* ── Tags / chips ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: #e5e7eb;
  color: #374151;
  vertical-align: middle;
}
.tag-self        { background: #dbeafe; color: #1e40af; margin-left: 0.4rem; }
.tag-active      { background: #d1fae5; color: #065f46; }
.tag-inactive    { background: #fee2e2; color: #991b1b; }
.tag-role-broker     { background: #e0e7ff; color: #3730a3; }
.tag-role-admin      { background: #fef3c7; color: #92400e; }
.tag-role-super_admin{ background: #fde68a; color: #78350f; }
.tag-plan-subscription { background: #d1fae5; color: #065f46; }
.tag-plan-free         { background: #f3f4f6; color: #374151; }

/* ── Form row (two columns side by side) ──────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Form divider ─────────────────────────────────────────── */
.form-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.25rem 0;
}

/* ── Company info card ────────────────────────────────────── */
.company-info-card { padding: 1.25rem 1.5rem; }
.company-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.info-item-wide { grid-column: 1 / -1; }
.info-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.3rem;
}
