/* BJ Solutions: softened blue accents with slate surfaces. */
:root {
  color-scheme: light;
  --brand: #087bff;
  --bg: #f1f4f9;
  --card: #ffffff;
  --ink: #233249;
  --muted: #5d6d82;
  --line: #cbd5e3;
  --accent: #2862bd;
  --accent-hover: #2053a4;
  --on-accent: #ffffff;
  --soft: #e8eff9;
  --field: #f7f9fc;
  --paper: #e7edf5;
  --error: #b33243;
  --selection: #2862bd;
  --selection-fill: #2862bd25;
  --handle: #7950b6;
  --shadow: 0 6px 24px #23324908;
}
body.dark {
  color-scheme: dark;
  --bg: #141c28;
  --card: #1d2838;
  --ink: #e6edf7;
  --muted: #afbdd0;
  --line: #42536b;
  --accent: #9bc2ff;
  --accent-hover: #b2d0ff;
  --on-accent: #152740;
  --soft: #293a52;
  --field: #172232;
  --paper: #111b29;
  --error: #ff9da9;
  --selection: #397be0;
  --selection-fill: #397be02b;
  --handle: #9763d0;
  --shadow: 0 6px 24px #00000014;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px 'Segoe UI', sans-serif; }
main { max-width: 1400px; margin: auto; padding: 32px 48px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.badge { letter-spacing: 3px; font-size: 11px; font-weight: 700; color: var(--accent); }
h1 { font-size: 48px; line-height: 1.12; letter-spacing: -2px; margin: 30px 0 12px; }
h1 em { font-style: normal; color: var(--accent); }
.intro, .muted { color: var(--muted); line-height: 1.6; }
nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 28px 0 20px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--ink); padding: 10px 13px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
nav button { background: transparent; border-color: transparent; }
nav button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.workspace { display: grid; grid-template-columns: 370px 1fr; gap: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
h2 { font-size: 18px; margin: 0 0 18px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; display: flex; align-items: center; flex-direction: column; gap: 8px; padding: 22px 10px; background: var(--field); cursor: pointer; font-size: 24px; color: var(--accent); }
.drop:hover { border-color: var(--accent); }
.drop strong { font-size: 14px; }
.drop span { font-size: 11px; color: var(--muted); }
.drop input { width: 100%; font-size: 11px; }
.file { display: flex; align-items: center; gap: 5px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; background: transparent; border: 0; padding: 5px; }
.file.selected { background: var(--soft); border-radius: 7px; box-shadow: inset 3px 0 var(--accent); }
.file button:not(.name) { padding: 4px 7px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
#settings label { display: block; margin: 12px 0 5px; }
input, select, textarea { background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 9px; max-width: 100%; accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=file]::file-selector-button { background: var(--soft); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; margin-right: 8px; cursor: pointer; }
#settings input:not([type=color]), select, textarea { width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); width: 100%; margin-top: 20px; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
#status { font-size: 12px; line-height: 1.5; }
#status.error { color: var(--error); }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.preview-head input { width: 65px; }
.paper { min-height: 420px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; }
canvas { display: none; max-width: 100%; max-height: 760px; object-fit: contain; cursor: crosshair; touch-action: none; box-shadow: 0 4px 20px #0003; }
#empty { margin: auto; text-align: center; color: var(--muted); font-size: 38px; }
#empty span { display: block; font-size: 14px; margin-top: 15px; }
#items { padding-left: 22px; }
#items li { margin: 8px 0; }
#items button { margin-left: 10px; padding: 3px 8px; }
footer { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; color: var(--muted); font-size: 11px; gap: 20px; }
footer a { display: inline-flex; background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; }
footer img { width: 140px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.history-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.history-bar span { font-size: 12px; }
.thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; max-height: 420px; overflow: auto; padding: 6px; margin-bottom: 20px; }
.thumbnail { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--field); overflow: hidden; }
.thumbnail:hover { border-color: var(--accent); }
.thumbnail > button { width: 100%; font-size: 11px; }
.thumbnail img { display: block; width: 90px; height: 120px; object-fit: contain; margin: 8px auto 18px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.page-actions button { padding: 5px; font-size: 11px; }
@media (max-width: 900px) {
  main { padding: 24px 18px; }
  .workspace { grid-template-columns: 1fr; }
  h1 { font-size: 38px; }
  .paper { min-height: 250px; }
  footer { flex-wrap: wrap; }
}

header { justify-content: flex-end; }
#status:empty { display: none; }

.tool-help{display:inline-flex;align-items:center;padding-right:6px}
.help-icon{display:inline-flex;align-items:center;justify-content:center;width:23px;height:23px;padding:0;border:1px solid var(--line);border-radius:50%;font-size:12px;font-weight:700;font-family:Georgia,serif;color:var(--accent);background:var(--soft)}
.tool-tooltip{position:fixed;z-index:1000;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--ink);box-shadow:0 8px 28px #0003;font-size:13px;line-height:1.65;font-weight:400;white-space:normal;pointer-events:auto}
.tool-tooltip[hidden]{display:none}

.documents-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.documents-head h2{margin:0}
