:root {
  --green-950: #0b2415;
  --green-900: #103420;
  --green-800: #12492a;
  --green-700: #177a43;
  --green-600: #1f8f50;
  --green-100: #e4f3e6;
  --green-50: #f2f9f2;
  --ink: #18231b;
  --muted: #6d7d71;
  --line: #e2e9e1;
  --bg: #f3f6f1;
  --card: #ffffff;
  --danger: #a4342a;
  --amber: #a1721c;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 35, 22, 0.06);
  --shadow-md: 0 14px 34px rgba(15, 35, 22, 0.1);
  --topbar-h: 56px;
  --editor-pct: 50%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.small {
  font-size: 12px;
}

.hint {
  font-size: 11.5px;
  color: #8b9a8e;
  line-height: 1.65;
  margin: 10px 0 0;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--green-700);
  margin: 0;
}

.eyebrow-light {
  color: #79d296;
}

.icon {
  display: inline-block;
  vertical-align: -2px;
  flex: none;
}

:focus-visible {
  outline: 2px solid #67b17c;
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #c8d4c9 transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  background: #cdd8ce;
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #b6c7b8;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 60, 30, 0.18);
}

.btn-primary:hover:not(:disabled) {
  background: #126637;
  border-color: #126637;
}

.btn-outline {
  background: #fff;
  border-color: var(--line);
  color: #33452f;
}

.btn-outline:hover:not(:disabled) {
  background: #f8faf7;
  border-color: #cad8cc;
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: #edf6ef;
}

.btn-ghost-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn-danger-outline {
  background: #fff;
  border-color: #e9c5bf;
  color: var(--danger);
}

.btn-danger-outline:hover:not(:disabled) {
  background: #fdf4f2;
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-lg {
  height: 42px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn.is-busy {
  position: relative;
  color: transparent !important;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

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

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #5c6c60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: background 0.14s, color 0.14s;
}

.icon-btn:hover {
  background: #e9efe8;
  color: #174d2c;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3c4c40;
}

.field input,
.field select,
.select {
  height: 38px;
  width: 100%;
  border: 1px solid #d9e2d9;
  border-radius: 8px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d7d71' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.field input:focus,
.field select:focus,
.select:focus,
.add-member-form input:focus {
  border-color: #79b58b;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.11);
}

.field-hint {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
}

.select-sm {
  height: 32px;
  font-size: 12px;
  width: auto;
}

.form-error {
  background: #fdf0ee;
  border: 1px solid #f1d3cd;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  color: #a03326;
  line-height: 1.55;
  margin-bottom: 14px;
}

/* ---------- avatars / badges ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex: none;
  text-transform: uppercase;
  user-select: none;
}

.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 10.5px;
}

.avatar-lg {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: #eef3ec;
  color: #647a68;
  white-space: nowrap;
}

.badge.on {
  background: #e2f4e4;
  color: #237a41;
}

/* ---------- top bar ---------- */

.topbar {
  height: var(--topbar-h);
  background: linear-gradient(180deg, #123a26 0%, #0f3321 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex: none;
}

.brand img {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

.brand-light img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.topbar-spacer,
.toolbar-spacer {
  flex: 1;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: #e8f4ea;
  min-width: 0;
}

.user-menu .avatar {
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.user-menu-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar :focus-visible {
  outline-color: #9be0b0;
}

/* ---------- auth ---------- */

.auth-body {
  min-height: 100vh;
  color: #fff;
  background:
    radial-gradient(1100px 700px at 6% -5%, rgba(40, 132, 74, 0.5), transparent 62%),
    radial-gradient(900px 620px at 100% 105%, rgba(25, 92, 53, 0.42), transparent 58%),
    #0a1f13;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.82fr);
  gap: 56px;
  align-items: center;
  max-width: 1160px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 52px 40px;
  position: relative;
}

.auth-hero h1 {
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.16;
  letter-spacing: -0.8px;
  margin: 30px 0 18px;
  font-weight: 750;
  color: #f7fdf8;
}

.auth-lead {
  max-width: 520px;
  font-size: 14.5px;
  line-height: 1.9;
  color: rgba(224, 241, 228, 0.75);
  margin: 0;
}

.auth-points {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 14px;
  font-size: 13.5px;
  color: rgba(231, 245, 234, 0.9);
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 11px;
}

.point-icon {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(72, 180, 108, 0.16);
  border: 1px solid rgba(127, 224, 160, 0.26);
  color: #83e2a4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.auth-footnote {
  margin-top: 36px;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  color: rgba(219, 240, 224, 0.42);
}

.auth-panel {
  justify-self: end;
  width: 100%;
}

.auth-card {
  background: #fff;
  color: var(--ink);
  border-radius: 20px;
  padding: 28px 30px 24px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 420px;
  margin-left: auto;
}

.auth-tabs {
  display: flex;
  background: #f2f5f1;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7b6f;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.auth-tab.active {
  background: #fff;
  color: #1a3d27;
  box-shadow: 0 1px 4px rgba(20, 45, 28, 0.1);
}

.auth-hint {
  background: #f0f8f0;
  border: 1px solid #d8ecd9;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.6;
  color: #2b6b3f;
  margin: 0 0 16px;
}

.auth-form .field input {
  height: 42px;
}

.auth-card-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11px;
  color: #94a098;
}

/* ---------- dashboard ---------- */

.page-body {
  min-height: 100vh;
  background: var(--bg);
}

.dashboard {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 72px;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.head-actions,
.empty-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-actions {
  justify-content: center;
  margin-top: 14px;
}

.dashboard-head h1 {
  font-size: 30px;
  letter-spacing: -0.5px;
  margin: 7px 0 8px;
}

.dashboard-head .muted {
  margin: 0;
  font-size: 13.5px;
}

.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: min(320px, 100%);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #8a998e;
  box-shadow: var(--shadow-sm);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 12.5px;
  color: var(--ink);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(266px, 1fr));
  gap: 16px;
}

.project-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  min-height: 156px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s;
  box-shadow: var(--shadow-sm);
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cfe0d1;
}

.project-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e9f6e9, #f7fbf6);
  border: 1px solid #dcecdc;
  color: var(--green-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  color: #17251b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.project-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  background: #eef4ec;
  color: #53705a;
}

.role-badge.owner {
  background: #e6f3e4;
  color: #276b3d;
}

.empty-projects {
  border: 1.5px dashed #ccdacc;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  padding: 58px 24px;
  text-align: center;
  margin-top: 10px;
}

.empty-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8aa18f;
  box-shadow: var(--shadow-sm);
}

.empty-projects h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.empty-projects p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- dialogs ---------- */

.dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  border: none;
  border-radius: 16px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(8, 20, 12, 0.35);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(7, 19, 11, 0.5);
  backdrop-filter: blur(3px);
}

.dialog-sm {
  width: min(440px, calc(100vw - 28px));
}

.dialog-body {
  padding: 26px 26px 24px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.dialog-head h2 {
  font-size: 20px;
  letter-spacing: -0.25px;
  margin: 4px 0 0;
}

.dialog-section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h3 {
  font-size: 13.5px;
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

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

.template-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.template-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.template-card:has(input:checked) {
  border-color: #75ad83;
  background: #f4faf2;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.08);
}

.template-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.template-card small {
  display: block;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
}

.template-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #eef6ed;
  color: #3b7f4f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ---------- editor layout ---------- */

.editor-body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.project-topbar {
  gap: 12px;
}

.project-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 430px;
  margin-left: 4px;
}

.project-title-input {
  height: 32px;
  width: 264px;
  max-width: 30vw;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #f3faf4;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.project-title-input:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.project-title-input:focus {
  border-color: rgba(122, 214, 152, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.project-title-input:disabled {
  color: #e9f4eb;
}

.save-state {
  font-size: 10.5px;
  color: rgba(219, 240, 224, 0.55);
  white-space: nowrap;
}

.presence {
  display: flex;
  align-items: center;
  padding-left: 4px;
  margin-right: 2px;
}

.presence .avatar {
  margin-left: -7px;
  border: 2px solid #113824;
  position: relative;
}

.presence .avatar:first-child {
  margin-left: 0;
}

.presence .avatar.editing::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee7a0;
  border: 1.5px solid #113824;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.avatar-self {
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-left: 3px;
}

.workspace {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
}

.file-pane {
  width: 246px;
  flex: none;
  background: #fafbf8;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.file-pane-head {
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #7e8d81;
}

.file-tools {
  display: flex;
  align-items: center;
  gap: 1px;
}

.file-tools .icon-btn {
  width: 26px;
  height: 26px;
}

.file-tools .icon {
  width: 15px;
  height: 15px;
}

.file-tree {
  flex: 1;
  overflow: auto;
  padding: 4px 7px 16px;
  min-height: 0;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  border-radius: 6px;
  font-size: 12.8px;
  color: #334037;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.tree-row:hover {
  background: #edf2ea;
}

.tree-row.active {
  background: #e2f0e0;
  color: #14532d;
  font-weight: 600;
}

.tree-chevron {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #90a093;
  flex: none;
  transition: transform 0.14s;
}

.tree-chevron svg {
  width: 12px;
  height: 12px;
}

.tree-chevron.open {
  transform: rotate(90deg);
}

.tree-chevron.empty {
  visibility: hidden;
}

.tree-icon {
  display: flex;
  align-items: center;
  color: #7d8f81;
  flex: none;
}

.tree-icon .icon {
  width: 15px;
  height: 15px;
}

.tree-row.active .tree-icon {
  color: var(--green-700);
}

.tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-actions {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.12s;
}

.tree-row:hover .tree-actions,
.tree-row.active .tree-actions {
  opacity: 1;
}

.tree-actions .icon-btn {
  width: 22px;
  height: 22px;
}

.tree-actions .icon {
  width: 13px;
  height: 13px;
}

.file-pane-foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
}

.editor-pane {
  flex: 0 0 var(--editor-pct);
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #fff;
  min-height: 0;
}

.editor-head {
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.active-file {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.active-file-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #26352a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-file-meta {
  font-size: 11px;
  color: #93a096;
  flex: none;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #869589;
  flex: none;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b8c3b9;
}

.sync-state.synced {
  color: #3e7a4e;
}

.sync-state.synced .sync-dot {
  background: #38a45c;
}

.sync-state.connecting {
  color: #a07a2a;
}

.sync-state.connecting .sync-dot {
  background: #d1a23c;
}

.sync-state.offline {
  color: #a15b52;
}

.sync-state.offline .sync-dot {
  background: #c06a5d;
}

.editor-head-actions {
  display: flex;
  gap: 2px;
}

.editor-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.editor-host .cm-editor {
  height: 100%;
}

.binary-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: #fbfcfa;
}

.binary-card {
  max-width: min(100%, 700px);
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.binary-card img {
  max-width: 100%;
  max-height: 62vh;
  border-radius: 8px;
  display: block;
  margin: 0 auto 14px;
}

.binary-card h3 {
  margin: 8px 0 4px;
  font-size: 14px;
  word-break: break-all;
}

.binary-card p {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.binary-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: #f1f7ef;
  color: #5b8767;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 6px;
}

.splitter {
  width: 5px;
  flex: none;
  background: #e8ede6;
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
  touch-action: none;
  outline: none;
}

/* 命中区域左右各扩 4px，视觉宽度仍为 5px，更容易抓取 */
.splitter::before {
  content: '';
  position: absolute;
  inset: 0 -4px;
}

/* 中部握把，提示可拖动 */
.splitter::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 32px;
  border-radius: 1px;
  background: #cbd8cb;
  transform: translate(-50%, -50%);
  transition: background 0.15s, height 0.15s;
}

.splitter:hover,
.splitter.dragging,
.splitter:focus-visible {
  background: #a9d0b3;
}

.splitter:hover::after,
.splitter.dragging::after,
.splitter:focus-visible::after {
  background: #2f7a4d;
  height: 56px;
}

.splitter:focus-visible {
  box-shadow: 0 0 0 2px rgba(47, 122, 77, 0.45);
}

.splitter-hint {
  position: absolute;
  top: 46px;
  left: 50%;
  z-index: 6;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(24, 35, 27, 0.9);
  color: #eef7ef;
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}

.splitter.dragging .splitter-hint {
  opacity: 1;
}

.pdf-pane {
  flex: 1 1 0;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: #eef1eb;
  min-height: 0;
  position: relative;
}

.pdf-toolbar {
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #fbfcfa;
  border-bottom: 1px solid var(--line);
}

.compile-status {
  font-size: 11.5px;
  color: #8a978c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.compile-status.ok { color: #3c7a4d; }
.compile-status.warn { color: var(--amber); }
.compile-status.error { color: #b04a3c; }
.compile-status.busy { color: #607a66; }

.zoom-group {
  display: flex;
  align-items: center;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.zoom-group .icon-btn {
  width: 26px;
  height: 28px;
  border-radius: 0;
}

.zoom-label {
  min-width: 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: #64746a;
  border-left: 1px solid #f0f3ef;
  border-right: 1px solid #f0f3ef;
}

#pdf-download[aria-disabled="true"] {
  opacity: 0.3;
  pointer-events: none;
}

.pdf-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 16px 28px;
  position: relative;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdf-page {
  position: relative;
  flex: none;
  background: #fff;
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto 18px;
  box-shadow: 0 2px 10px rgba(20, 35, 25, 0.13);
}

.pdf-page.rendered {
  background: #fff;
}

.pdf-canvas {
  display: block;
}

.pdf-page-label {
  position: absolute;
  right: 8px;
  bottom: 6px;
  padding: 1px 5px;
  font-size: 9.5px;
  color: #5d6d61;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e5ebe4;
  border-radius: 4px;
  pointer-events: none;
}

.pdf-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #8a988d;
}

.pdf-empty h3 {
  margin: 12px 0 0;
  font-size: 15px;
  color: #47584b;
}

.pdf-empty p {
  margin: 6px 0 12px;
  max-width: 300px;
  font-size: 12.5px;
  line-height: 1.7;
}

.pdf-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #89a18f;
  box-shadow: var(--shadow-sm);
}

.log-panel {
  flex: 0 0 250px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #121b15;
  border-top: 1px solid #0b120e;
  color: #cfd8d1;
}

.log-head {
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 14px;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #8fa394;
  border-bottom: 1px solid #202c24;
}

.log-panel .icon-btn {
  color: #a8bbae;
}

.log-panel .icon-btn:hover {
  background: #1e2b22;
  color: #fff;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.log-filter {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #2c3a30;
  background: none;
  color: #9ab0a2;
  font-size: 11px;
  cursor: pointer;
}

.log-filter:hover {
  background: #1e2b22;
  color: #fff;
}

.log-filter[aria-pressed="true"] {
  background: #24402e;
  border-color: #3a5a45;
  color: #cdebd6;
}

.log-content.only-errors > span:not(.log-error) {
  display: none;
}

.compile-hint {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #2a2413;
  border-bottom: 1px solid #3d331a;
  color: #f0d79a;
  font-size: 12px;
  line-height: 1.5;
}

.compile-hint[hidden] {
  display: none;
}

.compile-hint > span {
  flex: 1;
}

.log-link {
  font: inherit;
  color: #9fd6ff;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.log-link:hover {
  color: #d9ecff;
}

.log-error .log-link {
  color: #ffc4ba;
}

.log-content {
  margin: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 14px 16px;
  font: 11.5px/1.65 "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-error { color: #ff9b8f; }
.log-warn { color: #e8c575; }

/* ---------- share ---------- */

.share-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.share-link-row .select {
  width: 118px;
}

.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faf7;
}

.share-link-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #435448;
  font: 11.5px "Cascadia Code", Consolas, monospace;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
}

.member-row:hover {
  background: #f7faf6;
}

.member-main {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 12.8px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-name .you {
  margin-left: 4px;
  font-size: 10.5px;
  font-weight: 400;
  color: #8a998d;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-actions .select {
  height: 28px;
  width: 86px;
  padding: 0 6px;
  font-size: 11.5px;
}

.role-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.add-member-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.add-member-form input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
}

.add-member-form .select {
  width: 92px;
  height: 34px;
  font-size: 12px;
}

.danger-zone {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #f0e4e1;
}

.danger-zone h3 {
  margin: 0 0 5px;
  font-size: 13px;
  color: #a4342a;
}

.danger-zone p {
  margin: 0 0 10px;
}

/* ---------- toast ---------- */

.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(90vw, 540px);
  padding: 9px 16px;
  border-radius: 9px;
  background: #1d3325;
  color: #eef7f0;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: #175c34; }
.toast-error { background: #8f2f25; }
.toast-info { background: #1d3325; }

/* ---------- collaboration cursors ---------- */

.cm-ySelectionInfo {
  position: absolute;
  top: -1.4em;
  left: -1px;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px 4px 4px 0;
  color: #fff;
  white-space: nowrap;
  opacity: 0.92;
  z-index: 10;
  pointer-events: none;
}

.cm-ySelection {
  opacity: 0.7;
}

/* ---------- fatal ---------- */

.fatal-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: #f4f7f2;
}

.fatal-screen img {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  margin-bottom: 8px;
}

.fatal-screen h2 {
  margin: 0;
  font-size: 21px;
}

.fatal-screen p {
  margin: 2px 0 18px;
  max-width: 460px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- responsive ---------- */

@media (max-width: 1060px) {
  .project-title-input { width: 190px; }
  .file-pane { width: 218px; }
  .compile-status { display: none; }
}

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 520px;
    gap: 26px;
    padding: 36px 22px;
  }

  .auth-hero h1 {
    font-size: 34px;
    margin-top: 22px;
  }

  .auth-points,
  .auth-footnote {
    display: none;
  }

  .auth-panel {
    justify-self: stretch;
  }

  .auth-card {
    max-width: none;
    margin: 0;
  }

  .dashboard {
    padding: 26px 18px 56px;
  }

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

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }

  .editor-body {
    overflow: auto;
  }

  .workspace {
    min-width: 980px;
  }

  .project-title-wrap,
  .presence {
    display: none;
  }

  .topbar-actions .btn {
    padding: 0 9px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 10px;
  }

  .brand span {
    display: none;
  }

  .dashboard-head h1 {
    font-size: 26px;
  }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .user-menu-name {
    display: none;
  }
}

.editor-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.editor-empty h3 {
  margin: 12px 0 0;
  font-size: 15px;
  color: #47584b;
}

.editor-empty p {
  margin: 4px 0 0;
  font-size: 12.5px;
}

.presence-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: -7px;
  border-radius: 50%;
  border: 2px solid #113824;
  background: rgba(255, 255, 255, 0.12);
  color: #dfeee2;
  font-size: 9.5px;
  font-weight: 600;
}

body.resizing,
body.resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* 拖动期间隐藏横向滚动条，避免 PDF 预览缩放前滚动条闪烁 */
body.resizing .pdf-body {
  overflow-x: hidden;
}

.code-row {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1;
  min-width: 0;
  letter-spacing: 2px;
  font-family: "Cascadia Code", Consolas, monospace;
}

.code-send {
  flex: none;
  height: 42px;
  min-width: 112px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn-outline.is-busy::after {
  border-color: rgba(23, 122, 67, 0.25);
  border-top-color: var(--green-700);
}

.optional {
  margin-left: 2px;
  font-size: 10.5px;
  font-weight: 400;
  color: #93a096;
}

.auth-warning {
  background: #fdf6e7;
  border-color: #efdfb9;
  color: #8b641c;
}

.member-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 1px;
}

.member-email {
  font-size: 10.5px;
  color: #93a096;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
