:root {
  color-scheme: light;
  --chatline-indigo: #5859d9;
  --chatline-indigo-dark: #4748bd;
  --chatline-indigo-soft: #eef0ff;
  --chatline-text: #172033;
  --chatline-muted: #667085;
  --chatline-border-angle: 0deg;
}

@property --chatline-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes chatline-border-flow {
  to { --chatline-border-angle: 360deg; }
}

* { box-sizing: border-box; }

html { font-size: clamp(14px, calc(13.25px + .32vw), 18px) !important; }

body.chatline-login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  place-items: center;
  margin: 0;
  padding: clamp(18px, 5vh, 40px) 16px;
  color: var(--chatline-text);
  background:
    radial-gradient(ellipse at 12% 12%, rgb(88 89 217 / 9%), transparent 34rem),
    linear-gradient(145deg, #f8f8fc 0%, #f0f1f8 100%);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(.9rem, .84rem + .22vw, 1.05rem);
}

.chatline-auth-shell { width: min(100%, 450px); }

.chatline-auth-card {
  position: relative;
  isolation: isolate;
  width: 100%;
  padding: 2px;
  border: 0;
  border-radius: 20px;
  background: conic-gradient(
    from var(--chatline-border-angle),
    #3435a7,
    #c9c9f5,
    #7778e8,
    #e0e0fb,
    #3435a7
  );
  animation: chatline-border-flow 7s linear infinite;
  box-shadow: 0 1.5rem 4rem rgb(46 47 120 / 12%), 0 .25rem .75rem rgb(46 47 120 / 5%);
}

.chatline-auth-card::before {
  position: absolute;
  z-index: 1;
  top: 2px;
  right: 2px;
  left: 2px;
  height: .4rem;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, #9293ed, var(--chatline-indigo) 58%, #3435a7);
  content: "";
  pointer-events: none;
}

.chatline-auth-card-body {
  padding: clamp(1.15rem, 3.5vw, 2rem);
  border-radius: 18px;
  background: #fff;
}

.chatline-auth-header { margin-bottom: 1rem; text-align: center; }

.chatline-auth-logo {
  display: block;
  width: clamp(4.5rem, 10vw, 5.5rem);
  height: clamp(4.5rem, 10vw, 5.5rem);
  margin: 0 auto .65rem;
  object-fit: contain;
}

.chatline-auth-title {
  margin: 0;
  color: var(--chatline-indigo);
  font-size: clamp(1.35rem, 1.08rem + .9vw, 1.8rem);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .04em;
}

.chatline-auth-subtitle {
  margin: .15rem 0 0;
  color: var(--chatline-muted);
  font-size: .85rem;
  font-weight: 400;
  line-height: 1.5;
}

.chatline-auth-motto {
  margin: 0 0 1rem;
  color: var(--chatline-muted);
  font-size: .87rem;
  line-height: 1.5;
  text-align: center;
}

.chatline-auth-field { margin-bottom: 1rem; }
.chatline-password-field { margin-bottom: 1rem; }

.chatline-auth-field label {
  display: block;
  margin: 0 0 .5rem;
  color: #344054;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.5;
}

.chatline-input-group {
  display: flex;
  width: 100%;
  height: clamp(48px, 4.2vw, 54px);
  align-items: stretch;
  padding: 2px;
  overflow: hidden;
  border-radius: 12px;
  background: #dfe0ed;
  transition: background 150ms ease;
}

.chatline-input-group:focus-within {
  background: conic-gradient(
    from var(--chatline-border-angle),
    #3435a7,
    #c9c9f5,
    #7778e8,
    #e0e0fb,
    #3435a7
  );
  animation: chatline-border-flow 3.5s linear infinite;
}

.chatline-input-icon,
.chatline-password-toggle {
  display: flex;
  flex: 0 0 clamp(2.75rem, 8vw, 3.25rem);
  align-items: center;
  justify-content: center;
  border: 0;
  background: #f8f8fc;
  color: #7374ad;
}

.chatline-input-icon { border-radius: 9px 0 0 9px; }
.chatline-input-icon svg { width: 19px; height: 19px; }

.chatline-input {
  display: block;
  width: 1%;
  min-width: 0;
  height: 100%;
  flex: 1 1 auto;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: clamp(.9rem, .84rem + .22vw, 1.05rem);
}

.chatline-input::placeholder { color: #8993a3; opacity: 1; }
.chatline-input:focus-visible { outline: 0; }

.chatline-password-toggle {
  cursor: pointer;
  border-radius: 0 9px 9px 0;
}

.chatline-password-toggle:hover,
.chatline-password-toggle:focus-visible {
  background: #f0f0fb;
  color: var(--chatline-indigo-dark);
}

.chatline-password-toggle svg { width: 19px; height: 19px; }
.chatline-eye-slash { display: none; }
.chatline-password-toggle.is-visible .chatline-eye-slash { display: block; }

.chatline-submit {
  display: flex;
  width: 100%;
  min-height: clamp(46px, 7vw, 54px);
  height: clamp(46px, 7vw, 54px);
  max-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: .15rem;
  padding: 10px 16px;
  border: 0;
  border-radius: 11px;
  background: var(--chatline-indigo);
  color: #fff;
  font: inherit;
  font-size: clamp(.92rem, .86rem + .2vw, 1.02rem);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.chatline-submit svg { width: 18px; height: 18px; }
.chatline-submit:hover {
  transform: translateY(-1px);
  background: var(--chatline-indigo-dark);
  box-shadow: 0 .4rem 1rem rgb(88 89 217 / 20%);
}

.chatline-submit:focus-visible,
.chatline-password-toggle:focus-visible {
  outline: 3px solid rgb(88 89 217 / 35%);
  outline-offset: 2px;
}

.chatline-auth-alert,
.chatline-field-error { color: #a32732; font-size: .82rem; }

.chatline-auth-alert {
  margin-bottom: 1rem;
  padding: 10px 12px;
  border: 1px solid #f1c7cc;
  border-radius: 7px;
  background: #fff4f4;
}

.chatline-field-error { margin: 6px 0 0; }

@media (max-width: 380px) {
  .chatline-auth-card-body { padding: 1rem; }
  .chatline-auth-title { font-size: 1.25rem; }
}

@media (max-height: 720px) {
  .chatline-auth-card-body { padding-block: clamp(.85rem, 2vh, 1.1rem); }
  .chatline-auth-logo { width: clamp(4rem, 9vh, 4.8rem); height: clamp(4rem, 9vh, 4.8rem); }
}

@media (prefers-reduced-motion: reduce) {
  .chatline-auth-card,
  .chatline-input-group:focus-within { animation: none; }
  .chatline-submit { transition: none; }
}
