:root {
  color-scheme: light;
  --ink: #19213a;
  --muted: #616b84;
  --accent: #4c48ce;
  --accent-deep: #3733a6;
  --line: #e4e7f0;
  --surface: #fff;
  --canvas: #f7f8fc;
  font-family: Inter, system-ui, "Microsoft YaHei UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, input, a { outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.04em; }
h2 { font-size: 17px; }
[hidden] { display: none !important; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .workspace { width: min(1040px, calc(100% - 48px)); margin: 0 auto; }
.topbar-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 35px; border-radius: 10px; background: var(--accent); color: white; font-size: 18px; letter-spacing: -.05em; }
.main-nav { display: flex; align-items: center; gap: 4px; margin: 0 auto 0 27px; }
.main-nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--accent-deep); background: #eeedff; }
.workspace { padding: 38px 0 56px; }
.heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.storage { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.primary, .quiet, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; border-radius: 8px; padding: 0 14px; font-weight: 600; font-size: 14px; }
.primary { background: var(--accent); color: white; border: 1px solid transparent; }
.primary:hover:not(:disabled) { background: var(--accent-deep); }
.quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.quiet:hover:not(:disabled) { background: #f2f2fd; border-color: #cecdf2; }
.danger { background: #b72f46; color: white; border: 1px solid transparent; }
.dropzone { display: grid; justify-items: center; gap: 9px; padding: 29px 20px; border: 1.5px dashed #bdbbec; border-radius: 15px; background: #f2f1ff; text-align: center; transition: background .15s, border-color .15s; }
.dropzone.dragging { border-color: var(--accent); background: #e6e3ff; }
.dropzone h2 { font-size: 20px; }
.dropzone p { color: var(--muted); font-size: 14px; }
.dropzone .primary { margin-top: 7px; min-width: 115px; }
.upload-symbol { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: white; color: var(--accent); font-size: 28px; font-weight: 700; }
.file-panel, .queue-panel { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.panel-title, .toolbar { display: flex; align-items: center; gap: 9px; }
.file-count { color: var(--muted); background: var(--canvas); border-radius: 9px; padding: 3px 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
input { color: var(--ink); background: var(--surface); border: 1px solid #d9ddeb; border-radius: 8px; height: 40px; padding: 0 12px; min-width: 0; }
input[type=search] { width: 180px; font-size: 14px; }
.refresh { padding: 0 12px; font-size: 19px; }
.empty { text-align: center; color: var(--muted); padding: 42px 15px; border-top: 1px solid var(--line); font-size: 14px; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 145px auto; align-items: center; gap: 15px; padding: 12px 20px; border-top: 1px solid var(--line); }
.file-name { min-width: 0; display: flex; align-items: center; gap: 10px; }
.file-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.file-mark { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 8px; color: var(--accent-deep); background: #eeedff; font-size: 9px; font-weight: 800; }
.file-size, .file-date, .queue-meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 7px; }
.row-actions .quiet { min-height: 34px; padding: 0 10px; font-size: 13px; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.queue-panel { padding: 16px 20px; }
.queue { padding: 0; margin: 10px 0 0; list-style: none; }
.queue-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 8px 0; }
.queue-item progress { width: 100%; height: 6px; grid-column: 1 / -1; accent-color: var(--accent); }
.queue-action { grid-column: 2; grid-row: 1 / span 2; }
.toast { position: fixed; bottom: 20px; right: 20px; max-width: min(370px, calc(100vw - 40px)); border-radius: 9px; padding: 12px 16px; background: var(--ink); color: white; font-size: 14px; box-shadow: 0 7px 24px #19213a29; }
dialog { width: min(405px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 14px; padding: 22px; color: var(--ink); }
dialog::backdrop { background: #19213a73; }
dialog p { color: var(--muted); overflow-wrap: anywhere; margin: 12px 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 15%, #eceaff 0%, var(--canvas) 65%); }
.login-card { width: min(100%, 390px); padding: 32px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 55px #302e6a12; }
.login-card h1 { margin: 24px 0 22px; font-size: 28px; }
.login-card form { display: grid; gap: 10px; }
.login-card label { font-weight: 600; font-size: 14px; }
.login-card input, .login-card .primary { height: 45px; }
.login-card .primary { margin-top: 6px; justify-content: space-between; }
.form-error { color: #a9203d; font-size: 13px; }
.form-error:empty { display: none; }
.sr-only, .mode-picker input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.compose-panel { display: grid; gap: 12px; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.mode-picker { display: flex; gap: 3px; justify-self: start; margin: 0; padding: 4px; border: 0; border-radius: 9px; background: #f1f1f8; }
.mode-picker label { cursor: pointer; border-radius: 6px; padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mode-picker input:checked + label { background: white; color: var(--accent-deep); box-shadow: 0 1px 4px #19213a14; }
.mode-picker input:focus-visible + label { outline: 2px solid var(--accent); }
.compose-fields { display: flex; gap: 10px; }
.compose-fields #title { flex: 1; }
.language-field select { height: 40px; padding: 0 8px; border: 1px solid #d9ddeb; border-radius: 8px; background: white; color: var(--ink); font: inherit; font-size: 14px; }
.compose-panel textarea, .rich-editor { width: 100%; border: 1px solid #d9ddeb; border-radius: 9px; background: #fafaff; }
.compose-panel textarea { min-height: 144px; padding: 12px; resize: vertical; color: var(--ink); font: inherit; line-height: 1.55; }
.compose-panel textarea.code-input, .snippet-code { font-family: "IBM Plex Mono", Consolas, monospace; tab-size: 4; }
.compose-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.format-bar { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; border-bottom: 1px solid var(--line); }
.format-bar .quiet { min-height: 33px; padding: 0 9px; font-size: 13px; }
.rich-content { overflow-wrap: anywhere; line-height: 1.6; }
.rich-editor .rich-content { min-height: 130px; max-height: 55vh; overflow: auto; padding: 12px; }
.rich-editor .rich-content:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rich-content h1, .rich-content h2, .rich-content h3 { font-size: 18px; letter-spacing: normal; }
.rich-content p, .rich-content ul, .rich-content ol, .rich-content blockquote, .rich-content pre { margin: 5px 0; }
.rich-content a { color: var(--accent-deep); text-decoration: underline; }
.snippet-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; padding: 14px 20px; border-top: 1px solid var(--line); }
.snippet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; font-size: 12px; color: var(--muted); }
.snippet-kind { padding: 2px 6px; border-radius: 5px; color: var(--accent-deep); background: #eeedff; }
.snippet-title { display: block; max-width: 100%; border: 0; padding: 0; background: none; text-align: left; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 6px; }
.snippet-title:hover { text-decoration: underline; }
.snippet-preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.snippet-actions { flex-wrap: wrap; }
.detail-dialog { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 30px); max-height: calc(100dvh - 30px); padding: 0; overflow: hidden; }
.detail-dialog[open] { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.detail-header, .detail-actions { display: flex; align-items: center; gap: 10px; }
.detail-header { justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.detail-header h2 { overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.detail-header form { flex-shrink: 0; }
#detail-content { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px 16px; }
#detail-content:focus-visible { outline-offset: -3px; }
.detail-actions { flex-wrap: wrap; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); }
.detail-actions:empty { display: none; }
.snippet-body { margin: 0; padding: 13px; border-radius: 8px; background: #f5f5fc; white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet-code { white-space: pre; min-width: max-content; font-size: 13px; line-height: 1.55; }
.syntax-keyword { color: #5b2fba; font-weight: 600; }
.syntax-string { color: #166d56; }
.syntax-number { color: #9a4c13; }
.syntax-comment { color: #636c82; }
@media (max-width: 630px) {
  .topbar-inner, .workspace { width: calc(100% - 28px); }
  .topbar-inner { height: 60px; }
  .main-nav { margin-left: 7px; }
  .main-nav a { padding: 8px 6px; font-size: 13px; }
  .topbar .brand { gap: 5px; font-size: 13px; }
  .topbar #logout { padding: 0 7px; font-size: 12px; }
  .workspace { padding-top: 23px; }
  h1 { font-size: 28px; }
  .storage { font-size: 12px; }
  .dropzone { padding: 22px 12px; }
  .panel-header, .file-row { padding-left: 12px; padding-right: 12px; }
  .panel-header { flex-wrap: wrap; }
  input[type=search] { width: 132px; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .file-size { grid-column: 1; margin-left: 44px; }
  .file-date { display: none; }
  .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .compose-panel { padding: 12px; }
  .mode-picker label { padding: 8px 9px; font-size: 13px; }
  .snippet-row { padding: 12px; grid-template-columns: minmax(0, 1fr); }
  .snippet-row .row-actions { grid-column: 1; grid-row: auto; }
}
