/* Same palette as the desktop app (theme.py) and the remote testing page. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --accent: #5f7f9e;
  --accent-hover: #4c6980;
  --text: #1c1f26;
  --muted: #6b7280;
  --border: #e2e4e9;
  --warn: #b45309;
  --rec: #c2410c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
}
main.wide { max-width: none; padding: 0; }

.center {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

h1 { font-size: 1.8rem; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 24px 0 8px; }
.lead { font-size: 1.15rem; margin: 0; max-width: 520px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.9rem; }
a { color: var(--accent); }

button, select, input { font: inherit; }
button { cursor: pointer; }

.primary {
  display: inline-block;
  padding: 10px 28px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  text-decoration: none;
}
.primary:hover { background: var(--accent-hover); }
.primary.alt { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
.primary.alt:hover { background: var(--bg); }

.link { background: none; border: 0; color: var(--muted); padding: 6px 4px; }
.link:hover { color: var(--text); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 8px; }
.row.end { justify-content: flex-end; }

/* ---- signer's page */
.portal { display: flex; flex-direction: column; }
.docs { display: flex; flex-direction: column; gap: 8px; }
.doc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.doc.sealed { border-color: var(--accent); }
.doc-title { font-weight: 500; overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.small-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 0;
  color: #fff;
  background: var(--accent);
}

/* ---- room */
.room {
  display: grid;
  grid-template-columns: minmax(300px, 38%) 1fr;
  height: 100vh;
  height: 100dvh;
}
/* transform + overflow keep the meeting inside this panel even if the kit uses position: fixed. */
.video { position: relative; background: #111318; min-height: 0; overflow: hidden; transform: translateZ(0); }
/* No "display" here: the kit's own flex column is what gives the video stage its height. */
.video rtk-meeting { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-msg { position: absolute; inset: auto 0 45% 0; text-align: center; color: #cbd0d8; }

.paper { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
.doc-select { max-width: 260px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.doc-name { font-weight: 500; }
.tool {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}
.tool:hover:not(:disabled) { border-color: var(--accent); }
.tool:disabled { opacity: 0.45; cursor: default; }
.tool.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool.rec { background: var(--rec); border-color: var(--rec); color: #fff; }

.stage { flex: 1; overflow: auto; padding: 16px; display: flex; justify-content: center; align-items: flex-start; }
.stage .empty { margin-top: 20vh; }
.page-wrap { position: relative; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); background: #fff; }
.page { display: block; }
.overlay { position: absolute; inset: 0; }
.overlay.placing { cursor: crosshair; outline: 2px dashed var(--accent); }

.field {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 6px;
  border: 2px dashed var(--warn);
  background: rgba(251, 191, 36, 0.18);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--warn);
  cursor: pointer;
  animation: pulse 1.6s ease-in-out infinite;
}
.field.signed { border: 1px solid transparent; background: none; animation: none; }
.field.signed:hover { border-color: var(--border); }
.field img { max-width: 100%; max-height: 100%; }
.field .x {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  line-height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 0;
}
@keyframes pulse { 50% { background: rgba(251, 191, 36, 0.38); } }

.status { padding: 6px 14px 10px; min-height: 1.5em; }

/* ---- signature pad */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.sheet { width: min(640px, 100%); background: var(--card); border-radius: 14px; padding: 18px 20px; }
.sheet h2 { margin-top: 0; }
.pad {
  width: 100%;
  aspect-ratio: 3 / 1;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(transparent 74%, var(--border) 74%, var(--border) calc(74% + 1px), transparent calc(74% + 1px));
  touch-action: none;
}
.sheet input[type="text"] { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 800px) {
  .room { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; height: auto; min-height: 100dvh; }
  .doc-select { max-width: 100%; flex: 1 1 100%; }
}
