*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-deep: #030712;
  --bg-card: rgba(15, 18, 30, 0.88);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #818cf8;
  --accent-bright: #a5b4fc;
  --cyan: #22d3ee;
  --input-bg: rgba(7, 10, 18, 0.72);
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

body.page-login {
  background: radial-gradient(1200px 600px at 50% -10%, #1e1b4b 0%, transparent 55%), var(--bg-deep);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  width: 420px;
  height: 420px;
  background: #4f46e5;
  top: -120px;
  right: -80px;
}

.glow-2 {
  width: 360px;
  height: 360px;
  background: #0891b2;
  bottom: -100px;
  left: -60px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
}

.shell-wide {
  width: min(560px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-inline {
  align-items: flex-start;
  flex-wrap: wrap;
}

.brand-grow {
  flex: 1;
  min-width: 12rem;
}

.btn-logout {
  margin-left: auto;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-logout:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.35);
  background: rgba(99, 102, 241, 0.12);
}

.brand-mark {
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-dot {
  opacity: 0.55;
  font-weight: 600;
}

.tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 11px;
  border: 1px solid var(--border);
}

.segment {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.segment:hover {
  color: var(--text);
}

.segment.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(34, 211, 238, 0.18));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.card-pad .dash-heading {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
}

.card-pad .dash-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.hint {
  font-weight: 500;
  color: var(--muted);
}

.subhint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: -2px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* One shared shell + divider — matches username field border/radius/colors */
.password-input-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.password-input-wrap input[type="password"],
.password-input-wrap input[type="text"] {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 11px 13px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.password-input-wrap input[type="password"]:focus,
.password-input-wrap input[type="text"]:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.password-toggle {
  flex-shrink: 0;
  width: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

:root[data-theme="light"] .password-toggle {
  background: rgba(15, 23, 42, 0.04);
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(99, 102, 241, 0.12);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(129, 140, 248, 0.55);
}

.password-toggle-icon {
  grid-area: 1 / 1;
}

.password-toggle-icon[hidden] {
  display: none !important;
}

.password-input-wrap:focus-within {
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

input:focus:not(.password-input-wrap input) {
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.links {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.links a {
  color: var(--accent-bright);
  text-decoration: none;
}

.links a:hover {
  text-decoration: underline;
}

.sep {
  color: var(--muted);
  opacity: 0.6;
}

.submit {
  margin-top: 6px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  background: linear-gradient(135deg, #c7d2fe 0%, #a5f3fc 100%);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(99, 102, 241, 0.42);
}

.submit:active {
  transform: translateY(0);
}

.foot {
  margin-top: 24px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 400px) {
  .card {
    padding: 22px 18px;
  }
}
