:root { --bg:#f6f1ec; --card:#fff; --ink:#2b2320; --muted:#7a6f69; --line:#e6ddd6; --pink:#e8a2b4; --pink-d:#c9718a; --brown:#8a5a44; --ok:#3f8f5a; --err:#c0392b; }
* { box-sizing:border-box; }
body { margin:0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background:var(--bg); color:var(--ink); font-size:15px; }
.top { display:flex; align-items:center; justify-content:space-between; padding:10px 20px; background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:5; }
.brand { font-weight:800; letter-spacing:.5px; color:var(--brown); }
.brand span { font-weight:400; color:var(--muted); margin-left:8px; font-size:13px; }
nav { display:flex; gap:6px; align-items:center; }
.tab { background:none; border:1px solid transparent; padding:7px 14px; border-radius:20px; cursor:pointer; font-size:14px; color:var(--ink); }
.tab.active { background:var(--pink); color:#fff; }
.logout { font-size:13px; color:var(--muted); margin-left:10px; text-decoration:none; }
.menu-btn { display:none; width:44px; height:44px; background:none; border:0; padding:10px; flex-direction:column; justify-content:center; gap:5px; cursor:pointer; }
.menu-btn span { display:block; height:2px; background:var(--brown); border-radius:2px; transition:transform .2s, opacity .2s; }
.menu-btn[aria-expanded=true] span:nth-child(1) { transform:translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded=true] span:nth-child(2) { opacity:0; }
.menu-btn[aria-expanded=true] span:nth-child(3) { transform:translateY(-7px) rotate(-45deg); }
main { padding:16px 20px 60px; max-width:1400px; margin:0 auto; }
.tab-panel { display:none; } .tab-panel.active { display:block; }
.cols { display:grid; grid-template-columns: minmax(360px, 560px) 1fr; gap:16px; align-items:start; }
@media (max-width: 900px) { .cols { grid-template-columns:1fr; } }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:18px 20px; }
h2 { font-size:15px; margin:18px 0 8px; color:var(--brown); } h2:first-child { margin-top:0; }
h3 { font-size:14px; margin:16px 0 6px; }
.hint { color:var(--muted); font-size:13px; margin:4px 0 10px; }
.opt { color:var(--muted); font-weight:400; font-size:12px; }
input[type=text], input[type=password], textarea, select { width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; color:var(--ink); }
textarea { resize:vertical; }
label { display:block; font-size:13px; color:var(--muted); margin:8px 0 4px; }
label.inline { display:inline-block; }
.row { display:flex; gap:12px; align-items:end; } .row > * { flex:1; }
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip { display:flex; align-items:center; gap:8px; border:1px solid var(--line); border-radius:24px; padding:4px 12px 4px 4px; cursor:pointer; background:#fff; user-select:none; }
.chip img { width:34px; height:34px; border-radius:50%; object-fit:cover; background:#eee; }
.chip.on { border-color:var(--pink-d); background:#fdeef2; }
.chip.locked { opacity:.9; cursor:default; }
.panel { border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:10px; background:#fdfbf9; }
.panel .ph { font-weight:600; font-size:13px; color:var(--brown); margin-bottom:6px; }
.panel textarea { margin-bottom:6px; }
.panel .row label { margin:0 0 2px; }
button, .file-btn { font:inherit; border:none; border-radius:8px; padding:9px 16px; cursor:pointer; }
.primary { background:var(--pink-d); color:#fff; font-weight:600; }
.primary:disabled { opacity:.5; cursor:wait; }
.secondary { background:#efe8e2; color:var(--ink); }
.danger { background:#fbe3e0; color:var(--err); }
.actions { display:flex; gap:10px; align-items:center; margin-top:14px; flex-wrap:wrap; }
.cost { color:var(--muted); font-size:13px; }
details.adv { margin-top:18px; border-top:1px dashed var(--line); padding-top:10px; }
details.adv summary { cursor:pointer; color:var(--muted); font-size:13px; }
pre { white-space:pre-wrap; font-size:12px; background:#f3eeea; padding:10px; border-radius:8px; max-height:300px; overflow:auto; }
.thumbs { display:flex; flex-wrap:wrap; gap:8px; }
.thumbs .th { position:relative; width:120px; height:120px; border:2px solid var(--line); border-radius:8px; overflow:hidden; cursor:pointer; background:#fff; }
.thumbs.small .th { width:72px; height:72px; }
.thumbs .th img { width:100%; height:100%; object-fit:contain; }
.thumbs .th.on { border-color:var(--pink-d); box-shadow:0 0 0 2px #fdeef2; }
.thumbs .th .cap { position:absolute; left:0; right:0; bottom:0; font-size:10px; background:rgba(255,255,255,.85); padding:2px 4px; text-align:center; }
.thumbs .th .x { position:absolute; top:2px; right:2px; background:rgba(0,0,0,.5); color:#fff; border-radius:50%; width:20px; height:20px; font-size:13px; line-height:20px; text-align:center; padding:0; }
.result-imgs { display:flex; flex-wrap:wrap; gap:14px; }
.result-item { width:min(100%, 340px); }
.result-item img { width:100%; border:1px solid var(--line); border-radius:8px; cursor:zoom-in; display:block; background:#fff; }
.result-item .bar { display:flex; gap:8px; margin-top:6px; }
.result-item .bar a, .result-item .bar button { font-size:13px; padding:6px 12px; }
a.btn { text-decoration:none; display:inline-block; border-radius:8px; }
.status { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; background:#fdf6ec; margin-bottom:12px; font-size:14px; }
.status.ok { background:#eaf6ee; } .status.err { background:#fbe3e0; color:var(--err); }
.spinner { width:16px; height:16px; border:3px solid #e6c9a0; border-top-color:var(--brown); border-radius:50%; animation:spin .9s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.err { color:var(--err); }
.hist { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:14px; }
.hist .h { border:1px solid var(--line); border-radius:10px; padding:10px; background:#fff; }
.hist .h img { width:100%; aspect-ratio:3/4; object-fit:cover; border-radius:6px; cursor:zoom-in; background:#f3eeea; }
.hist .h .meta { font-size:12px; color:var(--muted); margin:6px 0; min-height:32px; }
.hist .h .bar { display:flex; gap:6px; flex-wrap:wrap; } .hist .h .bar button, .hist .h .bar a { font-size:12px; padding:5px 9px; }
.char-item { display:flex; gap:12px; align-items:center; border:1px solid var(--line); border-radius:10px; padding:8px 10px; margin-bottom:8px; cursor:pointer; }
.char-item img { width:56px; height:56px; object-fit:contain; border-radius:8px; background:#f7f3f0; }
.char-item .n { font-weight:600; } .char-item .d { font-size:12px; color:var(--muted); }
.char-item.sel { border-color:var(--pink-d); background:#fdeef2; }
.banner { padding:10px 20px; background:#fbe3e0; color:var(--err); font-size:14px; }
.hidden { display:none !important; }
.lightbox { position:fixed; inset:0; background:rgba(0,0,0,.85); display:flex; align-items:center; justify-content:center; z-index:50; }
.lightbox img { max-width:94vw; max-height:92vh; border-radius:6px; background:#fff; }
.lightbox .close { position:absolute; top:12px; right:16px; font-size:28px; background:none; color:#fff; }
.lightbox .dl { position:absolute; bottom:16px; left:50%; transform:translateX(-50%); background:var(--pink-d); color:#fff; padding:10px 20px; border-radius:8px; text-decoration:none; font-weight:600; }
body.login { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.login-box { background:#fff; padding:30px; border-radius:14px; width:320px; text-align:center; border:1px solid var(--line); }
.login-box h1 { color:var(--brown); margin:0; } .login-box p { color:var(--muted); margin:4px 0 16px; }
.login-box input { margin-bottom:12px; } .login-box button { width:100%; background:var(--pink-d); color:#fff; font-weight:600; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .top { padding:8px 12px; }
  .menu-btn { display:flex; }
  nav { display:none; position:absolute; top:100%; left:0; right:0; flex-direction:column; align-items:stretch; gap:0; background:#fff; border-bottom:1px solid var(--line); box-shadow:0 8px 20px rgba(0,0,0,.08); padding:6px 0; }
  nav.open { display:flex; }
  nav .tab { border-radius:0; padding:14px 20px; font-size:16px; text-align:left; width:100%; }
  nav .tab.active { background:#fdeef2; color:var(--pink-d); font-weight:600; }
  nav .logout { padding:14px 20px; margin:0; font-size:15px; border-top:1px solid var(--line); }
  main { padding:12px 12px 80px; }
  .card { padding:14px 14px; border-radius:10px; }
  .cols { gap:12px; }
  input[type=text], input[type=password], textarea, select { font-size:16px; padding:11px 12px; } /* 16px zapobiega powiększaniu na iPhone */
  button, .file-btn { padding:12px 16px; font-size:15px; min-height:44px; }
  .row { flex-direction:column; align-items:stretch; gap:8px; }
  .row > * { width:100%; }
  label.inline { display:block; }
  .panel .row { flex-direction:row; } .panel .row > * { flex:1; min-width:0; }
  .chip { padding:6px 14px 6px 6px; min-height:44px; }
  .thumbs .th { width:calc(33.333% - 6px); height:auto; aspect-ratio:1; }
  .thumbs.small .th { width:calc(25% - 6px); }
  .result-item { width:100%; }
  .result-item .bar a, .result-item .bar button { flex:1; text-align:center; }
  .hist { grid-template-columns:repeat(2, 1fr); gap:10px; }
  .hist .h { padding:8px; }
  .hist .h .bar button, .hist .h .bar a { flex:1; text-align:center; min-height:40px; }
  .actions { gap:8px; }
  .actions .primary { width:100%; order:-1; }
  .actions .secondary, .actions .danger { flex:1; }
  .cost { width:100%; text-align:center; }
  .lightbox img { max-width:100vw; max-height:84vh; border-radius:0; }
  .lightbox .dl { bottom:20px; padding:14px 28px; font-size:16px; }
  .lightbox .close { top:6px; right:10px; font-size:34px; width:44px; height:44px; }
  pre { font-size:11px; }
  .banner { padding:10px 12px; font-size:13px; }
  .login-box { width:min(92vw, 320px); }
}
@media (max-width: 420px) {
  .hist { grid-template-columns:1fr; }
  .brand span { display:none; }
}
