:root {
  color-scheme: light;
  --canvas: #f2f4f3;
  --surface: #ffffff;
  --surface-muted: #f7f8f7;
  --surface-strong: #e8ecea;
  --ink: #17201d;
  --muted: #66716d;
  --faint: #687570;
  --line: rgba(24, 41, 35, 0.12);
  --line-strong: rgba(24, 41, 35, 0.2);
  --accent: #1f604b;
  --accent-strong: #174838;
  --accent-soft: #e7f1ed;
  --on-accent: #ffffff;
  --danger: #b53c31;
  --danger-soft: #faece9;
  --on-danger: #ffffff;
  --focus-ring: #1f604b;
  --warning: #81500f;
  --warning-soft: #fbf1df;
  --success: #267351;
  --shadow-sm: 0 1px 2px rgba(18, 31, 27, 0.05), 0 8px 24px rgba(18, 31, 27, 0.04);
  --shadow-lg: 0 24px 70px rgba(18, 31, 27, 0.18);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar: 264px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #111513;
    --surface: #1a201e;
    --surface-muted: #202724;
    --surface-strong: #29322f;
    --ink: #f2f6f4;
    --muted: #aab5b0;
    --faint: #83908a;
    --line: rgba(233, 245, 239, 0.11);
    --line-strong: rgba(233, 245, 239, 0.2);
    --accent: #6dc3a3;
    --accent-strong: #8bd1b7;
    --accent-soft: #203a31;
    --on-accent: #10211b;
    --danger: #ff8176;
    --danger-soft: #432521;
    --on-danger: #2b0d0a;
    --focus-ring: #8bd1b7;
    --warning: #efba68;
    --warning-soft: #3c3020;
    --success: #75c9a6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.14);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.48);
  }
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

a { color: inherit; }

[hidden] { display: none !important; }

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

.studio-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.studio-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: max(22px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  display: flex;
  flex-direction: column;
  gap: 26px;
  z-index: 5;
}

.logout-button { width: 100%; margin-top: 12px; }
.mobile-logout { display: none; }
.field--cover-alt { margin-top: 14px; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-copy small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 580;
  letter-spacing: 0.03em;
}

.studio-nav { display: grid; gap: 6px; }

.nav-button {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  text-align: left;
  font-weight: 650;
}

.nav-button:hover { background: var(--surface-muted); }
.nav-button[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

.nav-symbol {
  width: 25px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.78;
}

.nav-count {
  min-width: 24px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-strong);
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-footer strong { color: var(--ink); display: block; font-size: 13px; }

.studio-main { min-width: 0; }

.topbar {
  min-height: 68px;
  padding: max(12px, env(safe-area-inset-top)) clamp(20px, 4vw, 48px) 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(18px);
}

.topbar-title { font-size: 17px; font-weight: 720; letter-spacing: -0.02em; }

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

.content {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 max(70px, env(safe-area-inset-bottom));
}

.content--editor { width: min(1240px, calc(100% - 32px)); }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.page-heading p {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.page-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }

.button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 690;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(18, 31, 27, 0.03);
}

.button:hover { border-color: var(--accent); }
.button:active { transform: translateY(1px); }
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.button--primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.button--primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.button--quiet { background: transparent; border-color: transparent; box-shadow: none; }
.button--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.button--danger-fill { color: var(--on-danger); background: var(--danger); border-color: var(--danger); }
.button--small { min-height: 38px; padding: 0 13px; border-radius: 10px; font-size: 13px; }

.toolbar-line {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap { flex: 1 1 360px; position: relative; }
.search-wrap::before { content: "搜尋"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12px; pointer-events: none; }
.search-input {
  width: 100%;
  min-height: 46px;
  padding: 0 15px 0 56px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
}

.segment {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  display: flex;
  gap: 2px;
}

.segment button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.segment button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.article-list { overflow: hidden; }

.article-row {
  width: 100%;
  min-height: 92px;
  padding: 17px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  text-align: left;
  cursor: pointer;
}

.article-row:last-child { border-bottom: 0; }
.article-row:hover { background: var(--surface-muted); }

.article-thumb {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
}

.article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-copy { min-width: 0; }
.article-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: -0.015em; }
.article-copy span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-badge {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-badge[data-tone="success"] { background: var(--accent-soft); color: var(--success); }
.status-badge[data-tone="warning"] { background: var(--warning-soft); color: var(--warning); }
.status-badge[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); }

.empty-state { padding: 64px 24px; text-align: center; }
.empty-state strong { display: block; font-size: 20px; }
.empty-state p { margin: 8px auto 20px; max-width: 420px; color: var(--muted); line-height: 1.65; }

.editor-heading { align-items: center; margin-bottom: 18px; }
.editor-heading h1 { max-width: 820px; font-size: clamp(24px, 3vw, 34px); }
.back-button { padding-left: 0; }

.save-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.save-state[data-tone="success"] .save-dot { background: var(--success); }
.save-state[data-tone="warning"] .save-dot { background: var(--warning); }
.save-state[data-tone="danger"] .save-dot { background: var(--danger); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-card { padding: clamp(20px, 3vw, 32px); }
.editor-aside { display: grid; gap: 16px; position: sticky; top: 88px; }
.aside-card { padding: 20px; }
.aside-card h2 { margin: 0 0 6px; font-size: 15px; }
.aside-card > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.field { display: block; margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 12px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 16px;
}

.field input, .field select { min-height: 48px; padding: 0 13px; }
.field textarea { min-height: 94px; padding: 12px 13px; resize: vertical; line-height: 1.65; }
.field textarea.article-body-input { min-height: 520px; border-radius: 0 0 14px 14px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 14px; line-height: 1.75; }
.field-error { margin: 7px 0 0; color: var(--danger); font-size: 12px; }

.markdown-wrap { border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--surface-muted); }
.markdown-wrap .article-body-input { border: 0; }
.markdown-toolbar { min-height: 48px; padding: 6px 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.toolbar-button { min-width: 36px; min-height: 34px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 740; cursor: pointer; }
.toolbar-button:hover { background: var(--surface-strong); color: var(--ink); }
.toolbar-separator { width: 1px; height: 22px; margin: 0 3px; background: var(--line); }

.cover-drop {
  min-height: 170px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.cover-drop:hover { border-color: var(--accent); }
.cover-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.cover-empty strong { display: block; color: var(--ink); font-size: 14px; }
.cover-preview { width: 100%; height: 190px; object-fit: cover; display: block; }
.cover-actions { margin-top: 10px; display: flex; gap: 8px; }

.aside-actions { display: grid; gap: 9px; }
.aside-actions .button { width: 100%; }
.danger-zone { padding-top: 16px; border-top: 1px solid var(--line); }

.tip-list { display: grid; gap: 10px; }
.tip { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tip-number { width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 11px; font-weight: 800; }

.asset-list { margin-top: 12px; display: grid; gap: 8px; }
.asset-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.asset-item { min-height: 46px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px; }
.asset-thumb-slot { width: 34px; height: 34px; display: block; }
.asset-item img, .asset-thumb-placeholder { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--surface-strong); }
.asset-thumb-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 750; }
.asset-filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.asset-item button { min-height: 32px; padding: 0 9px; border: 0; border-radius: 8px; background: var(--surface-strong); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 650; }
.asset-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.asset-item button.asset-remove { color: var(--danger); background: var(--danger-soft); }
.asset-alt { grid-column: 1 / -1; display: grid; gap: 5px; }
.asset-alt span { color: var(--muted); font-size: 12px; font-weight: 650; }
.asset-alt input { width: 100%; min-width: 0; min-height: 42px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-muted); color: var(--ink); font: inherit; font-size: 13px; }
.asset-alt input[aria-invalid="true"] { border-color: var(--danger); }
.asset-load-error { margin: 10px 0 0; padding: 10px 11px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 12px; line-height: 1.5; }

.progress-panel { padding: 18px; }
.progress-panel h3 { margin: 0 0 12px; font-size: 14px; }
.progress-steps { display: grid; gap: 9px; }
.progress-step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; align-items: start; color: var(--muted); font-size: 13px; line-height: 1.45; }
.progress-step::before { content: ""; width: 10px; height: 10px; margin: 4px; border: 2px solid var(--line-strong); border-radius: 50%; }
.progress-step[data-state="active"] { color: var(--ink); font-weight: 650; }
.progress-step[data-state="active"]::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.progress-step[data-state="done"]::before { border-color: var(--success); background: var(--success); }
.progress-step[data-state="failed"] { color: var(--danger); }
.progress-step[data-state="failed"]::before { border-color: var(--danger); background: var(--danger); }
.progress-actions, .public-link-row { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.inbox-list { display: grid; gap: 12px; }
.inbox-card { padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.inbox-copy { min-width: 0; }
.inbox-id { display: block; margin-bottom: 5px; color: var(--faint); font: 700 11px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: 0.04em; }
.inbox-card h2 { margin: 0; font-size: 16px; }
.inbox-card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.inbox-card .inbox-excerpt { max-width: 760px; line-height: 1.6; }
.inbox-card .inbox-meta { color: var(--faint); font-size: 12px; }
.inbox-card .inbox-ready { color: var(--success); font-weight: 650; }
.inbox-problems { margin: 10px 0 0; padding-left: 20px; color: var(--danger); font-size: 12px; line-height: 1.6; }

.login-page {
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.login-card { width: min(440px, 100%); padding: 34px; }
.login-logo { width: 58px; height: 58px; margin-bottom: 26px; border-radius: 18px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 850; font-size: 20px; }
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: -0.04em; }
.login-card > p { margin: 11px 0 25px; color: var(--muted); line-height: 1.7; }
.login-card .button { width: 100%; }
.login-note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; }

.loading-page { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { overflow: hidden; }
.skeleton-line { height: 16px; margin: 10px 20px; border-radius: 8px; background: var(--surface-strong); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.48; } }

dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(820px, calc(100vh - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog[open] { display: flex; flex-direction: column; }

dialog::backdrop { background: rgba(10, 17, 14, 0.52); backdrop-filter: blur(5px); }
.dialog-header { min-height: 66px; padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-header h2 { margin: 0; font-size: 18px; }
.dialog-close { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-strong); color: var(--muted); cursor: pointer; font-size: 18px; }
.dialog-body { min-height: 0; padding: 22px; overflow: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.dialog-footer { padding: 14px 20px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 9px; }

.preview-dialog { --focus-ring: #1f604b; width: min(1180px, calc(100% - 28px)); height: min(900px, calc(100vh - 28px)); height: min(900px, calc(100dvh - 28px)); }
.preview-dialog .dialog-body { height: calc(100% - 67px); padding: 0; background: #fff; color: #1b2421; }
.preview-shell { min-height: 100%; background: #fff; }
.preview-hero { padding: clamp(32px, 6vw, 76px) clamp(22px, 8vw, 96px) 30px; background: #f4f1e9; border-bottom: 1px solid #d9dedb; }
.preview-hero small { color: #b94b32; font-size: 12px; font-weight: 800; letter-spacing: 0.13em; }
.preview-hero h1 { max-width: 900px; margin: 13px 0 13px; font-size: clamp(30px, 5vw, 58px); line-height: 1.08; letter-spacing: -0.055em; }
.preview-hero p { max-width: 760px; color: #61706b; font-size: 17px; line-height: 1.7; }
.preview-feature { width: min(1000px, calc(100% - 44px)); max-height: 620px; margin: 34px auto; object-fit: contain; background: #f3f4f3; border: 1px solid #d9dedb; }
.preview-article { width: min(760px, calc(100% - 38px)); margin: 0 auto; padding: 20px 0 80px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif; }
.preview-article h1 { display: none; }
.preview-article h2 { margin: 2.1em 0 0.7em; font-size: clamp(25px, 3vw, 34px); line-height: 1.3; letter-spacing: -0.035em; }
.preview-article h3 { margin: 1.7em 0 0.6em; font-size: 22px; }
.preview-article p, .preview-article li { font-size: 17px; line-height: 2; }
.preview-article figure { margin: 34px 0; }
.preview-article figure img { display: block; width: 100%; height: auto; border: 1px solid #d9dedb; }
.preview-article blockquote { margin: 28px 0; padding: 15px 18px; border-left: 5px solid #bf4f35; background: #f7eee8; }
.preview-article pre { padding: 18px; overflow: auto; background: #131816; color: #eef5f1; border-radius: 12px; }
.preview-article code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.preview-article table { width: 100%; margin: 26px 0; border-collapse: collapse; display: block; overflow-x: auto; }
.preview-article th, .preview-article td { min-width: 120px; padding: 11px 12px; border: 1px solid #d9dedb; text-align: left; }
.preview-article th { background: #edf1ef; }
.preview-article a { color: #1f604b; font-weight: 700; }
.preview-warning { margin: 20px; padding: 14px 16px; border: 1px solid #e1ad5b; border-radius: 12px; background: #fff6e5; color: #6e4810; line-height: 1.6; }

.check-list { display: grid; gap: 12px; margin-top: 18px; }
.check-row { min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.check-row span { line-height: 1.5; }
.dialog-lead { margin: 0; color: var(--muted); line-height: 1.65; }
.compare-dialog { width: min(980px, calc(100% - 28px)); }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.compare-pane { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.compare-pane h3 { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.compare-pane strong { display: block; margin-bottom: 10px; }
.compare-pane pre { max-height: 360px; margin: 0; padding: 12px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 10px; background: var(--surface); color: var(--ink); font: 13px/1.65 ui-monospace, "SFMono-Regular", Consolas, monospace; }
.compare-meta { margin: 0 0 12px; display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.compare-meta div { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; }
.compare-meta dt { font-weight: 750; }
.compare-meta dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }

.toast-region { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 30; display: grid; gap: 9px; pointer-events: none; }
.toast { width: min(390px, calc(100vw - 36px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-lg); color: var(--ink); line-height: 1.5; font-size: 14px; pointer-events: auto; }
.toast[data-tone="success"] { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); }
.toast[data-tone="danger"] { border-color: color-mix(in srgb, var(--danger) 42%, var(--line)); }

.error-banner { margin-bottom: 18px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--danger) 38%, transparent); border-radius: 13px; background: var(--danger-soft); color: var(--danger); line-height: 1.55; }
.error-banner .button { margin: 8px 4px 0 0; }
.pending-banner { margin-bottom: 18px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--warning) 38%, transparent); border-radius: 13px; background: var(--warning-soft); color: var(--warning); line-height: 1.55; }
.pending-banner strong { display: block; color: var(--ink); }

.page-heading h1,
.error-banner,
.pending-banner,
.preview-warning,
.dialog-lead,
.toast,
.field-hint {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 900px) {
  :root { --mobile-header-height: calc(53px + max(10px, env(safe-area-inset-top))); }
  .studio-shell { display: block; }
  .studio-sidebar { position: sticky; top: 0; width: 100%; height: var(--mobile-header-height); padding: max(10px, env(safe-area-inset-top)) 14px 9px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: flex-end; gap: 12px; backdrop-filter: blur(18px); }
  .brand { padding: 0; }
  .brand-copy small, .sidebar-footer { display: none; }
  .mobile-logout { display: inline-flex; }
  .studio-nav { margin-left: auto; display: flex; gap: 3px; overflow-x: auto; }
  .nav-button { width: auto; min-height: 42px; padding: 0 11px; white-space: nowrap; }
  .nav-symbol, .nav-count { display: none; }
  .topbar { top: var(--mobile-header-height); padding-top: 12px; padding-left: 16px; padding-right: 16px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .brand-copy { display: none; }
  .studio-nav { width: calc(100% - 46px); justify-content: space-between; }
  .nav-button { flex: 1; justify-content: center; padding: 0 8px; font-size: 13px; }
  .topbar { top: var(--mobile-header-height); min-height: 58px; }
  .topbar-title { display: none; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .topbar-site-link { display: none; }
  .topbar-editor-actions { min-width: 0; }
  .topbar-editor-actions .button { padding-left: 11px; padding-right: 11px; }
  .content, .content--editor { width: min(100% - 24px, 1120px); padding-top: 24px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .page-heading-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar-line { align-items: stretch; flex-direction: column; }
  .segment { overflow-x: auto; }
  .segment button { flex: 1; white-space: nowrap; }
  .article-row { grid-template-columns: 48px minmax(0, 1fr); padding: 14px; }
  .article-thumb { width: 48px; height: 48px; }
  .article-row > .status-badge { grid-column: 2; justify-self: start; }
  .editor-card { padding: 18px 14px; border-radius: 18px; }
  .editor-aside { grid-template-columns: 1fr; }
  .field textarea.article-body-input { min-height: 430px; }
  .field textarea.article-body-input { font-size: 16px; }
  .asset-alt input { font-size: 16px; }
  .inbox-card { grid-template-columns: 1fr; }
  .inbox-card .button { width: 100%; }
  .dialog-footer { flex-direction: column; }
  .dialog-footer .button { width: 100%; }
  .login-card { padding: 27px 23px; }
  .button--small, .toolbar-button, .asset-item button, .dialog-close { min-height: 44px; }
  .dialog-close { width: 44px; height: 44px; }
  .compare-grid { grid-template-columns: 1fr; }
  .nav-button, .segment button { min-height: 44px; }
}

@media (pointer: coarse) {
  .nav-button,
  .segment button,
  .button--small,
  .toolbar-button,
  .asset-item button,
  .dialog-close {
    min-height: 44px;
  }

  .dialog-close { min-width: 44px; }
}

@media (forced-colors: active) {
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
