/* HexoStudio product interface. */
.preview .katex-display { overflow-x: auto; overflow-y: hidden; padding: 8px 0; }
.preview .katex { font-size: 1.1em; }
.preview .math-error { color: var(--danger); font-family: monospace; white-space: pre-wrap; }
.mermaid-preview { margin: 18px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mermaid-frame { display: block; width: 100%; height: 120px; border: 0; }
.mermaid-preview details { padding: 10px 14px; font-size: 12px; border-top: 1px solid var(--line); }
.mermaid-preview summary { cursor: pointer; color: var(--muted); }
.mermaid-preview pre { margin-bottom: 0; }
.network-result { padding: 10px 12px; border: 1px solid var(--success-border); border-radius: 6px; color: var(--success); background: var(--success-bg); }
.network-result[data-tone="error"] { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.database-advanced { margin-top: 18px; font-size: 12px; color: var(--ink-soft); }
.database-advanced summary { cursor: pointer; padding: 6px 0; }
.database-advanced p { margin-top: 10px; color: var(--muted); line-height: 1.7; }
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #20242c;
  --muted: #687180;
  --subtle: #8a929f;
  --line: #e6e8ed;
  --canvas: #fafbfc;
  --surface: #fff;
  --brand: #272d38;
  --brand-dark: #111720;
  --brand-soft: #edf2fc;
  --accent: #365fc5;
  --mint: #278264;
  color-scheme: light;
  --sidebar: #f5f6f8;
  --raised: #f8f9fb;
  --hover: #eaecef;
  --active: #e8edf6;
  --active-ink: #294e9e;
  --control-border: #dce1e8;
  --border-hover: #bfc6d0;
  --ink-soft: #454e5d;
  --on-brand: #fff;
  --danger: #b63d4c;
  --danger-bg: #fff4f5;
  --danger-border: #efd4d9;
  --success: #28745b;
  --success-bg: #edf7f1;
  --success-border: #d7e4dd;
  --warning: #94692c;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23687180' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: var(--ink);
  background: var(--canvas);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eaf0;
  --ink-soft: #ccd3df;
  --muted: #aab3c2;
  --subtle: #919dad;
  --line: #303741;
  --canvas: #14171c;
  --surface: #1c2129;
  --sidebar: #181c22;
  --raised: #232932;
  --hover: #2c3440;
  --brand: #dae4f5;
  --brand-dark: #f0f5ff;
  --on-brand: #192336;
  --brand-soft: #24334b;
  --accent: #9dbbff;
  --active: #27354e;
  --active-ink: #bdd0ff;
  --control-border: #3b4452;
  --border-hover: #66778f;
  --mint: #72d4b0;
  --danger: #f4a4b0;
  --danger-bg: #38232d;
  --danger-border: #6a3b48;
  --success: #95d9bb;
  --success-bg: #203b31;
  --success-border: #3c6251;
  --warning: #e6bf7e;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23aab3c2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus { outline: none; }
input, select, textarea { background: var(--surface); color: var(--ink); font-weight: 400; accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--subtle); opacity: 1; font-weight: 400; }
input:read-only, textarea:read-only { background: var(--raised); }
.hidden { display: none !important; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; display: inline-block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; }

/* Shell and navigation */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow-y: auto; width: 228px; flex: none; display: flex; flex-direction: column; padding: 24px 14px 16px; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 32px; }
.brand-mark, .auth-brand { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex: none; border-radius: 8px; background: var(--brand); color: var(--on-brand); font-size: 20px; font-weight: 650; letter-spacing: -.04em; }
.brand strong { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.4px; }
.brand small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.workspace-label { padding: 0 12px 10px; font-size: 11px; font-weight: 500; color: var(--subtle); }
.workspace-label span:not([data-i18n]) { display: none; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 11px; min-height: 40px; border: 0; border-radius: 7px; padding: 9px 12px; color: var(--muted); background: transparent; text-align: left; font-size: 13px; font-weight: 500; }
.nav button:hover { background: var(--hover); color: var(--ink); }
.nav button.active { background: var(--active); color: var(--active-ink); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; }
.sidebar-bottom { margin-top: auto; padding: 22px 2px 0; }
.project-chip { display: flex; align-items: center; gap: 9px; padding: 12px 8px; margin: 18px 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-icon { display: grid; place-items: center; width: 29px; height: 29px; background: var(--hover); border-radius: 6px; color: var(--muted); flex: none; }
.project-icon .icon { width: 16px; height: 16px; }
.project-chip>div { min-width: 0; }
.project-chip strong, .project-chip small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 128px; }
.project-chip strong { font-size: 12px; font-weight: 550; }
.project-chip small { color: var(--subtle); font-size: 10px; margin-top: 3px; }
.status-dot { width: 6px; height: 6px; background: var(--mint); border-radius: 50%; flex: none; margin-left: auto; }
.text-button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 6px; padding: 8px 10px; text-align: left; color: var(--muted); font-size: 12px; }
.text-button:hover { background: var(--hover); color: var(--ink); }
.text-button .icon { width: 16px; height: 16px; }
.main { flex: 1; min-width: 0; width: 0; }
.topbar { position: sticky; top: 0; z-index: 3; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-location { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-label { display: none; }
#breadcrumb { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.connection { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.connection:before { content: ''; width: 5px; height: 5px; background: var(--mint); border-radius: 50%; }
.view { max-width: 1380px; margin: auto; padding: 34px 36px 64px; scroll-margin-top: 64px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.page-head>div:first-child { min-width: 0; }
.page-head h1 { font-size: 25px; letter-spacing: -.6px; line-height: 1.3; font-weight: 650; margin: 0 0 8px; overflow-wrap: anywhere; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* Shared controls and surfaces */
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border-radius: 7px; border: 1px solid transparent; padding: 8px 13px; font-size: 12px; font-weight: 550; line-height: 1.4; }
.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); box-shadow: 0 1px 2px #10182812; }
.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.secondary { background: var(--surface); border-color: var(--control-border); color: var(--ink-soft); box-shadow: 0 1px 2px #10182805; }
.secondary:hover { background: var(--hover); border-color: var(--border-hover); }
.primary.small { min-height: 32px; padding: 7px 11px; }
.primary .icon { width: 15px; height: 15px; }
.danger { color: var(--danger); border-color: var(--danger-border); }
.secondary.danger:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.panel, .stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px #10182803; }
.panel { padding: 22px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-title h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-title button { border: 0; background: none; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.panel-title button:hover { color: var(--accent); }
.panel-title button .icon { width: 14px; height: 14px; }
.hint-card { border: 1px solid var(--line); border-radius: 7px; background: var(--raised); padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 18px; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty h2 { margin: 12px 0 8px; font-size: 16px; font-weight: 550; color: var(--ink); }
.empty p { margin: 6px 0 18px; }
.empty .symbol { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--raised); color: var(--subtle); }
.empty .symbol .icon { width: 20px; height: 20px; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 26px; }
.stat-card { display: flex; align-items: center; gap: 16px; padding: 22px; min-height: 124px; position: relative; }
.stat-card>div { order: -1; }
.stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; font-size: 30px; font-weight: 600; letter-spacing: -1px; line-height: 1.3; margin-top: 9px; font-variant-numeric: tabular-nums; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; color: var(--subtle); margin-left: auto; align-self: flex-start; }
.stat-icon .icon { width: 18px; height: 18px; }
.stat-tail { position: absolute; right: 22px; bottom: 23px; color: var(--subtle); font-size: 11px; }
.columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 20px; }
.post-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.post-row { display: flex; align-items: center; gap: 12px; padding: 17px 0; border-top: 1px solid var(--line); }
.post-avatar { display: grid; place-items: center; width: 34px; height: 38px; flex: none; color: var(--subtle); background: var(--sidebar); border: 1px solid var(--line); border-radius: 6px; }
.post-avatar .icon { width: 17px; height: 17px; }
.post-summary { flex: 1; min-width: 0; }
.post-title { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-meta { color: var(--subtle); font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-row button { border: 0; border-radius: 5px; padding: 6px; color: var(--muted); background: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.post-row button:hover { background: var(--active); color: var(--accent); }
.post-row button .icon { width: 13px; height: 13px; }
.quick-actions { display: grid; gap: 10px; }
.quick-action { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; text-align: left; }
.quick-action:hover { background: var(--canvas); border-color: var(--border-hover); }
.q-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--raised); color: var(--muted); flex: none; }
.q-icon .icon { width: 17px; height: 17px; }
.quick-action strong { display: block; color: var(--ink); font-size: 12px; font-weight: 550; }
.quick-action small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.quick-arrow { width: 14px; height: 14px; color: var(--subtle); margin-left: auto; }

/* Content lists */
.content-tabs { display: inline-flex; gap: 3px; background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 22px; }
.content-tabs button { border: 1px solid transparent; border-radius: 5px; background: none; color: var(--muted); font-size: 12px; padding: 6px 12px; font-weight: 500; }
.content-tabs button.active { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px #10182806; }
.content-tabs span { display: inline-block; font-variant-numeric: tabular-nums; padding: 0 5px; margin-left: 5px; font-size: 11px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 9px; min-width: min(340px, 100%); border: 1px solid var(--control-border); border-radius: 7px; padding: 0 11px; color: var(--subtle); background: var(--surface); }
.search .icon { width: 16px; height: 16px; }
.search input { width: 100%; height: 36px; border: 0; outline: 0; font-size: 12px; background: transparent; }
.list-filters { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.filter, .scope-select { max-width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--control-border); background: var(--surface); border-radius: 7px; font-size: 12px; }
.list-filters .filter { min-width: 0; max-width: 240px; }
#list-sort { flex-shrink: 0; }
.scope-select { min-width: 0; }
.table-panel { padding: 0 20px; overflow: hidden; }
.table-head, .article-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 105px 130px; align-items: center; gap: 18px; }
.table-head { margin: 0 -20px; padding: 12px 20px; color: var(--muted); background: var(--raised); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 500; }
.article-row { min-height: 76px; margin: 0 -20px; padding: 16px 20px; border-bottom: 1px solid var(--hover); font-size: 12px; }
.article-row:hover { background: var(--raised); }
.article-row>div:first-child { min-width: 0; }
.article-row .title { display: block; margin-bottom: 4px; color: var(--ink); font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.excerpt { color: var(--subtle); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; margin: 2px; background: var(--raised); color: var(--muted); font-size: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.row-actions button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 0; }
.row-actions button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.row-actions button[data-delete] { color: var(--danger); }
.page-table { grid-template-columns: minmax(0, 1fr) minmax(140px, .65fr) 100px 80px; }
.page-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; font-size: 11px; color: var(--muted); }
.list-footer>div { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.list-footer button { min-height: 30px; padding: 5px 9px; font-size: 11px; box-shadow: none; }

/* Writing and configuration */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 20px; }
.editor-panel { padding: 0; overflow: hidden; }
.editor-tabs { display: flex; align-items: center; gap: 6px; padding: 0 18px; height: 48px; border-bottom: 1px solid var(--line); }
.editor-tabs button { height: 48px; border: 0; border-bottom: 2px solid transparent; padding: 12px 10px; background: none; color: var(--muted); font-size: 12px; }
.editor-tabs button.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 550; }
.editor-status { color: var(--muted); font-size: 11px; margin-right: 6px; }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 7px 12px; min-height: 42px; border-bottom: 1px solid var(--line); background: var(--raised); }
.editor-toolbar button { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 5px 8px; border-radius: 5px; background: none; color: var(--muted); font-size: 12px; }
.editor-toolbar button:hover { color: var(--ink); background: var(--hover); }
.editor-toolbar button .icon { width: 15px; height: 15px; }
.editor-toolbar small { color: var(--subtle); font-size: 10px; margin-left: auto; }
.toolbar-separator { height: 16px; width: 1px; background: var(--line); margin: 0 4px; }
.editor-textarea, .code-area { display: block; width: 100%; min-height: 530px; resize: vertical; padding: 26px; border: 0; outline: 0; color: var(--ink-soft); background: var(--surface); font: 13px/1.9 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.code-area { min-height: 580px; }
.meta-panel { display: block; padding: 20px; }
.meta-panel h3 { font-size: 13px; font-weight: 600; margin: 0 0 20px; }
.meta-panel label, .modal label { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin: 0 0 7px; }
.meta-panel input, .modal input { width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface); color: var(--ink); margin-bottom: 16px; font-size: 12px; }
.meta-panel .meta-value { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; margin-bottom: 18px; }
.meta-panel .hint-card { margin-top: 0; font-size: 11px; }
.preview { min-height: 530px; padding: 26px 32px; color: var(--ink-soft); line-height: 1.9; overflow-wrap: anywhere; overflow-x: auto; }
.preview h1, .preview h2 { color: var(--ink); line-height: 1.4; }
.preview pre { padding: 18px; background: #202733; color: #e5e9f0; border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview code:not(pre code) { background: var(--raised); padding: 2px 5px; border-radius: 4px; font-size: .9em; }
.preview blockquote { border-left: 3px solid var(--border-hover); margin-left: 0; padding-left: 16px; color: var(--muted); }
.preview img { display: block; max-width: 100%; height: auto; border-radius: 7px; margin: 16px 0; }
.preview a { color: var(--accent); text-underline-offset: 3px; }
.preview table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 12px; }
.preview th, .preview td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.preview th { background: var(--raised); }
.media-library { padding: 16px; border-bottom: 1px solid var(--line); background: var(--raised); }
.media-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.media-head strong { color: var(--ink-soft); font-weight: 550; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; max-height: 270px; overflow: auto; }
.media-card { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px; text-align: left; color: var(--muted); }
.media-card:hover { border-color: var(--border-hover); }
.media-card img { display: block; width: 100%; height: 76px; object-fit: cover; border-radius: 4px; background: var(--hover); }
.media-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; margin-top: 6px; }
.media-empty { font-size: 12px; color: var(--muted); }

/* Repository and build */
.git-summary { display: flex; gap: 40px; margin-bottom: 18px; overflow-wrap: anywhere; }
.git-summary small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.git-summary strong { font-size: 12px; font-weight: 550; }
.git-files { margin-bottom: 18px; }
.git-file { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; font-size: 12px; }
.git-file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.git-file-name small { display: block; color: var(--warning); font-size: 11px; margin-top: 3px; }
.git-badge { padding: 3px 6px; color: var(--muted); background: var(--raised); border-radius: 4px; font: 11px ui-monospace, monospace; white-space: pre; }
.git-badge.staged { color: var(--success); background: var(--success-bg); }
.git-file-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.git-file-actions button { background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; color: var(--muted); font-size: 11px; }
.git-file-actions button:hover { color: var(--accent); border-color: var(--border-hover); }
.git-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.git-commit h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.git-commit p { margin: 0; font-size: 12px; color: var(--muted); }
.git-commit-row { display: flex; gap: 10px; margin-top: 18px; }
.git-commit-row input { flex: 1; min-width: 0; border: 1px solid var(--control-border); border-radius: 6px; padding: 0 12px; font-size: 12px; }
.git-diff-content, .terminal { background: #202733; color: #d8e0eb; border-radius: 8px; padding: 20px; font: 12px/1.8 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; }
.git-diff-content { max-height: 50vh; margin: 0 0 20px; }
.diff-add, .terminal .ok { color: #96dfb5; }
.diff-remove, .terminal .bad { color: #ffa2b1; }
.diff-hunk { color: #a9c1f4; }
.command-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.command-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; min-height: 155px; text-align: left; color: var(--ink); }
.command-card:hover { border-color: var(--border-hover); background: var(--raised); }
.command-icon { display: block; margin-bottom: 18px; color: var(--muted); }
.command-icon .icon { width: 22px; height: 22px; }
.command-card strong { font-size: 13px; font-weight: 550; }
.command-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; margin-top: 6px; }
.terminal { min-height: 280px; max-height: 480px; }

/* Forms, dialogs and account setup */
.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; background: #1c243561; backdrop-filter: blur(2px); padding: 20px; z-index: 10; }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; position: relative; box-shadow: 0 24px 80px #121b2d26; }
.modal-feedback { margin-top: 16px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--raised); color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.modal-feedback[data-tone="error"] { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.modal h2 { margin: 0 0 10px; font-size: 20px; font-weight: 600; letter-spacing: -.4px; padding-right: 20px; }
.modal p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0 0 20px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { border: 0; background: none; color: var(--subtle); font-size: 22px; border-radius: 5px; }
.icon-button:hover { color: var(--ink); background: var(--raised); }
.close { position: absolute; right: 14px; top: 12px; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 28px; background: var(--sidebar); }
.auth-card { width: min(100%, 460px); max-height: calc(100dvh - 56px); overflow: auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px #10182806; }
.auth-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.auth-heading .eyebrow { font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.auth-brand { width: 40px; height: 40px; border-radius: 9px; font-size: 24px; }
.auth-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -.5px; line-height: 1.4; margin: 4px 0 0; }
.auth-card p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0 0 22px; }
.auth-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.auth-card label, .password-form label { display: block; margin: 14px 0 0; color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.auth-card input, .password-form input, .auth-card select, .modal select { display: block; width: 100%; min-width: 0; height: 40px; border: 1px solid var(--control-border); border-radius: 6px; padding: 0 11px; background: var(--surface); margin-top: 7px; font-size: 13px; }
.password-control { position: relative; display: block; }
.auth-card .password-control input, .password-form .password-control input { padding-right: 44px; }
.password-toggle { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.password-toggle:hover { color: var(--ink); background: var(--hover); }
.password-toggle .icon { width: 18px; height: 18px; pointer-events: none; }
.auth-passwords { display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-setup .auth-passwords { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* Setup uses a quiet progress indicator, with one focused form per step. */
.setup-progress { margin-bottom: 28px; }
.setup-progress-caption { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 10px; }
.setup-progress-caption>span:last-child { font-variant-numeric: tabular-nums; color: var(--subtle); }
.setup-progress-track { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.setup-progress-track>span { display: block; height: 100%; width: 33.333%; background: var(--accent); border-radius: inherit; }
.setup-progress[data-step="2"] .setup-progress-track>span { width: 66.667%; }
.setup-progress[data-step="3"] .setup-progress-track>span { width: 100%; }
.auth-actions { display: flex; gap: 10px; margin-top: 24px; }
.auth-actions .primary { flex: 1; min-height: 40px; }
.auth-actions .secondary { min-width: 80px; }
.auth-card .storage-help { margin: 12px 0 0; font-size: 11px; }
.auth-error, .form-error { padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: 6px; background: var(--danger-bg); color: var(--danger) !important; margin: 16px 0 0 !important; font-size: 12px; overflow-wrap: anywhere; }
.password-form .actions { margin-top: 22px; }
.modal #storage-form label { margin: 12px 0 7px; }
.modal #storage-form p { margin: 10px 0; }
.modal #storage-form .actions { margin-top: 20px; }
.setup-blog-card { width: min(100%, 590px); padding: 26px 30px; }
.setup-blog-card .setup-progress { margin-bottom: 20px; }
.setup-blog-card .auth-heading { margin-bottom: 12px; }
.setup-blog-card>p { margin-bottom: 14px; }
.setup-blog-card .connection-choices { margin: 16px 0; }
.setup-blog-card .connection-choices button { padding: 10px 12px; }
.setup-blog-card .connection-fields p { margin-bottom: 14px; }
.setup-blog-card .connection-grid { gap: 12px; margin-bottom: 14px; }
.setup-blog-card .setup-exit { margin-top: 12px; }
.setup-blog-card .connection-fields .secret-note { margin-bottom: 0; }
.setup-blog-card h1 { margin: 8px 0 10px; }
.setup-blog-card .connection-fields .primary { width: 100%; min-height: 40px; }
.setup-blog-card .connection-fields label { margin-top: 0; }
.setup-blog-card .connection-fields input { margin-top: 0; }
.setup-exit { display: block; margin: 20px auto 0; background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.connection-panel { max-width: 760px; padding: 28px; }
.connection-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
.connection-choices button { display: flex; align-items: flex-start; gap: 10px; padding: 14px 12px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); text-align: left; color: var(--muted); }
.connection-choices button:hover { border-color: var(--border-hover); background: var(--raised); }
.connection-choices button.active { border-color: var(--accent); background: var(--brand-soft); color: var(--accent); }
.connection-choices .icon { margin-top: 2px; width: 17px; height: 17px; }
.connection-choices strong { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
.connection-choices small { display: block; font-size: 11px; line-height: 1.6; color: var(--muted); margin-top: 5px; }
.connection-fields p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 20px; }
.connection-fields label { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 500; margin-bottom: 7px; }
.connection-fields input, .connection-fields select { width: 100%; height: 40px; border: 1px solid var(--control-border); border-radius: 6px; padding: 0 11px; background: var(--surface); font-size: 12px; margin: 0; }
.connection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; margin-bottom: 22px; }
.connection-grid .full { grid-column: 1 / -1; }
.connect-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.connection-fields .secret-note { color: var(--subtle); font-size: 11px; margin: 12px 0 0; }
.advanced-options { border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.advanced-options summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.advanced-options[open] summary { margin-bottom: 16px; }
.advanced-options>div+div { margin-top: 14px; }
.toast { position: fixed; bottom: 24px; right: 24px; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid var(--success-border); border-left: 3px solid var(--mint); border-radius: 8px; background: var(--surface); color: var(--success); box-shadow: 0 6px 24px #10182812; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; z-index: 20; }
.toast[data-tone="error"] { border-color: var(--danger-border); border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

/* Compact workspaces and mobile */
@media (max-width: 1150px) {
  .sidebar { width: 208px; }
  .view { padding: 28px 26px 56px; }
  .topbar { padding: 0 26px; }
  .table-head, .article-row { grid-template-columns: minmax(0, 1fr) 88px 85px 120px; gap: 12px; }
  .page-table { grid-template-columns: minmax(0, 1fr) 130px 85px 80px; }
  .head-actions { flex-shrink: 1; }
  .stat-tail { display: none; }
}
@media (max-width: 1000px) {
  .columns, .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .page-head { flex-wrap: wrap; }
  .head-actions { justify-content: flex-start; }
  .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-action { flex-wrap: wrap; }
  .quick-arrow { display: none; }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .main { width: auto; }
  .topbar { min-height: 60px; height: auto; padding: 8px 12px; position: sticky; }
  .connection { display: none; }
  .view { padding: 24px 16px 48px; scroll-margin-top: 16px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
  .page-head h1 { font-size: 23px; }
  .page-head p { font-size: 12px; }
  .head-actions { width: 100%; }
  .stats { gap: 8px; }
  .stat-card { padding: 14px 12px; min-height: 105px; }
  .stat-icon { display: none; }
  .stat-card small { font-size: 11px; }
  .stat-card strong { font-size: 26px; }
  .panel { padding: 18px; }
  .table-panel { padding: 0 14px; }
  .table-head, .article-row, .page-table { grid-template-columns: minmax(0, 1fr) 106px; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; gap: 10px; }
  .table-head>span:nth-child(2), .table-head>span:nth-child(3), .article-row>span:nth-child(2), .article-row>span:nth-child(3) { display: none; }
  .row-actions { flex-wrap: wrap; gap: 7px; }
  .row-actions button { font-size: 11px; }
  .toolbar { flex-wrap: wrap; }
  .search { min-width: 0; width: 100%; }
  .list-filters { width: 100%; }
  .list-filters .filter { flex: 1 1 0; min-width: 0; max-width: none; }
  .list-footer { flex-wrap: wrap; }
  .list-footer>div { margin-left: auto; }
  .quick-actions, .command-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-action { flex-wrap: nowrap; }
  .quick-arrow { display: block; }
  .editor-panel { padding: 0; }
  .editor-textarea, .code-area, .preview { padding: 20px; min-height: 400px; }
  .editor-status { width: 100%; }
  .editor-toolbar small { width: 100%; margin: 2px 0 0; }
  .git-summary, .git-commit-row { flex-direction: column; gap: 14px; }
  .git-commit-row input { min-height: 38px; }
  .git-file { flex-wrap: wrap; }
  .git-file-actions { width: 100%; justify-content: flex-start; margin-left: 25px; }
  .connection-grid { grid-template-columns: minmax(0, 1fr); }
  .connection-grid .full { grid-column: auto; }
  .modal { padding: 24px; }
  .auth-screen { padding: 16px; }
  .auth-card { padding: 26px; max-height: calc(100dvh - 32px); }
  .toast { right: 16px; bottom: 16px; }
}
@media (max-width: 380px) { .auth-setup .auth-passwords { grid-template-columns: minmax(0, 1fr); gap: 0; } .connection-choices { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

/* Display controls are available before login and within the workspace. */
.preferences-home { position: absolute; top: 16px; right: 20px; z-index: 4; }
.display-preferences { display: flex; align-items: center; gap: 8px; }
.preference-control { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); min-width: 0; }
.preference-control .icon { width: 14px; height: 14px; }
.preference-control select { min-width: 0; width: 100%; border: 0; border-radius: 4px; background: transparent; color: var(--ink-soft); font-size: 11px; padding: 5px 0; cursor: pointer; }
#preferences-workspace .display-preferences { gap: 5px; }
#preferences-workspace .preference-control { flex: 1; }
#preferences-workspace .preference-control .icon { display: none; }
.auth-screen { padding-top: 76px; }
.auth-card { max-height: calc(100dvh - 104px); }
@media (max-width: 700px) {
  #preferences-workspace { width: 100%; padding-bottom: 6px; }
  #preferences-workspace .preference-control { flex: none; }
  #preferences-workspace .preference-control .icon { display: block; }
  .preferences-home { top: 12px; right: 16px; }
  .auth-card { max-height: calc(100dvh - 92px); }
}

.cloud-note { color: var(--accent) !important; font-size: 11px !important; }

.setup-progress.cloud-setup .setup-progress-track>span { width: 50%; }

/* Keep native menus and keyboard behavior, with consistent closed-control geometry. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-inline: var(--select-padding-start, 12px) var(--select-padding-end, 38px);
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right var(--select-arrow-inset, 12px) center;
  background-size: 16px 16px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
select:not(:disabled):hover { border-color: var(--border-hover); }
select:disabled { cursor: not-allowed; opacity: .55; }
.preference-control select {
  height: 26px;
  padding-block: 0;
  --select-padding-start: 2px;
  --select-padding-end: 24px;
  --select-arrow-inset: 2px;
}
@media (forced-colors: active) {
  select:not([multiple]):not([size]) {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
  }
}

/* A quiet persistent entry; details stay in the update dialog. */
.update-badge { margin-inline-start: auto; padding: 2px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--accent); font-size: 10px; white-space: nowrap; }
.update-status { margin: 20px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); font-size: 13px; line-height: 1.6; }
.update-status[data-tone="available"] { color: var(--accent); background: var(--brand-soft); }
.update-status[data-tone="unavailable"] { color: var(--danger); }
.update-details { margin: 0 0 22px; font-size: 12px; }
.update-details > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.update-details dt { color: var(--muted); flex-shrink: 0; }
.update-details dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
.update-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.update-actions a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; text-underline-offset: 4px; }
.update-actions a .icon { width: 14px; height: 14px; }
.modal .update-note { margin: 18px 0 0; font-size: 11px; }

#version-updates { gap: 8px; }
#version-updates > .icon { flex-shrink: 0; }

.web-update-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 36px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--brand-soft); font-size: 12px; }
.web-update-notice button { flex-shrink: 0; }
#update-web-ready p { margin-bottom: 12px; color: inherit; }
@media (max-width: 700px) { .web-update-notice { margin: 12px 16px 0; flex-wrap: wrap; } }

/* OEM colors only override the default palette when explicitly customized. */
:root[data-oem-colors="true"] { --accent: var(--oem-light); --on-brand: var(--oem-light-ink); --brand: var(--accent); --brand-dark: color-mix(in srgb, var(--accent), black 14%); --brand-soft: color-mix(in srgb, var(--accent) 10%, var(--surface)); --active: var(--brand-soft); --active-ink: var(--accent); }
:root[data-theme="dark"][data-oem-colors="true"] { --accent: var(--oem-dark); --on-brand: var(--oem-dark-ink); --brand-dark: color-mix(in srgb, var(--accent), white 14%); --brand-soft: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.custom-brand-logo { background: transparent; }
.custom-brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand > div, .auth-heading > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.brand [data-brand-name] { overflow-wrap: anywhere; }
.brand-footer { display: block; padding: 6px 10px; color: var(--subtle); font-size: 10px; overflow-wrap: anywhere; }
.brand-login-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; color: var(--subtle); font-size: 11px; }
.brand-login-footer:has(:not(.hidden)) { margin-top: 18px; }
[data-brand-help] { color: var(--muted); text-decoration: none; }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 16px; margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
#brand-preview-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--on-brand); background: var(--brand); flex-shrink: 0; font-size: 24px; font-weight: 600; }
#brand-preview-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-preview > div { min-width: 0; overflow-wrap: anywhere; }
.brand-preview small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.brand-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#branding-form input { margin-top: 6px; margin-bottom: 6px; }
#branding-form input[type="color"] { padding: 4px; cursor: pointer; }
.brand-image-input { display: flex; gap: 8px; align-items: center; }
.brand-image-input > input { flex: 1; min-width: 0; }
.brand-image-input > button { flex-shrink: 0; }
.modal .brand-tip { font-size: 11px; margin: 8px 0 16px; }
.brand-more { border-top: 1px solid var(--line); padding-top: 12px; }
.brand-more summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
#branding-form .actions { margin-top: 20px; }
#brand-reset { width: auto; margin-inline-end: auto; }
@media (max-width: 480px) { .brand-fields { grid-template-columns: 1fr; gap: 0; } }

/* Configuration file list and dedicated editor. */
.config-files-panel, .config-edit-panel { padding: 0; overflow: hidden; }
.config-files-header { display: flex; align-items: center; gap: 10px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.config-files-header h3 { margin: 0; font-size: 13px; }
.config-files-header > span { border-radius: 5px; padding: 1px 7px; background: var(--raised); color: var(--muted); font-size: 11px; }
.config-files-panel .list-footer { margin: 0; padding: 14px 24px; border-top: 1px solid var(--line); }
.config-table-wrap { overflow-x: auto; }
.config-files-table { width: 100%; border-collapse: collapse; text-align: left; }
.config-files-table th { padding: 12px 24px; background: var(--raised); color: var(--muted); font-size: 11px; font-weight: 500; }
.config-files-table td { padding: 20px 24px; border-top: 1px solid var(--line); }
.config-files-table th:last-child, .config-files-table td:last-child { text-align: right; }
.config-files-table tr:hover td { background: var(--raised); }
.config-file-row { display: flex; align-items: center; gap: 14px; }
.config-file-icon { display: grid; place-items: center; width: 36px; height: 40px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); flex-shrink: 0; }
.config-file-name { border: 0; padding: 0; text-align: left; background: transparent; color: var(--ink); font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.config-file-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.config-file-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.config-file-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.config-edit-button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--accent); font-size: 12px; padding: 7px; }
.config-edit-button .icon { width: 15px; height: 15px; }
.config-back { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: 0; color: var(--muted); padding: 0; margin: 0 0 18px; font-size: 12px; }
.config-back:hover { color: var(--accent); }
.config-back-arrow { transform: rotate(180deg); width: 15px; height: 15px; }
.config-edit-header, .config-edit-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 20px; color: var(--muted); font-size: 11px; background: var(--raised); }
.config-edit-header { border-bottom: 1px solid var(--line); }
.config-edit-header .editor-status { width: auto; margin: 0; }
.config-edit-footer { border-top: 1px solid var(--line); }
.config-edit-footer kbd { font: inherit; white-space: nowrap; }
.config-edit-panel .code-area { min-height: 380px; height: 52vh; line-height: 1.9; resize: vertical; }
.config-error { margin: 0; padding: 12px 20px; color: var(--danger); background: var(--danger-bg); overflow-wrap: anywhere; font-size: 12px; }
@media (max-width: 600px) {
  .config-files-header { padding: 16px; }
  .config-files-table th, .config-files-table td { padding: 14px 10px; }
  .config-file-icon { display: none; }
  .config-edit-button span { display: none; }
  .config-files-table td:last-child { width: 42px; }
  .config-edit-header, .config-edit-footer { padding: 12px 14px; }
  .config-edit-panel .code-area { padding: 16px; }
}

/* Mobile navigation and touch layouts. Keep the document scrollable for keyboards. */
.mobile-navigation-control, .navigation-backdrop { display: none; }
.panel, .stat-card, .editor-layout > *, .columns > * { min-width: 0; }
@media (max-width: 700px) {
  body.navigation-open { overflow: hidden; }
  .mobile-navigation-control { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; color: var(--ink); }
  .navigation-backdrop { display: block; position: fixed; inset: 0; z-index: 6; background: #10182880; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 7; width: min(320px, calc(100% - 32px)); height: 100dvh; overflow-y: auto; overscroll-behavior: contain; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); visibility: hidden; transform: translateX(-100%); border-right: 1px solid var(--line); box-shadow: 16px 0 48px #10182820; }
  .navigation-open .sidebar { visibility: visible; transform: translateX(0); }
  #navigation-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 10px; }
  .sidebar .brand { padding: 2px 42px 28px 8px; }
  .sidebar .nav { display: grid; gap: 6px; }
  .sidebar .nav button { min-height: 48px; font-size: 14px; }
  .sidebar-bottom { display: block; padding-top: 24px; }
  .sidebar .text-button { width: 100%; min-height: 44px; font-size: 13px; }
  .sidebar .project-chip { display: flex; }
  .project-chip strong, .project-chip small { max-width: 210px; }
  #preferences-workspace .preference-control { flex: 1; }
  #preferences-workspace .preference-control .icon { display: none; }
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); gap: 8px; }
  .topbar-location { gap: 6px; flex: 1; }
  #breadcrumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { flex: none; gap: 8px; }
  .view { padding: 24px max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); scroll-margin-top: 80px; }
  .page-head p, .modal p, .hint-card, .quick-action > span { overflow-wrap: anywhere; }
  .primary, .secondary, .primary.small, .list-footer button, .panel-title button, .post-row button, .config-back, .config-edit-button, .git-file-actions button, .setup-exit { min-height: 44px; }
  .icon-button, .password-toggle { min-width: 44px; min-height: 44px; }
  .head-actions { gap: 8px; }
  .head-actions > button { flex: 1 1 auto; }
  .head-actions .editor-status { flex-basis: 100%; }
  .content-tabs { display: flex; max-width: 100%; }
  .content-tabs button { flex: 1; min-height: 44px; padding: 6px 8px; }
  .content-tabs span { margin-left: 2px; }
  /* A card keeps title, tags, date and actions readable without table scrolling. */
  .table-head { display: none; }
  .article-row, .article-row.page-table { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 8px; padding-top: 16px; padding-bottom: 12px; }
  .article-row > div:first-child { grid-column: 1 / -1; }
  .article-row .title { font-size: 15px; }
  .article-row > span:nth-child(2), .article-row > span:nth-child(3) { display: block; min-width: 0; }
  .article-row > span:nth-child(2) { overflow-wrap: anywhere; }
  .article-row > span:nth-child(3) { text-align: right; }
  .row-actions { grid-column: 1 / -1; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
  .row-actions button { min-width: 56px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
  .row-actions button:first-child { color: var(--accent); background: var(--brand-soft); }
  .list-footer > div { justify-content: space-between; width: 100%; margin: 0; }
  .stats { gap: 8px; }
  .stat-card { padding: 14px 10px; }
  .stat-card small { overflow-wrap: anywhere; }
  .editor-toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; }
  .editor-toolbar button { flex: none; min-width: 44px; min-height: 44px; white-space: nowrap; }
  .editor-toolbar small { display: none; }
  .toolbar-separator { flex: none; }
  .editor-tabs { padding: 0 8px; }
  .editor-textarea, .code-area, .preview { padding: 16px; min-height: 340px; }
  .editor-textarea { height: 60dvh; }
  .preview { font-size: 15px; }
  .config-edit-panel .code-area { min-height: 300px; height: 60dvh; }
  .config-files-panel, .config-edit-panel { padding: 0; }
  .config-files-table { table-layout: fixed; }
  .config-files-table th, .config-files-table td { padding: 12px 10px; }
  .config-files-table th:nth-child(2), .config-files-table td:nth-child(2) { width: 72px; }
  .config-files-table th:last-child, .config-files-table td:last-child { width: 64px; }
  .config-file-row, .config-file-row > div { min-width: 0; }
  .config-file-icon { display: none; }
  .config-file-name { max-width: 100%; }
  .config-edit-button { min-width: 44px; justify-content: center; }
  .config-edit-button span { display: none; }
  .config-edit-footer kbd { display: none; }
  .git-summary > div, .git-commit-row > * { min-width: 0; }
  .git-file-actions { margin-left: 0; }
  .media-head { flex-wrap: wrap; }
  .modal-backdrop { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .modal { padding: 24px 20px; width: 100%; max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .modal .actions { flex-wrap: wrap; }
  .modal .actions > button { flex: 1 1 auto; }
  .close { top: 6px; right: 6px; }
  .modal h2 { padding-right: 30px; }
  .auth-screen { padding: max(84px, calc(env(safe-area-inset-top) + 72px)) 16px max(24px, env(safe-area-inset-bottom)); align-items: start; }
  .auth-card { max-height: none; overflow: visible; padding: 24px 20px; }
  .auth-setup .auth-passwords { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .preferences-home { top: max(12px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); left: max(16px, env(safe-area-inset-left)); display: flex; justify-content: flex-end; }
  .display-preferences { max-width: 100%; }
  .preference-control { flex: 1; }
  /* 16px controls prevent focus zoom on iOS without disabling user zoom. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea,
  .auth-card input, .auth-card select, .password-form input, .modal input, .modal select,
  .meta-panel input, .connection-fields input, .connection-fields select, .search input,
  .preference-control select, .filter, .git-commit-row input { font-size: 16px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { min-height: 44px; }
  .preference-control { padding: 0 6px; }
  .password-toggle { top: 0; }
  .toast { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: none; }
}
@media (max-width: 360px) {
  .connection-choices { grid-template-columns: minmax(0, 1fr); }
  .config-files-table th:nth-child(2), .config-files-table td:nth-child(2) { display: none; }
  .list-filters { flex-wrap: wrap; }
  .list-filters .filter { flex-basis: 100%; }
}

/* AI writing: requirements first, editable results before applying. */
.modal:has(.ai-workspace) { width: min(760px, 100%); }
.ai-workspace .eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); margin-bottom: 10px; }
.ai-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.ai-options select { width: 100%; }
.ai-input, .ai-output { display: block; width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--control-border); border-radius: 7px; background: var(--surface); color: var(--ink); resize: vertical; font-size: 13px; line-height: 1.8; margin-bottom: 14px; }
.ai-output { min-height: 260px; max-height: 50dvh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.modal .ai-note { margin: 10px 0 16px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.ai-result { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
#ai-truncated { color: var(--warning); }
@media (max-width: 700px) {
  .ai-options { gap: 12px; }
  .ai-input, .ai-output { font-size: 16px; }
  .ai-workspace .actions > button { flex: 1; min-height: 44px; }
}
@media (max-width: 560px) { .ai-options { grid-template-columns: 1fr; gap: 8px; } }

/* Article appearance and typed Front Matter fields. */
.article-fields-entry { border-top: 1px solid var(--line); margin-top: 8px; padding: 16px 0; }
.article-fields-entry button { width: 100%; }
.article-fields-entry p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.modal:has(.article-fields-dialog) { width: min(760px, 100%); }
.cover-settings { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 22px 0; }
.cover-settings .field-clear { flex: 0 0 auto; color: var(--muted); padding: 6px 8px; font-size: 11px; }
.cover-inputs { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 3fr); gap: 12px; }
.cover-inputs input { margin-top: 7px; margin-bottom: 0; }
.field-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-preview { margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--raised); }
.cover-preview img { display: block; width: 100%; max-height: 240px; object-fit: contain; }
#cover-images { margin-top: 16px; }
.article-fields-dialog .field-note { font-size: 11px; line-height: 1.7; margin: 10px 0 14px; overflow-wrap: anywhere; }
.custom-fields-section summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 8px 0 14px; }
.custom-fields-section summary span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.custom-field-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 3fr); align-items: start; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.custom-field-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.custom-field-heading code { font-size: 12px; overflow-wrap: anywhere; }
.custom-field-heading button { color: var(--muted); font-size: 11px; }
.custom-field-row select { margin: 0; }
.custom-field-row textarea { width: 100%; min-width: 0; border: 1px solid var(--control-border); border-radius: 6px; padding: 10px; font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.custom-field-row .field-note { grid-column: 1 / -1; margin: 0; }
.custom-field-row.field-removed code { text-decoration: line-through; color: var(--muted); }
.field-add { display: flex; align-items: start; gap: 10px; margin-top: 16px; }
.field-add button { flex-shrink: 0; min-height: 38px; }
.article-fields-footer { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.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; }
@media (max-width: 600px) {
  .cover-inputs, .custom-field-row { grid-template-columns: minmax(0, 1fr); }
  .article-fields-dialog input, .article-fields-dialog select, .custom-field-row textarea { font-size: 16px; }
  .field-actions button, .article-fields-footer button, .field-add button { min-height: 44px; }
  .cover-settings { padding: 12px; }
  .field-actions button { flex: 1 1 auto; }
  .custom-field-heading button { min-height: 44px; padding: 8px; }
}
