:root {
      color-scheme: light;
      --bg: #f7f7f5;
      --panel: rgba(255, 255, 255, 0.74);
      --panel-strong: #ffffff;
      --text: #191a1c;
      --muted: #6f737b;
      --soft: #9aa0aa;
      --line: #e6e3dc;
      --line-strong: #d8d4cb;
      --accent: #1f2937;
      --accent-dark: #000000;
      --success: #12b76a;
      --shadow: 0 20px 60px rgba(32, 31, 28, 0.08);
      --focus: 0 0 0 4px rgba(31, 41, 55, 0.08);
    }
    * { box-sizing: border-box; }
    html {
      max-width: 100%;
      overflow-x: clip;
    }
    [hidden] { display: none !important; }
    body {
      margin: 0;
      max-width: 100%;
      overflow-x: clip;
      min-height: 100vh;
      font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
      background:
        radial-gradient(circle at 12% -10%, rgba(255, 255, 255, 0.92), transparent 34%),
        linear-gradient(180deg, #fbfaf8 0%, var(--bg) 38%, #f3f3f1 100%);
      color: var(--text);
    }
    header {
      height: 68px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 clamp(20px, 4vw, 48px);
      border-bottom: 1px solid var(--line);
      background: rgba(250, 249, 246, 0.78);
      backdrop-filter: blur(20px);
      position: sticky;
      top: 0;
      z-index: 10;
    }
    h1 { margin: 0; font-size: 15px; letter-spacing: 0; font-weight: 760; }
    .brand-title {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }
    .brand-edit-button {
      width: 30px;
      min-height: 30px;
      border-radius: 8px;
    }
    .brand-edit-button svg {
      width: 15px;
      height: 15px;
    }
    .brand-title h1 {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .header-actions {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .language-control {
      min-height: 36px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin: 0;
      padding: 0 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.72);
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.84) inset;
    }
    .language-control select {
      width: auto;
      min-width: 92px;
      min-height: 30px;
      border: 0;
      border-left: 1px solid var(--line);
      border-radius: 0;
      padding: 0 0 0 8px;
      background: transparent;
      color: var(--text);
      font-size: 13px;
      box-shadow: none;
    }
    .icon-button {
      width: 42px;
      min-height: 42px;
      padding: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.72);
      color: var(--text);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.84) inset;
    }
    .icon-button svg {
      width: 19px;
      height: 19px;
      stroke-width: 2;
    }
    .icon-button:hover {
      background: #fff;
      border-color: var(--line-strong);
      color: var(--accent-dark);
      box-shadow: 0 8px 22px rgba(32, 31, 28, 0.08);
    }
    main {
      max-width: 1080px;
      margin: 0 auto;
      padding: 48px 28px 80px;
      display: grid;
      gap: 34px;
    }
    .auth-panel {
      min-height: calc(100vh - 68px);
      display: grid;
      place-items: center;
      padding: 56px 24px;
    }
    .auth-panel[hidden] {
      display: none;
    }
    .auth-card {
      width: min(480px, 100%);
      display: grid;
      gap: 22px;
      padding: 30px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-strong);
      box-shadow: var(--shadow);
    }
    .auth-card-head {
      display: grid;
      gap: 8px;
    }
    .auth-kicker {
      width: fit-content;
      padding: 5px 9px;
      border: 1px solid var(--line);
      border-radius: 999px;
      color: var(--muted);
      background: #f7f7f5;
      font-size: 12px;
      font-weight: 760;
    }
    .auth-card h2 {
      margin: 0;
      font-size: 26px;
      line-height: 1.16;
    }
    .auth-card p {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.7;
      white-space: normal;
    }
    .auth-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 4px;
    }
    .hero {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 28px;
      align-items: end;
      padding: 10px 0 22px;
      border-bottom: 1px solid var(--line);
    }
    .hero-copy {
      min-width: 0;
    }
    .hero-actions {
      display: flex;
      gap: 8px;
      margin-top: 20px;
    }
    .title {
      font-size: clamp(31px, 4.1vw, 44px);
      line-height: 1.08;
      margin: 0 0 18px;
      max-width: 760px;
      font-weight: 820;
      overflow-wrap: anywhere;
    }
    .desc {
      color: var(--muted);
      margin: 0;
      line-height: 1.85;
      max-width: 820px;
      font-size: 15px;
      overflow-wrap: anywhere;
    }
    .hero-editor {
      display: none;
      max-width: 680px;
      margin-top: 20px;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.62);
      gap: 12px;
    }
    .hero-editor.open {
      display: grid;
    }
    .hero-editor textarea {
      width: 100%;
      min-height: 92px;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      padding: 12px 13px;
      font: inherit;
      color: var(--text);
      background: rgba(255, 255, 255, 0.82);
      resize: vertical;
      outline: none;
      transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    }
    .hero-editor textarea:focus {
      border-color: #9ca3af;
      box-shadow: var(--focus);
      background: #fff;
    }
    .editor-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    .panel {
      padding: 0;
    }
    .panel > h2 {
      margin: 0 0 16px;
      font-size: 18px;
      font-weight: 780;
    }
    .section-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 16px;
      flex-wrap: wrap;
    }
    .section-heading h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 780;
    }
    .compact-button {
      min-height: 36px;
      padding: 8px 12px;
      font-size: 13px;
    }
    .doc-toolbar {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 10px;
      flex: 1;
      min-width: min(100%, 320px);
    }
    .doc-search {
      width: min(360px, 100%);
      min-height: 36px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin: 0;
      padding: 0 11px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.72);
      color: var(--muted);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.84) inset;
      transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    }
    .doc-search:focus-within {
      border-color: #9ca3af;
      background: #fff;
      box-shadow: var(--focus);
    }
    .doc-search svg {
      width: 16px;
      height: 16px;
      stroke-width: 2;
      flex: 0 0 auto;
    }
    .doc-search input {
      width: 100%;
      min-width: 0;
      height: 34px;
      border: 0;
      padding: 0;
      background: transparent;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      outline: none;
    }
    .doc-search input::placeholder {
      color: var(--soft);
    }
    .server {
      display: grid;
      gap: 10px;
      font-size: 13px;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.54);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
    }
    .pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: #067647;
      background: rgba(236, 253, 243, 0.82);
      border: 1px solid #bbf7d0;
      border-radius: 999px;
      padding: 7px 11px;
      width: fit-content;
      font-size: 13px;
    }
    .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
    }
    label {
      display: block;
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 8px;
      font-weight: 650;
    }
    input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="file"], select {
      width: 100%;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      padding: 12px 13px;
      font: inherit;
      background: rgba(255, 255, 255, 0.82);
      color: var(--text);
      outline: none;
      transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    }
    .native-file-input {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }
    .file-picker {
      min-height: 54px;
      display: flex;
      align-items: center;
      gap: 10px;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      padding: 8px;
      background: rgba(255, 255, 255, 0.82);
      color: var(--text);
      overflow: hidden;
    }
    .file-picker:focus-within {
      border-color: #9ca3af;
      box-shadow: var(--focus);
      background: #fff;
    }
    .file-picker-button {
      flex: 0 0 auto;
      min-height: 36px;
      padding: 8px 12px;
    }
    .file-picker-name {
      min-width: 0;
      color: var(--muted);
      font-size: 14px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    input::placeholder {
      color: var(--soft);
    }
    input:focus, select:focus {
      border-color: #9ca3af;
      box-shadow: var(--focus);
      background: #fff;
    }
    .form-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 14px;
      align-items: stretch;
    }
    button, .button {
      border: 0;
      border-radius: 8px;
      background: var(--accent);
      color: white;
      font: inherit;
      font-weight: 720;
      padding: 11px 15px;
      cursor: pointer;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 42px;
      white-space: nowrap;
      transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
    }
    button:hover, .button:hover {
      background: var(--accent-dark);
      transform: translateY(-1px);
      box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
    }
    button:active, .button:active {
      transform: translateY(0);
      box-shadow: none;
    }
    button:disabled, .button.is-disabled {
      cursor: wait;
      opacity: 0.68;
      transform: none;
      box-shadow: none;
    }
    button:disabled:hover, .button.is-disabled:hover {
      background: var(--accent);
      transform: none;
      box-shadow: none;
    }
    .secondary {
      background: rgba(255, 255, 255, 0.7);
      color: var(--text);
      border: 1px solid var(--line);
    }
    .secondary:hover {
      background: #fff;
      border-color: var(--line-strong);
      box-shadow: 0 8px 22px rgba(32, 31, 28, 0.08);
    }
    .import-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
    }
    .import-card {
      min-height: 184px;
      padding: 18px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.86) inset;
      display: grid;
      gap: 14px;
      align-content: space-between;
      transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
    }
    .import-card:hover {
      border-color: var(--line-strong);
      background: rgba(255, 255, 255, 0.88);
      box-shadow: var(--shadow);
      transform: translateY(-1px);
    }
    .import-progress {
      display: grid;
      gap: 8px;
      padding: 10px 11px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.68);
    }
    .import-progress[hidden] {
      display: none;
    }
    .import-progress-bar {
      position: relative;
      height: 7px;
      overflow: hidden;
      border-radius: 999px;
      background: #ece9e2;
    }
    .import-progress-bar::before {
      content: "";
      position: absolute;
      inset: 0;
      width: 42%;
      border-radius: inherit;
      background: linear-gradient(90deg, #111827, #6b7280);
      animation: importProgressSlide 1.05s ease-in-out infinite;
    }
    .import-progress-text {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
    }
    @keyframes importProgressSlide {
      0% { transform: translateX(-115%); }
      100% { transform: translateX(245%); }
    }
    .settings-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 14px;
      padding: 18px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
    }
    .settings-grid .wide {
      grid-column: 1 / -1;
    }
    .settings-backdrop {
      position: fixed;
      inset: 0;
      z-index: 40;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: rgba(25, 26, 28, 0.18);
      backdrop-filter: blur(10px);
    }
    .settings-backdrop.open {
      display: flex;
    }
    .settings-dialog {
      width: min(720px, 100%);
      max-height: calc(100vh - 106px);
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.96);
      box-shadow: 0 24px 70px rgba(25, 26, 28, 0.18);
    }
    .settings-dialog-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 18px;
      border-bottom: 1px solid var(--line);
    }
    .settings-dialog-header h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 780;
    }
    .settings-dialog .settings-grid {
      border: 0;
      border-radius: 0;
      background: transparent;
    }
    .docs {
      display: grid;
      gap: 10px;
    }
    .folder-drop-root,
    .folder-group {
      display: grid;
      gap: 10px;
      border: 1px dashed transparent;
      border-radius: 8px;
      transition: border-color 0.16s ease, background 0.16s ease;
    }
    .folder-drop-root {
      padding: 0;
    }
    .folder-drop-root.drop-active,
    .folder-group.drop-active {
      border-color: #93c5fd;
      background: rgba(219, 234, 254, 0.36);
    }
    .folder-group {
      padding: 12px;
      border-color: var(--line);
      background: rgba(255, 255, 255, 0.44);
    }
    .folder-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      color: var(--text);
      font-size: 14px;
      font-weight: 760;
    }
    .folder-title {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .folder-title svg {
      width: 18px;
      height: 18px;
      color: #2563eb;
      stroke-width: 2;
      flex: 0 0 auto;
    }
    .folder-title span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .folder-count {
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }
    .folder-empty {
      min-height: 58px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px dashed var(--line);
      border-radius: 8px;
      color: var(--muted);
      font-size: 13px;
      background: rgba(255, 255, 255, 0.44);
    }
    .doc {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 14px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      background: rgba(255, 255, 255, 0.72);
      transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
    }
    .doc[draggable="true"] {
      cursor: grab;
    }
    .doc.dragging {
      opacity: 0.52;
      cursor: grabbing;
      border-color: #93c5fd;
      box-shadow: 0 16px 42px rgba(37, 99, 235, 0.12);
    }
    .doc:hover {
      border-color: var(--line-strong);
      background: #fff;
      box-shadow: 0 14px 38px rgba(32, 31, 28, 0.07);
    }
    .doc > div:first-child {
      min-width: 0;
    }
    .doc h3 {
      margin: 0 0 6px;
      font-size: 16px;
    }
    .meta {
      color: var(--muted);
      font-size: 13px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
      position: relative;
    }
    .share-action {
      position: relative;
      display: inline-flex;
    }
    .menu-action {
      position: relative;
      display: inline-flex;
    }
    .share-action::after,
    .menu-action::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: 100%;
      height: 10px;
    }
    .collaborator-button {
      flex: 0 0 auto;
    }
    .share-button {
      gap: 8px;
    }
    .chevron {
      font-size: 12px;
      line-height: 1;
      opacity: 0.72;
    }
    .share-menu {
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      z-index: 20;
      min-width: 260px;
      padding: 6px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.96);
      box-shadow: 0 18px 48px rgba(32, 31, 28, 0.14);
      display: none;
    }
    .share-action:hover .share-menu,
    .share-action:focus-within .share-menu,
    .share-action.open .share-menu,
    .menu-action:hover .share-menu,
    .menu-action:focus-within .share-menu,
    .menu-action.open .share-menu {
      display: grid;
      gap: 4px;
    }
    .share-option {
      width: 100%;
      min-height: 34px;
      display: inline-flex;
      align-items: center;
      justify-content: flex-start;
      background: transparent;
      color: var(--text);
      border: 0;
      padding: 8px 10px;
      font-size: 13px;
      font-weight: 650;
      box-shadow: none;
      text-decoration: none;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .share-option:hover {
      background: #f5f4f1;
      color: var(--text);
      box-shadow: none;
      transform: none;
    }
    .hint {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
      margin: 10px 0 0;
    }
    .file-name-preview {
      color: var(--muted);
      font-size: 13px;
      margin-top: 8px;
      line-height: 1.55;
    }
    .collaborator-preview {
      white-space: normal;
    }
    .subtle-button {
      min-height: 34px;
      padding: 7px 11px;
      background: rgba(255, 255, 255, 0.66);
      color: var(--text);
      border: 1px solid var(--line);
      font-size: 13px;
      font-weight: 680;
    }
    .subtle-button:hover {
      background: #fff;
      border-color: var(--line-strong);
      box-shadow: 0 8px 22px rgba(32, 31, 28, 0.08);
    }
    .toast {
      position: fixed;
      right: 20px;
      bottom: 20px;
      background: rgba(25, 26, 28, 0.94);
      color: #fff;
      padding: 12px 14px;
      border-radius: 8px;
      box-shadow: 0 18px 40px rgba(25, 26, 28, 0.18);
      opacity: 0;
      transform: translateY(8px);
      transition: 0.18s ease;
      pointer-events: none;
      z-index: 50;
    }
    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }
    @media (max-width: 820px) {
      header { padding: 0 18px; }
      main { padding: 28px 18px 56px; gap: 26px; }
      .hero, .import-grid, .settings-grid, .doc { grid-template-columns: 1fr; }
      .settings-grid .wide { grid-column: auto; }
      .editor-actions { justify-content: stretch; }
      .editor-actions > * { flex: 1; }
      .actions { justify-content: stretch; }
      .actions > * { flex: 1; }
      .doc-toolbar { justify-content: stretch; }
      .doc-toolbar > * { flex: 1; }
      .header-actions { gap: 8px; }
      .pill { display: none; }
      .language-control span { display: none; }
      .auth-panel { padding: 34px 18px; place-items: start center; }
      .auth-card { padding: 22px; }
      .auth-actions { grid-template-columns: 1fr; }
    }
