:root {
  --ink: #0b1412;
  --ink-2: #12201c;
  --ink-3: #1a2c26;
  --paper: #f4f1ea;
  --paper-2: #ebe6dc;
  --line: rgba(18, 32, 28, 0.12);
  --copper: #d4a056;
  --copper-deep: #b07d32;
  --mint: #8fcb9b;
  --danger: #b42318;
  --danger-bg: #fde8e6;
  --ok: #12b76a;
  --text: #161c19;
  --muted: #5c6560;
  --white: #fff;
  --shadow: 0 24px 60px rgba(11, 20, 18, 0.18);
  --radius: 16px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.skip:focus {
  top: 12px;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  min-height: 100dvh;
}

.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px clamp(40px, 6vw, 104px) 36px;
  color: var(--paper);
  background:
    radial-gradient(900px 480px at 10% 0%, rgba(212, 160, 86, 0.16), transparent 55%),
    radial-gradient(700px 420px at 90% 100%, rgba(143, 203, 155, 0.12), transparent 50%),
    linear-gradient(165deg, #101c19 0%, var(--ink) 55%, #0a1210 100%);
}

.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cpath d='M0 70h140M70 0v140' stroke='%23f4f1ea' stroke-opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
}

.brand-top,
.brand-copy {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
}

.logo {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
}

.brand-copy {
  margin: auto 0;
  padding: 48px 0;
}

.brand h1 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 4.4vw, 4.1rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 0;
  max-width: 42ch;
  color: rgba(244, 241, 234, 0.72);
  font-size: 1.05rem;
  line-height: 1.55;
}

.brand .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  max-width: none;
  color: rgba(244, 241, 234, 0.7);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(143, 203, 155, 0.7);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(143, 203, 155, 0);
  }
}

.mesh {
  width: min(100%, 520px);
  margin: 36px 0 8px;
}

.mesh-line {
  fill: none;
  stroke: rgba(244, 241, 234, 0.22);
  stroke-width: 1.2;
}

.mesh-flow {
  stroke: var(--copper);
  stroke-dasharray: 6 18;
  stroke-opacity: 0.9;
  animation: flow 8s linear infinite;
}

.mesh-node {
  fill: #0b1412;
  stroke: rgba(244, 241, 234, 0.55);
  stroke-width: 1.4;
}

.mesh-node.active {
  fill: var(--copper);
  stroke: #f0d7a8;
}

@keyframes flow {
  to {
    stroke-dashoffset: -240;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.18);
}

.panel-bar {
  display: flex;
  justify-content: flex-end;
  padding: 20px 28px 0;
}

.lang {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  appearance: none;
  font: inherit;
  cursor: pointer;
}

.lang-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--ink-2);
  transition: transform 0.22s var(--ease);
}

.lang[aria-checked="true"] .lang-thumb {
  transform: translateX(100%);
}

.lang > span:not(.lang-thumb) {
  position: relative;
  z-index: 1;
  padding: 6px 10px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.lang:not([aria-checked="true"]) [data-side="fi"],
.lang[aria-checked="true"] [data-side="en"] {
  color: var(--paper);
}

.panel-body {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 28px 12px;
}

.card {
  width: min(100%, 400px);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

#view-login h2 {
  margin-bottom: 28px;
}

.lede {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.5;
}

.alert {
  display: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: #7a271a;
  font-size: 0.92rem;
  line-height: 1.45;
}

.alert.is-visible,
.alert.is-ok {
  display: block;
}

.alert.is-ok {
  background: #e7f8ee;
  color: #085d38;
}

.field {
  margin-bottom: 16px;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

.control {
  position: relative;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 4px rgba(18, 32, 28, 0.12);
}

.password-input {
  padding-right: 52px;
}

.toggle-pass {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
}

.hint {
  min-height: 1.2em;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.8rem;
}

.options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.remember input {
  accent-color: var(--ink-2);
}

.text-btn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink-2);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.text-btn:hover,
.link:hover {
  color: var(--copper-deep);
}

.primary:focus-visible,
.sso-btn:focus-visible,
.text-btn:focus-visible,
.lang:focus-visible,
.logo:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
}

.primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--ink-2);
  color: var(--paper);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.primary:hover {
  background: var(--ink);
}

.primary:active {
  transform: translateY(1px);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.78;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(244, 241, 234, 0.25);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.sso {
  display: grid;
  gap: 10px;
}

.sso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.sso-btn:hover {
  background: var(--paper-2);
}

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

.access {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.panel-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 28px 22px;
  color: var(--muted);
  font-size: 0.8rem;
}

[hidden] {
  display: none !important;
}

.view[hidden] {
  display: none;
}

.inner {
  min-height: 100dvh;
  background:
    radial-gradient(700px 320px at 0% 0%, rgba(212, 160, 86, 0.16), transparent 50%),
    var(--ink);
  color: var(--paper);
}

.inner-wrap {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.inner-wrap > .logo {
  margin-bottom: 40px;
}

.inner a:not(.logo) {
  color: #e8c48a;
}

.inner .text-btn {
  color: #e8c48a;
}

.inner a:not(.logo):hover,
.inner .text-btn:hover {
  color: #f4f1ea;
}

.inner h1 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.inner p,
.inner li {
  color: rgba(244, 241, 234, 0.78);
  line-height: 1.65;
}

.shake {
  animation: shake 0.42s var(--ease);
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .brand {
    min-height: auto;
    align-items: stretch;
    padding: 22px 22px 18px;
  }

  .brand-top,
  .brand-copy {
    width: 100%;
  }

  .brand-copy {
    padding: 18px 0 8px;
  }

  .brand h1 {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  .mesh {
    display: none;
  }

  .panel-body {
    align-items: flex-start;
    padding-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
