
  :root {
    --bg: #f5f6f8; --card: #ffffff; --text: #1d2330; --muted: #667085;
    --accent: #2457d6; --accent-text: #fff; --border: #d9dde5; --error: #b42318; --ok: #1a7f4b;
  }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #14171f; --card: #1d212c; --text: #e8eaf0; --muted: #98a0b3;
            --accent: #6b93ff; --accent-text: #0d1324; --border: #323848; --error: #ff8a80; --ok: #5ed39a; }
  }
  * { box-sizing: border-box; }
  body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
         background: var(--bg); color: var(--text); line-height: 1.5; }
  main { max-width: 860px; margin: 0 auto; padding: 32px 16px; }
  h1, .xh1 { font-size: 1.6rem; margin: 0 0 4px; }
  p.lead { color: var(--muted); margin: 0 0 24px; }
  .card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
  label { display: block; font-weight: 600; margin-bottom: 6px; }
  input[type=text] { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--border);
                     border-radius: 6px; background: var(--bg); color: var(--text); }
  input[type=text]:focus-visible, button:focus-visible, .thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .hint { color: var(--muted); font-size: .9rem; margin-top: 6px; }
  button { font: inherit; font-weight: 600; padding: 10px 18px; border: 0; border-radius: 6px;
           background: var(--accent); color: var(--accent-text); cursor: pointer; }
  button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 12px; font-weight: 500; }
  button:disabled { opacity: .5; cursor: not-allowed; }
  .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 10px; }
  .row .count { margin-left: auto; color: var(--muted); font-size: .9rem; }
  #grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px;
          max-height: 520px; overflow-y: auto; padding: 4px; }
  .thumb { position: relative; border: 2px solid var(--border); border-radius: 8px; padding: 6px;
           background: var(--bg); cursor: pointer; text-align: center; user-select: none; }
  .thumb .ph { min-height: 150px; display: flex; align-items: center; justify-content: center; }
  .thumb canvas { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
  .thumb .num { font-size: .85rem; color: var(--muted); margin-top: 4px; }
  .thumb.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
  .thumb.sel .num { color: var(--text); font-weight: 600; }
  .thumb .badge { display: none; position: absolute; top: 4px; right: 4px; min-width: 22px; height: 22px; padding: 0 6px;
                  border-radius: 11px; background: var(--accent); color: var(--accent-text);
                  font-size: .78rem; font-weight: 700; line-height: 22px; }
  .thumb.sel .badge { display: block; }
  #msg { margin-top: 12px; min-height: 1.5em; }
  .error { color: var(--error); } .ok { color: var(--ok); }
  .tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
  .tab { background: transparent; color: var(--muted); border-radius: 6px 6px 0 0; padding: 10px 16px;
         border-bottom: 3px solid transparent; margin-bottom: -1px; }
  .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

  #mfiles { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
  .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border: 1px solid var(--border);
          border-left: 5px solid var(--c); border-radius: 6px; background: var(--bg); font-size: .85rem; max-width: 100%; }
  .chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
  .chip small { color: var(--muted); }
  .chip button { padding: 0 6px; }
  #mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px;
           max-height: 560px; overflow-y: auto; padding: 4px; }
  .mt { position: relative; border: 1px solid var(--border); border-bottom: 5px solid var(--c); border-radius: 8px;
        padding: 6px; background: var(--bg); cursor: grab; text-align: center; user-select: none; }
  .mt.dragging { opacity: .35; }
  .mt.mark-before { box-shadow: -5px 0 0 0 var(--accent); }
  .mt.mark-after { box-shadow: 5px 0 0 0 var(--accent); }
  .mt .ph { min-height: 140px; display: flex; align-items: center; justify-content: center; }
  .mt canvas { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); pointer-events: none; }
  .mt .pos { position: absolute; top: 4px; left: 4px; z-index: 1; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
             background: var(--accent); color: var(--accent-text); font-size: .78rem; font-weight: 700; line-height: 22px; }
  .mt .cap { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
  .mt .tb { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
  .mt .tb button { padding: 2px 8px; font-size: .8rem; }
  #mmsg { margin-top: 12px; min-height: 1.5em; }

  .toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
  .toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
  .toolbar label.inl { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: .9rem; }
  .toolbar input[type=color] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
  .toolbar input[type=number] { width: 64px; padding: 6px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
  .toolbar button.tool[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
  .toolbar .grow { margin-left: auto; color: var(--muted); font-size: .9rem; }
  #estage { max-height: 78vh; overflow: auto; background: color-mix(in srgb, var(--text) 12%, var(--bg)); border-radius: 8px; padding: 14px; }
  #epages { width: max-content; min-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; }
  .ephead { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); padding: 0 2px 4px; }
  .ephead .enote { flex: 1; min-width: 0; color: var(--error); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ephead .eacts { margin-left: auto; display: flex; gap: 6px; }
  .ephead button { padding: 3px 12px; font-size: .8rem; background: var(--card); color: var(--text); border: 1px solid var(--border); }
  .ephead button:hover:not(:disabled) { border-color: var(--accent); }
  .ewrap { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); line-height: 0; }
  .ewrap canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
  .ac { touch-action: none; }
  #epages[data-tool=text] .ac, #epages[data-tool=edittext] .ac { cursor: text; }
  #epages[data-tool=draw] .ac, #epages[data-tool=rect] .ac, #epages[data-tool=highlight] .ac, #epages[data-tool=cover] .ac { cursor: crosshair; }
  #etext { position: absolute; margin: 0; padding: 0; border: 0; outline: 1px dashed var(--accent); background: rgba(255,255,255,.6);
           font-family: EditorFont, Arial, sans-serif; line-height: 1.2; resize: none; overflow: hidden; white-space: pre; }
  #emsg { margin-top: 12px; min-height: 1.5em; }

  /* ===== zgłaszanie błędów ===== */
  .report-container { max-width: 980px; }
  .report-main { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: 28px; align-items: start; margin-top: 34px; }
  .report-copy { padding: 8px 4px; }
  .report-copy h1, .report-copy .xh1 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.12; letter-spacing: -0.025em; font-weight: 650; }
  .report-copy > p { margin: 0; max-width: 48ch; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
  .report-benefit { margin-top: 24px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--card) 90%, var(--bg)); }
  .report-benefit strong { display: block; margin-bottom: 4px; font-size: 1rem; }
  .report-benefit span { display: block; color: var(--muted); font-size: .92rem; line-height: 1.55; }
  .report-card { padding: 24px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 12px 28px rgba(0,0,0,.08); }
  .report-card h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; }
  .report-card .report-sub { margin: 0 0 20px; color: var(--muted); font-size: .92rem; line-height: 1.55; }
  .report-form { display: grid; gap: 16px; }
  .report-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .report-field { display: grid; gap: 7px; }
  .report-field.full { grid-column: 1 / -1; }
  .report-field > span { font-size: .9rem; font-weight: 600; }
  .report-field input,
  .report-field select,
  .report-field textarea { width: 100%; padding: 11px 12px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--card-2); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease; }
  .report-field input::placeholder,
  .report-field textarea::placeholder { color: var(--muted) !important; opacity: 1; font-weight: 400; }
  .report-field #bugNick::placeholder { color: var(--muted) !important; opacity: 1; font-weight: 400; }
  /* Nick in the bug report must use exactly the same field styling as the other inputs. */
  .report-field #bugNick {
    background: var(--card-2) !important;
    color: var(--text) !important;
    -webkit-appearance: none;
    appearance: none;
  }
  .report-field #bugNick:-webkit-autofill,
  .report-field #bugNick:-webkit-autofill:hover,
  .report-field #bugNick:-webkit-autofill:focus,
  .report-field #bugNick:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--card-2) inset !important;
    box-shadow: 0 0 0 1000px var(--card-2) inset !important;
    background: var(--card-2) !important;
    color: var(--text) !important;
    caret-color: var(--text);
  }
  .report-field select { appearance: auto; -webkit-appearance: auto; }
  .report-field select:disabled,
  .report-field input:read-only { opacity: 1; }

  /* Browser autofill must follow the active PDFowo theme. */
  .report-field input:-webkit-autofill,
  .report-field input:-webkit-autofill:hover,
  .report-field input:-webkit-autofill:focus,
  .report-field textarea:-webkit-autofill,
  .report-field select:-webkit-autofill {
    -webkit-text-fill-color: var(--text) !important;
    box-shadow: 0 0 0 1000px var(--card-2) inset !important;
    transition: background-color 9999s ease-out 0s;
    caret-color: var(--text);
  }
  body.light-theme .report-field input,
  body.light-theme .report-field select,
  body.light-theme .report-field textarea {
    border-color: #cfd4dc;
    background: #fff;
    color: #1c2433;
  }
  body.light-theme .report-field input::placeholder,
  body.light-theme .report-field textarea::placeholder,
  body.light-theme .report-field #bugNick::placeholder {
    color: #747b86 !important;
  }
  body.light-theme .report-field #bugNick {
    background: #fff !important;
    color: #1c2433 !important;
  }
  body.light-theme .report-field #bugNick:-webkit-autofill,
  body.light-theme .report-field #bugNick:-webkit-autofill:hover,
  body.light-theme .report-field #bugNick:-webkit-autofill:focus,
  body.light-theme .report-field #bugNick:-webkit-autofill:active {
    -webkit-text-fill-color: #1c2433 !important;
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    background: #fff !important;
    color: #1c2433 !important;
    caret-color: #1c2433;
  }
  body.light-theme .report-field input:-webkit-autofill,
  body.light-theme .report-field input:-webkit-autofill:hover,
  body.light-theme .report-field input:-webkit-autofill:focus,
  body.light-theme .report-field textarea:-webkit-autofill,
  body.light-theme .report-field select:-webkit-autofill {
    -webkit-text-fill-color: #1c2433 !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    caret-color: #1c2433;
  }
  body.light-theme .report-file-text {
    border-color: #cfd4dc;
    background: #f7f8fa;
    color: #6f7580;
  }
  body.light-theme .report-file-text::before {
    color: #3f444c;
  }
  body.light-theme .report-file-wrap:hover .report-file-text,
  body.light-theme .report-file-wrap:focus-within .report-file-text {
    border-color: #aeb4bd;
    background: #eef0f3;
    color: #2f343b;
  }
  body.light-theme .report-file-item {
    border-color: #d5d9df;
    background: #f7f8fa;
    color: #30343a;
  }
  body.light-theme .report-file-item .remove:hover,
  body.light-theme .report-file-item .remove:focus-visible {
    color: #20242a;
    background: rgba(0,0,0,.06);
  }

  body.light-theme .report-field select:invalid { color: #747b86; }
  .report-field select:invalid { color: var(--muted); }
  .report-field textarea { min-height: 132px; resize: vertical; line-height: 1.5; }
  .report-field textarea.compact { min-height: 92px; }
  .report-field input:focus-visible,
  .report-field select:focus-visible,
  .report-field textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
  .report-field small { color: var(--muted); font-size: .82rem; font-weight: 400; line-height: 1.45; }
  .report-upload { gap: 8px; }
  .report-file-wrap { position: relative; display: block; }
  .report-file-wrap input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
  .report-file-text { display: flex; align-items: center; min-height: 46px; padding: 11px 12px 11px 42px; position: relative; border: 1px dashed #3c4047; border-radius: 8px; background: #1d2024; color: var(--muted); font-size: .92rem; transition: border-color .15s ease, background .15s ease, color .15s ease; }
  .report-file-text::before { content: "↑"; position: absolute; left: 15px; top: 50%; transform: translateY(-52%); width: 18px; height: 18px; display: grid; place-items: center; font-weight: 800; color: var(--text); }
  .report-file-wrap:hover .report-file-text,
  .report-file-wrap:focus-within .report-file-text { border-color: var(--accent); background: color-mix(in srgb, var(--card) 92%, var(--bg)); color: var(--text); }
  .report-file-list { display: grid; gap: 7px; margin-top: 8px; }
  .report-file-item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; border: 1px solid #3c4047; border-radius: 8px; background: #1d2024; color: var(--text); font-size: .85rem; }
  .report-file-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .report-file-item .remove { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
  .report-file-item .remove:hover, .report-file-item .remove:focus-visible { color: var(--text); background: rgba(255,255,255,.06); }
  .report-file-limit { margin: 6px 0 0; color: var(--muted); font-size: .78rem; }
  .report-submit { display: block; margin-top: 2px; }
  .report-submit button { display: block; width: 100%; padding: 13px 20px; }
  .report-status { min-height: 1.4em; margin: -2px 0 0; font-size: .9rem; color: var(--muted); }
  .report-status.ok { color: var(--ok); }
  .report-status.error { color: var(--error); }
  .report-how { margin-top: 52px; padding-top: 28px; border-top: 1px solid var(--border); }
  .report-how h2 { margin: 0 0 20px; text-align: center; font-size: 1.35rem; font-weight: 600; }
  .report-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .report-step { padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
  .report-step .num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: .88rem; margin-bottom: 12px; }
  .report-step strong { display: block; margin-bottom: 4px; font-size: .96rem; }
  .report-step span { display: block; color: var(--muted); font-size: .88rem; line-height: 1.55; }
  .report-note { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .84rem; line-height: 1.5; }
  .footer-report { margin-left: auto; }
  .footer-legal { display: inline-flex; gap: 16px; flex-wrap: wrap; }
  .footer-legal a { color: var(--muted); text-decoration: none; font-size: .78rem; line-height: 1.2; }
  .footer-legal a:hover, .footer-legal a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .legal-container { max-width: 760px; padding-bottom: 48px; }
  .legal-container h1, .legal-container .xh1 { margin-bottom: 6px; }
  .legal-container h2 { font-size: 1.1rem; margin: 26px 0 8px; }
  .legal-container p, .legal-container li { color: var(--muted); line-height: 1.65; }
  .legal-container ul { padding-left: 20px; }
  .legal-container .legal-date { font-size: .85rem; }
  .footer-report a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; font-size: .78rem; line-height: 1.2; white-space: nowrap; transition: color .15s ease, text-decoration-color .15s ease; }
  .footer-report a::after { content: "→"; opacity: 0; transform: translateX(-3px); transition: opacity .15s ease, transform .15s ease; }
  .footer-report a:hover, .footer-report a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .footer-report a:hover::after, .footer-report a:focus-visible::after { opacity: 1; transform: translateX(0); }
  .footer-report .ico { display: none; }
  .footer-report .copy { display: inline; }
  .footer-report .title { display: inline; font-weight: 600; font-size: inherit; margin: 0; }
  .footer-report .desc { display: inline; color: inherit; font-size: inherit; line-height: inherit; }
  .footer-report .arrow { display: none; }
  @media (max-width: 760px) {
    .report-main { grid-template-columns: 1fr; margin-top: 24px; }
    .report-copy { padding: 0; }
    .report-steps { grid-template-columns: 1fr; }
  }
  @media (max-width: 560px) {
    .report-container { padding-bottom: 48px; }
    .report-card { padding: 18px; }
    .report-form-grid { grid-template-columns: 1fr; }
    .report-field.full { grid-column: auto; }
    .report-submit { align-items: flex-start; flex-direction: column; }
    .footer-report { margin-left: 0; }
  }

  /* ===== wygląd strony ===== */
  :root { --bg: #EEF1F5; --desk: #E3E8EF; --card: #FFFFFF; --text: #1C2433; --muted: #5B6577; --accent: #2445C7; --accent-text: #FFFFFF;
          --border: #D5DBE4; --red: #C8372D; --error: #B42318; --ok: #1A7F4B; }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #12161D; --desk: #0D1117; --card: #1A1F29; --text: #E6E9EF; --muted: #9AA3B2; --accent: #7B97FF; --accent-text: #0B1230;
            --border: #2C3341; --red: #FF8A7F; --error: #FF8A80; --ok: #5ED39A; }
  }
  body { font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; -webkit-font-smoothing: antialiased; }
  main { max-width: none; margin: 0; padding: 0; }
  button { border-radius: 8px; }
  a { color: var(--accent); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .topbar { background: var(--card); border-bottom: 1px solid var(--border); }
  .topbar .in { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 12px; }
  .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
  .logo, .logo img { display: block; height: 40px; width: auto; }
  .appbar .appname { display: inline-flex; align-items: center; gap: 10px; }
  .appbar .logo, .appbar .logo img { height: 30px; width: 30px; }
  .topbar .local { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
  .topbar .local svg { width: 16px; height: 16px; }
  .brand { white-space: nowrap; }
  .global-nav { background: transparent; border: 0; }
  .global-nav .in { max-width: 1120px; margin: 0 auto; padding: 18px 24px 4px; box-sizing: border-box; }
  .global-nav .back { margin: 0; }
  .global-nav.account-nav-mode .back { font-weight: 500; }
  .view:not(.app) .back { display: none; }
  body.app-mode .global-nav { display: none; }
  @media (max-width: 520px) {
    .topbar .local { display: none; }
    .global-nav .in { padding: 14px 18px 2px; }
    .container { padding: 32px 18px 56px; }
  }

  .container { max-width: 1120px; margin: 0 auto; padding: 48px 24px 72px; }
  .container.narrow { max-width: 920px; padding-top: 28px; }

  .hero { max-width: 760px; margin-bottom: 40px; }
  .hero h1, .hero .xh1 { font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 16px; }
  .hero p { font-size: 1.125rem; line-height: 1.6; color: var(--muted); margin: 0; max-width: 60ch; }

  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
  .tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 14px;
          color: var(--text); text-decoration: none; overflow: hidden; transition: border-color .15s ease; }
  .tile:hover { border-color: var(--accent); }
  .tile .art { height: 168px; background: var(--desk); border-bottom: 1px solid var(--border); display: grid; place-items: center; }
  .tile .art svg { width: 240px; max-width: 86%; height: auto; }
  .tile .tb { padding: 18px 22px 20px; }
  .tile h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
  .tile:hover h2 { color: var(--accent); }
  .tile p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }
  .tile ul { margin: 0; padding: 0; list-style: none; font-size: .92rem; }
  .tile li { position: relative; padding-left: 18px; margin-bottom: 6px; }
  .tile li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); opacity: .7; }
  .tile .cta { margin-top: auto; padding: 14px 24px 22px; font-weight: 600; color: var(--accent); }
  .tile:hover .cta { text-decoration: underline; text-underline-offset: 3px; }

  .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border); }
  .facts h3 { font-size: 1rem; font-weight: 600; margin: 0 0 6px; }
  .facts p { margin: 0; color: var(--muted); line-height: 1.55; font-size: .95rem; }
  .footer { border-top: 1px solid var(--border); }
  .footer .in { max-width: 1120px; margin: 0 auto; padding: 20px 24px; color: var(--muted); font-size: .875rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
  body { min-height: 100vh; display: flex; flex-direction: column; }
  body > main { flex: 1 0 auto; }
  .footer { flex: none; background: var(--card); }

  .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
  .back svg { width: 18px; height: 18px; }
  .back:hover { color: var(--text); }
  .viewhead { display: flex; align-items: center; gap: 16px; margin: 18px 0 24px; }
  .viewhead .vi { width: 52px; height: 52px; flex: none; border-radius: 12px; background: var(--card); border: 1px solid var(--border); display: grid; place-items: center; }
  .viewhead .vi svg { width: 30px; height: 30px; }
  .viewhead h1, .viewhead .xh1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 2px; }
  .viewhead p { margin: 0; color: var(--muted); }
  .card { border-radius: 12px; padding: 22px; }

  /* ===== edytor jako aplikacja na pełny ekran ===== */
  body.app-mode { overflow: hidden; }
  body.app-mode .topbar, body.app-mode .footer { display: none; }
  .view.app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 5; }
  #tool-edit:has(#eempty:not([hidden])) { position: static; inset: auto; z-index: auto; flex: 1 0 auto; min-height: auto; background: transparent; }
  #tool-edit:has(#eempty:not([hidden])) > .appbar { display: none; }
  .appbar { flex: none; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--border); }
  .appbar .appname { font-weight: 600; }
  .appbar .filename { color: var(--muted); font-size: .9rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .appbar .sp { flex: 1; }
  .appbar button { padding: 8px 16px; white-space: nowrap; }
  .appbar .zoom { flex: none; }
  .appbar .zoom button { padding: 6px 12px; }
  .appbar .sm { display: none; }
  .toolbar #eundo, .toolbar #edel { padding: 7px 10px; }
  .appbar .div { width: 1px; height: 24px; background: var(--border); }
  .empty { flex: 1; display: grid; place-items: center; padding: 24px; }
  .workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .workspace .toolbar { flex: none; margin: 0; padding: 8px 16px; gap: 8px; background: var(--card); border-bottom: 1px solid var(--border); }
  #etools { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  #etools .tool { border: 0; border-radius: 0; border-right: 1px solid var(--border); padding: 7px 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
  #etools .tool:last-child { border-right: 0; }
  .toolbar svg { width: 16px; height: 16px; flex: none; }
  .toolbar .ghost { padding: 7px 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
  .zoom { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .zoom button { border: 0; border-radius: 0; padding: 7px 12px; }
  .zoom span { min-width: 4.2em; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; }
  #estage { flex: 1; min-height: 0; max-height: none; border-radius: 0; padding: 28px; background: var(--desk); }
  #emsg { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; margin: 0; min-height: 0; max-width: min(640px, 92vw);
          padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--card); font-size: .92rem; box-shadow: 0 6px 24px rgba(16,24,40,.25); }
  #emsg:empty { display: none; }
  #emsg.error { background: #8F1D14; color: #fff; }
  #emsg.ok { background: #14532D; color: #fff; }
  @media (max-width: 1100px) { #etools .tool span { display: none; } }
  @media (max-width: 640px) { .toolbar .ghost span { display: none; } .appbar { gap: 8px; padding: 0 10px; } .appbar .filename, .appbar .appname, .appbar .div { display: none; }
    .appbar .lg, .appbar .bt { display: none; } .appbar .sm { display: inline; } .appbar button { padding: 8px 10px; } .appbar .zoom button { padding: 6px 8px; } #estage { padding: 14px 10px; } .zoom span { min-width: 3em; } .toolbar .sep { display: none; } }

  /* ===== pole na pliki ===== */
  .dzwrap { margin-bottom: 18px; }
  .dz { position: relative; width: min(420px, 100%); aspect-ratio: 1 / 1; margin: 0 auto; padding: 28px; box-sizing: border-box;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
        background: var(--card); border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 22px;
        color: var(--muted); cursor: pointer; overflow: hidden;
        transition: border-color .2s ease, background-color .2s ease, transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; }
  .dz:hover { border-color: var(--accent); }
  .dz:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
  .dz.over { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card));
             transform: scale(1.025); box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--accent) 55%, transparent); }
  .dz p { margin: 0; }
  .dz-art { width: 132px; height: 132px; flex: none; }
  .dz-art svg { width: 100%; height: 100%; overflow: visible; }
  .dz-disc { fill: var(--bg); transition: fill .2s ease; }
  .dz.over .dz-disc { fill: color-mix(in srgb, var(--accent) 14%, var(--card)); }
  .dz-paper { fill: var(--card); stroke: var(--accent); stroke-width: 2.5; }
  .dz-fold { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
  .dz-line { fill: color-mix(in srgb, var(--accent) 25%, var(--card)); }
  .dz-badge { fill: var(--red); }
  .dz-badge-t { fill: #fff; font: 700 9.5px "IBM Plex Sans", system-ui, sans-serif; letter-spacing: .02em; }
  .dz-doc { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
  .dz:hover .dz-doc { transform: translateY(-4px); }
  .dz.over .dz-doc { transform: translateY(-14px) rotate(-6deg); }
  .dz-check { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.4); }
  .dz-check circle { fill: var(--ok); }
  .dz-check path { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
  .dz.got .dz-doc { animation: dz-drop .75s cubic-bezier(.3,1.25,.5,1) both; }
  .dz.got .dz-check { animation: dz-pop .45s .5s cubic-bezier(.3,1.6,.5,1) forwards; }
  .dz.got .dz-check path { animation: dz-tick .35s .72s ease-out forwards; }
  @keyframes dz-drop { 0% { transform: translateY(-80px) rotate(-10deg); opacity: 0; } 45% { opacity: 1; }
                       60% { transform: translateY(6px) rotate(2deg) scaleY(.96); } 78% { transform: translateY(-3px) rotate(0); } 100% { transform: none; } }
  @keyframes dz-pop { to { opacity: 1; transform: scale(1); } }
  @keyframes dz-tick { to { stroke-dashoffset: 0; } }
  .dz-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .dz-title { font-size: 1.2rem; font-weight: 600; color: var(--text); }
  .dz-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  .dz-file { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dz-change { display: none; font-size: .88rem; }
  .dz.compact { width: 100%; aspect-ratio: auto; flex-direction: row; justify-content: flex-start; text-align: left; gap: 16px; padding: 12px 20px; border-radius: 14px; }
  .dz.compact .dz-art { width: 56px; height: 56px; }
  .dz.compact .dz-title, .dz.compact .dz-sub { display: none; }
  .dz.compact .dz-change { display: block; }
  .dz.compact.over { transform: scale(1.01); }
  @media (prefers-reduced-motion: reduce) {
    .dz, .dz * { transition: none !important; animation: none !important; }
    .dz.got .dz-check { opacity: 1; transform: none; } .dz.got .dz-check path { stroke-dashoffset: 0; }
  }

  /* ===== nagłówek narzędzia nad polem na pliki, pusty stan na środku ekranu ===== */
  main { display: flex; flex-direction: column; }
  .view:not([hidden]):not(.app) { flex: 1 0 auto; display: flex; flex-direction: column; }
  .view:not(.app) > .container { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
  .view.tool > .container { display: flex; flex-direction: column; }
  .view.tool .back { align-self: flex-start; }
  .toolhead { text-align: center; max-width: 640px; margin: 28px auto 28px; }
  .toolhead h1, .toolhead .xh1 { font-size: clamp(1.9rem, 3.2vw, 2.5rem); line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
  .toolhead p { margin: 0; color: var(--muted); font-size: 1.06rem; line-height: 1.55; }
  .view.tool.is-empty .toolhead { margin-top: auto; }
  .view.tool.is-empty .dzwrap { margin-bottom: auto; padding-bottom: 24px; }
  .view.tool.is-empty .tool-info-cards { margin-top: 0; }
  .view.tool:not(.is-empty) .toolhead { margin: 12px auto 20px; }
  .view.tool:not(.is-empty) .toolhead h1, .view.tool:not(.is-empty) .toolhead .xh1 { font-size: 1.6rem; margin-bottom: 4px; }
  .emptyin { width: min(680px, 100%); }
  .emptyin .toolhead { margin: 0 auto 26px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty { flex:1; width:100%; display:flex; flex-direction:column; align-items:center; box-sizing:border-box; padding:0; min-height:0; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .emptyin { width:min(920px,100%); height:auto; min-height:0; flex:1 1 auto; display:flex; flex-direction:column; box-sizing:border-box; padding:28px 24px 72px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .toolhead { margin:8.8125px auto 28px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .dzwrap { width:100%; margin-bottom:24px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .tool-info-cards { width:100%; margin-top:auto !important; }
  #tool-edit:has(#eempty:not([hidden])) #eempty #edrop { margin:0 auto; }
  @media (max-width:700px) {
    #tool-edit:has(#eempty:not([hidden])) #eempty .emptyin { padding-top:28px; padding-bottom:48px; }
    #tool-edit:has(#eempty:not([hidden])) #eempty .tool-info-cards { margin-top:auto !important; }
  }

  /* ===== otwarty układ stron + przenoszenie z animacją ===== */
  .view.tool:not(.is-empty) > .container.narrow { max-width: 1240px; }
  .mopts { margin-top: 6px; }
  .mhead h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px; }
  .mhead .hint { margin: 0 0 14px; }
  .grip-inline svg { width: 9px; height: 14px; vertical-align: -2px; fill: var(--muted); }
  #grid, #mgrid { max-height: none; overflow: visible; padding: 4px 0; }
  #mgrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 16px; }
  .actionbar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
               margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--border);
               background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .actionbar .count { margin-left: auto; color: var(--muted); font-size: .9rem; }
  .actionbar #go { margin-left: auto; }
  .actionbar #mgo, .actionbar #go { padding: 11px 22px; }
  .mt { cursor: grab; border-radius: 10px; padding: 8px 8px 6px; background: var(--card); touch-action: auto; }
  .mt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
  .mt .ph { min-height: 150px; }
  .mt canvas { -webkit-user-drag: none; }
  .mt .del { position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; padding: 0; border-radius: 50%;
             background: var(--card); color: var(--text); border: 1px solid var(--border); font-size: .8rem; line-height: 1;
             opacity: 0; transition: opacity .15s ease; display: inline-flex; align-items: center; justify-content: center; }
  .mt .del svg { width: 14px; height: 14px; }
  .mt:hover .del, .mt:focus-within .del { opacity: 1; }
  .mt .del:hover { color: #fff; background: var(--error); border-color: var(--error); }
  @media (hover: none) { .mt .del { opacity: 1; } }
  .mt-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
  .grip { display: inline-flex; padding: 3px 2px; border-radius: 4px; touch-action: none; cursor: grab; flex: none; }
  .grip svg { width: 10px; height: 16px; fill: var(--muted); }
  .mt:hover .grip svg { fill: var(--accent); }
  .mt .cap { flex: 1; min-width: 0; margin: 0; text-align: left; }
  .mt.lifted { opacity: .35; border-style: dashed; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
  .mt.lifted > * { visibility: hidden; }
  .mt-ghost { position: fixed; z-index: 60; margin: 0; pointer-events: none; cursor: grabbing;
              box-shadow: 0 2px 6px rgba(16,24,40,.12); transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease; }
  .mt-ghost.up { transform: rotate(2.5deg) scale(1.06); box-shadow: 0 26px 50px -14px rgba(16,24,40,.45); }
  .mt-ghost .del { display: none; }
  body.dragging-tile, body.dragging-tile * { cursor: grabbing !important; user-select: none; }

  .dz-remove { display: none; margin-left: auto; flex: none; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
               background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
  .dz-remove svg { width: 16px; height: 16px; }
  .dz.compact .dz-remove { display: inline-flex; }
  .dz-remove:hover { color: #fff; background: var(--error); border-color: var(--error); }
  @media (max-width: 520px) { .dz-remove span { display: none; } }

  /* ===== kompresor PDF ===== */
  .compress-panel { margin-top: 8px; }
  .compress-box { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
  .compress-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 5px; }
  .compress-sub { color: var(--muted); margin: 0 0 18px; font-size: .92rem; }
  .compress-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .compress-option { position: relative; }
  .compress-option input { position: absolute; opacity: 0; pointer-events: none; }
  .compress-option label { display: block; margin: 0; padding: 14px 14px 13px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--bg) 55%, var(--card)); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
  .compress-option label:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
  .compress-option input:checked + label { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
  .compress-option .name { display: block; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .compress-option .desc { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; font-weight: 400; }
  .compress-note { margin: 14px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
  .compress-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
  .compress-status { margin-left: auto; color: var(--muted); font-size: .9rem; }
  .compress-status.ok { color: var(--ok); }
  .compress-status.error { color: var(--error); }
  @media (max-width: 700px) {
    .compress-options { grid-template-columns: 1fr; }
    .compress-status { width: 100%; margin-left: 0; }
  }

  [hidden] { display: none !important; }


  /* ===== wygląd strony ===== */
  :root { --bg: #EEF1F5; --desk: #E3E8EF; --card: #FFFFFF; --text: #1C2433; --muted: #5B6577; --accent: #2445C7; --accent-text: #FFFFFF;
          --border: #D5DBE4; --red: #C8372D; --error: #B42318; --ok: #1A7F4B; }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #12161D; --desk: #0D1117; --card: #1A1F29; --text: #E6E9EF; --muted: #9AA3B2; --accent: #7B97FF; --accent-text: #0B1230;
            --border: #2C3341; --red: #FF8A7F; --error: #FF8A80; --ok: #5ED39A; }
  }
  body { font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; -webkit-font-smoothing: antialiased; }
  main { max-width: none; margin: 0; padding: 0; }
  button { border-radius: 8px; }
  a { color: var(--accent); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .topbar { background: var(--card); border-bottom: 1px solid var(--border); }
  .topbar .in { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 12px; }
  .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
  .logo, .logo img { display: block; height: 40px; width: auto; }
  .appbar .appname { display: inline-flex; align-items: center; gap: 10px; }
  .appbar .logo, .appbar .logo img { height: 30px; width: 30px; }
  .topbar .local { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
  .topbar .local svg { width: 16px; height: 16px; }
  .brand { white-space: nowrap; }
  .global-nav { background: transparent; border: 0; }
  .global-nav .in { max-width: 1120px; margin: 0 auto; padding: 18px 24px 4px; box-sizing: border-box; }
  .global-nav .back { margin: 0; }
  .view:not(.app) .back { display: none; }
  body.app-mode .global-nav { display: none; }
  @media (max-width: 520px) {
    .topbar .local { display: none; }
    .global-nav .in { padding: 14px 18px 2px; }
    .container { padding: 32px 18px 56px; }
  }

  .container { max-width: 1120px; margin: 0 auto; padding: 48px 24px 72px; }
  .container.narrow { max-width: 920px; padding-top: 28px; }

  .hero { max-width: 760px; margin-bottom: 40px; }
  .hero h1, .hero .xh1 { font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 16px; }
  .hero p { font-size: 1.125rem; line-height: 1.6; color: var(--muted); margin: 0; max-width: 60ch; }

  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
  .tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 14px;
          color: var(--text); text-decoration: none; overflow: hidden; transition: border-color .15s ease; }
  .tile:hover { border-color: var(--accent); }
  .tile .art { height: 168px; background: var(--desk); border-bottom: 1px solid var(--border); display: grid; place-items: center; }
  .tile .art svg { width: 240px; max-width: 86%; height: auto; }
  .tile .tb { padding: 18px 22px 20px; }
  .tile h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
  .tile:hover h2 { color: var(--accent); }
  .tile p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }
  .tile ul { margin: 0; padding: 0; list-style: none; font-size: .92rem; }
  .tile li { position: relative; padding-left: 18px; margin-bottom: 6px; }
  .tile li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); opacity: .7; }
  .tile .cta { margin-top: auto; padding: 14px 24px 22px; font-weight: 600; color: var(--accent); }
  .tile:hover .cta { text-decoration: underline; text-underline-offset: 3px; }

  .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border); }
  .facts h3 { font-size: 1rem; font-weight: 600; margin: 0 0 6px; }
  .facts p { margin: 0; color: var(--muted); line-height: 1.55; font-size: .95rem; }
  .footer { border-top: 1px solid var(--border); }
  .footer .in { max-width: 1120px; margin: 0 auto; padding: 20px 24px; color: var(--muted); font-size: .875rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
  body { min-height: 100vh; display: flex; flex-direction: column; }
  body > main { flex: 1 0 auto; }
  .footer { flex: none; background: var(--card); }

  .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
  .back svg { width: 18px; height: 18px; }
  .back:hover { color: var(--text); }
  .viewhead { display: flex; align-items: center; gap: 16px; margin: 18px 0 24px; }
  .viewhead .vi { width: 52px; height: 52px; flex: none; border-radius: 12px; background: var(--card); border: 1px solid var(--border); display: grid; place-items: center; }
  .viewhead .vi svg { width: 30px; height: 30px; }
  .viewhead h1, .viewhead .xh1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 2px; }
  .viewhead p { margin: 0; color: var(--muted); }
  .card { border-radius: 12px; padding: 22px; }

  /* ===== edytor jako aplikacja na pełny ekran ===== */
  body.app-mode { overflow: hidden; }
  body.app-mode .topbar, body.app-mode .footer { display: none; }
  .view.app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 5; }
  #tool-edit:has(#eempty:not([hidden])) { position: static; inset: auto; z-index: auto; flex: 1 0 auto; min-height: auto; background: transparent; }
  #tool-edit:has(#eempty:not([hidden])) > .appbar { display: none; }
  .appbar { flex: none; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--border); }
  .appbar .appname { font-weight: 600; }
  .appbar .filename { color: var(--muted); font-size: .9rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .appbar .sp { flex: 1; }
  .appbar button { padding: 8px 16px; white-space: nowrap; }
  .appbar .zoom { flex: none; }
  .appbar .zoom button { padding: 6px 12px; }
  .appbar .sm { display: none; }
  .toolbar #eundo, .toolbar #edel { padding: 7px 10px; }
  .appbar .div { width: 1px; height: 24px; background: var(--border); }
  .empty { flex: 1; display: grid; place-items: center; padding: 24px; }
  .workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .workspace .toolbar { flex: none; margin: 0; padding: 8px 16px; gap: 8px; background: var(--card); border-bottom: 1px solid var(--border); }
  #etools { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  #etools .tool { border: 0; border-radius: 0; border-right: 1px solid var(--border); padding: 7px 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
  #etools .tool:last-child { border-right: 0; }
  .toolbar svg { width: 16px; height: 16px; flex: none; }
  .toolbar .ghost { padding: 7px 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
  .zoom { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .zoom button { border: 0; border-radius: 0; padding: 7px 12px; }
  .zoom span { min-width: 4.2em; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; }
  #estage { flex: 1; min-height: 0; max-height: none; border-radius: 0; padding: 28px; background: var(--desk); }
  #emsg { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; margin: 0; min-height: 0; max-width: min(640px, 92vw);
          padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--card); font-size: .92rem; box-shadow: 0 6px 24px rgba(16,24,40,.25); }
  #emsg:empty { display: none; }
  #emsg.error { background: #8F1D14; color: #fff; }
  #emsg.ok { background: #14532D; color: #fff; }
  @media (max-width: 1100px) { #etools .tool span { display: none; } }
  @media (max-width: 640px) { .toolbar .ghost span { display: none; } .appbar { gap: 8px; padding: 0 10px; } .appbar .filename, .appbar .appname, .appbar .div { display: none; }
    .appbar .lg, .appbar .bt { display: none; } .appbar .sm { display: inline; } .appbar button { padding: 8px 10px; } .appbar .zoom button { padding: 6px 8px; } #estage { padding: 14px 10px; } .zoom span { min-width: 3em; } .toolbar .sep { display: none; } }

  /* ===== pole na pliki ===== */
  .dzwrap { margin-bottom: 18px; }
  .dz { position: relative; width: min(420px, 100%); aspect-ratio: 1 / 1; margin: 0 auto; padding: 28px; box-sizing: border-box;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
        background: var(--card); border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 22px;
        color: var(--muted); cursor: pointer; overflow: hidden;
        transition: border-color .2s ease, background-color .2s ease, transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; }
  .dz:hover { border-color: var(--accent); }
  .dz:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
  .dz.over { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card));
             transform: scale(1.025); box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--accent) 55%, transparent); }
  .dz p { margin: 0; }
  .dz-art { width: 132px; height: 132px; flex: none; }
  .dz-art svg { width: 100%; height: 100%; overflow: visible; }
  .dz-disc { fill: var(--bg); transition: fill .2s ease; }
  .dz.over .dz-disc { fill: color-mix(in srgb, var(--accent) 14%, var(--card)); }
  .dz-paper { fill: var(--card); stroke: var(--accent); stroke-width: 2.5; }
  .dz-fold { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
  .dz-line { fill: color-mix(in srgb, var(--accent) 25%, var(--card)); }
  .dz-badge { fill: var(--red); }
  .dz-badge-t { fill: #fff; font: 700 9.5px "IBM Plex Sans", system-ui, sans-serif; letter-spacing: .02em; }
  .dz-doc { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
  .dz:hover .dz-doc { transform: translateY(-4px); }
  .dz.over .dz-doc { transform: translateY(-14px) rotate(-6deg); }
  .dz-check { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.4); }
  .dz-check circle { fill: var(--ok); }
  .dz-check path { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
  .dz.got .dz-doc { animation: dz-drop .75s cubic-bezier(.3,1.25,.5,1) both; }
  .dz.got .dz-check { animation: dz-pop .45s .5s cubic-bezier(.3,1.6,.5,1) forwards; }
  .dz.got .dz-check path { animation: dz-tick .35s .72s ease-out forwards; }
  @keyframes dz-drop { 0% { transform: translateY(-80px) rotate(-10deg); opacity: 0; } 45% { opacity: 1; }
                       60% { transform: translateY(6px) rotate(2deg) scaleY(.96); } 78% { transform: translateY(-3px) rotate(0); } 100% { transform: none; } }
  @keyframes dz-pop { to { opacity: 1; transform: scale(1); } }
  @keyframes dz-tick { to { stroke-dashoffset: 0; } }
  .dz-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .dz-title { font-size: 1.2rem; font-weight: 600; color: var(--text); }
  .dz-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  .dz-file { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dz-change { display: none; font-size: .88rem; }
  .dz.compact { width: 100%; aspect-ratio: auto; flex-direction: row; justify-content: flex-start; text-align: left; gap: 16px; padding: 12px 20px; border-radius: 14px; }
  .dz.compact .dz-art { width: 56px; height: 56px; }
  .dz.compact .dz-title, .dz.compact .dz-sub { display: none; }
  .dz.compact .dz-change { display: block; }
  .dz.compact.over { transform: scale(1.01); }
  @media (prefers-reduced-motion: reduce) {
    .dz, .dz * { transition: none !important; animation: none !important; }
    .dz.got .dz-check { opacity: 1; transform: none; } .dz.got .dz-check path { stroke-dashoffset: 0; }
  }

  /* ===== nagłówek narzędzia nad polem na pliki, pusty stan na środku ekranu ===== */
  main { display: flex; flex-direction: column; }
  .view:not([hidden]):not(.app) { flex: 1 0 auto; display: flex; flex-direction: column; }
  .view:not(.app) > .container { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
  .view.tool > .container { display: flex; flex-direction: column; }
  .view.tool .back { align-self: flex-start; }
  .toolhead { text-align: center; max-width: 640px; margin: 28px auto 28px; }
  .toolhead h1, .toolhead .xh1 { font-size: clamp(1.9rem, 3.2vw, 2.5rem); line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
  .toolhead p { margin: 0; color: var(--muted); font-size: 1.06rem; line-height: 1.55; }
  .view.tool.is-empty .toolhead { margin-top: auto; }
  .view.tool.is-empty .dzwrap { margin-bottom: auto; padding-bottom: 24px; }
  .view.tool.is-empty .tool-info-cards { margin-top: 0; }
  .view.tool:not(.is-empty) .toolhead { margin: 12px auto 20px; }
  .view.tool:not(.is-empty) .toolhead h1, .view.tool:not(.is-empty) .toolhead .xh1 { font-size: 1.6rem; margin-bottom: 4px; }
  .emptyin { width: min(680px, 100%); }
  .emptyin .toolhead { margin: 0 auto 26px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty { flex:1; width:100%; display:flex; flex-direction:column; align-items:center; box-sizing:border-box; padding:0; min-height:0; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .emptyin { width:min(920px,100%); height:auto; min-height:0; flex:1 1 auto; display:flex; flex-direction:column; box-sizing:border-box; padding:28px 24px 72px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .toolhead { margin:8.8125px auto 28px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .dzwrap { width:100%; margin-bottom:24px; }
  #tool-edit:has(#eempty:not([hidden])) #eempty .tool-info-cards { width:100%; margin-top:auto !important; }
  #tool-edit:has(#eempty:not([hidden])) #eempty #edrop { margin:0 auto; }
  @media (max-width:700px) {
    #tool-edit:has(#eempty:not([hidden])) #eempty .emptyin { padding-top:28px; padding-bottom:48px; }
    #tool-edit:has(#eempty:not([hidden])) #eempty .tool-info-cards { margin-top:auto !important; }
  }

  /* ===== otwarty układ stron + przenoszenie z animacją ===== */
  .view.tool:not(.is-empty) > .container.narrow { max-width: 1240px; }
  .mopts { margin-top: 6px; }
  .mhead h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px; }
  .mhead .hint { margin: 0 0 14px; }
  .grip-inline svg { width: 9px; height: 14px; vertical-align: -2px; fill: var(--muted); }
  #grid, #mgrid { max-height: none; overflow: visible; padding: 4px 0; }
  #mgrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 16px; }
  .actionbar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
               margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--border);
               background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .actionbar .count { margin-left: auto; color: var(--muted); font-size: .9rem; }
  .actionbar #go { margin-left: auto; }
  .actionbar #mgo, .actionbar #go { padding: 11px 22px; }
  .mt { cursor: grab; border-radius: 10px; padding: 8px 8px 6px; background: var(--card); touch-action: auto; }
  .mt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
  .mt .ph { min-height: 150px; }
  .mt canvas { -webkit-user-drag: none; }
  .mt .del { position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; padding: 0; border-radius: 50%;
             background: var(--card); color: var(--text); border: 1px solid var(--border); font-size: .8rem; line-height: 1;
             opacity: 0; transition: opacity .15s ease; display: inline-flex; align-items: center; justify-content: center; }
  .mt .del svg { width: 14px; height: 14px; }
  .mt:hover .del, .mt:focus-within .del { opacity: 1; }
  .mt .del:hover { color: #fff; background: var(--error); border-color: var(--error); }
  @media (hover: none) { .mt .del { opacity: 1; } }
  .mt-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
  .grip { display: inline-flex; padding: 3px 2px; border-radius: 4px; touch-action: none; cursor: grab; flex: none; }
  .grip svg { width: 10px; height: 16px; fill: var(--muted); }
  .mt:hover .grip svg { fill: var(--accent); }
  .mt .cap { flex: 1; min-width: 0; margin: 0; text-align: left; }
  .mt.lifted { opacity: .35; border-style: dashed; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
  .mt.lifted > * { visibility: hidden; }
  .mt-ghost { position: fixed; z-index: 60; margin: 0; pointer-events: none; cursor: grabbing;
              box-shadow: 0 2px 6px rgba(16,24,40,.12); transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease; }
  .mt-ghost.up { transform: rotate(2.5deg) scale(1.06); box-shadow: 0 26px 50px -14px rgba(16,24,40,.45); }
  .mt-ghost .del { display: none; }
  body.dragging-tile, body.dragging-tile * { cursor: grabbing !important; user-select: none; }

  .dz-remove { display: none; margin-left: auto; flex: none; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
               background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
  .dz-remove svg { width: 16px; height: 16px; }
  .dz.compact .dz-remove { display: inline-flex; }
  .dz-remove:hover { color: #fff; background: var(--error); border-color: var(--error); }
  @media (max-width: 520px) { .dz-remove span { display: none; } }

  /* ===== kompresor PDF ===== */
  .compress-panel { margin-top: 8px; }
  .compress-box { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
  .compress-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 5px; }
  .compress-sub { color: var(--muted); margin: 0 0 18px; font-size: .92rem; }
  .compress-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .compress-option { position: relative; }
  .compress-option input { position: absolute; opacity: 0; pointer-events: none; }
  .compress-option label { display: block; margin: 0; padding: 14px 14px 13px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--bg) 55%, var(--card)); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
  .compress-option label:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
  .compress-option input:checked + label { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
  .compress-option .name { display: block; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .compress-option .desc { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; font-weight: 400; }
  .compress-note { margin: 14px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
  .cmp-keep { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
  .cmp-keep input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
  .cmp-sw { flex: none; position: relative; width: 36px; height: 21px; margin-top: 1px; border-radius: 99px; background: color-mix(in srgb, var(--text) 22%, transparent); transition: background .15s; }
  .cmp-sw::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
  .cmp-keep input:checked + .cmp-sw { background: var(--accent); }
  .cmp-keep input:checked + .cmp-sw::after { transform: translateX(15px); }
  .cmp-keep input:focus-visible + .cmp-sw { outline: 2px solid var(--accent); outline-offset: 2px; }
  .cmp-keep-t { display: grid; gap: 3px; }
  .cmp-keep-t strong { font-size: .92rem; }
  .cmp-keep-t small { color: var(--muted); font-size: .8rem; line-height: 1.4; }
  .compress-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
  .compress-status { margin-left: auto; color: var(--muted); font-size: .9rem; }
  .compress-status.ok { color: var(--ok); }
  .compress-status.error { color: var(--error); }
  @media (max-width: 700px) {
    .compress-options { grid-template-columns: 1fr; }
    .compress-status { width: 100%; margin-left: 0; }
  }

  [hidden] { display: none !important; }
