:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #d8deea;
  --accent: #4f46e5;
  --accent-2: #312e81;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, .button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 600;
}
button.secondary, .button.secondary {
  background: #e9ecf6;
  color: var(--text);
}
input, textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}
textarea { resize: vertical; }
label { display: grid; gap: .5rem; font-weight: 600; }
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.auth-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 10px 25px rgba(17, 24, 39, 0.05);
}
.auth-card { max-width: 420px; width: 100%; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border-bottom: 1px solid var(--line);
}
.container { padding: 1.25rem; }
.stack { display: grid; }
.gap-m { gap: .8rem; }
.gap-l { gap: 1.25rem; }
.flash {
  background: #fff4e5;
  color: #8a4b08;
  border: 1px solid #f5cf93;
  border-radius: 12px;
  padding: .85rem 1rem;
}
.doc-list { display: grid; gap: .75rem; }
.doc-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: #fbfcff;
}
.muted { color: var(--muted); font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.editor-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1rem;
  padding: 1rem;
}
.sidebar { align-content: start; }
.viewer-section { min-width: 0; }
.pdf-pages { display: grid; gap: 1rem; }
.page-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  overflow: auto;
}
.page-stage {
  position: relative;
  display: inline-block;
  border: 1px solid #ccd5e3;
}
.page-stage canvas.rendered-page {
  display: block;
  max-width: 100%;
  height: auto;
}
.page-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
.overlay-item {
  position: absolute;
  pointer-events: none;
  white-space: pre-wrap;
}
.overlay-item.signature img {
  display: block;
  width: 100%;
  height: 100%;
}
#signaturePad {
  width: 100%;
  height: 160px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: white;
  touch-action: none;
}
@media (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
  .topbar, .doc-item { align-items: flex-start; flex-direction: column; }
}
