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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #eef0f3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #1a2540;
  height: 4px;
}

.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

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

.logo-block {
  text-align: center;
  margin-bottom: 28px;
}

.logo-img {
  display: block;
  margin: 0 auto 12px;
  height: 156px;
  width: auto;
  object-fit: contain;
}

.logo-name {
  font-size: 22px;
  font-weight: 700;
  color: #1a2540;
  letter-spacing: -0.3px;
}

.logo-name span {
  color: #3b7de8;
}

.logo-sub {
  font-size: 12px;
  color: #8a93a6;
  margin-top: 3px;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 32px 30px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid #e3e6ed;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: #1a2540;
  margin: 0 0 22px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  font-size: 14px;
  color: #1a2540;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 16px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: #3b7de8;
  box-shadow: 0 0 0 3px rgba(59,125,232,0.12);
  background: #fff;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #4a5568;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #3b7de8;
}

.forgot {
  font-size: 13px;
  color: #3b7de8;
  text-decoration: none;
}

.forgot:hover {
  text-decoration: underline;
}

.btn {
  display: block;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: #3b7de8;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.1px;
}

.btn:hover { background: #2f6cd6; }
.btn:active { background: #2560c4; }
.btn:disabled { opacity: 0.6; cursor: default; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: none;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-error {
  background: #fff2f2;
  border: 1px solid #f5c6c6;
  color: #b91c1c;
}

.divider {
  height: 1px;
  background: #e8ebf0;
  margin: 24px 0;
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  background: #fff;
  color: #1a2540;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-decoration: none;
}

.sso-btn:hover {
  background: #f5f7fa;
  border-color: #b8c2d4;
}

.sso-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.notice {
  margin-top: 20px;
  padding: 10px 14px;
  background: #f0f4ff;
  border: 1px solid #cdd9f5;
  border-radius: 8px;
  font-size: 12px;
  color: #3d5a9e;
  line-height: 1.5;
}

footer {
  text-align: center;
  padding: 20px 16px;
  font-size: 12px;
  color: #9aa3b5;
  line-height: 1.8;
}

footer a {
  color: #9aa3b5;
  text-decoration: none;
}

footer a:hover { color: #6b7898; text-decoration: underline; }

/* ── Theme toggle ─────────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  z-index: 100;
}

.theme-toggle:hover {
  background: #f5f7fa;
  border-color: #b8c2d4;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #4a5568;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s;
}

.icon-sun { display: none; }
.icon-moon { display: block; }

/* ── Dark theme ───────────────────────────────────────── */

body.dark {
  background: #111827;
  color: #e2e8f0;
}

body.dark .card {
  background: #1e2a3a;
  border-color: #2d3d52;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

body.dark .card-title { color: #e2e8f0; }

body.dark label { color: #94a3b8; }

body.dark input[type="text"],
body.dark input[type="email"],
body.dark input[type="password"] {
  background: #162032;
  border-color: #2d3d52;
  color: #e2e8f0;
}

body.dark input[type="text"]:focus,
body.dark input[type="email"]:focus,
body.dark input[type="password"]:focus {
  border-color: #3b7de8;
  background: #1a2740;
}

body.dark .checkbox-label { color: #94a3b8; }

body.dark .logo-name { color: #e2e8f0; }

body.dark .logo-sub { color: #64748b; }

body.dark .divider { background: #2d3d52; }

body.dark .sso-btn {
  background: #1e2a3a;
  border-color: #2d3d52;
  color: #cbd5e1;
}

body.dark .sso-btn:hover {
  background: #243347;
  border-color: #3d5470;
}

body.dark .notice {
  background: #1a2740;
  border-color: #2d4070;
  color: #7da4d8;
}

body.dark footer { color: #4a5f7a; }
body.dark footer a { color: #4a5f7a; }
body.dark footer a:hover { color: #6b87aa; }

body.dark .theme-toggle {
  background: #1e2a3a;
  border-color: #2d3d52;
}

body.dark .theme-toggle:hover {
  background: #243347;
}

body.dark .theme-toggle svg { stroke: #94a3b8; }

body.dark .icon-sun { display: block; }
body.dark .icon-moon { display: none; }

body.dark .alert-error {
  background: #2d1a1a;
  border-color: #5c2a2a;
  color: #f87171;
}

/* ── Language switcher ────────────────────────────────── */

.lang-switcher {
  position: relative;
  display: inline-block;
  margin-top: 10px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid #d1d8e4;
  border-radius: 7px;
  background: transparent;
  color: #9aa3b5;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.lang-btn:hover {
  background: #f5f7fa;
  border-color: #b8c2d4;
  color: #4a5568;
}

.lang-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.lang-btn .chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
}

.lang-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.lang-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 130px;
  background: #fff;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  overflow: hidden;
  z-index: 200;
}

.lang-dropdown.open {
  display: block;
}

.lang-option {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: #1a2540;
  cursor: pointer;
  transition: background 0.1s;
}

.lang-option:hover {
  background: #f0f4ff;
}

.lang-option.active {
  font-weight: 600;
  color: #3b7de8;
}

/* dark */
body.dark .lang-btn {
  border-color: #2d3d52;
  color: #4a5f7a;
}

body.dark .lang-btn:hover {
  background: #243347;
  border-color: #3d5470;
  color: #94a3b8;
}

body.dark .lang-dropdown {
  background: #1e2a3a;
  border-color: #2d3d52;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

body.dark .lang-option {
  color: #cbd5e1;
}

body.dark .lang-option:hover {
  background: #243347;
}

body.dark .lang-option.active {
  color: #3b7de8;
}

