:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --sidebar: #171a1f;
  --sidebar-soft: #22262d;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-warm: #fff7ed;
  --line: #e4e7ec;
  --line-strong: #cfd5df;
  --text: #16181d;
  --muted: #697386;
  --muted-strong: #46515f;
  --accent: #e6531d;
  --accent-hover: #c94314;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --radius: 8px;
  --shadow: 0 10px 26px rgba(16, 24, 40, 0.07);
  --auth-shell-bg: #d5bf9f;
  --auth-panel-bg: #0b0909;
  --auth-card-bg: rgba(255, 255, 255, 0.88);
  --auth-card-border: rgba(17, 24, 39, 0.07);
  --auth-card-shadow: 0 28px 80px rgba(15, 23, 42, 0.12);
  --auth-kicker-color: #f0b183;
  --auth-title-color: #ffffff;
  --auth-subtitle-color: #e1e6ee;
  --auth-form-label: #ffffff;
  --auth-field-text: #ffffff;
  --auth-field-bg: rgba(255, 255, 255, 0.08);
  --auth-field-border: rgba(255, 255, 255, 0.24);
  --auth-field-border-focus: rgba(255, 255, 255, 0.38);
  --auth-field-placeholder: #b7c0cd;
  --auth-toggle-bg: rgba(255, 255, 255, 0.72);
  --auth-toggle-border: rgba(17, 24, 39, 0.08);
  --auth-toggle-text: #16181d;
  --auth-toggle-track: #d7dde6;
  --auth-toggle-thumb: #ffffff;
  --auth-help-text: #b2bac7;
  --auth-error-text: #ff8e8e;
  --auth-turnstile-border: rgba(255, 255, 255, 0.16);
  --auth-stage-text: #16181d;
  --auth-stage-footer: #757f8e;
  --auth-stage-brand-bg: rgba(255, 255, 255, 0.74);
  --auth-stage-brand-border: rgba(17, 24, 39, 0.08);
  --auth-stage-brand-mark-bg: #111111;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.is-hidden {
  display: none !important;
}

body.auth-theme-night {
  --auth-shell-bg: #08090d;
  --auth-panel-bg: #0b0909;
  --auth-card-bg: transparent;
  --auth-card-border: transparent;
  --auth-card-shadow: none;
  --auth-kicker-color: #f6a67d;
  --auth-title-color: #ffffff;
  --auth-subtitle-color: #97a0af;
  --auth-form-label: #e3e7ef;
  --auth-field-text: #ffffff;
  --auth-field-bg: rgba(255, 255, 255, 0.02);
  --auth-field-border: rgba(255, 255, 255, 0.11);
  --auth-field-border-focus: rgba(255, 255, 255, 0.24);
  --auth-field-placeholder: #697283;
  --auth-toggle-bg: rgba(255, 255, 255, 0.04);
  --auth-toggle-border: rgba(255, 255, 255, 0.1);
  --auth-toggle-text: #f7f9fd;
  --auth-toggle-track: rgba(255, 255, 255, 0.1);
  --auth-toggle-thumb: #ffb531;
  --auth-help-text: #6f7787;
  --auth-error-text: #ff8b8b;
  --auth-turnstile-border: rgba(255, 255, 255, 0.09);
  --auth-stage-text: #111216;
  --auth-stage-footer: #727b89;
  --auth-stage-brand-bg: rgba(255, 255, 255, 0.66);
  --auth-stage-brand-border: rgba(255, 255, 255, 0.24);
  --auth-stage-brand-mark-bg: #121212;
}

body.auth-theme-day {
  --auth-shell-bg: #d5bf9f;
  --auth-panel-bg: #0b0909;
  --auth-card-bg: transparent;
  --auth-card-border: transparent;
  --auth-card-shadow: none;
  --auth-kicker-color: #f0b183;
  --auth-title-color: #ffffff;
  --auth-subtitle-color: rgba(255, 255, 255, 0.36);
  --auth-form-label: rgba(255, 255, 255, 0.82);
  --auth-field-text: #ffffff;
  --auth-field-bg: rgba(255, 255, 255, 0.02);
  --auth-field-border: rgba(255, 255, 255, 0.12);
  --auth-field-border-focus: rgba(255, 255, 255, 0.24);
  --auth-field-placeholder: rgba(255, 255, 255, 0.34);
  --auth-toggle-bg: rgba(255, 255, 255, 0.72);
  --auth-toggle-border: rgba(17, 24, 39, 0.08);
  --auth-toggle-text: #16181d;
  --auth-toggle-track: #d7dde6;
  --auth-toggle-thumb: #ffffff;
  --auth-help-text: rgba(255, 255, 255, 0.24);
  --auth-error-text: #ff8e8e;
  --auth-turnstile-border: rgba(255, 255, 255, 0.16);
  --auth-stage-text: #16181d;
  --auth-stage-footer: #757f8e;
  --auth-stage-brand-bg: rgba(255, 255, 255, 0.74);
  --auth-stage-brand-border: rgba(17, 24, 39, 0.08);
  --auth-stage-brand-mark-bg: #111111;
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  overflow: hidden;
  background: var(--auth-shell-bg);
}

.auth-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(17, 24, 39, 0.16);
  pointer-events: none;
}

.auth-stage-panel,
.auth-card-panel {
  min-width: 0;
}

.auth-stage-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 24% 14%, rgba(246, 229, 202, 0.34), transparent 30%),
    radial-gradient(circle at 74% 18%, rgba(194, 151, 92, 0.18), transparent 24%),
    radial-gradient(circle at 58% 70%, rgba(188, 147, 78, 0.12), transparent 28%),
    linear-gradient(180deg, #dbc29e 0%, #ccb086 100%);
}

.auth-stage-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 34% 18%, rgba(240, 220, 188, 0.18), transparent 24%),
    radial-gradient(circle at 58% 38%, rgba(161, 124, 74, 0.1), transparent 32%),
    linear-gradient(180deg, rgba(230, 205, 165, 0.08) 0%, rgba(196, 164, 120, 0.06) 100%);
}

.auth-stage-grid {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background:
    radial-gradient(circle at 36% 22%, rgba(255, 255, 255, 0.42), transparent 24%),
    radial-gradient(circle at 56% 34%, rgba(194, 170, 140, 0.16), transparent 28%);
}

body.auth-theme-night .auth-stage-panel {
  background:
    radial-gradient(circle at 22% 14%, rgba(146, 123, 255, 0.18), transparent 32%),
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.62), transparent 28%),
    radial-gradient(circle at 58% 72%, rgba(255, 210, 85, 0.16), transparent 26%),
    linear-gradient(180deg, #ececf1 0%, #cdcfda 100%);
}

body.auth-theme-night .auth-stage-backdrop {
  background:
    radial-gradient(circle at 30% 16%, rgba(255, 255, 255, 0.74), transparent 24%),
    radial-gradient(circle at 54% 40%, rgba(188, 190, 198, 0.32), transparent 34%),
    linear-gradient(180deg, rgba(247, 247, 250, 0.58) 0%, rgba(210, 213, 224, 0.24) 100%);
}

body.auth-theme-night .auth-stage-grid {
  opacity: 0.16;
  background:
    radial-gradient(circle at 36% 22%, rgba(255, 255, 255, 0.44), transparent 22%),
    radial-gradient(circle at 56% 34%, rgba(170, 174, 184, 0.16), transparent 30%);
}

body.auth-theme-day .auth-stage-panel {
  background:
    radial-gradient(circle at 24% 14%, rgba(246, 229, 202, 0.34), transparent 30%),
    radial-gradient(circle at 74% 18%, rgba(194, 151, 92, 0.18), transparent 24%),
    radial-gradient(circle at 58% 70%, rgba(188, 147, 78, 0.12), transparent 28%),
    linear-gradient(180deg, #dbc29e 0%, #ccb086 100%);
}

body.auth-theme-day .auth-stage-backdrop {
  background:
    radial-gradient(circle at 34% 18%, rgba(240, 220, 188, 0.18), transparent 24%),
    radial-gradient(circle at 58% 38%, rgba(161, 124, 74, 0.1), transparent 32%),
    linear-gradient(180deg, rgba(230, 205, 165, 0.08) 0%, rgba(196, 164, 120, 0.06) 100%);
}

body.auth-theme-day .auth-stage-grid {
  opacity: 0.14;
  background:
    radial-gradient(circle at 36% 22%, rgba(255, 255, 255, 0.42), transparent 24%),
    radial-gradient(circle at 56% 34%, rgba(194, 170, 140, 0.16), transparent 28%);
}

.auth-stage-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(58px);
  opacity: 0.72;
  animation: authFloat 14s ease-in-out infinite;
}

.auth-stage-glow-a {
  top: 8%;
  left: 8%;
  width: 220px;
  height: 220px;
}

.auth-stage-glow-b {
  right: 10%;
  top: 24%;
  width: 260px;
  height: 260px;
  animation-delay: -4s;
}

.auth-stage-glow-c {
  left: 34%;
  bottom: 14%;
  width: 300px;
  height: 300px;
  animation-delay: -8s;
}

body.auth-theme-night .auth-stage-glow-a {
  background: rgba(133, 123, 255, 0.18);
}

body.auth-theme-night .auth-stage-glow-b {
  background: rgba(255, 201, 123, 0.14);
}

body.auth-theme-night .auth-stage-glow-c {
  background: rgba(167, 175, 208, 0.16);
}

body.auth-theme-day .auth-stage-glow-a {
  background: rgba(255, 229, 170, 0.22);
}

body.auth-theme-day .auth-stage-glow-b {
  background: rgba(255, 194, 129, 0.14);
}

body.auth-theme-day .auth-stage-glow-c {
  background: rgba(255, 255, 255, 0.18);
}

.auth-stage-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  padding: 34px 34px 28px;
  color: var(--auth-stage-text);
}

.auth-stage-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 12px 18px 12px 12px;
  border: 1px solid var(--auth-stage-brand-border);
  border-radius: 999px;
  background: var(--auth-stage-brand-bg);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 28px rgba(255, 255, 255, 0.08);
}

.auth-stage-brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--auth-stage-brand-mark-bg);
  color: #ffffff;
  box-shadow: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.auth-stage-brand-kicker {
  display: none;
}

.auth-stage-brand-name {
  margin-top: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.auth-stage-scene {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  min-height: 0;
  padding-top: clamp(58px, 13vh, 118px);
}

.auth-character-stage {
  position: relative;
  width: min(550px, 100%);
  height: 400px;
  margin-top: 0;
}

.auth-character {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition:
    transform 0.7s ease-in-out,
    height 0.7s ease-in-out,
    width 0.7s ease-in-out;
  will-change: transform;
}

.auth-character-purple {
  left: 70px;
  width: 180px;
  height: 400px;
  border-radius: 10px 10px 0 0;
  background: #6b2fff;
  z-index: 1;
  animation: none;
}

.auth-character-black {
  left: 240px;
  width: 120px;
  height: 310px;
  border-radius: 8px 8px 0 0;
  background: #1f1f1f;
  z-index: 2;
  animation: none;
}

.auth-character-orange {
  left: 0;
  width: 240px;
  height: 200px;
  border-radius: 120px 120px 0 0;
  background: #ff8d57;
  z-index: 3;
  animation: none;
}

.auth-character-yellow {
  left: 310px;
  width: 140px;
  height: 230px;
  border-radius: 70px 70px 0 0;
  background: #f2df3d;
  z-index: 4;
  animation: none;
}

.auth-face {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 24px;
}

.auth-face-purple {
  top: 40px;
  left: 45px;
  gap: 32px;
}

.auth-face-black {
  top: 32px;
  left: 26px;
  gap: 24px;
}

.auth-face-orange {
  top: 90px;
  left: 82px;
  gap: 32px;
}

.auth-face-yellow {
  top: 40px;
  left: 52px;
  gap: 24px;
}

.auth-eye-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff;
  transition:
    transform 0.16s ease-out,
    opacity 0.08s linear;
}

.auth-eye-track.is-blinking {
  height: 2px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.auth-eye-track.is-blinking .auth-eye-pupil {
  opacity: 0;
}

.auth-eye-track.is-minimal {
  width: 12px;
  height: 12px;
  background: transparent;
}

.auth-eye-pupil {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2d2d2d;
  transform: translate3d(0, 0, 0);
  transition:
    transform 0.18s ease-out,
    opacity 0.08s linear;
}

.auth-eye-track.is-password-glancing .auth-eye-pupil {
  transition: transform 0.11s linear, opacity 0.12s linear;
}

.auth-eye-track.is-password-avoiding .auth-eye-pupil {
  transition: transform 0.14s ease-out, opacity 0.08s linear;
}

.auth-eye-pupil.is-solid {
  width: 12px;
  height: 12px;
}

.auth-character-mouth {
  position: absolute;
  left: 40px;
  top: 88px;
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: #2d2d2d;
  transition:
    left 0.2s ease-out,
    top 0.2s ease-out;
}

.auth-card-panel {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 255, 255, 0.03), transparent 28%),
    linear-gradient(180deg, #090707 0%, #050404 100%);
  padding: 40px 54px 36px;
}

.auth-theme-toggle-row {
  position: absolute;
  top: 28px;
  right: 34px;
  z-index: 3;
}

.auth-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--auth-toggle-border);
  border-radius: 999px;
  background: var(--auth-toggle-bg);
  color: var(--auth-toggle-text);
  padding: 8px 10px 8px 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.auth-theme-toggle:hover {
  transform: translateY(-1px);
}

.auth-theme-toggle:focus-visible {
  outline: 2px solid rgba(230, 83, 29, 0.28);
  outline-offset: 3px;
}

.auth-theme-toggle-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-theme-toggle-track {
  position: relative;
  width: 48px;
  height: 24px;
  border-radius: 999px;
  background: var(--auth-toggle-track);
}

.auth-theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--auth-toggle-thumb);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transition:
    transform 0.24s ease,
    background 0.24s ease;
}

body.auth-theme-night .auth-theme-toggle-thumb {
  transform: translateX(24px);
}

.auth-card {
  display: grid;
  align-content: start;
  width: min(420px, 100%);
  min-height: auto;
  border: 1px solid var(--auth-card-border);
  border-radius: 0;
  background: var(--auth-card-bg);
  box-shadow: var(--auth-card-shadow);
  backdrop-filter: none;
  padding: 0;
  transform: translateY(-6px);
}

.auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(230, 83, 29, 0.28);
}

.auth-brand-plain .auth-brand-mark {
  display: none;
}

.auth-kicker {
  color: var(--auth-kicker-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-title {
  margin-top: 8px;
  font-size: clamp(31px, 2.35vw, 38px);
  letter-spacing: -0.03em;
  color: var(--auth-title-color);
}

.auth-subtitle {
  margin-top: 10px;
  max-width: 320px;
  color: var(--auth-subtitle-color);
  font-size: 13px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 42px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form label span {
  color: var(--auth-form-label);
  font-size: 12px;
  font-weight: 700;
}

.auth-card input {
  min-height: 48px;
  border: 1px solid var(--auth-field-border);
  border-radius: 999px;
  background: var(--auth-field-bg);
  color: var(--auth-field-text);
  padding: 12px 16px;
  box-shadow: none;
}

.auth-card input:focus {
  border-color: var(--auth-field-border-focus);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.auth-card input::placeholder {
  color: var(--auth-field-placeholder);
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: transparent;
  color: var(--auth-subtitle-color);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--auth-title-color);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(230, 83, 29, 0.24);
  outline-offset: 2px;
}

.password-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-icon-hide {
  display: none;
}

.password-toggle.is-visible .password-icon-show {
  display: none;
}

.password-toggle.is-visible .password-icon-hide {
  display: block;
}

.auth-submit {
  min-height: 48px;
  margin-top: 4px;
}

.auth-card .button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 700;
}

.auth-card .button-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #ff7032 0%, #ee561d 100%);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(230, 83, 29, 0.24);
}

.auth-card .button-primary:hover {
  border-color: transparent;
  background: linear-gradient(180deg, #ff7a40 0%, #ea5721 100%);
}

.auth-card .button-ghost {
  border-color: var(--auth-field-border);
  background: transparent;
  color: var(--auth-form-label);
}

.auth-card .button-ghost:hover {
  border-color: var(--auth-field-border-focus);
  background: rgba(255, 255, 255, 0.03);
}

.turnstile-wrap {
  display: grid;
  gap: 10px;
  width: 100%;
}

.turnstile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--auth-form-label);
  font-size: 12px;
  font-weight: 700;
}

.turnstile-box {
  display: grid;
  place-items: start;
  width: 100%;
  min-height: 74px;
  border: 1px solid var(--auth-turnstile-border);
  border-radius: 22px;
  background: transparent;
  padding: 12px;
}

.turnstile-box > div,
.turnstile-box iframe {
  width: 100% !important;
  max-width: 100% !important;
}

.auth-error {
  min-height: 20px;
  margin-top: 14px;
  color: var(--auth-error-text);
  font-size: 13px;
}

.auth-hint {
  margin-top: 22px;
  color: var(--auth-help-text);
  font-size: 12px;
  line-height: 1.7;
}

body.auth-theme-night .auth-card {
  width: min(390px, 100%);
}

body.auth-theme-night .auth-card-panel {
  justify-items: start;
  padding-left: clamp(54px, 7vw, 96px);
  padding-right: clamp(44px, 6vw, 82px);
}

body.auth-theme-night .auth-brand {
  justify-self: start;
}

body.auth-theme-night .auth-theme-toggle-row {
  right: 32px;
}

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

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 18px 14px;
  background: var(--sidebar);
  color: #f8fafc;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
}

.brand-subtitle,
.mini-label,
.profile-box label {
  margin-top: 3px;
  color: #aeb7c4;
  font-size: 12px;
}

.profile-box {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: var(--sidebar-soft);
}

.profile-box select {
  border-color: rgba(255, 255, 255, 0.14);
  background: #111419;
  color: #fff;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 5px;
}

.side-nav-item {
  width: 100%;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: transparent;
  color: #d8dee8;
  text-align: left;
  cursor: pointer;
}

.side-nav-item:hover,
.side-nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.mini-value {
  color: #fff;
  line-height: 1.45;
}

.main-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.session-meta {
  display: grid;
  gap: 2px;
}

.session-meta strong {
  font-size: 13px;
}

.session-meta span {
  color: var(--muted);
  font-size: 11px;
}

.page-kicker,
.panel-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button-row.tight {
  justify-content: flex-end;
}

.button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.button:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}

.button-primary {
  border-color: rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #fff;
}

.button-primary:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.button.is-dirty {
  box-shadow: 0 0 0 3px rgba(230, 83, 29, 0.16);
}

.button-danger {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.button-danger:hover {
  border-color: #fda29b;
  background: #fee4e2;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) 430px;
  gap: 18px;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.work-area,
.dashboard-area {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  overflow: auto;
  padding-right: 3px;
}

.dashboard-area {
  padding-right: 0;
}

.panel,
.split-panel {
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.dashboard-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
}

.split-panel {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: 14px;
  align-items: stretch;
}

.split-panel > .panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.status-badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.is-running {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.status-item,
.metric-card {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.status-label,
.metric-label,
.row-meta,
.empty-state {
  color: var(--muted);
  font-size: 12px;
}

.status-value,
.metric-value {
  margin-top: 8px;
  overflow: hidden;
  color: var(--text);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-value {
  font-size: 15px;
}

.metric-value {
  font-size: 22px;
}

.billing-grid {
  margin-top: 12px;
}

.billing-progress {
  height: 12px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.billing-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #f97316);
  transition: width 0.24s ease;
}

.billing-note {
  margin-top: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gateway-config {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.65fr);
  gap: 12px;
}

#loginSection .gateway-config {
  flex: 1;
  align-content: start;
}

.service-status-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.gateway-field {
  min-width: 0;
}

.gateway-service-field {
  grid-column: 1 / -1;
}

.gateway-field input[readonly],
.gateway-field input:disabled {
  color: var(--text);
  background: #fff;
  opacity: 1;
}

.gateway-secret-field {
  grid-column: 1 / 2;
}

.gateway-timeout-field {
  grid-column: 2 / 3;
}

.gateway-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.gateway-actions .button {
  width: 100%;
}

.gateway-result-card {
  display: grid;
  gap: 10px;
  min-height: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.gateway-result-card:empty {
  display: none;
}

.gateway-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gateway-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px;
}

.gateway-result-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 9px 10px;
}

.gateway-result-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.gateway-result-grid strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gateway-result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.helper-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span,
.sub-title {
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
  color: #6d7482;
}

.auth-stage-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--auth-stage-footer);
  font-size: 12px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.span-two {
  grid-column: span 2;
}

.span-all {
  grid-column: 1 / -1;
}

.qr-panel {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 262px;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(228, 231, 236, 0.55) 1px, transparent 1px),
    linear-gradient(rgba(228, 231, 236, 0.55) 1px, transparent 1px),
    #fff;
  background-size: 22px 22px;
}

.qr-panel img {
  display: none;
  max-width: 230px;
  max-height: 230px;
  border: 10px solid #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  object-fit: contain;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  text-align: center;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

#knowledgeSection .knowledge-grid > div {
  min-width: 0;
  display: grid;
  gap: 8px;
}

#knowledgeSection .list-surface {
  height: 200px;
  min-height: 200px;
  max-height: 200px;
}

.knowledge-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.knowledge-health-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px 13px;
  min-height: 88px;
  display: grid;
  gap: 8px;
}

.knowledge-health-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.knowledge-health-value {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.knowledge-health-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.policy-template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.policy-template-list {
  min-height: 96px;
  max-height: 260px;
}

.list-surface {
  min-height: 122px;
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.list-row {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child {
  border-bottom: 0;
}

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

.row-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions .button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.code-box {
  margin: 14px 0 0;
  border: 1px solid #1f2937;
  border-radius: var(--radius);
  background: #111827;
  color: #d1fae5;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-box.compact {
  max-height: 150px;
}

.code-box.tall {
  min-height: 260px;
  max-height: 420px;
}

.room-select {
  margin-bottom: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-list {
  max-height: 240px;
}

.stream-list {
  max-height: 260px;
}

.entry-dialog {
  width: min(760px, calc(100vw - 60px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 22px 70px rgba(16, 24, 40, 0.26);
}

.entry-dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

.dialog-card {
  padding: 18px;
  background: #fff;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 20;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 10px 13px;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.muted {
  color: var(--muted);
}

@keyframes authFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(10px, -18px, 0) scale(1.06);
  }
}

@keyframes authRockPurple {
  0%,
  100% {
    transform: skewX(0deg) translateY(0);
  }
  25% {
    transform: skewX(-2deg) translateY(-4px);
  }
  50% {
    transform: skewX(1.8deg) translateY(0);
  }
  75% {
    transform: skewX(-1.2deg) translateY(-6px);
  }
}

@keyframes authRockBlack {
  0%,
  100% {
    transform: skewX(0deg) translateY(0);
  }
  35% {
    transform: skewX(2deg) translateY(-4px);
  }
  65% {
    transform: skewX(-1.6deg) translateY(0);
  }
}

@keyframes authRockOrange {
  0%,
  100% {
    transform: skewX(0deg) translateY(0);
  }
  30% {
    transform: skewX(1.4deg) translateY(-3px);
  }
  60% {
    transform: skewX(-1.6deg) translateY(0);
  }
}

@keyframes authRockYellow {
  0%,
  100% {
    transform: skewX(0deg) translateY(0);
  }
  20% {
    transform: skewX(-1.6deg) translateY(-3px);
  }
  70% {
    transform: skewX(1.4deg) translateY(0);
  }
}

@media (max-width: 1380px) {
  .content-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .work-area,
  .dashboard-area {
    overflow: visible;
  }

  .dashboard-sticky {
    position: static;
  }
}

@media (max-width: 1160px) {
  .auth-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .auth-stage-panel {
    min-height: 640px;
  }

  .auth-card-panel {
    padding-top: 0;
    padding-bottom: 24px;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell,
  .main-shell {
    display: block;
    height: auto;
  }

  .sidebar {
    position: static;
  }

  .content-grid,
  .split-panel,
  .form-grid.four,
  .form-grid.two,
  .gateway-config,
  .knowledge-grid,
  .knowledge-health-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .gateway-secret-field,
  .gateway-timeout-field,
  .gateway-actions {
    grid-column: 1;
  }

  .gateway-actions {
    grid-template-columns: 1fr;
  }

  .span-two,
  .span-all {
    grid-column: 1;
  }

  .auth-shell {
    background: #0d0d0d;
  }

  .auth-stage-panel {
    min-height: auto;
  }

  .auth-stage-content {
    padding: 24px 18px 18px;
  }

  .auth-character-stage {
    width: 100%;
    height: 300px;
    margin-top: 18px;
  }

  .auth-character-purple {
    left: 44px;
    width: 138px;
    height: 292px;
  }

  .auth-character-black {
    left: 166px;
    width: 92px;
    height: 226px;
  }

  .auth-character-orange {
    left: 0;
    width: 176px;
    height: 144px;
  }

  .auth-character-yellow {
    left: 220px;
    width: 104px;
    height: 170px;
  }

  .auth-face-purple {
    top: 34px;
    left: 36px;
    gap: 18px;
  }

  .auth-face-black {
    top: 26px;
    left: 18px;
    gap: 14px;
  }

  .auth-face-orange {
    top: 62px;
    left: 56px;
    gap: 16px;
  }

  .auth-face-yellow {
    top: 28px;
    left: 34px;
    gap: 14px;
  }

  .auth-character-mouth {
    left: 26px;
    top: 68px;
    width: 48px;
  }

  .auth-eye-track {
    width: 15px;
    height: 15px;
  }

  .auth-eye-track.is-minimal,
  .auth-eye-pupil.is-solid {
    width: 10px;
    height: 10px;
  }

  .auth-eye-pupil {
    width: 6px;
    height: 6px;
  }

  .auth-card-panel {
    background: #0d0d0d;
  }

  .auth-card {
    width: 100%;
    min-height: auto;
    padding: 28px 22px 34px;
  }

  .auth-stage-footer {
    margin-top: 10px;
  }
}

#loginSection.split-panel {
  align-items: stretch;
}

#loginSection.split-panel > .panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

#loginSection .qr-panel {
  flex: 1;
}

#loginSection .gateway-config.service-status-card {
  flex: 1;
  align-content: start;
}
