:where([hidden]){display:none!important}
:root {
  color-scheme: light;
  --page-bg: #e8eee9;
  --panel-bg: #f3f6f3;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --surface-soft: #eef3ef;
  --green: #0d3025;
  --green-2: #174838;
  --gold: #b38b3e;
  --gold-bright: #d2b46c;
  --ink: #13251e;
  --muted: #697a72;
  --line: rgba(20, 54, 43, 0.14);
  --focus: #2f725b;
  --focus-ring: rgba(47, 114, 91, 0.15);
  --secure-bg: #e7f3ed;
  --secure-ink: #20664c;
  --button-text: #ffffff;
  --danger: #b23d43;
  --success: #287350;
  --card-shadow: 0 28px 70px rgba(13, 48, 37, 0.14), 0 2px 12px rgba(13, 48, 37, 0.05);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #03100c;
  --panel-bg: #061710;
  --surface: #0b2119;
  --surface-glass: rgba(8, 29, 21, 0.9);
  --surface-soft: #0d281e;
  --green: #d5b66e;
  --green-2: #e3c984;
  --gold: #d5b66e;
  --gold-bright: #ecd797;
  --ink: #f4f7f5;
  --muted: #9eafa7;
  --line: rgba(190, 211, 201, 0.16);
  --focus: #d5b66e;
  --focus-ring: rgba(213, 182, 110, 0.16);
  --secure-bg: rgba(28, 102, 75, 0.24);
  --secure-ink: #91d7b6;
  --button-text: #07130e;
  --danger: #ff999d;
  --success: #8bd8b3;
  --card-shadow: 0 34px 90px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--page-bg);
}

body {
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
input { font: inherit; }
button { color: inherit; }

.login-layout {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(390px, 46%) 1fr;
  background: var(--panel-bg);
}

.brand-panel {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(40px, 5vw, 72px) clamp(38px, 5.8vw, 90px);
  color: #ffffff;
  background:
    radial-gradient(circle at 86% 12%, rgba(170, 196, 180, 0.18), transparent 28%),
    linear-gradient(145deg, rgba(4, 20, 14, 0.98) 0%, rgba(10, 48, 35, 0.96) 58%, rgba(17, 62, 46, 0.93) 100%),
    #082219;
  border-inline-end: 1px solid rgba(213, 182, 110, 0.3);
}

.brand-panel::before {
  position: absolute;
  z-index: -1;
  content: "";
  width: min(48vw, 680px);
  aspect-ratio: 1;
  inset: auto -38% -39% auto;
  border: 1px solid rgba(213, 182, 110, 0.24);
  border-radius: 50%;
  box-shadow:
    0 0 0 54px rgba(213, 182, 110, 0.035),
    0 0 0 108px rgba(213, 182, 110, 0.025);
}

.brand-panel::after {
  position: absolute;
  z-index: -1;
  content: "";
  width: 1px;
  height: 42%;
  inset: 29% 30px auto auto;
  background: linear-gradient(transparent, rgba(213, 182, 110, 0.55), transparent);
}

.brand-lockup,
.mobile-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border: 1px solid rgba(213, 182, 110, 0.68);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.brand-mark img {
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-lockup > div,
.mobile-brand > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand-lockup strong {
  font-size: 20px;
  letter-spacing: 0.14em;
}

.brand-lockup div span {
  margin-top: 5px;
  color: #cbd8d1;
  font-size: 9px;
  letter-spacing: 0.25em;
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.eyebrow {
  display: block;
  margin-bottom: 22px;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.2em;
}

.brand-copy h1 {
  margin: 0 0 26px;
  font: 500 clamp(40px, 4.4vw, 68px) / 1.1 Georgia, "Times New Roman", serif;
  letter-spacing: -0.025em;
}

.brand-copy p {
  max-width: 520px;
  margin: 0;
  color: #cbd9d2;
  font-size: 17px;
  line-height: 1.75;
}

.scope-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  color: #d4dfd9;
  font-size: 12px;
  letter-spacing: 0.015em;
}

.scope-list span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scope-list i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 4px rgba(213, 182, 110, 0.11);
}

.form-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 76px 38px 52px;
  background:
    radial-gradient(circle at 84% 8%, rgba(179, 139, 62, 0.11), transparent 27%),
    radial-gradient(circle at 12% 92%, rgba(27, 91, 67, 0.09), transparent 28%),
    linear-gradient(145deg, var(--panel-bg), var(--page-bg));
}

.form-panel::before {
  position: absolute;
  content: "";
  width: 260px;
  height: 260px;
  top: -165px;
  inset-inline-end: -120px;
  border: 1px solid color-mix(in srgb, var(--gold) 24%, transparent);
  border-radius: 50%;
}

.top-controls {
  position: absolute;
  z-index: 5;
  top: max(22px, env(safe-area-inset-top));
  inset-inline-end: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-toggle,
.theme-toggle {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(13, 48, 37, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.language-toggle {
  min-width: 72px;
  padding: 0 14px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

:root[data-theme="dark"] .language-toggle { color: var(--gold); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
}

.theme-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon { display: none; }

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
  color: var(--gold);
}

.language-toggle:focus-visible,
.theme-toggle:focus-visible,
.show-password:focus-visible,
.submit-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.form-wrap {
  position: relative;
  width: min(100%, 470px);
  max-height: 100%;
  overflow: hidden;
  padding: 34px 36px 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface-glass);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.form-wrap::before {
  position: absolute;
  content: "";
  width: 58px;
  height: 3px;
  top: 0;
  inset-inline-start: 36px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.form-wrap.form-flow-expanded {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.form-wrap.form-flow-expanded::-webkit-scrollbar { display: none; }

.mobile-brand { display: none; }

.mobile-brand strong {
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.16em;
}

.mobile-brand div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.mobile-brand .brand-mark {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--secure-ink) 12%, transparent);
  border-radius: 999px;
  background: var(--secure-bg);
  color: var(--secure-ink);
  font-size: 12px;
  font-weight: 750;
}

.secure-badge svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.form-wrap h2 {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 37px;
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.form-wrap h3 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.2;
}

.intro {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

form > label {
  display: block;
  margin-bottom: 16px;
}

form > label > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.input-shell {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-shell:focus-within {
  border-color: var(--focus);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.input-shell > svg,
.show-password svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
}

.input-shell input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  direction: ltr;
  text-align: left;
  font-size: 16px;
}

.input-shell input::placeholder {
  color: color-mix(in srgb, var(--muted) 68%, transparent);
}

.show-password {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.form-meta {
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.submit-button {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  color: var(--button-text);
  box-shadow: 0 14px 30px rgba(13, 48, 37, 0.2);
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

:root[data-theme="dark"] .submit-button {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.32);
}

.submit-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 17px 34px rgba(13, 48, 37, 0.24);
}

.submit-button:active { transform: translateY(0); }

.submit-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.submit-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

[dir="rtl"] .submit-button svg { transform: scaleX(-1); }

.login-message {
  min-height: 17px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.login-message.success { color: var(--success); }

.access-note {
  position: relative;
  margin-top: 17px;
  padding: 13px 15px 13px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
}

[dir="rtl"] .access-note { padding: 13px 18px 13px 15px; }

.access-note::before {
  position: absolute;
  content: "";
  width: 3px;
  top: 13px;
  bottom: 13px;
  inset-inline-start: 0;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}

.access-note strong {
  color: var(--ink);
  font-size: 13px;
}

.access-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

footer {
  position: absolute;
  bottom: max(15px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 820px) {
  .login-layout {
    display: block;
    background: var(--page-bg);
  }

  .brand-panel { display: none; }

  .form-panel {
    width: 100%;
    height: 100%;
    padding:
      max(68px, calc(env(safe-area-inset-top) + 58px))
      18px
      max(42px, calc(env(safe-area-inset-bottom) + 34px));
    background:
      radial-gradient(circle at 10% 7%, rgba(179, 139, 62, 0.14), transparent 27%),
      radial-gradient(circle at 96% 80%, rgba(37, 109, 82, 0.12), transparent 30%),
      linear-gradient(160deg, var(--panel-bg), var(--page-bg));
  }

  .form-panel::before {
    width: 230px;
    height: 230px;
    top: -155px;
    inset-inline-end: -104px;
    box-shadow: 0 0 0 42px color-mix(in srgb, var(--gold) 3%, transparent);
  }

  .top-controls {
    top: max(13px, calc(env(safe-area-inset-top) + 8px));
    inset-inline-end: 16px;
  }

  .form-wrap {
    width: min(100%, 430px);
    max-height: 100%;
    padding: 25px 23px 20px;
    border-radius: 25px;
  }

  .form-wrap::before {
    width: 52px;
    inset-inline-start: 23px;
  }

  .mobile-brand {
    display: flex;
    margin-bottom: 17px;
  }

  .mobile-brand .brand-mark {
    width: 47px;
    height: 47px;
    border-radius: 15px;
  }

  .form-wrap h2 {
    margin-top: 15px;
    font-size: 31px;
  }

  .intro {
    margin-bottom: 20px;
    font-size: 14px;
  }

  form > label { margin-bottom: 13px; }

  .input-shell,
  .submit-button { height: 50px; }

  .form-meta { margin-bottom: 15px; }

  .access-note {
    margin-top: 14px;
    padding-block: 11px;
  }

  footer { bottom: max(9px, env(safe-area-inset-bottom)); }
}

@media (max-width: 820px) and (max-height: 760px) {
  .form-panel {
    padding-top: max(58px, calc(env(safe-area-inset-top) + 49px));
    padding-bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  }

  .top-controls { top: max(7px, calc(env(safe-area-inset-top) + 4px)); }

  .language-toggle,
  .theme-toggle {
    height: 36px;
    border-radius: 11px;
  }

  .theme-toggle { width: 36px; }

  .form-wrap {
    padding: 19px 20px 15px;
    border-radius: 22px;
  }

  .form-wrap::before { inset-inline-start: 20px; }
  .mobile-brand { margin-bottom: 9px; }

  .mobile-brand .brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 12px;
  }

  .mobile-brand strong { font-size: 14px; }
  .mobile-brand div span { font-size: 7px; }
  .secure-badge { padding: 5px 9px; }

  .form-wrap h2 {
    margin: 9px 0 5px;
    font-size: 27px;
  }

  .intro {
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.3;
  }

  form > label { margin-bottom: 9px; }
  form > label > span { margin-bottom: 5px; }

  .input-shell,
  .submit-button { height: 45px; }

  .form-meta {
    min-height: 14px;
    margin: -1px 0 9px;
  }

  .login-message {
    min-height: 8px;
    margin-top: 5px;
  }

  .access-note {
    margin-top: 8px;
    padding: 8px 11px 8px 14px;
  }

  .access-note span { display: none; }
  footer { display: none; }
}

@media (max-width: 820px) and (max-height: 620px) {
  .access-note { display: none; }
  .secure-badge { font-size: 11px; }
}

@media (max-width: 420px) {
  .form-panel { padding-inline: 14px; }
  .top-controls { inset-inline-end: 14px; }
  .form-wrap { padding-inline: 19px; }
  .form-wrap::before { inset-inline-start: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
