:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #15181d;
  --muted: #68707d;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #e3f5f2;
  --on-accent: #ffffff;
  --danger: #c2410c;
  --danger-soft: #fdeee6;
  --warn: #b45309;
  --warn-soft: #fdf3e1;
  --ok: #15803d;
  --ok-soft: #e5f6ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, .22);
  --radius: 14px;
  --t-message: #2563eb; --t-template: #7c3aed; --t-note: #b45309; --t-link: #0e7490;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1114; --surface: #161a1f; --surface-2: #1d2228; --border: #2a3038; --text: #e8eaed; --muted: #949ba6;
    --accent: #2dd4bf; --accent-2: #14b8a6; --accent-soft: #12302d; --on-accent: #04201d;
    --danger: #fb923c; --danger-soft: #3a2114; --warn: #fbbf24; --warn-soft: #33270f; --ok: #4ade80; --ok-soft: #12301d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
    --t-message: #60a5fa; --t-template: #a78bfa; --t-note: #fbbf24; --t-link: #22d3ee;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1114; --surface: #161a1f; --surface-2: #1d2228; --border: #2a3038; --text: #e8eaed; --muted: #949ba6;
  --accent: #2dd4bf; --accent-2: #14b8a6; --accent-soft: #12302d; --on-accent: #04201d;
  --danger: #fb923c; --danger-soft: #3a2114; --warn: #fbbf24; --warn-soft: #33270f; --ok: #4ade80; --ok-soft: #12301d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  --t-message: #60a5fa; --t-template: #a78bfa; --t-note: #fbbf24; --t-link: #22d3ee;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
code, kbd { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.xs { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.center { text-align: center; justify-content: center; }
.pad { padding: 24px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 228px; flex: none; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
  border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-weight: 750; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; }
#nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
#nav a.on { background: var(--accent-soft); color: var(--accent); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.top-search { display: flex; align-items: center; gap: 10px; min-width: 280px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; }
.top-search span { flex: 1; text-align: left; }
body[data-route="home"] .top-search { visibility: hidden; }
.top-search:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.view { padding: 8px 28px 120px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- pills / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 550; border: 1px solid transparent; background: var(--surface-2); color: var(--muted); cursor: pointer; white-space: nowrap; }
.pill .ic { width: 15px; height: 15px; }
.pill:hover { text-decoration: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--danger-soft); color: var(--danger); }
.pill.run { background: var(--accent-soft); color: var(--accent); }
.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.err { background: var(--danger-soft); color: var(--danger); }
.status.run { background: var(--accent-soft); color: var(--accent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--text); transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- page head / toolbar ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 20px; }
.page-head p { margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; max-width: 460px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); }
.search input, .search input:focus { border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; padding: 9px 0; width: 100%; color: var(--text); border-radius: 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search.sm { flex: 0 1 240px; min-width: 160px; }
.search.sm input { padding: 6px 0; }
select, input:not([type=checkbox]):not([type=file]), textarea { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 9px 12px; outline: none; width: 100%; }
.toolbar select { width: auto; }
select:focus, input:not([type=checkbox]):focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 550; cursor: pointer; color: var(--muted); }
.chip-btn em { font-style: normal; opacity: .7; margin-left: 2px; }
.chip-btn:hover { color: var(--text); }
.chip-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 550; white-space: nowrap; }
.chip.ghost { background: transparent; border: 1px dashed var(--border); }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.item { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; transition: border-color .15s, box-shadow .15s; }
.card.item:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card header, .card footer { display: flex; align-items: center; gap: 6px; }
.card footer { margin-top: auto; padding-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 8px 2px 6px; border-radius: 6px; color: var(--t-note); background: color-mix(in srgb, currentColor 12%, transparent); }
.badge .ic { width: 13px; height: 13px; }
.badge.t-message { color: var(--t-message); } .badge.t-template { color: var(--t-template); } .badge.t-note { color: var(--t-note); } .badge.t-link { color: var(--t-link); }
.pin.on { color: #eab308; }
.pin.on .ic { fill: #eab308; }
.item-body { text-align: left; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.preview { margin: 0; font: 13.5px/1.55 inherit; font-family: inherit; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 8.2em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.compact .preview { max-height: 4.7em; }
.preview.rich * { font-size: inherit !important; color: inherit !important; background: none !important; margin: 0 !important; }
.vars { display: flex; flex-wrap: wrap; gap: 4px; }
.var { font: 11.5px ui-monospace, Menlo, monospace; padding: 1px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 20px; border: 1.5px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty > .ic { width: 38px; height: 38px; stroke-width: 1.5; color: var(--accent); }
.empty h3 { color: var(--text); font-size: 17px; }
.empty p { max-width: 440px; }
.empty.small { padding: 24px; }
.empty.small .ic { width: 26px; height: 26px; }
.card.cta { padding: 0; border: 0; box-shadow: none; background: none; margin-bottom: 18px; }

/* ---------- home ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 12px 0 18px; }
.hero-search { display: flex; align-items: center; gap: 10px; min-width: min(420px, 100%); padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); color: var(--muted); cursor: pointer; font-size: 15px; }
.hero-search span { flex: 1; text-align: left; }
.hero-search:hover { border-color: var(--accent); }
.account { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.account img, .avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.avatar { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.account .bar { max-width: 320px; margin: 8px 0 2px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.q { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; transition: border-color .15s, transform .15s; }
.q:hover { border-color: var(--accent); transform: translateY(-1px); }
.q .ic { width: 22px; height: 22px; color: var(--accent); margin-bottom: 8px; }
.q small { color: var(--muted); font-size: 12.5px; }
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.home-cols aside { display: flex; flex-direction: column; gap: 14px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-head h2 { display: flex; align-items: center; gap: 6px; }
.sec-head h2 .ic { width: 16px; height: 16px; color: #eab308; }
.mini-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.sec-head + .mini-row { border-top: 0; }
.dot-s { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-s.ok { background: var(--ok); } .dot-s.err { background: var(--danger); }
.stats { display: flex; gap: 22px; justify-content: center; color: var(--muted); font-size: 13px; margin-top: 30px; }
.stats b { color: var(--text); }
.section-title { margin: 26px 0 12px; display: flex; gap: 8px; align-items: center; }
.section-title em { font-style: normal; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; }

/* ---------- sheets ---------- */
.card.sheet { display: flex; flex-direction: column; gap: 10px; }
.sheet-top { display: flex; gap: 12px; align-items: flex-start; }
.emoji { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface-2); border-radius: 11px; flex: none; }
.emoji.sm { font-size: 16px; width: 28px; height: 28px; border-radius: 8px; }
.sheet-purpose { font-size: 13.5px; color: var(--text); opacity: .85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-purpose.muted { color: var(--muted); font-style: italic; opacity: 1; }
.name-builder { display: grid; grid-template-columns: 170px 1fr 130px; gap: 10px; }

/* ---------- drive ---------- */
#dvBody { border-radius: var(--radius); transition: box-shadow .15s; }
#dvBody.dragging { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-weight: 600; }
.crumbs .ic { width: 14px; height: 14px; color: var(--muted); }
.file-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 80px auto; gap: 12px; align-items: center; padding: 6px 10px 6px 14px; border-top: 1px solid var(--border); }
.file-row:first-child { border-top: 0; }
.file-row:hover { background: var(--surface-2); }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; padding: 6px 0; cursor: pointer; color: var(--text); text-align: left; font-size: 14.5px; }
.file-name:hover { text-decoration: none; color: var(--accent); }
.size { text-align: right; }
.row-actions { display: flex; opacity: .55; }
.file-row:hover .row-actions { opacity: 1; }
.c-folder { color: #eab308; fill: color-mix(in srgb, #eab308 25%, transparent); }
.c-sheet { color: #16a34a; } .c-image { color: #db2777; } .c-doc { color: #2563eb; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.hint .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- backup ---------- */
.card.job { display: flex; flex-direction: column; gap: 12px; }
.card.job.paused { opacity: .7; }
.job-top { display: flex; gap: 12px; align-items: center; }
.job-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.job-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 10px; background: var(--surface-2); border-radius: 10px; }
.job-meta dt { font-size: 11.5px; color: var(--muted); }
.job-meta dd { margin: 0; font-size: 13px; font-weight: 600; }
.job-msg { min-height: 1em; }
.card.agent { margin-top: 18px; }
.card.agent details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.cmd { display: flex; align-items: center; gap: 6px; margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 6px 6px 6px 12px; }
.cmd code { flex: 1; background: none; padding: 0; overflow-x: auto; white-space: nowrap; }
.activity { padding: 6px 16px; }
.act { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.act:first-child { border-top: 0; }
.act .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.act.warn .dot { background: var(--warn); } .act.error .dot { background: var(--danger); }
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 12px; flex-wrap: wrap; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert > span { flex: 1; }
.card .alert { margin: 0; }

/* ---------- settings ---------- */
.settings-sec { margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; max-width: 820px; }
.settings-sec h2 { display: flex; align-items: center; gap: 8px; }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.input-row { display: flex; gap: 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 38px; height: 22px; border-radius: 99px; background: var(--border); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.kbd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; font-size: 14px; }
.kbd-list kbd { margin-right: 6px; }

/* ---------- forms in modals ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field em { font-style: normal; font-weight: 400; opacity: .8; }
.row2 { display: flex; gap: 10px; }
.row2 .field:not(.grow) { width: 210px; flex: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.type-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.type-pick.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); text-align: left; }
.type-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.type-opt.big { padding: 14px; align-items: flex-start; gap: 12px; }
.type-opt.big .ic { width: 22px; height: 22px; margin-top: 2px; }
.type-opt.big span { display: flex; flex-direction: column; gap: 2px; }
.type-opt.big b { color: var(--text); }
.type-opt.big small { font-weight: 450; color: var(--muted); font-size: 12.5px; }
.ed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: -6px; }
.ed-text { min-height: 230px; resize: vertical; font: 14px/1.6 inherit; font-family: inherit; white-space: pre-wrap; tab-size: 4; }
.ed-rich { min-height: 230px; max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 0 0 10px 10px; padding: 12px; background: var(--surface); outline: none; }
.ed-rich:focus { border-color: var(--accent); }
.ed-rich img { max-width: 100%; }
.rt-bar { display: flex; gap: 2px; flex-wrap: wrap; padding: 4px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); }
.rt-bar button { border: 0; background: transparent; padding: 4px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; }
.rt-bar button:hover { background: var(--surface); }
.rt-bar .ic { width: 15px; height: 15px; }
.ed-foot { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-top: -6px; flex-wrap: wrap; }
.ed-foot .hint { margin: 0; }
.paste-hint { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--accent-soft); color: var(--accent); padding: 8px 12px; border-radius: 10px; }
.paste-hint .ic { width: 15px; height: 15px; }
.drop { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; border: 1.5px dashed var(--border); border-radius: 12px; cursor: pointer; color: var(--muted); font-weight: 550; text-align: center; }
.drop:hover { border-color: var(--accent); color: var(--accent); }
.fill-grid { display: grid; grid-template-columns: 280px 1fr; gap: 18px; }
.fill-fields { display: flex; flex-direction: column; gap: 10px; }
.fill-preview { margin-top: 5px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); max-height: 50vh; overflow: auto; font-size: 14px; }
.fill-preview pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; }
.view-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.view-content { margin: 0; white-space: pre-wrap; word-break: break-word; font: 14.5px/1.6 inherit; font-family: inherit; background: var(--surface-2); border-radius: 10px; padding: 14px; max-height: 60vh; overflow: auto; }
.view-content.rich { white-space: normal; }
.pick-list { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.pick:first-child { border-top: 0; }
.pick input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- overlay / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.overlay.out { opacity: 0; transition: opacity .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px 22px; }
.modal > header h2 { font-size: 18px; }
.modal-body { padding: 10px 22px 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal > footer { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- palette ---------- */
.palette-wrap { place-items: start center; padding-top: 12vh; }
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .15s ease; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 4px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.pal-in input { border: 0 !important; box-shadow: none !important; padding: 14px 0 !important; font-size: 16px; background: transparent !important; }
.pal-list { max-height: 52vh; overflow: auto; padding: 6px; }
.pal-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; }
.pal-row b { display: block; font-weight: 600; font-size: 14px; }
.pal-row small { color: var(--muted); font-size: 12.5px; }
.pal-row .ic { color: var(--muted); }
.pal-row.on { background: var(--accent-soft); }
.pal-row.on .ic { color: var(--accent); }
.pal-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ---------- tasks / toasts ---------- */
.tasks { position: fixed; right: 18px; bottom: 18px; z-index: 90; width: 340px; display: flex; flex-direction: column; gap: 8px; }
.task { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.task.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.task.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.task-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.task-sub { font-size: 12.5px; color: var(--muted); }
.task.error .task-sub { color: var(--danger); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar.thin { height: 5px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: inherit; transition: width .25s; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 550; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease; max-width: min(520px, 92vw); }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .home-cols { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: auto; height: auto; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); flex-direction: row; border-right: 0; border-top: 1px solid var(--border); z-index: 50; }
  .brand { display: none; }
  #nav { flex-direction: row; width: 100%; justify-content: space-around; }
  #nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 10.5px; flex: 1; align-items: center; }
  .topbar { padding: 10px 16px; }
  .top-search { min-width: 0; flex: 1; }
  .top-search kbd { display: none; }
  .view { padding: 4px 16px 140px; }
  h1 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .page-head .btn-row { width: 100%; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hide-sm { display: none; }
  .name-builder, .fill-grid, .type-pick.two { grid-template-columns: 1fr; }
  .row2 { flex-direction: column; }
  .row2 .field:not(.grow) { width: auto; }
  .job-meta { grid-template-columns: 1fr 1fr; }
  .tasks { left: 12px; right: 12px; width: auto; bottom: 76px; }
  .search { max-width: none; }
  .modal { max-height: calc(100vh - 16px); }
  .hero-search { min-width: 100%; }
}
.grid.jobs { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
