:root {
  color-scheme: light dark;
  --bg: #f2f4f8;
  --card-bg: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --border: #e2e5ea;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-contrast: #ffffff;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --success: #15803d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card-bg: #191c22;
    --text: #eef0f4;
    --muted: #9aa1ac;
    --border: #2a2e37;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-contrast: #0f1115;
    --danger-bg: #3a1a1a;
    --danger-text: #fca5a5;
    --danger-border: #5c2626;
    --success: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1.25rem;
}

.page {
  width: 100%;
  max-width: 460px;
}

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

h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 1.15rem;
  margin-bottom: 0.4rem;
}
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

input::placeholder { color: var(--muted); opacity: 0.7; }

small.hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}

/* Custom file input */
.file-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.file-drop:hover { border-color: var(--primary); }
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-drop .file-icon {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 7px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.file-drop .file-label {
  font-size: 0.9rem;
  color: var(--muted);
}
.file-drop.has-file .file-label { color: var(--text); font-weight: 500; }

/* Checkbox row */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.4rem;
}
.checkbox-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 1.75rem;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:hover, .button:hover { background: var(--primary-hover); }
button:active, .button:active { transform: translateY(1px); }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover, .button.secondary:hover { background: var(--bg); }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  margin-top: 1.25rem;
}
.banner.error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.hidden { display: none !important; }

/* Success page */
.status-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}
dl.summary { margin: 1.4rem 0 0; }
dl.summary dt {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.9rem;
}
dl.summary dt:first-child { margin-top: 0; }
dl.summary dd {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
}
dl.summary a { color: var(--primary); word-break: break-all; text-decoration: none; }
dl.summary a:hover { text-decoration: underline; }

.footer-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.footer-link:hover { color: var(--text); }

/* Unlock page */
.lock-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 1rem;
}
.center { text-align: center; }
