:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #fbfbfd;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --border: #d2d2d7;
  --border-soft: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #ff3b30;
  --ok: #34c759;
  --radius: 14px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-secondary: #1d1d1f;
    --bg-tertiary: #161617;
    --text: #f5f5f7;
    --text-dim: #86868b;
    --border: #3a3a3c;
    --border-soft: rgba(255, 255, 255, 0.12);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

header.site .brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}

header.site .brand span { color: var(--accent); }

header.site nav { display: flex; align-items: center; }

header.site nav a {
  color: var(--text);
  margin-left: 28px;
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
}

header.site nav a:hover { opacity: 1; text-decoration: none; }

main {
  flex: 1;
  width: 100%;
}

main.narrow { max-width: 692px; margin: 0 auto; padding: 64px 22px 100px; }
main.wide { max-width: 980px; margin: 0 auto; padding: 64px 22px 100px; }

footer.site {
  border-top: 1px solid var(--border-soft);
  padding: 28px 22px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  background: var(--bg-secondary);
}

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: 96px 24px 72px;
  max-width: 900px;
  margin: 0 auto;
}

.hero .eyebrow {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 20px;
}

.hero p.lead {
  font-size: clamp(19px, 2.4vw, 24px);
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 640px;
  margin: 0 auto 36px;
}

.hero .actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

section.band {
  background: var(--bg-secondary);
  padding: 80px 24px;
}

section.band .inner {
  max-width: 980px;
  margin: 0 auto;
}

section.band h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  margin: 0 0 48px;
}

/* ---------- Typography ---------- */

h1 {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 48px 0 16px;
}

h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }

p.lead {
  font-size: 19px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0 0 32px;
}

p { line-height: 1.65; color: var(--text-dim); }

/* ---------- Cards / grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; font-size: 14px; }

/* ---------- Panels / forms ---------- */

.panel {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 32px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 13px 15px;
  font-size: 16px;
  font-family: var(--font);
}

textarea { min-height: 110px; resize: vertical; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.code-input {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.field { margin-bottom: 20px; }

.hint { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

/* ---------- Buttons (pill, Apple-style) ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 980px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s ease, transform 0.1s ease;
}

button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-lg { padding: 14px 30px; font-size: 17px; }

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

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

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 8px 4px;
}

.btn-ghost:hover { background: transparent; text-decoration: underline; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d70015; }
.btn-icon { border-radius: var(--radius-sm); padding: 8px 12px; }

/* ---------- Messages ---------- */

.msg {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

.msg.show { display: block; }
.msg.error { background: rgba(255, 59, 48, 0.1); border: 1px solid rgba(255, 59, 48, 0.3); color: #ff3b30; }
.msg.ok { background: rgba(52, 199, 89, 0.1); border: 1px solid rgba(52, 199, 89, 0.3); color: #248a3d; }

/* ---------- Lists ---------- */

.doc-list { list-style: none; padding: 0; margin: 16px 0 0; }

.doc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 16px; }

.table th, .table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.table th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
}

.dossier-list { list-style: none; padding: 0; margin: 0; }

.dossier-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.dossier-row .info { flex: 1; min-width: 0; }
.dossier-row .info .name { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.dossier-row .info .meta { font-size: 13px; color: var(--text-dim); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 980px;
  background: var(--bg-secondary);
  color: var(--text-dim);
}

.badge.active { background: rgba(52, 199, 89, 0.12); color: #248a3d; }

.code-reveal {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.1em;
  background: var(--bg);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin: 20px 0;
  word-break: break-all;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.text-dim { color: var(--text-dim); }
.hidden { display: none !important; }

/* ---------- Rich editor (used on the standalone editor page) ---------- */

.editor-body {
  min-height: 40vh;
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
}

.editor-body:focus { outline: none; }
.editor-body[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-dim);
}

.editor-body.drag-over { outline: 2px dashed var(--accent); outline-offset: 8px; border-radius: var(--radius); }
.editor-body img { max-width: 100%; border-radius: var(--radius); display: block; margin: 20px 0; }
.editor-body h2 { font-size: 24px; margin: 28px 0 12px; }
.editor-body p { color: var(--text); margin: 0 0 14px; }
.editor-body ul { margin: 0 0 14px; padding-left: 24px; }

.dossier-content { margin-top: 24px; font-size: 17px; line-height: 1.75; }
.dossier-content img { max-width: 100%; border-radius: var(--radius); display: block; margin: 20px 0; }
.dossier-content h2 { font-size: 22px; margin: 28px 0 12px; }
.dossier-content ul { padding-left: 22px; }

/* ---------- Photo grid (dossier viewer) ---------- */

.photo-grid { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); display: block; }
