:root {
  --bg: #f3f5fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #1c2333;
  --ink-2: #4b5568;
  --muted: #7a8498;
  --line: #dfe4ee;
  --line-strong: #cdd4e3;
  --accent: #3557e8;
  --accent-ink: #ffffff;
  --accent-soft: #e9edff;
  --green: #178a58;
  --green-soft: #e5f6ed;
  --amber: #b45309;
  --amber-soft: #fdf2df;
  --rose: #c2414e;
  --rose-soft: #fdecee;
  --violet: #6d28d9;
  --violet-soft: #f0ebff;
  --shadow-sm: 0 1px 2px rgba(28, 35, 51, 0.06), 0 1px 3px rgba(28, 35, 51, 0.08);
  --shadow-md: 0 6px 20px rgba(28, 35, 51, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:hover:not(:disabled) {
  border-color: #aeb8cf;
  background: var(--panel-soft);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

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

.btn-danger {
  border-color: #f0c9cd;
  color: var(--rose);
  background: var(--rose-soft);
}

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

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(28, 35, 51, 0.06);
}

.btn-quick {
  border-style: dashed;
}

.btn-block {
  width: 100%;
}

.btn-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-grid.two {
  grid-template-columns: 1fr 1fr;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  flex: 0 0 auto;
}

.icon-btn:hover {
  background: rgba(28, 35, 51, 0.07);
  color: var(--ink);
}

.icon-btn-danger:hover {
  background: var(--rose-soft);
  color: var(--rose);
}

/* Home */
.home {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
}

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

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
  line-height: 1.25;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
}

.home-main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 32px 56px;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 44px 28px;
  border: 1.5px dashed #b9c3da;
  border-radius: 10px;
  background: var(--panel);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.upload-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.upload-copy h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.upload-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.home-section {
  margin-top: 34px;
}

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

.section-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.section-note {
  color: var(--muted);
  font-size: 12px;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.format-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.format-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.format-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.tone-rose .format-icon {
  background: var(--rose-soft);
  color: var(--rose);
}

.tone-blue .format-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.tone-green .format-icon {
  background: var(--green-soft);
  color: var(--green);
}

.tone-amber .format-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.tone-violet .format-icon {
  background: var(--violet-soft);
  color: var(--violet);
}

.format-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.format-copy strong {
  font-size: 14px;
}

.format-copy small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-arrow {
  color: var(--muted);
  flex: 0 0 auto;
}

.recent-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.recent-head,
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 90px 90px 150px 118px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.recent-head {
  height: 38px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.recent-row {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}

.recent-row:last-child {
  border-bottom: 0;
}

.recent-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.recent-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-name:hover {
  color: var(--accent);
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 52px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.kind-badge.kind-pdf {
  background: var(--rose-soft);
  border-color: #f2cdd1;
  color: var(--rose);
}

.kind-badge.kind-docx {
  background: var(--accent-soft);
  border-color: #d3dcff;
  color: var(--accent);
}

.kind-badge.kind-xlsx,
.kind-badge.kind-sheet {
  background: var(--green-soft);
  border-color: #c9ead8;
  color: var(--green);
}

.kind-badge.kind-pptx {
  background: var(--amber-soft);
  border-color: #f2dfbb;
  color: var(--amber);
}

.kind-badge.kind-image {
  background: var(--violet-soft);
  border-color: #ddd2f8;
  color: var(--violet);
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-actions {
  display: flex;
  gap: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 21, 34, 0.45);
}

.modal {
  width: 100%;
  max-width: 500px;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.file-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
  cursor: pointer;
  font-weight: 600;
}

.file-pick:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.merge-list {
  margin-top: 12px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.merge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.merge-item:last-child {
  border-bottom: 0;
}

.merge-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.merge-item strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Toasts */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  font-size: 13px;
}

.toast-success {
  border-left: 3px solid var(--green);
  color: #146c46;
}

.toast-error {
  border-left: 3px solid var(--rose);
  color: #a2323e;
}

.toast-info {
  border-left: 3px solid var(--accent);
  color: #2c47bd;
}

.toast span {
  flex: 1;
  min-width: 0;
}

.toast-close {
  width: 26px;
  height: 26px;
}

/* Workspace */
.workspace {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.workspace-loading {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.workspace-loading p {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.topbar-back {
  width: 36px;
  height: 36px;
}

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

.topbar-name {
  min-width: 0;
  max-width: 420px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 15px;
  font-weight: 700;
}

.topbar-name:hover,
.topbar-name:focus {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  outline: none;
}

.dirty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex: 0 0 auto;
}

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

.workspace-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr) 330px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.side-section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.side-section.grow {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.file-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.file-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.file-meta dd {
  margin: 0;
  font-size: 12px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.page-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.page-thumb.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.thumb-canvas {
  width: 100%;
  aspect-ratio: 0.72;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  border-radius: 3px;
}

.thumb-canvas canvas {
  width: 100%;
  height: auto;
  display: block;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}

.nav-row:hover {
  background: var(--panel-soft);
}

.nav-row.active {
  border-color: #cfd8ff;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-row.static {
  cursor: default;
}

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  text-align: left;
}

.side-action:hover {
  border-color: var(--line-strong);
  background: #eef1f7;
}

/* Preview */
.preview-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #eceff5;
}

.busy-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: rgba(28, 35, 51, 0.92);
  color: #fff;
  font-size: 12px;
}

.preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.pdf-preview {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 12px;
}

.pdf-page-info {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}

.pdf-main {
  display: flex;
  justify-content: center;
}

.pdf-main canvas {
  max-width: 100%;
  height: auto;
  display: block;
  background: #fff;
  box-shadow: 0 4px 18px rgba(28, 35, 51, 0.18);
  border-radius: 2px;
}

.image-preview {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}

.image-preview img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(28, 35, 51, 0.18);
  background: #fff;
}

.image-kind {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.docx-editor {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-toolbar,
.sheet-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 4;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
}

.tool-btn:hover:not(:disabled) {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--ink);
}

.tool-btn:disabled {
  opacity: 0.4;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: var(--line);
}

.docx-content {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 56px;
  background: #fff;
  outline: none;
  line-height: 1.85;
  font-size: 15px;
}

.docx-content:focus {
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

.docx-content h1,
.docx-content h2,
.docx-content h3 {
  line-height: 1.3;
  letter-spacing: 0;
}

.docx-content blockquote {
  margin: 12px 0;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-2);
}

.xlsx-editor {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.sheet-tab {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: var(--panel-soft);
  color: var(--ink-2);
  white-space: nowrap;
}

.sheet-tab.active {
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  border-top: 2px solid var(--accent);
}

.sheet-tabs-note {
  margin-left: auto;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.sheet-toolbar-note {
  margin-left: auto;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.sheet-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.sheet-table {
  border-collapse: collapse;
  min-width: 100%;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.sheet-table th,
.sheet-table td {
  min-width: 90px;
  height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-table .col-head,
.sheet-table .row-head,
.sheet-table .corner-cell {
  position: sticky;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}

.sheet-table .col-head {
  top: 0;
  text-align: center;
}

.sheet-table .row-head {
  left: 0;
  min-width: 36px;
  text-align: center;
}

.sheet-table .corner-cell {
  top: 0;
  left: 0;
  z-index: 2;
}

.sheet-table td:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--accent-soft);
}

.sheet-table .cell-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.sheet-table .row-selected .row-head {
  background: var(--accent-soft);
  color: var(--accent);
}

.pptx-preview {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto;
}

.ppt-slide-card {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ppt-slide-card.selected {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.slide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  font-weight: 700;
  font-size: 13px;
}

.slide-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.slide-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide-image {
  max-width: 100%;
  max-height: 280px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.slide-blocks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slide-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.slide-block > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.slide-block textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
  line-height: 1.5;
}

.slide-block textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.slide-no-text {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
}

.text-editor {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 28px;
  border: 0;
  outline: none;
  resize: none;
  background: #fff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
}

/* Tools panel */
.tools-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: hidden;
}

.tools-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tools-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.tools-tab:hover {
  color: var(--ink);
  background: var(--panel-soft);
}

.tools-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

.tools-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tool-section {
  padding: 16px;
}

.tool-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.tool-section-head.compact {
  margin-top: 16px;
}

.tool-section-head h4 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.tool-hint {
  color: var(--muted);
  font-size: 11px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.segmented button {
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.target-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.target-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  text-align: left;
}

.target-row:hover {
  border-color: var(--line-strong);
}

.target-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.target-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  flex: 0 0 auto;
  color: #fff;
}

.target-row.active .target-radio {
  border-color: var(--accent);
  background: var(--accent);
}

.target-row > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.target-row strong {
  font-size: 13px;
}

.target-row small {
  color: var(--muted);
  font-size: 11px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.field > span {
  font-weight: 600;
}

.field input[type="text"],
.field input:not([type]),
.field select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.field input[type="text"]:focus,
.field input:not([type]):focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

.check-field input {
  accent-color: var(--accent);
}

.output-list {
  margin-top: 14px;
}

.output-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.output-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  flex: 0 0 auto;
}

.output-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.output-copy strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-copy small {
  color: var(--muted);
  font-size: 11px;
}

.tool-note {
  margin: 12px 0;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: #f4f6fb;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.compress-result {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  overflow: hidden;
}

.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.result-line:last-child {
  border-bottom: 0;
}

.result-line.total {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.link-box {
  display: flex;
  gap: 6px;
}

.link-box input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-size: 11px;
  color: var(--ink-2);
}

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.qr-box img {
  width: 200px;
  height: 200px;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edit-group {
  margin-top: 4px;
}

.edit-hint {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 12px;
}

.edit-hint p {
  margin: 0;
  line-height: 1.6;
}

.mobile-nav {
  display: none;
}

/* Responsive */
@media (max-width: 1180px) {
  .workspace-body {
    grid-template-columns: 220px minmax(0, 1fr) 300px;
  }
}

@media (max-width: 960px) {
  .workspace-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) 340px;
  }

  .side-panel {
    display: none;
  }

  .tools-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .mobile-nav {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    flex: 0 0 auto;
  }

  .mobile-nav button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--ink-2);
    font-size: 12px;
    white-space: nowrap;
  }

  .mobile-nav button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
  }
}

@media (max-width: 700px) {
  .home-header,
  .home-main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .home-header-meta {
    display: none;
  }

  .upload-zone {
    padding: 32px 18px;
  }

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

  .recent-head {
    display: none;
  }

  .recent-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
    gap: 6px;
  }

  .recent-row .kind-badge,
  .recent-row .muted-cell {
    display: none;
  }

  .recent-actions {
    justify-content: flex-end;
  }

  .topbar {
    padding: 0 10px;
  }

  .topbar-name {
    max-width: 160px;
    font-size: 13px;
  }

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

  .docx-content {
    padding: 28px 18px;
  }

  .pdf-preview {
    padding: 14px;
  }

  .sheet-tabs-note,
  .sheet-toolbar-note {
    display: none;
  }

  .tools-tab {
    font-size: 12px;
  }

  .tools-tab svg {
    display: none;
  }

  .qr-box img {
    width: 170px;
    height: 170px;
  }
}
