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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0ea5e9 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-wrap { width: 100%; max-width: 420px; }

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: center;
  margin-bottom: .5rem;
}
.logo-icon { font-size: 2rem; }
.logo-text { font-size: 1.8rem; color: var(--text); letter-spacing: -.5px; }
.logo-text b { color: var(--primary); }

.subtitle { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 1.8rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.field input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--primary); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; opacity: .6;
}

.btn-primary {
  width: 100%; padding: .75rem;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
  margin-top: .5rem;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-outline {
  width: 100%; padding: .75rem;
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 8px;
  font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.btn-outline:hover { background: #eff6ff; }

.divider {
  text-align: center; color: var(--muted); font-size: .82rem;
  margin: 1rem 0; position: relative;
}
.divider::before, .divider::after {
  content: ''; position: absolute; top: 50%;
  width: 42%; height: 1px; background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

.alert {
  background: #fef2f2; color: var(--danger);
  border: 1px solid #fecaca; border-radius: 8px;
  padding: .65rem .9rem; font-size: .87rem;
  margin-bottom: 1rem;
}
.hidden { display: none !important; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-card {
  background: var(--card); border-radius: var(--radius);
  padding: 2rem; width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.2rem; color: var(--text); }
.modal-header button {
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; color: var(--muted);
}

.free-note {
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: .65rem .9rem; font-size: .84rem;
  margin: .5rem 0 1rem;
}
