:root {
  color-scheme: dark;
  --bg: #08090c;
  --bg-soft: #0d0f14;
  --panel: #111419;
  --panel-2: #151920;
  --border: #232831;
  --border-strong: #303845;
  --text: #eceef3;
  --muted: #9aa1ad;
  --muted-2: #6f7683;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.12);
  --accent-strong: #4d8df6;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: radial-gradient(1200px 700px at 85% -10%, rgba(77, 141, 246, 0.14), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.boot {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.login-hero {
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(160deg, rgba(110, 168, 254, 0.11), transparent 55%);
  border-right: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #3d7ff2, #7a5cf0);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.hero-copy h1 {
  font-size: 40px;
  margin: 26px 0 14px;
  max-width: 520px;
}
.hero-copy p {
  color: var(--muted);
  max-width: 470px;
  font-size: 15px;
}
.hero-points {
  list-style: none;
  padding: 0;
  margin: 26px 0 0;
  display: grid;
  gap: 12px;
  max-width: 460px;
}
.hero-points li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
}
.hero-points b {
  color: var(--text);
  font-weight: 600;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
  flex: none;
}
.login-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
}
.login-card .sub {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 13px;
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.14);
}
.textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover {
  background: #1a1f28;
  border-color: var(--border-strong);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(180deg, #5f9bfb, #3f7fe8);
  border-color: #5f9bfb;
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #6ea8fe, #4d8df6);
  border-color: #6ea8fe;
}
.btn-ghost {
  background: transparent;
}
.btn-danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.08);
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-block {
  width: 100%;
}
.login-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
}
.error-text {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 6px 0 0;
}

/* ---------------------------------------------------------------- shell */
.app-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.9);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.nav-group {
  display: grid;
  gap: 3px;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 0 10px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  width: 100%;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}
.nav-item.is-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(110, 168, 254, 0.25);
}
.nav-item .ico {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.85;
}
.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d2f4d;
  color: #9dc4ff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}
.account-meta {
  min-width: 0;
}
.account-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-plan {
  font-size: 11px;
  color: var(--muted-2);
}
.main {
  min-width: 0;
  padding: 26px 34px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.topbar h1 {
  font-size: 24px;
}
.topbar .sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------------------------------------------------------------- cards */
.grid {
  display: grid;
  gap: 14px;
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.metric {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 6px;
}
.metric small {
  font-size: 13px;
  color: var(--muted-2);
  font-weight: 500;
}
.bar {
  height: 7px;
  background: #1b2029;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4d8df6, #7a5cf0);
  border-radius: inherit;
  transition: width 0.3s;
}
.bar.warn span {
  background: linear-gradient(90deg, #f59e0b, #f87171);
}
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 8px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 12px;
}
.section-head h2 {
  font-size: 16px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
}
.code-block {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  color: #c9d1d9;
}
.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 11px;
  color: var(--muted);
}
.tag.ok {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
}
.tag.warn {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}
.tag.bad {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}
.tag.info {
  color: var(--accent);
  border-color: rgba(110, 168, 254, 0.3);
  background: rgba(110, 168, 254, 0.08);
}

/* ---------------------------------------------------------------- docs */
.split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.list {
  display: grid;
  gap: 6px;
}
.list-item {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.list-item:hover {
  border-color: var(--border);
  background: var(--panel-2);
}
.list-item.is-active {
  border-color: rgba(110, 168, 254, 0.32);
  background: var(--accent-soft);
}
.list-item .title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: space-between;
}
.list-item .sub {
  color: var(--muted-2);
  font-size: 11px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.editor-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}
.editor textarea.content {
  min-height: 320px;
  flex: 1;
}
.editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ai-box {
  border: 1px solid rgba(110, 168, 254, 0.24);
  background: rgba(110, 168, 254, 0.05);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.ai-box .ai-row {
  display: flex;
  gap: 8px;
}
.ai-box .input {
  flex: 1;
}
.preview {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  overflow: auto;
  max-height: 420px;
}
.preview h1,
.preview h2,
.preview h3 {
  margin: 1.2em 0 0.5em;
}
.preview h1:first-child {
  margin-top: 0;
}
.preview p {
  margin: 0 0 0.9em;
  color: #cfd5de;
}
.preview code {
  font-family: var(--mono);
  background: #191c22;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.34em;
  font-size: 0.9em;
}
.preview pre {
  background: #0f1116;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow: auto;
}
.preview pre code {
  background: none;
  border: 0;
  padding: 0;
}
.preview blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.1em 1em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table th {
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.table tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}
.table .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ---------------------------------------------------------------- files */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.file-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px 150px 70px;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.file-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- misc */
.plan-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
}
.plan-card.is-current {
  border-color: rgba(110, 168, 254, 0.5);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.08);
}
.plan-price {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 8px 0 2px;
}
.plan-price small {
  font-size: 13px;
  color: var(--muted-2);
  font-weight: 500;
}
.plan-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 18px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.plan-list li::before {
  content: "✓";
  color: var(--success);
  margin-right: 8px;
  font-weight: 700;
}
.plan-list li.off {
  color: var(--muted-2);
}
.plan-list li.off::before {
  content: "—";
  color: var(--muted-2);
}
.notice {
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.07);
  color: #f0cf7a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: #171b22;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 15px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
  max-width: 360px;
}
.toast.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal h3 {
  font-size: 17px;
  margin-bottom: 6px;
}
.modal p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 1080px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}
@media (max-width: 860px) {
  .login-wrap {
    grid-template-columns: 1fr;
  }
  .login-hero {
    display: none;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    align-items: center;
    padding: 10px 12px;
  }
  .sidebar .nav-group {
    display: flex;
    gap: 4px;
  }
  .sidebar .nav-label,
  .sidebar-foot {
    display: none;
  }
  .main {
    padding: 18px;
  }
  .grid-3,
  .grid-2,
  .split,
  .editor-row {
    grid-template-columns: 1fr;
  }
  .file-row {
    grid-template-columns: 34px minmax(0, 1fr) 80px;
  }
  .file-row .hide-sm {
    display: none;
  }
}
