:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --bg: #f4f7fb;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --cyan: #06b6d4;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --text: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --line: rgba(87, 116, 161, 0.22);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
}

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

.brand strong {
  font-size: 17px;
}

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

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #334155;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-list a.active,
.nav-list a:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  transform: translateX(2px);
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  color: #1e40af;
  background: #eff6ff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-chip-strong {
  color: #047481;
  border-color: rgba(6, 182, 212, 0.22);
  background: #ecfeff;
}

.global-model-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 8px;
  color: #075985;
  background: #ecfeff;
  box-shadow: 0 12px 34px rgba(6, 182, 212, 0.08);
}

.global-model-notice strong {
  padding: 5px 8px;
  border-radius: 999px;
  color: #1e40af;
  background: rgba(219, 234, 254, 0.86);
  font-size: 12px;
  font-weight: 900;
}

.global-model-notice span {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.error-panel {
  max-width: 640px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.primary-action {
  display: inline-flex;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-status {
    justify-content: flex-start;
  }

  .global-model-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .app-shell,
  .main-panel,
  .topbar,
  .topbar-title,
  .topbar-status {
    width: 100%;
    max-width: 100%;
  }

  .main-panel,
  .sidebar {
    padding: 16px;
  }

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

  .topbar h1 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .mode-chip {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}
