/* ── Custom properties ─────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg-page:      #f0f2f5;
  --bg-card:      #ffffff;
  --bg-input:     #ffffff;
  --bg-surface2:  #f1f5f9;
  --shadow-card:  0 2px 16px rgba(0,0,0,.09);
  --border:       #e2e8f0;
  --text-heading: #0f172a;
  --text-primary: #1e293b;
  --text-secondary:#64748b;
  --text-muted:   #94a3b8;
  --text-label:   #374151;
  --text-input:   #1e293b;
  --accent:       #3b82f6;
  --accent-dim:   rgba(59,130,246,.12);
  --accent-btn:   #2563eb;
  --accent-hover: #1d4ed8;
  --accent-active:#1e40af;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-page:      #0d1117;
  --bg-card:      #161b22;
  --bg-input:     #0d1117;
  --bg-surface2:  #21262d;
  --shadow-card:  0 2px 16px rgba(0,0,0,.5);
  --border:       #30363d;
  --text-heading: #e6edf3;
  --text-primary: #c9d1d9;
  --text-secondary:#8b949e;
  --text-muted:   #6e7681;
  --text-label:   #c9d1d9;
  --text-input:   #c9d1d9;
  --accent:       #3b82f6;
  --accent-dim:   rgba(59,130,246,.2);
  --accent-btn:   #1d4ed8;
  --accent-hover: #2563eb;
  --accent-active:#3b82f6;
}

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: background-color .25s;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    position: relative;
    transition: background-color .25s, box-shadow .25s;
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 6px; border-radius: 7px;
    display: flex; align-items: center; line-height: 1;
    transition: color .15s, background-color .15s;
}
.theme-toggle:hover { color: var(--text-secondary); background: var(--bg-surface2); }

/* ── Logo block ───────────────────────────────────────────── */
.logo { text-align: center; margin-bottom: 1.5rem; }
.logo img {
    display: block;
    margin: 0 auto;
    width: 120px;
    height: 120px;
}
.logo h1 { font-size: 1.15rem; font-weight: 700; color: var(--text-heading); margin-top: .6rem; }
.logo p  { font-size: .8rem; color: var(--text-secondary); margin-top: .2rem; }

/* ── Form ─────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-label); margin-bottom: .3rem; }

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: .6rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 1rem;
    color: var(--text-input);
    background: var(--bg-input);
    outline: none;
    -webkit-appearance: none;
    transition: border-color .15s, box-shadow .15s, background-color .25s, color .25s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.error {
    background: #fef2f2; border: 1.5px solid #fca5a5;
    color: #7f1d1d; border-radius: 7px;
    padding: .6rem .85rem; font-size: .83rem; margin-bottom: 1rem;
}
[data-theme="dark"] .error {
    background: #2d1212; border-color: #f85149; color: #ff7b72;
}

.btn {
    width: 100%; padding: .7rem 1rem;
    background: var(--accent-btn); color: #fff;
    border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 700;
    cursor: pointer; margin-top: .25rem;
    transition: background .15s; touch-action: manipulation;
}
.btn:hover  { background: var(--accent-hover); }
.btn:active { background: var(--accent-active); }

/* ── Responsive: Mobile (≤480px) ─────────────────────────── */
@media (max-width: 480px) {
    body { align-items: flex-start; padding-top: 2rem; }
    .card { padding: 1.5rem 1.25rem; border-radius: 10px; }
    .logo img { max-width: 180px; }
    .logo h1 { font-size: 1rem; }
}
