/* ---------------------------------------------------------------
   login — woven yarn hero, monochrome studio
   --------------------------------------------------------------- */
.login-body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(10, 10, 10, .11) .7px, transparent .7px);
  background-size: 16px 16px;
  overflow: hidden;
}
#weave-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
}
.login-scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(56% 50% at 50% 44%, rgba(246, 245, 241, .94), rgba(246, 245, 241, .62) 60%, rgba(246, 245, 241, .2) 100%),
    linear-gradient(0deg, rgba(246, 245, 241, .55), transparent 26%, transparent 80%, rgba(246, 245, 241, .45));
}
.login-grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.login-frame {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding: 36px clamp(24px, 5vw, 64px) 24px;
}
.login-main {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 0 40px;
}
.login-hero { text-align: center; animation: rise 1s .06s var(--ease-out) both; }
.login-logo-link { display: inline-block; }
.login-logo { height: clamp(30px, 3.2vw, 40px); width: auto; }
.login-hero h1 {
  margin-top: clamp(16px, 2vw, 22px);
  font-family: var(--display);
  font-size: clamp(26px, 3.1vw, 42px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--ink);
  white-space: nowrap;
}
.login-hero h1 em {
  font-style: normal;
  color: var(--ink);
  position: relative;
  white-space: nowrap;
}
.login-hero h1 em::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: -.22em; height: 2px;
  background: var(--ink);
  transform-origin: left;
  animation: lineIn 1.2s 1s var(--ease-out) both;
}
@keyframes lineIn { from { transform: scaleX(0); } }
.login-hero .login-sub {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ink-4);
}

/* card */
.login-card {
  position: relative;
  width: min(432px, 100%);
  flex: 0 0 auto;
  margin-top: clamp(22px, 2.6vw, 32px);
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line-2);
  border-radius: 26px;
  box-shadow:
    0 44px 90px -56px rgba(10, 10, 10, .5),
    0 10px 28px -22px rgba(10, 10, 10, .22),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(26px) saturate(1.05);
  -webkit-backdrop-filter: blur(26px) saturate(1.05);
  padding: 30px 32px 22px;
  animation: cardIn 1.1s .16s var(--ease-spring) both;
  overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 100% 0%, rgba(10, 10, 10, .035), transparent 44%);
}
.login-card > * { position: relative; }
.login-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.login-card-head h2 { font-family: var(--display); font-size: 26px; font-weight: 750; letter-spacing: -.025em; line-height: 1.25; }
.login-card-head p { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.login-card-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--ink);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 12px 24px -14px rgba(10, 10, 10, .8), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.login-card-mark .icon { width: 21px; height: 21px; stroke-width: 1.4; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .field-label { font-size: 12.5px; letter-spacing: .04em; color: var(--ink-2); }
.login-form .input {
  height: 48px; border-radius: 12px;
  background: #fff;
  border-color: var(--line-2);
  font-size: 14.5px;
}
.login-form .input-affix .icon { left: 15px; width: 18px; height: 18px; color: var(--ink-3); }
.login-form .input-affix .input { padding-left: 44px; padding-right: 44px; }
.login-form .input-affix .affix-btn { right: 8px; color: var(--ink-3); }
.login-form .input:focus {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(10, 10, 10, .07);
}
.login-options {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-3); margin-top: -2px;
}
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 16px; height: 16px; border-radius: 5px;
  border: 1px solid var(--line-strong); background: #fff;
  display: grid; place-items: center; transition: all .16s;
}
.check .box .icon { width: 10px; height: 10px; color: #fff; opacity: 0; stroke-width: 2.4; }
.check input:checked + .box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .box .icon { opacity: 1; }
.login-submit { margin-top: 4px; height: 50px; border-radius: 12px; font-size: 14.5px; letter-spacing: .06em; }
.login-submit .icon { transition: transform .3s var(--ease-out); }
.login-submit:hover .icon { transform: translateX(5px); }
.login-alt {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 14px;
  font-family: var(--mono);
  font-size: 9.5px; color: var(--ink-4); letter-spacing: .16em; text-transform: uppercase;
}
.login-alt::before, .login-alt::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.login-sso {
  width: 100%; height: 46px; border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: all .2s;
}
.login-sso:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.login-demo {
  margin-top: 16px; padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper-2);
  border: 1px dashed var(--line-strong);
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
}
.login-demo b { color: var(--ink); font-weight: 650; }
.login-terms { margin-top: 14px; font-size: 11px; color: var(--ink-4); text-align: center; line-height: 1.7; }
.login-terms a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.login-terms a:hover { color: var(--ink); }

.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 26px;
  font-family: var(--mono);
  font-size: 10px; color: var(--ink-3);
  letter-spacing: .14em; text-transform: uppercase;
  animation: rise .9s .3s var(--ease-out) both;
}
.login-admin-link {
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  letter-spacing: .12em;
  transition: color .2s, border-color .2s;
}
.login-admin-link:hover { color: var(--ink); border-color: var(--ink); }

@keyframes rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.97); } }

/* leaving transition */
.login-body.leaving .login-hero,
.login-body.leaving .login-foot { transition: opacity .5s, transform .5s var(--ease-soft); opacity: 0; transform: translateY(-14px); }
.login-body.leaving .login-card { transition: opacity .45s, transform .55s var(--ease-spring); opacity: 0; transform: scale(.96) translateY(10px); }
.login-body.leaving #weave-canvas { transition: opacity .7s; opacity: 0; }

@media (max-width: 900px) {
  .login-body { overflow: auto; }
  .login-frame { padding: 24px 20px; min-height: 100dvh; }
  .login-main { padding: 28px 0 32px; }
  .login-hero h1 { white-space: normal; font-size: clamp(24px, 6vw, 34px); }
  .login-card { width: 100%; padding: 26px 22px 22px; border-radius: 22px; }
  .login-foot { font-size: 9.5px; letter-spacing: .08em; text-align: center; }
}
@media (max-height: 780px) and (min-width: 901px) {
  .login-logo { height: 30px; }
  .login-hero h1 { margin-top: 18px; font-size: clamp(26px, 3vw, 36px); }
  .login-card { margin-top: 22px; padding: 26px 32px 20px; }
  .login-demo { margin-top: 12px; }
}

/* canvas reveal + inline error */
#weave-canvas { opacity: 0; animation: canvasIn 1.8s .1s var(--ease-out) forwards; }
@keyframes canvasIn { to { opacity: 1; } }
.login-error {
  font-size: 12.5px; color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 9px 12px; border-radius: 9px;
  margin-top: -4px;
}
.login-error[hidden] { display: none; }
