:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --line: #e5e7eb;
  --ink: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --shadow: 0 16px 50px rgba(15, 23, 42, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f4f6;
}

.login-panel {
  width: min(400px, 100%);
  padding: 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.08);
}

.login-brand {
  display: grid;
  place-items: center;
  width: 64px;
  height: 42px;
  margin: 0 auto 22px;
  background: transparent;
}

.login-brand img {
  width: 62px;
  height: auto;
}

.login-panel h1 {
  margin: 0;
  font-size: 24px;
  text-align: center;
}

.login-panel > p {
  margin: 9px 0 26px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.login-panel label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.login-panel input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
}

.login-panel input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.primary-button {
  width: 100%;
  height: 44px;
  margin-top: 20px;
  color: #fff;
  background: #18191e;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button:disabled {
  opacity: 0.6;
}

.login-mode-switch {
  width: 100%;
  height: 40px;
  margin-top: 10px;
  color: #525866;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.login-mode-switch:hover {
  background: #f5f6f8;
}

.form-error {
  min-height: 18px;
  margin-top: 12px;
  color: #dc2626;
  font-size: 13px;
}

.desktop-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.desktop-shell.session-locked {
  visibility: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: #101624;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  font-weight: 800;
}

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

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.feature-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 14px;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
}

.feature-button:hover,
.feature-button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
}

.feature-button strong,
.feature-button small {
  display: block;
}

.feature-button small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  line-height: 1.35;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

.feature-icon.rose {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
}

.feature-icon.dark {
  background: linear-gradient(135deg, #27272a, #52525b);
}

.status-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: auto;
  padding: 14px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.account-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.account-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.account-line strong {
  color: #fff;
}

.account-card small {
  color: rgba(255, 255, 255, 0.52);
}

.sidebar-button {
  height: 32px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
}

.status-card strong,
.status-card small {
  display: block;
}

.status-card strong {
  color: #fff;
  font-size: 13px;
}

.status-card small {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: #f59e0b;
}

.status-dot.ready {
  background: #22c55e;
}

.status-dot.error {
  background: #ef4444;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  padding: 18px;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 0 4px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.topbar-actions button {
  height: 36px;
  padding: 0 13px;
  color: #374151;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.topbar-actions button:hover {
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.32);
}

.frame-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

#feature-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.loading-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
}

.loading-state.hidden {
  display: none;
}

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.82s linear infinite;
}

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