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

:root {
  --bg: #080b12;
  --surface: #0e1320;
  --surface-2: #141c2e;
  --border: #1e2a42;
  --text: #e8ecf4;
  --text-dim: #7088a8;
  --accent: #3b82f6;
  --accent-glow: #60a5fa;
  --accent-deep: #2563eb;
  --success: #34d399;
  --error: #f43f5e;
  --warning: #f59e0b;
  --ink-subtle: rgba(59, 130, 246, 0.08);
  --ink-glow: rgba(96, 165, 250, 0.15);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.03) 0%, transparent 100%);
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-glow);
  text-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-dim);
  width: 100%;
}

nav {
  display: flex;
  gap: 0.25rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-btn.active {
  color: var(--accent-glow);
  background: var(--surface);
  border-color: var(--border);
}

/* Main */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

main:has(.page-fullwidth.active),
main.main-fullwidth {
  max-width: none !important;
  padding: 0 !important;
  width: 100%;
}

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

h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

/* Steps */
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.step:last-of-type {
  border-bottom: none;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-content {
  flex: 1;
}

.step-content label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

/* Inputs */
input[type="email"],
input[type="text"],
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  font-family: var(--mono);
  font-size: 0.8rem;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
  margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-glow);
  box-shadow: 0 0 24px rgba(96, 165, 250, 0.35), 0 0 8px rgba(59, 130, 246, 0.2);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

/* Drop zones */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--ink-subtle);
}

.drop-zone p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* File info */
#sign-file-info, #verify-doc-info, #verify-proof-info {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--success);
}

/* Key display */
.key-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

#key-display label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

/* Results */
.result-checks {
  margin: 1rem 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.check-row:last-child { border-bottom: none; }

.check-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.check-pass .check-icon { color: var(--success); }
.check-fail .check-icon { color: var(--error); }
.check-skip .check-icon { color: var(--text-dim); }

.check-label { flex: 1; }

#sign-result h3 {
  color: var(--success);
  margin-bottom: 0.5rem;
}

#sign-result {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.85rem;
}

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text-dim);
}

/* Verify result */
#verify-status {
  padding: 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1rem;
}

#verify-status.valid {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

#verify-status.invalid {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
}

#verify-signer-info {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.9rem;
}

#verify-signer-info .label {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Transparency log */
#log-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-glow);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* How it works */
.how-step {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.how-step:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.how-step h3 {
  color: var(--accent-glow);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.how-step p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Auth card */
.auth-card {
  max-width: 400px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.auth-switch a {
  color: var(--accent-glow);
  text-decoration: none;
}

.error-msg {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Dashboard */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.dash-header .btn-primary {
  width: auto;
  margin-top: 0;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.doc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.1);
}

.doc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.doc-title {
  font-weight: 600;
  font-size: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-transform: capitalize;
}

.doc-card-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

/* Document detail */
.doc-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.doc-actions {
  display: flex;
  gap: 0.5rem;
}

.info-grid {
  margin-top: 0.75rem;
}

.info-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.info-item:last-child { border-bottom: none; }

.info-item .label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.signer-list {
  margin-top: 0.75rem;
}

.signer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.signer-item:last-child { border-bottom: none; }

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

/* Add signers */
.signer-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.signer-row input {
  flex: 1;
}

.signer-order-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.signer-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.btn-move-up, .btn-move-down {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-move-up:hover, .btn-move-down:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-move-up:disabled, .btn-move-down:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.checkbox-label {
  font-size: 0.95rem;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.btn-remove {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--error);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.signer-sent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

/* Signing canvas */
#sig-canvas {
  width: 100%;
  max-width: 500px;
  height: 160px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: crosshair;
  display: block;
  touch-action: none;
}

/* File info generic */
.file-info {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--success);
}

/* Logo clickable */
.logo {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.logo-icon {
  width: 28px;
  height: 28px;
}

/* Field Editor — Full Width Layout */
.page-fullwidth {
  max-width: none !important;
  padding: 0 !important;
  width: 100%;
}

.editor-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.editor-pdf-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.editor-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.editor-pdf-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#page-indicator {
  font-size: 0.85rem;
  color: var(--text-dim);
  min-width: 80px;
  text-align: center;
}

#pdf-viewer-container {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  background: #0a0f1a;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#pdf-active-page {
  position: relative;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  background: white;
}

#pdf-active-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

.page-thumbnails {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.page-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 80px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.6;
  transition: all 0.2s;
}

.page-thumb.active {
  border-color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.page-thumb:hover { opacity: 0.9; }

.page-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Right panel — tools */
.editor-tools-panel {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow-y: auto;
}

.tools-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.tools-section h3 {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

#field-signer-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.field-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  transition: all 0.2s;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.field-tool-item:hover {
  border-color: var(--accent);
  background: var(--ink-subtle);
  color: var(--text);
}

.field-tool-item:active { cursor: grabbing; }

.field-tool-icon {
  font-size: 1.3rem;
  line-height: 1;
}

#field-list {
  max-height: 200px;
  overflow-y: auto;
}

.field-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.field-list-item:last-child { border-bottom: none; }

.field-list-item .field-list-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field-list-item .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tools-actions {
  padding: 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.tools-actions .btn-primary {
  margin-top: 0;
}

/* PDF page field overlays */
.pdf-page-wrapper,
#pdf-active-page {
  position: relative;
}

.field-overlay {
  position: absolute;
  border: 2px dashed;
  border-radius: 4px;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  user-select: none;
  z-index: 10;
  transition: box-shadow 0.15s;
}

.field-overlay:hover {
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
}

.field-overlay .field-label {
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.field-overlay .field-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 20;
}

.field-overlay:hover .field-delete {
  display: flex;
}

.field-overlay .field-resize {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: white;
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 2px;
  cursor: se-resize;
  z-index: 20;
}

/* Signer field colors */
.signer-color-0 { border-color: #4dabf7; background: rgba(77, 171, 247, 0.15); }
.signer-color-1 { border-color: #ff6b6b; background: rgba(255, 107, 107, 0.15); }
.signer-color-2 { border-color: #51cf66; background: rgba(81, 207, 102, 0.15); }
.signer-color-3 { border-color: #fcc419; background: rgba(252, 196, 25, 0.15); }
.signer-color-4 { border-color: #cc5de8; background: rgba(204, 93, 232, 0.15); }

/* Template modal */
.template-list {
  max-height: 200px;
  overflow-y: auto;
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
}

.template-item:hover {
  background: var(--ink-subtle);
}

@media (max-width: 768px) {
  .editor-layout { flex-direction: column; height: auto; }
  .editor-tools-panel { width: 100%; }
  .editor-pdf-panel { border-right: none; border-bottom: 1px solid var(--border); }
}

/* Signer signing view field inputs */
.field-input-overlay {
  position: absolute;
  z-index: 10;
}

.field-input-overlay input,
.field-input-overlay textarea {
  width: 100%;
  height: 100%;
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 4px;
  font-size: 0.85rem;
  color: #333;
}

.sig-field-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  display: block;
  touch-action: none;
}

.sig-field-canvas.sig-applied {
  border-color: var(--success);
}

.tap-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: none;
  border-radius: 4px;
  border: 2px dashed var(--accent);
  animation: tapPulse 2s ease-in-out infinite;
}

@keyframes tapPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Audit log */
tr.audit-fail td {
  color: var(--error);
}

#audit-table td:first-child {
  white-space: nowrap;
  font-size: 0.75rem;
}

#audit-table td:nth-child(3) {
  font-size: 0.75rem;
  color: var(--text-dim);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
/* Prefill fields in editor */
.prefill-field {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.15) !important;
}

/* Owner interactive fields in editor */
.owner-field-active {
  background: rgba(255, 255, 255, 0.95) !important;
  border-style: solid !important;
  overflow: hidden;
}

.owner-field-active .sig-field-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.owner-field-active input {
  position: relative;
  z-index: 1;
}

/* E-Signature Disclaimer */
.esign-disclaimer-body {
  font-size: 0.9rem;
  line-height: 1.7;
}

.esign-disclaimer-body ul {
  padding-left: 1.2rem;
  margin-top: 0.75rem;
}

.esign-disclaimer-body li {
  margin-bottom: 0.5rem;
}

/* Signature Input Modal */
.sig-input-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.sig-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
}

.sig-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sig-tab-content {
  display: none;
}

.sig-tab-content.active {
  display: block;
}

#sig-modal-canvas,
#sig-modal-typed-preview {
  width: 100%;
  max-width: 480px;
  height: 150px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: crosshair;
  display: block;
  touch-action: none;
}

/* Owner Sign Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--error);
  border-color: var(--error);
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

/* Responsive */
@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  nav { flex-wrap: wrap; }
  main { padding: 1rem; }
  .card { padding: 1.25rem; }
  #log-stats { flex-wrap: wrap; gap: 1rem; }
}
