:root{
  --bg:#f6f5f2;--surface:#ffffff;--text:#1f1f1d;--muted:#6b6a65;--border:#e4e2dc;--border-strong:#cfccc3;
  --accent:#0F6E56;--accent-bg:#E1F5EE;--accent-text:#085041;--on-accent:#ffffff;
  --danger:#A32D2D;--danger-bg:#FCEBEB;
  --note-y:#FAC775;--note-y-t:#412402;--note-g:#C0DD97;--note-g-t:#173404;
  --note-o:#F5C4B3;--note-o-t:#4A1B0C;--note-d:#D3D1C7;--note-d-t:#2C2C2A;
  --radius:8px;--topbar-h:52px;--row-hl:rgba(15,110,86,.07);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-size:15px;
}
@media (prefers-color-scheme:dark){
  :root{--bg:#141413;--surface:#1f1f1e;--text:#ecebe7;--muted:#9c9a93;--border:#2e2e2c;--border-strong:#444441;
    --accent:#5DCAA5;--accent-bg:#08503f;--row-hl:rgba(93,202,165,.10);--accent-text:#E1F5EE;--on-accent:#04342C;--danger:#F09595;--danger-bg:#501313}
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text)}
a{color:var(--accent)}
h1{font-size:20px;font-weight:600;margin:0 0 8px}
p{line-height:1.55}
.muted{color:var(--muted)}.small{font-size:13px}.center{text-align:center}.strong{font-weight:600}
input,button{font:inherit;color:inherit}
input{width:100%;height:42px;padding:0 12px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);margin-top:4px}
input:focus{outline:2px solid var(--accent);outline-offset:1px;border-color:transparent}
button{height:38px;padding:0 14px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);cursor:pointer}
button.primary{background:var(--accent);color:var(--on-accent);border-color:var(--accent);height:44px;font-weight:600}
.linklike{border:0;background:none;padding:0;height:auto;text-align:left;color:var(--muted);width:100%}
label{display:block;font-size:14px;color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:14px}
.error{color:var(--danger);background:var(--danger-bg);padding:8px 10px;border-radius:var(--radius);margin:0;font-size:14px}
.pill{font-size:12px;padding:1px 8px;border-radius:10px;background:var(--accent-bg);color:var(--accent-text);font-weight:400}
.logo-row{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--text)}
.logo{width:30px;height:30px;border-radius:8px;background:var(--accent-bg);color:var(--accent-text);display:inline-flex;align-items:center;justify-content:center;font-weight:700}
.app-name{font-weight:600}

/* prihlasovacie stránky */
body.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}
.auth-card{width:100%;max-width:360px;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:24px}
.auth-card .logo-row{justify-content:center;margin-bottom:20px}
.code{font-size:22px;letter-spacing:6px;text-align:center}
.qr{display:flex;justify-content:center}.qr svg{max-width:100%;height:auto;border-radius:6px}
.secret{display:block;word-break:break-all;background:var(--bg);padding:8px;border-radius:6px;font-size:13px}

/* hlavné rozloženie: menu | obsah | detail */
.topbar{height:52px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;background:var(--surface);border-bottom:1px solid var(--border)}
.shell{display:grid;grid-template-columns:200px minmax(0,1fr) 340px;min-height:calc(100vh - 52px)}
.menu{background:var(--surface);border-right:1px solid var(--border);padding:12px 8px;display:flex;flex-direction:column;gap:2px}
.menu-head{font-size:12px;color:var(--muted);margin:12px 10px 4px}
.menu-item{display:block;padding:7px 10px;border-radius:var(--radius);color:var(--text);text-decoration:none;font-size:14px}
.menu-item:hover{background:var(--bg)}.menu-item.active{background:var(--accent-bg);color:var(--accent-text)}
.menu-bottom{margin-top:auto;display:flex;flex-direction:column;gap:2px}
.content{padding:20px 24px;min-width:0}
.detail{background:var(--surface);border-left:1px solid var(--border);padding:16px}
.list{list-style:none;padding:0;margin:16px 0;display:flex;flex-direction:column;gap:8px}
.row{display:flex;justify-content:space-between;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px}

@media (max-width:1000px){.shell{grid-template-columns:180px minmax(0,1fr)}.detail{display:none}}
@media (max-width:700px){
  .shell{grid-template-columns:1fr}
  .menu{position:fixed;bottom:0;left:0;right:0;flex-direction:row;justify-content:space-around;border-right:0;border-top:1px solid var(--border);padding:6px;z-index:10;overflow-x:auto}
  .menu-head{display:none}.menu-bottom{margin:0;flex-direction:row}
  .content{padding:16px 14px 80px}
}

/* admin a formuláre */
select{font:inherit;color:inherit;height:38px;padding:0 10px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface)}
button:disabled{opacity:.4;cursor:default}
.inline-form{display:flex;gap:8px;align-items:center;margin:0}
.inline-form input{margin-top:0;height:38px}
.inline-form.grow{flex:1}
.card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.card-head{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.chips{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.chip{display:inline-flex;align-items:center;gap:4px;background:var(--accent-bg);color:var(--accent-text);border-radius:16px;padding:2px 4px 2px 12px;margin:0;font-size:14px}
.chip-x{border:0;background:none;height:24px;width:24px;padding:0;color:inherit;font-size:16px}

/* horná lišta – rýchly zápis */
.quick{display:flex;gap:6px;flex:0 1 420px;margin-left:16px}
.quick input{margin:0;height:36px}
.quick button{height:36px}

/* riadky s memami */
.lanes{display:flex;flex-direction:column;gap:6px}
.lane-head{font-size:13px;font-weight:600;color:var(--muted);margin:10px 0 2px;display:flex;gap:10px;align-items:baseline}
.lane-head a{font-weight:400}
.notes{display:flex;flex-wrap:wrap;gap:16px;padding:10px 4px 8px}
.empty{padding:6px 0}
.note{position:relative;width:118px;height:118px;padding:16px 9px 8px;border-radius:2px;text-decoration:none;display:flex;flex-direction:column;justify-content:space-between;font-size:13px;line-height:1.3;transition:transform .12s}
.note:before{content:"";position:absolute;top:-2px;left:50%;transform:translateX(-50%);width:54px;height:12px;background:rgba(255,255,255,.55)}
.note:nth-child(odd){transform:rotate(-1.4deg)}.note:nth-child(even){transform:rotate(1.1deg)}
.note-title{font-weight:600;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;word-break:break-word}
.note-foot{font-size:12px;display:flex;gap:4px;flex-wrap:wrap;opacity:.85}
.note-foot .late{color:#A32D2D;font-weight:600}
.note .tag{background:rgba(255,255,255,.5);border-radius:6px;padding:0 5px}
.note-pv{display:none;position:absolute;left:-6px;top:108px;z-index:5;width:230px;padding:9px 10px;border-radius:2px;flex-direction:column;gap:3px;font-size:13px;border:1px solid rgba(0,0,0,.15)}
.note-pv b{font-weight:600}
@media (hover:hover){.note:hover{z-index:6;transform:rotate(0) scale(1.03)}.note:hover .note-pv{display:flex}}
.note.peek{z-index:6;transform:rotate(0)}.note.peek .note-pv{display:flex}
.note.sel{outline:2px solid var(--accent);outline-offset:3px}
.note-ideas,.note-ideas .note-pv{background:var(--note-y);color:var(--note-y-t)}
.note-active,.note-active .note-pv{background:var(--note-g);color:var(--note-g-t)}
.note-waiting,.note-waiting .note-pv{background:var(--note-o);color:var(--note-o-t)}
.note-done,.note-done .note-pv{background:var(--note-d);color:var(--note-d-t)}

/* detail projektu */
.detail{overflow-y:auto;max-height:calc(100vh - 52px);position:sticky;top:0}
.pd{display:flex;flex-direction:column;gap:10px}
.pd h3{font-size:14px;font-weight:600;margin:14px 0 0;display:flex;gap:8px;align-items:baseline}
.pd-close{text-decoration:none}
.pd-form{display:flex;flex-direction:column;gap:10px}
.pd-title{font-size:18px;font-weight:600;height:44px}
.pd-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.pd-grid input,.pd-grid select{height:36px;margin-top:2px;width:100%}
.next input{background:var(--accent-bg);color:var(--accent-text);border-color:transparent;font-weight:600}
.waiting-info{margin:-4px 0 0}
textarea{width:100%;font:inherit;color:inherit;padding:8px 10px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);margin-top:4px;resize:vertical}
.steps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.step{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px;padding:3px 0}
.step form{margin:0}
.check{border:0;background:none;height:26px;width:26px;padding:0;font-size:19px;line-height:1;color:var(--accent)}
.step-title{flex:1 1 60%;min-width:0;padding-top:3px;word-break:break-word}
.step.done .step-title{text-decoration:line-through;color:var(--muted)}
.tag.wait{font-size:12px;background:var(--note-o);color:var(--note-o-t);border-radius:6px;padding:0 6px;text-decoration:none}
.step-more summary{list-style:none;cursor:pointer;color:var(--muted);padding:2px 6px}
.step-more summary::-webkit-details-marker{display:none}
.step-more[open]{flex-basis:100%}
.step-menu{display:flex;flex-direction:column;gap:6px;padding:6px 0}
.stack-sm{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.notes-log{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.notes-log li{border-left:2px solid var(--border-strong);padding-left:10px}
.note-text{white-space:pre-wrap;word-break:break-word}
form.inline{display:inline}
.danger-link{border:0;background:none;height:auto;padding:0;color:var(--danger);font-size:13px}
.danger{background:var(--danger);color:#fff;border-color:var(--danger)}
.danger-zone{margin-top:18px}

@media (max-width:1000px){
  .has-detail .content{display:none}
  .has-detail .detail{display:block;max-height:none;position:static;border-left:0}
  .has-detail .shell{grid-template-columns:180px minmax(0,1fr)}
}
@media (max-width:700px){
  .topbar{gap:8px}.app-name{display:none}.quick{margin-left:0;flex:1}
  .has-detail .shell{grid-template-columns:1fr}
  .has-detail .detail{padding:14px 14px 90px}
  .note{width:104px;height:104px;font-size:12px}
  .note-pv{width:200px}
  .pd-grid{grid-template-columns:1fr 1fr}
}
a,button,.note{-webkit-tap-highlight-color:transparent}
.mob-only{display:none}
@media (max-width:700px){.desk-only{display:none}.mob-only{display:inline}.menu{justify-content:space-around}.menu-item{padding:8px 10px}}

/* admin – záložky a zálohy */
.tabs{display:flex;gap:4px;margin-bottom:16px;border-bottom:1px solid var(--border)}
.tabs a{padding:8px 12px;text-decoration:none;color:var(--muted);border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs a.active{color:var(--text);border-bottom-color:var(--accent)}
.h2{font-size:15px;font-weight:600;margin:22px 0 8px}
.status-card{border-radius:12px;padding:12px 14px;margin:8px 0 14px;display:flex;flex-direction:column;gap:3px}
.status-card.good{background:var(--accent-bg);color:var(--accent-text)}
.status-card.bad{background:var(--danger-bg);color:var(--danger)}
.status-title{font-weight:600}
.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.metric{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px}
.metric-v{font-size:20px;font-weight:600;margin-top:2px}
.tbl{width:100%;border-collapse:collapse;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);font-size:14px}
.tbl th{text-align:left;font-weight:600;color:var(--muted);font-size:12px;padding:8px 10px;border-bottom:1px solid var(--border)}
.tbl td{padding:7px 10px;border-bottom:1px solid var(--border)}
.tbl tr:last-child td{border-bottom:0}
.err-row td{color:var(--danger);padding-top:0}
.pill.bad{background:var(--danger-bg);color:var(--danger)}
.mono{font-family:ui-monospace,Consolas,monospace;word-break:break-all}
@media (max-width:700px){.tbl{font-size:12px}.tbl th:nth-child(6),.tbl td:nth-child(6),.tbl th:nth-child(3),.tbl td:nth-child(3){display:none}}
.no-detail .shell{grid-template-columns:200px minmax(0,1fr)}.no-detail .detail{display:none}
.no-detail .content{max-width:1000px}
@media (max-width:700px){.no-detail .shell{grid-template-columns:1fr}}

/* PWA: iPhone – obsah mimo výrezu a domovskej lišty */
@supports (padding:env(safe-area-inset-bottom)){
  :root{--topbar-h:calc(52px + env(safe-area-inset-top))}
  .topbar{padding-top:env(safe-area-inset-top);height:var(--topbar-h)}
  @media (max-width:700px){.menu{padding-bottom:calc(6px + env(safe-area-inset-bottom))}}
}

/* admin – používatelia */
.okmsg{color:var(--accent-text);background:var(--accent-bg);padding:8px 10px;border-radius:var(--radius);margin:0;font-size:14px}
.pill.warn{background:var(--note-y);color:var(--note-y-t)}
tr.inactive td{color:var(--muted)}
.checks{border:0;padding:0;margin:0;display:flex;gap:14px;flex-wrap:wrap}
.check-label{display:inline-flex;gap:6px;align-items:center;color:var(--text);font-size:14px}
.check-label input{width:auto;height:auto;margin:0}
.small-v{font-size:15px}
.actions{flex-direction:row;flex-wrap:wrap;gap:8px}
.actions form{margin:0}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
#invite-link{flex:1;font-size:13px}
@media (max-width:700px){.tbl th:nth-child(3),.tbl td:nth-child(3){display:none}}

/* Projekty (krok 8a) */
.note-pm{font-size:12px;font-weight:600;opacity:.9}
.pm-link{display:flex;flex-direction:column;gap:2px;padding:10px 12px;border:1px solid var(--border-strong);border-radius:var(--radius);text-decoration:none;color:var(--text);margin:8px 0}
.pm-code{align-self:flex-start;font-weight:700;color:var(--accent-text);background:var(--accent-bg);border-radius:6px;padding:0 6px;white-space:nowrap}
.pd-title-ro{margin:8px 0 0;font-size:20px}
a.button{display:inline-flex;align-items:center;justify-content:center;height:44px;padding:0 14px;border-radius:var(--radius);text-decoration:none}
a.button.primary{background:var(--accent);color:var(--on-accent);font-weight:600}
.make-project{margin:14px 0;padding:8px 10px;border:1px dashed var(--border-strong);border-radius:var(--radius)}
.make-project summary{cursor:pointer;font-weight:600;color:var(--accent)}
.check-row{display:flex;align-items:center;gap:8px;color:var(--text)}
.check-row input{width:18px;height:18px;margin:0}
.pm-new{flex-wrap:wrap}.pm-new select{flex:0 0 auto}.pm-new input{flex:1 1 200px;margin-top:0}
.pm-filter{display:flex;gap:12px;flex-wrap:wrap;margin:12px 0}
.pm-group{margin-bottom:8px}
.pm-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;padding:8px 12px;margin:4px 0;background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--note-g);border-radius:var(--radius);text-decoration:none;color:var(--text)}
.pm-row.pm-waiting{border-left-color:var(--note-o)}.pm-row.pm-postponed{border-left-color:var(--note-y)}.pm-row.pm-done{border-left-color:var(--note-d);opacity:.8}
.pm-row-title{font-weight:600;flex:1 1 40%;min-width:0;word-break:break-word}
.pm-detail{max-width:760px}
.pm-head{margin:6px 0}
.tag.late,.late{color:var(--danger);font-weight:600}
.history{color:var(--muted);border-left:2px solid var(--border-strong);padding-left:8px}
.space-code{font-weight:700;font-family:ui-monospace,monospace;padding:0 6px;border-radius:6px;background:var(--accent-bg);color:var(--accent-text)}
.code-input{max-width:90px;text-transform:uppercase}
.step .tag{font-size:12px;background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:0 6px}
.menu-projects{margin-top:10px}
@media (max-width:700px){.menu-projects{margin-top:0}}
/* krok 8a+: čas */
.menu-time{margin-top:0}
.time-log{list-style:none;padding:0;margin:8px 0 0}
.time-log li{padding:4px 0;border-bottom:1px solid var(--border)}
.time-form .error,.time-filter .error{display:block;margin-top:4px}
.time-table{width:100%;border-collapse:collapse;font-size:14px;margin:8px 0 16px}
.time-table th,.time-table td{text-align:left;padding:4px 6px;border-bottom:1px solid var(--border)}
.time-table .num{text-align:right;white-space:nowrap}
.time-table .time-group th{background:var(--bg)}
.js-closing[hidden]{display:none}
/* krok 8a-UI: pásik postupu, ID, odznaky stavu */
.pm-bar{display:block;height:4px;border-radius:2px;background:rgba(0,0,0,.12);overflow:hidden;min-width:40px}
.pm-bar>span{display:block;height:100%;background:var(--accent)}
.pm-id{font-size:12px;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums;letter-spacing:.02em}
.badge{display:inline-block;font-size:12px;font-weight:600;padding:1px 8px;border-radius:10px;white-space:nowrap}
.badge-active{background:var(--note-g);color:var(--note-g-t)}
.badge-waiting{background:var(--note-o);color:var(--note-o-t)}
.badge-postponed{background:var(--note-y);color:var(--note-y-t)}
.badge-done{background:var(--note-d);color:var(--note-d-t)}
.soon{color:#B4570F;font-weight:600}
.wait-text{color:#B4570F}
@media (prefers-color-scheme:dark){.soon,.wait-text{color:#F0A56B}}
/* memo s projektom */
.note-head{display:flex;flex-direction:column;gap:1px;min-height:0;overflow:hidden}
.note-id{font-size:10.5px;opacity:.7;white-space:nowrap;line-height:1.2}
.note-has-pm .note-title{-webkit-line-clamp:2}
.note-customer{font-size:11px;opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.note-pm{flex-direction:column;flex-wrap:nowrap;gap:3px;font-weight:400}
.note-pm .pm-bar{background:rgba(0,0,0,.15)}.note-pm .pm-bar>span{background:currentColor;opacity:.75}
.note-id-row{display:flex;justify-content:space-between;gap:4px;align-items:baseline}
.note-pm .pm-state-line{font-size:11px;line-height:1.25;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-word}
.note-due{white-space:nowrap;font-weight:700;font-size:11px;flex:0 0 auto}
.note-due.late{color:#A32D2D}.note-due.soon{color:#8A3B00}
/* zoznam Projekty */
.pm-row{flex-wrap:nowrap;align-items:center;gap:14px}
.pm-row-main{display:flex;flex-direction:column;gap:1px;flex:1 1 auto;min-width:0}
.pm-row-title{flex:none}
.pm-row-side{display:flex;flex-direction:column;gap:4px;flex:0 0 220px;align-items:stretch;text-align:right}
@media (max-width:700px){.pm-row{flex-wrap:wrap;gap:6px}.pm-row-side{flex:1 1 100%;text-align:left}}
/* detail projektu – pracovná stránka */
.pm-page .content{max-width:1180px}
.pmd{display:flex;flex-direction:column;gap:12px}
.pmd-crumb a{text-decoration:none}
.pmd-head{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;padding-bottom:12px;border-bottom:1px solid var(--border)}
.pmd-head-main{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}
.pmd-title{font-size:24px;font-weight:650;margin:0;word-break:break-word;line-height:1.25}
.pmd-progress{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:4px}
.pmd-progress .pm-bar{width:160px;height:6px;border-radius:3px}
.pmd-actions{display:flex;gap:8px;flex:0 0 auto}
.pmd-actions .button{border:1px solid var(--border-strong);color:var(--text);background:var(--surface);height:40px}
.pmd-actions button.primary{height:40px}
.pmd-cols{display:grid;grid-template-columns:minmax(0,1fr) 300px;grid-template-areas:"main side";gap:28px;align-items:start}
.pmd-main{grid-area:main;display:flex;flex-direction:column;gap:22px;min-width:0}
.pmd-side{grid-area:side;position:sticky;top:12px}
.pmd-h{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:0 0 8px;display:flex;gap:10px;align-items:baseline}
.pmd-h a,.pmd-h .small{text-transform:none;letter-spacing:0;font-weight:400}
.pmd-next{background:var(--accent-bg);color:var(--accent-text);border-radius:var(--radius);padding:12px 14px}
.pmd-next .pmd-h{color:inherit;opacity:.8}
.pmd-next-text{margin:0;font-size:16px;font-weight:600}
.pmd-next .muted{color:inherit;opacity:.7}
.pmd-next input{margin-top:0;font-weight:600}
.pmd-main textarea{margin-top:0}
/* Vlastnosti */
.pm-props{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px}
.pm-props>summary{list-style:none;display:flex;flex-direction:column;gap:2px}
.pm-props>summary::-webkit-details-marker{display:none}
.pm-props-h{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.pm-props-sum{display:none}
.props{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px 12px;margin:10px 0 0;font-size:14px}
.props dt{color:var(--muted);font-size:13px;padding-top:1px}
.props dd{margin:0;min-width:0;word-break:break-word;display:flex;flex-direction:column;gap:4px;align-items:flex-start}
.props dd select,.props dd input{width:100%;height:36px;margin-top:0}
.pm-props .danger-zone{margin-top:14px;padding-top:10px;border-top:1px solid var(--border)}
/* 8b.3: voľba pri zmazaní projektu; checkbox krokov len pri „Ponechať“ */
.del-card{border:0;padding:0;margin:0 0 10px}
.del-card legend{padding:0;margin-bottom:4px;color:var(--muted)}
.del-card-steps{margin-left:26px}
.del-card:has(input[value=zmazat]:checked) .del-card-steps{display:none}
@media (min-width:701px){.pm-props>summary{pointer-events:none}}
/* tabuľka krokov */
.pm-steps{width:100%;border-collapse:collapse;font-size:14px}
.pm-steps th{text-align:left;font-weight:600;color:var(--muted);font-size:12px;padding:4px 6px;border-bottom:1px solid var(--border)}
.pm-steps td{padding:5px 6px;border-bottom:1px solid var(--border);vertical-align:top}
.pm-steps .num{text-align:right;white-space:nowrap}
.pm-steps .c-check{width:30px;padding-left:0}.pm-steps .c-check form{margin:0}
.pm-steps .c-col{white-space:nowrap;color:var(--text)}
.pm-steps td.c-col:not(.late){color:var(--text)}
.pm-steps td.late{color:var(--danger);font-weight:600}
.pm-steps .c-title{width:40%;word-break:break-word}
.pm-steps .step-title{padding-top:0}
.pm-steps tr.done .step-title{text-decoration:line-through;color:var(--muted)}
.pm-steps tr.done td{color:var(--muted)}
.pm-steps .c-more{width:30px;position:relative;text-align:right;padding-right:0}
.pm-steps .step-more[open] .step-menu{position:absolute;right:0;top:100%;z-index:8;width:min(340px,86vw);text-align:left;background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--radius);padding:10px;box-shadow:0 6px 20px rgba(0,0,0,.12)}
.step-meta{display:none}
.pmd-add{margin-top:8px}
.pd-grid-3{grid-template-columns:1fr 1fr 1fr;width:100%}
.time-form{max-width:560px}
/* poznámky a história */
.pmd-log{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
.pmd-note{background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:var(--radius);padding:8px 12px}
.pmd-note .note-text{margin-top:2px}
.pmd-log .history{font-size:12px;opacity:.85;padding:0 0 0 12px}
/* mobil */
@media (max-width:1000px){.pmd-cols{grid-template-columns:minmax(0,1fr) 260px}}
@media (max-width:700px){
  .pmd-head{flex-direction:column;gap:10px}
  .pmd-title{font-size:20px}
  .pmd-cols{grid-template-columns:1fr;grid-template-areas:"side" "main";gap:16px}
  .pmd-side{position:static}
  .pm-props>summary{cursor:pointer;position:relative;padding-right:22px}
  .pm-props>summary:after{content:"▾";position:absolute;right:0;top:0;color:var(--muted)}
  .pm-props[open]>summary:after{content:"▴"}
  .pm-props:not([open]) .pm-props-sum{display:block}
  .pm-steps thead,.pm-steps .c-col{display:none}
  .pm-steps .c-title{width:auto}
  .step-meta{display:flex;flex-wrap:wrap;gap:4px;margin-top:3px}
  .pd-grid-3{grid-template-columns:1fr 1fr}
}
.note-has-pm{padding-top:13px;gap:3px}
.note-has-pm .note-head{flex:1 1 auto}
.note-has-customer .note-title{-webkit-line-clamp:1}
.note-has-pm .note-head{overflow:hidden;min-height:0}
.pm-bar>.w0{width:0%}.pm-bar>.w5{width:5%}.pm-bar>.w10{width:10%}.pm-bar>.w15{width:15%}.pm-bar>.w20{width:20%}.pm-bar>.w25{width:25%}.pm-bar>.w30{width:30%}.pm-bar>.w35{width:35%}.pm-bar>.w40{width:40%}.pm-bar>.w45{width:45%}.pm-bar>.w50{width:50%}.pm-bar>.w55{width:55%}.pm-bar>.w60{width:60%}.pm-bar>.w65{width:65%}.pm-bar>.w70{width:70%}.pm-bar>.w75{width:75%}.pm-bar>.w80{width:80%}.pm-bar>.w85{width:85%}.pm-bar>.w90{width:90%}.pm-bar>.w95{width:95%}.pm-bar>.w100{width:100%}
/* 8a-UI oprava: Záver hore, režim úpravy */
.pmd-closing{background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--note-d);border-radius:var(--radius);padding:12px 14px;border-top:1px solid var(--border)}
.pmd-closing[hidden]{display:none}
.pmd-closing textarea{margin-top:0}
.check-ro{display:inline-flex;align-items:center;justify-content:center;color:var(--muted)}
.locked{margin:0 0 6px}

/* krok 8b – šablóny */
.tpl-new{flex-wrap:wrap}.tpl-new input{flex:1 1 220px}
.tpl-list{gap:6px}
.tpl-row{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:8px;padding:8px 12px;background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--accent);border-radius:var(--radius);text-decoration:none;color:var(--text)}
.tpl-row.tpl-off{border-left-color:var(--border-strong);opacity:.75}
.tpl-row-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 50%}
.tpl-row-side{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.tpl-detail{max-width:760px}
.tpl-form-foot{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.tpl-steps{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:4px;counter-reset:tpl}
.tpl-step{display:flex;gap:8px;align-items:flex-start;padding:4px;border-radius:6px;counter-increment:tpl}
.tpl-step:before{content:counter(tpl) ".";min-width:20px;text-align:right;color:var(--muted);padding-top:2px}
.js-reorder .tpl-step:before{padding-top:9px}
.js-reorder .tpl-step .drag-handle{margin-top:6px}
.tpl-step-body{flex:1;min-width:0}
.tpl-step-form{flex-wrap:wrap}.tpl-step-form input[name=text]{flex:1 1 220px}
.tpl-days{width:70px;flex:0 0 70px}
.tpl-step-actions{display:flex;gap:10px;align-items:center;margin-top:4px}
.tpl-step-actions form{margin:0}
.js-pm-template{flex:0 1 auto;max-width:100%}

/* krok 8b.1 – kroky zo šablóny v režime úprav */
.pmd-tpl,.pmd-tpl-confirm{margin:6px 0 10px;padding:8px 10px;border:1px dashed var(--border-strong);border-radius:var(--radius)}
.pmd-tpl-confirm{border-style:solid;background:var(--note-y);color:var(--note-y-t)}
.pmd-tpl-confirm p{margin:0 0 6px}
.pmd-tpl-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:4px}
.pmd-tpl-actions select{flex:1 1 200px;margin:0}

/* krok 8b.4 – poradie: zvýraznenie riadku, úchyt, šípky, ťahanie */
.hl-row{transition:background-color .12s}
.hl-row:focus-within{background:var(--row-hl)}
@media (hover:hover){.hl-row:hover{background:var(--row-hl)}}
.steps .hl-row{border-radius:6px;padding:3px 4px}
.steps.js-reorder>.step{flex-wrap:nowrap;align-items:center}
.steps.js-reorder>.step .step-title{flex:1 1 auto;padding-top:0}
.drag-handle{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:26px;padding:0 2px;
  color:var(--muted);font-size:15px;line-height:1;letter-spacing:-3px;cursor:grab;user-select:none;-webkit-user-select:none;touch-action:none}
.move-arrows{display:inline-flex;gap:2px;margin:0;flex:0 0 auto}
.move-arrows button{height:26px;width:26px;padding:0;border-color:transparent;background:none;color:var(--muted);font-size:14px}
.move-arrows button:not(:disabled):hover,.move-arrows button:focus-visible{border-color:var(--border-strong);color:var(--text)}
@media (hover:hover){
  .drag-handle,.move-arrows{opacity:.35;transition:opacity .12s}
  .hl-row:hover .drag-handle,.hl-row:hover .move-arrows,
  .hl-row:focus-within .drag-handle,.hl-row:focus-within .move-arrows,
  .sortable-chosen .drag-handle,.sortable-chosen .move-arrows{opacity:1}
}
@media (hover:none){.drag-handle{min-width:32px;height:32px}.move-arrows button{width:32px;height:32px}}
.pm-steps .c-drag{width:24px;padding-left:0;padding-right:0}
.pm-steps .c-move{width:58px;white-space:nowrap;padding-left:0;padding-right:0}
.sortable-chosen{background:var(--accent-bg)}
.sortable-ghost{background:var(--accent-bg);outline:2px dashed var(--accent);outline-offset:-2px;opacity:.6}
.sortable-fallback,.sortable-drag{background:var(--surface);outline:2px solid var(--accent);box-shadow:0 8px 24px rgba(0,0,0,.18);opacity:.95 !important}
/* ťahaný riadok tabuľky: plávajúca kópia len s úchytom, ☐ a názvom (stĺpce by sa v nej zúžili) */
.pm-steps tr.sortable-fallback{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:var(--radius)}
.pm-steps tr.sortable-fallback td{border:0;padding:0}
.pm-steps tr.sortable-fallback .c-col,.pm-steps tr.sortable-fallback .c-move,.pm-steps tr.sortable-fallback .c-more{display:none}
body.is-dragging,body.is-dragging *{cursor:grabbing !important}
.reorder-msg{margin:6px 0 0;font-size:13px}
.reorder-msg:empty{margin:0}
.reorder-msg.is-error{color:var(--danger);background:var(--danger-bg);padding:6px 10px;border-radius:var(--radius)}
/* memo otvorené v pravom paneli */
.note.sel{outline:3px solid var(--accent);outline-offset:3px;transform:rotate(0) scale(1.04);box-shadow:0 6px 16px rgba(0,0,0,.18);z-index:4}

/* krok 8b.4 – PC: stránka stojí, posúva sa obsah a pravý panel (mobil a telefón na šírku bez zmeny) */
@media (min-width:701px) and (min-height:500px){
  .shell{height:calc(100vh - var(--topbar-h));height:calc(100dvh - var(--topbar-h));min-height:0;grid-template-rows:minmax(0,1fr)}
  .menu{overflow-y:auto}
  .content,.detail{overflow-y:auto;overscroll-behavior:contain}
  .detail{max-height:none;position:static}
  /* obsah obmedzený vnútorným okrajom (nie max-width), aby posuvník ostal pri pravom okraji okna */
  .no-detail .content{max-width:none;padding-right:max(24px,calc(100% - 976px))}
  .pm-page .content{max-width:none;padding-right:max(24px,calc(100% - 1156px))}
}
.content [id],.detail [id]{scroll-margin-top:12px}

/* tlač: celý obsah, bez menu a ovládania poradia */
@media print{
  .topbar,.menu,.detail:empty,.drag-handle,.move-arrows,.c-drag,.c-move,.reorder-msg,.step-more,.c-more{display:none !important}
  html,body{background:#fff}
  .shell{display:block !important;height:auto !important}
  .content,.detail{overflow:visible !important;height:auto !important;max-height:none !important;position:static !important}
  .pmd-side{position:static}
}
/* 8c: čas na meme */
.note-time{margin-left:auto;white-space:nowrap}
.card-pm-facts{display:flex;gap:12px;flex-wrap:wrap}
.card-time{margin-top:12px}

/* krok T – testovacia inštancia (PM_INSTANCE=lab): oranžový pruh v hornej lište + štítok LAB.
   Výška lišty sa nemení (vnútorný tieň), takže rozloženie na PC, mobile aj v PWA ostáva rovnaké. */
.instance-badge{display:inline-flex;align-items:center;flex:none;height:26px;padding:0 10px;border-radius:6px;
  background:#C2410C;color:#fff;font-weight:800;font-size:13px;letter-spacing:.12em;text-transform:uppercase;
  margin-left:10px;margin-right:auto;white-space:nowrap}
body.is-instance .topbar{box-shadow:inset 0 -6px 0 #C2410C;background:repeating-linear-gradient(135deg,var(--surface) 0 14px,rgba(194,65,12,.07) 14px 28px)}
body.is-instance.auth{border-top:8px solid #C2410C}
@media (max-width:700px){.instance-badge{margin-left:0;padding:0 7px}}
