:root { --bg:#fff; --fg:#1b1b1b; --muted:#666; --line:#d8d8d8; --accent:#1a5fb4; --card:#f7f7f7; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#17181a; --fg:#e6e6e6; --muted:#9a9a9a; --line:#33363a; --accent:#78aeed; --card:#1f2124; }
}
* { box-sizing: border-box; }
body { margin:0; font:16px/1.5 system-ui, sans-serif; background:var(--bg); color:var(--fg); }
a { color:var(--accent); }
.topbar { display:flex; justify-content:space-between; align-items:center;
          padding:.6rem 1rem; border-bottom:1px solid var(--line); }
.brand { font-weight:600; text-decoration:none; }
.inline { display:flex; gap:.6rem; align-items:center; margin:0; }
.who { color:var(--muted); }
main { max-width:60rem; margin:0 auto; padding:1rem; }
.card { max-width:22rem; margin:3rem auto; padding:1.2rem; background:var(--card);
        border:1px solid var(--line); border-radius:8px; }
label { display:block; margin:.8rem 0; }
input { width:100%; padding:.55rem; font:inherit; color:inherit; background:var(--bg);
        border:1px solid var(--line); border-radius:6px; }
button { padding:.5rem .9rem; font:inherit; cursor:pointer; color:inherit;
         background:var(--card); border:1px solid var(--line); border-radius:6px; }
.card button { width:100%; margin-top:.4rem; background:var(--accent); color:#fff; border-color:var(--accent); }
.flash { padding:.6rem .8rem; margin-bottom:1rem; border:1px solid var(--line);
         border-radius:6px; background:var(--card); }
        .topbar-left { display:flex; align-items:center; gap:1rem; }
.ws-menu { position:relative; }
.ws-menu summary { cursor:pointer; padding:.2rem .6rem; border:1px solid var(--line); border-radius:6px; }
.ws-menu ul { position:absolute; z-index:10; margin:.3rem 0 0; padding:.3rem; min-width:12rem;
              list-style:none; background:var(--card); border:1px solid var(--line); border-radius:6px; }
.ws-menu li a { display:block; padding:.4rem .6rem; text-decoration:none; }
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; }
.toolbar small, .muted { color:var(--muted); }
.btn { display:inline-block; padding:.45rem .8rem; border:1px solid var(--accent);
       border-radius:6px; background:var(--accent); color:#fff; text-decoration:none; }
.bm-list { list-style:none; margin:1rem 0; padding:0; }
.bm { display:flex; justify-content:space-between; gap:1rem; padding:.7rem 0; border-bottom:1px solid var(--line); }
.bm-main { min-width:0; }
.bm-title { font-weight:600; overflow-wrap:anywhere; }
.bm-url { color:var(--muted); font-size:.85rem; overflow-wrap:anywhere; }
.bm-desc { margin-top:.2rem; }
.bm-meta { color:var(--muted); font-size:.8rem; }
.bm-actions { display:flex; gap:.8rem; align-items:flex-start; white-space:nowrap; }
.bm-actions form { margin:0; }
.link-danger { padding:0; border:0; background:none; color:#c01c28; }
.pager { display:flex; gap:1rem; justify-content:center; margin:1rem 0; }
textarea { width:100%; padding:.55rem; font:inherit; color:inherit; background:var(--bg);
           border:1px solid var(--line); border-radius:6px; }
.card.wide { max-width:40rem; margin:1.5rem auto; }
.actions { display:flex; gap:1rem; align-items:center; margin-top:.8rem; }
.card .actions button { width:auto; margin:0; } 
select { width:100%; padding:.55rem; font:inherit; color:inherit; background:var(--bg);
         border:1px solid var(--line); border-radius:6px; }
.layout { display:grid; grid-template-columns:16rem minmax(0,1fr); gap:1.5rem; align-items:start; }
.side summary { cursor:pointer; font-weight:600; margin-bottom:.4rem; }
.side h3 { font-size:.9rem; color:var(--muted); margin:1rem 0 .3rem; }
@media (min-width: 801px) { .side summary { display:none; } }
@media (max-width: 800px) {
  .layout { grid-template-columns:1fr; gap:.5rem; }
  .side { border-bottom:1px solid var(--line); padding-bottom:.6rem; }
}
.tree { list-style:none; margin:0; padding:0; }
.tree a { display:flex; justify-content:space-between; gap:.5rem; padding:.25rem .5rem;
          border-radius:6px; text-decoration:none; overflow-wrap:anywhere; }
.tree a.active { background:var(--card); font-weight:600; }
.cnt { color:var(--muted); font-size:.8rem; }
.depth-1 { padding-left:1rem; } .depth-2 { padding-left:2rem; }
.depth-3 { padding-left:3rem; } .depth-4 { padding-left:4rem; }
.depth-5 { padding-left:5rem; } .depth-6 { padding-left:6rem; }
.depth-7 { padding-left:7rem; } .depth-8 { padding-left:8rem; }
.tree.manage li { display:flex; align-items:center; gap:.6rem; padding-top:.3rem; padding-bottom:.3rem;
                  border-bottom:1px solid var(--line); }
.tree.manage a { display:inline; padding:0; }
.row-actions { margin-left:auto; display:flex; gap:.8rem; align-items:center; }
.row-actions form { margin:0; }
.tagcloud, .bm-tags { display:flex; flex-wrap:wrap; gap:.3rem; }
.bm-tags { margin-top:.3rem; }
.tag { display:inline-block; padding:.05rem .55rem; border:1px solid var(--line); border-radius:999px;
       font-size:.85rem; text-decoration:none; }
.tag.active { background:var(--accent); border-color:var(--accent); color:#fff; }
input[type="checkbox"], input[type="file"] { width:auto; padding:0; border:0; }
label.check { display:flex; gap:.5rem; align-items:baseline; margin:.4rem 0; }
.pick { list-style:none; margin:0 0 1rem; padding:0; max-height:24rem; overflow:auto; }
.pick .cnt { margin-left:.4rem; }
.skipped { padding-left:1.2rem; overflow-wrap:anywhere; }
.topbar { flex-wrap:wrap; gap:.5rem; }
.card h2 { margin-top:0; }
input[type="radio"] { width:auto; margin-top:.35rem; }
.pairlist { list-style:none; margin:0; padding:0; }
.pairlist li { padding:.7rem 0; border-bottom:1px solid var(--line); }
.pair-actions { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.5rem; }
.pair-actions form { margin:0; }
.pair-actions button { text-align:left; }
.dupgroup .pick { max-height:none; margin-bottom:.6rem; }
.badge { display:inline-block; padding:.05rem .55rem; border:1px solid var(--line); border-radius:999px; font-size:.8rem; }
.badge.ok { background:rgba(46,160,67,.2); }
.badge.redirect { background:rgba(26,95,180,.2); }
.badge.uncertain { background:rgba(200,150,0,.22); }
.badge.failing { background:rgba(230,120,0,.25); }
.badge.dead { background:rgba(200,30,40,.25); }
.badge.private, .badge.unchecked { background:var(--card); }
progress { width:100%; height:1rem; }
.cats { display:flex; flex-wrap:wrap; gap:.4rem; margin:1rem 0; }
.check-actions { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.8rem; }
.check-actions form { margin:0; }
.check-folder { display:flex; flex-wrap:wrap; gap:.5rem; margin:0; }
.check-folder select { width:auto; flex:1 1 12rem; }
.link-btn { padding:0; border:0; background:none; color:var(--accent); text-decoration:underline; font:inherit; }
button:disabled { opacity:.5; cursor:not-allowed; }
.bm-actions { flex-wrap:wrap; justify-content:flex-end; }
.tag.active .cnt { color: inherit; opacity: .85; }
.preview { position:fixed; top:0; right:0; bottom:0; width:min(34rem, 100vw); z-index:30;
           overflow:auto; padding:1rem; background:var(--bg); border-left:1px solid var(--line);
           box-shadow:-4px 0 16px rgba(0,0,0,.15); }
.preview:empty { display:none; }
.preview-head { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.preview h2 { margin:0 0 .4rem; overflow-wrap:anywhere; }
.preview .desc { white-space:pre-line; overflow-wrap:anywhere; }
.preview iframe { width:100%; height:60vh; border:1px solid var(--line); border-radius:6px; background:#fff; }
.preview-actions { display:flex; flex-wrap:wrap; gap:.8rem; align-items:center; margin:.8rem 0; }
.preview-actions form { margin:0; }
@media (min-width: 1300px) {
  body:has(.preview:not(:empty)) main { max-width:none; margin-left:1.5rem; margin-right:calc(34rem + 1.5rem); }
}
@media (max-width: 800px) { .preview { width:100vw; border-left:0; } }
.searchbar { display:flex; gap:.5rem; margin:.6rem 0 1rem; }
.searchbar input[type="search"] { flex:1; }
mark { background:rgba(255,200,0,.45); color:inherit; border-radius:2px; padding:0 .1rem; }
.bm-sel { padding-top:.2rem; }
.bm-main { flex:1; }
.bulkbar { position:sticky; bottom:0; z-index:10; display:flex; flex-wrap:wrap; gap:.6rem;
           align-items:center; padding:.5rem .7rem; margin:.6rem 0; background:var(--card);
           border:1px solid var(--line); border-radius:8px; }
.bulkbar select, .bulkbar input[type="text"] { width:auto; }
.bulkbar [hidden] { display:none !important; }
.bulk-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
/* --- skočni prozor bookmarkleta --- */
body.popup .topbar { display:none; }
body.popup main { padding-top:.5rem; }
body.popup .card, body.popup .card.wide { margin:.5rem 0; max-width:none; }

/* --- mobitel i dodir --- */
html { -webkit-text-size-adjust:100%; }
.ws-menu ul { max-width:calc(100vw - 2rem); }
.preview { padding-bottom:calc(1rem + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling:touch; }
.preview iframe { height:60vh; height:60dvh; }
@media (pointer: coarse) {
  button, .btn, select, input[type="text"], input[type="search"], input[type="password"] { min-height:44px; }
  input[type="checkbox"], input[type="radio"] { width:1.4rem; height:1.4rem; }
  .bm-actions a, .bm-actions button, .row-actions a, .row-actions button { padding:.55rem .3rem; }
  .tree a { padding:.5rem .5rem; }
  .tag { padding:.35rem .7rem; }
}
@media (max-width: 640px) {
  main { padding:.75rem; }
  .topbar { padding:.5rem .75rem; }
  .toolbar .btn { width:100%; text-align:center; }
  .bm { flex-wrap:wrap; }
  .bm-main { flex:1 1 calc(100% - 3rem); }
  .bm-actions { flex:1 1 100%; padding-left:2.4rem; justify-content:flex-start; gap:1rem; }
  .searchbar { flex-wrap:wrap; }
  .searchbar button { flex:1 1 100%; }
  .bulkbar { padding-bottom:calc(.5rem + env(safe-area-inset-bottom, 0px)); }
  .bulkbar .bulk-actions { width:100%; }
  .bulkbar select, .bulkbar input[type="text"], .bulkbar button[type="submit"] { flex:1 1 100%; width:100%; }
  .check-actions form { flex:1 1 100%; }
  .check-actions button { width:100%; }
  .pair-actions button { white-space:normal; width:100%; }
}
