:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #1b2234;
  --muted: #667089;
  --border: #d7dcea;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --ring: rgba(79, 70, 229, 0.25);
  --err-bg: #fdecec; --err-text: #9b1c1c; --err-border: #f5c2c2;
  --warn-bg: #fff6df; --warn-text: #7a5600; --warn-border: #f1d58a;
  --ok-bg: #e8f7ee; --ok-text: #14633a; --ok-border: #a9dfc0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --card: #171d2e;
    --text: #e9edf7;
    --muted: #9aa5be;
    --border: #2b3550;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --ring: rgba(129, 140, 248, 0.35);
    --err-bg: #3a1c20; --err-text: #ffb4b4; --err-border: #6b2c33;
    --warn-bg: #3a2f14; --warn-text: #ffd98a; --warn-border: #6b5622;
    --ok-bg: #12352436; --ok-text: #8fe0b2; --ok-border: #1f5a3d;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }

/* ---- left branding panel ---- */
.brand-panel {
  background: linear-gradient(135deg, #0f172a 0%, #312e81 60%, #4f46e5 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-top { display: flex; align-items: center; gap: 12px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.16); font-weight: 800; letter-spacing: 1px;
}
.brand-name { font-size: 20px; font-weight: 700; }
.brand-copy h1 { font-size: 34px; line-height: 1.2; margin: 0 0 14px; }
.brand-copy p { margin: 0 0 24px; color: rgba(255, 255, 255, 0.8); font-size: 16px; }
.brand-copy ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.brand-copy li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, 0.92); }
.brand-copy li::before {
  content: "\2713"; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); font-size: 13px;
}
.brand-foot { color: rgba(255, 255, 255, 0.6); font-size: 13px; }

/* ---- right form panel ---- */
.form-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.card {
  width: 100%; max-width: 410px; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; padding: 34px 30px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 18px; }
.mobile-brand .logo { background: var(--primary); color: #fff; width: 38px; height: 38px; }
.mobile-brand span:last-child { font-weight: 700; font-size: 18px; }

.greeting { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.card h2 { margin: 0 0 22px; font-size: 22px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.field { position: relative; margin-bottom: 16px; }
.field input[type="text"], .field input[type="password"] {
  width: 100%; padding: 12px 14px; font-size: 15px; color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: 10px; outline: none;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.field.has-toggle input { padding-right: 70px; }
.toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--primary); font-weight: 600;
  font-size: 13px; cursor: pointer; padding: 6px 8px; border-radius: 6px;
}
.toggle:hover { background: var(--ring); }
.caps { margin: -8px 0 12px; font-size: 12.5px; color: var(--warn-text); }

.row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.hint { color: var(--muted); }

.btn {
  width: 100%; padding: 13px; font-size: 15px; font-weight: 600; color: #fff;
  background: var(--primary); border: 0; border-radius: 10px; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.75; cursor: wait; }
.btn.loading .label::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; border-radius: 50%;
  vertical-align: -2px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert.error { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }

.foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--muted); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .mobile-brand { display: flex; }
}
