:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #22263a;
  --bg-input: #2a2e42;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b4;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --border: #2e3348;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: all 0.25s cubic-bezier(.4,0,.2,1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ─── Card ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ─── Layout ─── */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

/* ─── Typography ─── */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 1.5rem; }

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

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
  color: white;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card); color: white; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { opacity: 0.85; color: white; }

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
}

.btn-block { width: 100%; }

/* ─── Captcha ─── */
.captcha-image {
  display: block;
  margin: 1rem auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.captcha-refresh {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

/* ─── Flash / Alert ─── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: rgba(248,113,113,0.15); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.alert-success { background: rgba(52,211,153,0.15); color: var(--success); border: 1px solid rgba(52,211,153,0.3); }

/* ─── Error page ─── */
.error-code {
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* ─── Document view ─── */
.doc-frame {
  width: 100%;
  height: calc(100vh - 60px);
  border: none;
  border-radius: var(--radius-sm);
}

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

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

/* ─── Logo ─── */
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }

/* ─── Footer ─── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container { max-width: 100%; padding: 2rem 1rem; }
  .card { padding: 1.5rem; }
  h1 { font-size: 1.4rem; }
  .doc-header { padding: 0.5rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .doc-title { font-size: 0.9rem; }
  .error-code { font-size: 3.5rem; }
}

@media (max-width: 480px) {
  .container { padding: 1.5rem 0.75rem; }
  .card { padding: 1rem; }
  h1 { font-size: 1.2rem; }
  h2 { font-size: 1.1rem; }
  .btn { padding: 0.6rem 1rem; font-size: 0.85rem; }
  .center-page { padding: 1rem; }
  .error-code { font-size: 3rem; }
  .captcha-image { max-width: 100%; height: auto; }
}

/* ─── Language toggle ─── */
.lang-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
  letter-spacing: 0.5px;
}
.lang-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-input);
  border-color: var(--accent);
}
