:root {
  color-scheme: dark;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    sans-serif;
  background: #060914;
  color: #eef2ff;
  --panel: rgba(13, 19, 37, 0.82);
  --panel-solid: #0d1325;
  --border: rgba(151, 170, 255, 0.16);
  --muted: #8993ad;
  --blue: #6c8cff;
  --cyan: #5de1d1;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -20%, #1a2458 0, transparent 38%),
    linear-gradient(145deg, #050712, #080d1e 60%, #060813);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.aurora {
  position: fixed;
  z-index: 0;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
  animation: float 12s ease-in-out infinite alternate;
}

.aurora-one {
  top: -20vw;
  right: -10vw;
  background: #526dff;
}

.aurora-two {
  bottom: -24vw;
  left: -12vw;
  background: #25cdb5;
  animation-delay: -5s;
}

@keyframes float {
  to {
    transform: translate3d(-4vw, 5vw, 0) scale(1.12);
  }
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(440px, calc(100vw - 32px));
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(10, 15, 30, 0.82);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(28px);
  transform: translate(-50%, -50%);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--blue), var(--cyan));
  color: white;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(91, 123, 255, 0.35);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 18px;
}

.eyebrow {
  margin: 22px 0 6px;
  color: #7d94ec;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

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

h1 {
  margin-bottom: 10px;
  font-size: 32px;
}

.subtle {
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: #b5bdd3;
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  background: rgba(3, 7, 18, 0.6);
  color: #f4f6ff;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  resize: none;
  padding: 14px;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: rgba(108, 140, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.12);
}

.primary-button,
.secondary-button {
  width: 100%;
  border: 0;
  border-radius: 13px;
  color: white;
  font-weight: 700;
}

.primary-button {
  height: 50px;
  margin-top: 24px;
  background: linear-gradient(110deg, #637fff, #5abebf);
  box-shadow: 0 14px 30px rgba(76, 106, 228, 0.28);
}

.secondary-button {
  height: 42px;
  margin-top: 14px;
  background: #26365e;
}

.error-text {
  min-height: 18px;
  margin: 12px 0 0;
  color: #ff8e9f;
  font-size: 13px;
}

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

.app-layout.admin-open {
  grid-template-columns: 270px minmax(0, 1fr) 320px;
}

.sidebar,
.admin-panel {
  background: rgba(8, 12, 25, 0.84);
  backdrop-filter: blur(24px);
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 7px 22px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.new-session-button {
  display: flex;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(108, 140, 255, 0.3);
  border-radius: 13px;
  background: rgba(89, 117, 222, 0.13);
  color: #cdd8ff;
}

.session-list {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  overflow: auto;
}

.session-item {
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #919bb6;
  text-align: left;
}

.session-item:hover,
.session-item.active {
  border-color: var(--border);
  background: rgba(113, 137, 232, 0.1);
  color: #eef2ff;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--border);
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  border: 0;
  background: transparent;
  color: #8ba1ee;
}

.conversation {
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
}

.conversation-header {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 10, 22, 0.36);
}

.conversation-header .eyebrow {
  margin: 0 0 6px;
}

.conversation-header h2 {
  margin: 0;
  font-size: 19px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(83, 220, 187, 0.2);
  border-radius: 999px;
  background: rgba(32, 133, 117, 0.1);
  color: #8be0cd;
  font-size: 11px;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58d5b8;
  box-shadow: 0 0 12px #58d5b8;
}

.message-list {
  display: flex;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 34px;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.empty-state {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  color: #dfe5ff;
}

.empty-icon {
  margin-bottom: 16px;
  color: #86a0ff;
  font-size: 38px;
}

.message {
  max-width: 78%;
  padding: 14px 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #536ac6, #436f83);
}

.message.assistant {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: rgba(18, 26, 49, 0.92);
}

.composer {
  width: min(860px, calc(100% - 42px));
  margin: 0 auto 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(10, 16, 31, 0.9);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.composer textarea {
  min-height: 82px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 11px 15px;
  color: #707b97;
  font-size: 10px;
}

.composer-footer button {
  min-width: 76px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #6682ec;
  color: white;
  font-weight: 700;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-panel {
  padding: 28px 22px;
  border-left: 1px solid var(--border);
}

.admin-header .eyebrow {
  margin-top: 0;
}

.config-list {
  margin: 22px 0;
}

.config-list div {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.config-list dt {
  color: var(--muted);
  font-size: 11px;
}

.config-list dd {
  margin: 5px 0 0;
  color: #d8def1;
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-layout,
  .app-layout.admin-open {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .admin-panel {
    position: fixed;
    z-index: 3;
    top: 0;
    right: 0;
    width: min(340px, 92vw);
    height: 100vh;
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.55);
  }
}

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

  .app-layout,
  .app-layout.admin-open {
    display: block;
  }

  .sidebar {
    min-height: auto;
    padding: 14px;
  }

  .session-list {
    display: flex;
    margin: 12px 0;
  }

  .session-item {
    min-width: 130px;
  }

  .user-card {
    display: none;
  }

  .conversation {
    height: calc(100vh - 142px);
  }

  .conversation-header {
    padding: 0 18px;
  }

  .status-pill {
    display: none;
  }

  .message-list {
    padding: 22px 18px;
  }

  .composer {
    width: calc(100% - 24px);
    margin-bottom: 12px;
  }

  .composer-footer span {
    display: none;
  }

  .composer-footer {
    justify-content: flex-end;
  }
}
