/* notes.ekora.sk - vzhlad appky (styl podla appky Asistent) */
:root{
  --bg:#f5f5f1; --panel:#ffffff; --line:#e6e5df; --line2:#efeee9;
  --text:#16171a; --muted:#6b6c70; --faint:#9a9b9f;
  --accent:#262f99; --accent-bg:#e9eafc; --accent-soft:#f3f4fe;
  --dark:#111214; --warn-bg:#fbe8dd; --warn:#b2461c; --red:#d33a2c;
  --mark:#fff0a8; --code-bg:#f7f7f4; --r:14px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,sans-serif;font-size:15px;-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
input{font:inherit;color:inherit}
[hidden]{display:none!important}
.ml-auto{margin-left:auto}

/* ---------- prihlasenie ---------- */
.login-page{display:grid;place-items:center;min-height:100vh;padding:16px}
.login-card{width:100%;max-width:380px;background:#fff;border:1px solid var(--line);border-radius:20px;padding:28px 26px}
.login-card .brand{padding:0 0 18px}
.lstep{display:flex;flex-direction:column;gap:14px}
.lstep label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600;color:var(--muted)}
.lstep input:not([type=checkbox]){height:44px;border:1px solid var(--line);border-radius:11px;padding:0 14px;background:var(--bg);font-size:16px;color:var(--text);outline:none}
.lstep input:focus{border-color:var(--accent);background:#fff;box-shadow:0 0 0 3px var(--accent-bg)}
.lstep .chk{flex-direction:row;align-items:center;gap:8px;font-weight:500;color:var(--text);font-size:14px}
.lhint{margin:0;font-size:14px;color:var(--muted);line-height:1.5}
.lhint b{color:var(--text)}
.lsecret{margin:0;font-size:12.5px;color:var(--muted);text-align:center}
.lsecret code{font-family:"JetBrains Mono",monospace;font-size:12.5px;color:var(--text);word-break:break-all;user-select:all}
.qr{display:grid;place-items:center;padding:8px}
.qr img{width:200px;height:200px;image-rendering:pixelated}
.lerr{margin:14px 0 0;color:var(--red);font-size:14px;font-weight:600}
.btn-primary{height:44px;border-radius:999px;background:var(--dark);color:#fff;font-weight:600;padding:0 20px}
.btn-primary:hover{background:#000}
.btn-primary:disabled{opacity:.5;cursor:default}
.btn-ghost{height:40px;border-radius:999px;border:1px solid var(--line);background:#fff;font-weight:600;padding:0 18px}
.btn-danger{background:var(--red)}
.btn-danger:hover{background:#b72f23}

/* ---------- rozlozenie ---------- */
.app{display:grid;grid-template-columns:290px 360px 1fr;height:100vh;height:100dvh}

/* ---------- stlpec 1 ---------- */
.col1{background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.brand{display:flex;align-items:center;gap:12px;padding:22px 20px 16px}
.logo{width:40px;height:40px;border-radius:11px;background:var(--dark);color:#fff;display:grid;place-items:center;font-weight:800;font-size:18px;flex:none}
.brand b{font-size:21px;font-weight:800;letter-spacing:-.02em}
.brand small{color:var(--muted);font-size:12px;font-weight:500}
.iconbtn{width:32px;height:32px;border-radius:9px;color:var(--muted);font-size:16px}
.iconbtn:hover{background:var(--line2);color:var(--text)}
.sortbar{display:flex;align-items:center;gap:6px;padding:4px 20px 8px;color:var(--muted);font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.05em}
.sortbar span{flex:1}
.mini{height:26px;min-width:26px;padding:0 9px;border-radius:999px;border:1px solid var(--line);font-size:12px;font-weight:600;text-transform:none;letter-spacing:0;color:var(--text)}
.mini:hover{background:var(--line2)}
.mini-add{background:var(--dark);color:#fff;border-color:var(--dark);font-size:15px;padding:0}
.mini-add:hover{background:#000}
.tree{flex:1;overflow:auto;padding:4px 12px 12px}
.sec{display:flex;align-items:center;gap:10px;height:42px;padding:0 6px 0 8px;border-radius:12px;cursor:pointer;user-select:none}
.sec:hover{background:var(--line2)}
.sec.active{background:var(--accent-bg);color:var(--accent)}
.sec .chev{width:18px;height:18px;display:grid;place-items:center;color:var(--faint);transition:transform .15s;flex:none}
.sec .chev.open{transform:rotate(90deg)}
.sec .chev.none{visibility:hidden}
.sec .ico{color:var(--muted);flex:none}
.sec.active .ico{color:var(--accent)}
.sec .nm{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.sec.active .nm{font-weight:600}
.sec.sub{padding-left:36px;height:38px;font-size:14.5px}
.cnt{min-width:26px;height:22px;padding:0 8px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-size:12px;font-weight:600;display:grid;place-items:center}
.sec .pinmark{color:var(--accent);display:grid;place-items:center}
.sec .more{width:26px;height:26px;border-radius:7px;color:var(--muted);opacity:0;display:grid;place-items:center;font-size:16px;line-height:1;flex:none}
.sec:hover .more,.sec.active .more{opacity:1}
.sec .more:hover{background:#fff}
.sec-input{display:flex;align-items:center;gap:8px;padding:4px 6px 4px 34px}
.sec-input.sub{padding-left:58px}
.sec-input input{flex:1;height:36px;border:1px solid var(--accent);border-radius:10px;padding:0 10px;outline:none;box-shadow:0 0 0 3px var(--accent-bg);min-width:0}
.tree-empty{color:var(--muted);font-size:14px;padding:16px 10px;line-height:1.5}
.side-foot{border-top:1px solid var(--line);padding:10px 12px 14px;display:flex;flex-direction:column;gap:2px}
.foot-item{display:flex;align-items:center;gap:10px;height:38px;padding:0 10px;border-radius:12px;font-weight:500;cursor:pointer}
.foot-item:hover{background:var(--line2)}
.foot-item .grow{flex:1}
.pill-warn{background:var(--warn-bg);color:var(--warn);font-size:12px;font-weight:600;padding:3px 9px;border-radius:999px}
.sync{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);padding:6px 10px 0}
.dot{width:8px;height:8px;border-radius:50%;background:#2ea44f}
.sync.off .dot{background:var(--red)}

/* ---------- stlpec 2 ---------- */
.col2{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.col2-head{padding:24px 22px 12px}
.crumb{font-size:14px;font-weight:600;color:var(--muted);display:flex;gap:8px;align-items:center;min-height:20px}
.crumb a{color:var(--accent);cursor:pointer}
.crumb .sep{color:var(--faint)}
.col2 h1{font-size:30px;font-weight:800;letter-spacing:-.03em;margin:8px 0 4px;line-height:1.1;word-break:break-word}
.sub-info{color:var(--muted);font-size:14px}
.pills{display:flex;gap:8px;flex-wrap:wrap;padding:6px 22px 12px}
.pill{height:34px;padding:0 14px;border-radius:999px;border:1px solid var(--line);background:#fff;font-weight:600;font-size:13.5px}
.pill.on{background:var(--dark);color:#fff;border-color:var(--dark)}
.newnote{margin:0 22px 12px;width:calc(100% - 44px);height:48px;border:1px solid var(--line);background:#fff;border-radius:var(--r);display:flex;align-items:center;gap:10px;padding:0 16px;font-weight:600}
.newnote:hover{border-color:#d6d5ce}
.newnote:disabled{opacity:.5;cursor:default}
.newnote .plus{font-size:20px;line-height:1}
.list{flex:1;overflow:auto;padding:0 14px 20px}
.note{padding:12px;border-radius:12px;cursor:pointer;border:1px solid transparent;margin-bottom:4px}
.note:hover{background:rgba(255,255,255,.7)}
.note.active{background:#fff;border-color:var(--line);box-shadow:0 1px 2px rgba(0,0,0,.04)}
.note .t{font-weight:700;font-size:15px;display:flex;align-items:center;gap:8px;word-break:break-word}
.note .t .flag{background:#fde4e1;color:var(--red);font-size:11px;font-weight:700;padding:2px 7px;border-radius:999px;flex:none}
.note .m{font-size:13px;color:var(--muted);margin-top:3px;display:flex;gap:8px}
.note .s{font-size:13.5px;color:var(--muted);margin-top:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.4;word-break:break-word}
.empty{color:var(--muted);text-align:center;padding:40px 10px;font-size:14px}

/* ---------- stlpec 3 ---------- */
.col1,.col2,.col3{min-width:0}
.col3{display:flex;flex-direction:column;min-height:0;background:var(--bg)}
.toolbar{display:flex;align-items:center;gap:4px;padding:14px 22px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.tb{min-width:34px;height:34px;border-radius:9px;display:grid;place-items:center;font-weight:600;padding:0 8px;font-size:14px}
.tb:hover{background:#fff}
.tb.on{background:var(--accent-bg);color:var(--accent)}
.tb:disabled{opacity:.35;cursor:default;background:none}
.tsep{width:1px;height:22px;background:var(--line);margin:0 6px}
.toolbar .grow{flex:1}
.tb.more{color:var(--muted)}
.savestate{font-size:12.5px;color:var(--muted);margin-right:6px;white-space:nowrap}
.savestate.err{color:var(--red);font-weight:600}
.paper-wrap{flex:1;overflow:auto;padding:28px 22px 60px}
.paper{max-width:820px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:18px;padding:36px 44px 48px;min-height:100%}
.ncrumb{font-size:13px;color:var(--muted);font-weight:600;display:flex;gap:6px;align-items:center;margin-bottom:10px}
.ncrumb a{color:var(--accent);cursor:pointer}
.ntitle{display:block;width:100%;border:0;padding:0;font-size:32px;font-weight:800;letter-spacing:-.03em;outline:none;margin:0 0 6px;line-height:1.2;background:transparent}
.ntitle::placeholder{color:#c9c9c4}
.ndate{color:var(--faint);font-size:13px;margin-bottom:26px}
.conflict{background:#fde4e1;color:var(--red);border-radius:12px;padding:12px 14px;margin-bottom:20px;font-size:14px;font-weight:600;display:flex;gap:10px;line-height:1.45}
.conflict .grow{flex:1}

/* editor (TipTap / ProseMirror) */
.ProseMirror{outline:none;line-height:1.65;font-size:16px;min-height:300px;white-space:pre-wrap;word-wrap:break-word}
.ProseMirror p{margin:0 0 12px}
.ProseMirror ul,.ProseMirror ol{margin:0 0 12px;padding-left:4ch}
.ProseMirror ul{list-style:disc}
.ProseMirror ul ul{list-style:circle}
.ProseMirror ul ul ul{list-style:square}
.ProseMirror li>p{margin:0 0 4px}
.ProseMirror h1,.ProseMirror h2,.ProseMirror h3{letter-spacing:-.01em;line-height:1.3}
.ProseMirror h2{font-size:21px;margin:22px 0 8px}
.ProseMirror h3{font-size:18px;margin:18px 0 6px}
.ProseMirror pre{background:var(--code-bg);border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin:6px 0 16px;font-family:"JetBrains Mono",ui-monospace,Menlo,monospace;font-size:13.5px;line-height:1.6;white-space:pre;overflow-x:auto}
.ProseMirror pre code{font-family:inherit;font-size:inherit;background:none;border:0;padding:0;border-radius:0}
.ProseMirror code{font-family:"JetBrains Mono",ui-monospace,Menlo,monospace;font-size:.9em;background:var(--code-bg);border:1px solid var(--line);border-radius:5px;padding:1px 4px}
.ProseMirror blockquote{border-left:3px solid var(--line);margin:0 0 12px;padding-left:14px;color:var(--muted)}
.ProseMirror hr{border:0;border-top:1px solid var(--line);margin:18px 0}
.ProseMirror a{color:var(--accent)}
.ProseMirror p.is-editor-empty:first-child::before{content:attr(data-placeholder);color:#c9c9c4;float:left;height:0;pointer-events:none}

/* ---------- modal, menu, toast ---------- */
.modal{position:fixed;inset:0;background:rgba(17,18,20,.35);display:grid;place-items:center;padding:16px;z-index:50}
.modal-card{width:100%;max-width:420px;background:#fff;border-radius:18px;padding:22px 22px 18px;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.modal-card h3{margin:0 0 10px;font-size:18px}
.modal-card p{margin:0 0 8px;color:var(--muted);line-height:1.5;font-size:14.5px}
.modal-card input,.modal-card select{width:100%;height:42px;border:1px solid var(--line);border-radius:11px;padding:0 12px;font-size:15px;outline:none;background:#fff}
.modal-card input:focus,.modal-card select:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-bg)}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.modal-actions .btn-primary{height:40px}
.menu{position:fixed;z-index:40;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.12);padding:6px;min-width:200px}
.menu button{display:flex;width:100%;text-align:left;padding:9px 12px;border-radius:8px;font-size:14px;font-weight:500}
.menu button:hover{background:var(--line2)}
.menu button.danger{color:var(--red)}
.menu hr{border:0;border-top:1px solid var(--line);margin:4px 0}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:var(--dark);color:#fff;padding:10px 16px;border-radius:999px;font-size:14px;font-weight:500;z-index:60;max-width:calc(100% - 32px)}
.toast.err{background:var(--red)}

.mback{display:none}

/* ---------- mobil ---------- */
@media (max-width: 860px){
  .app{grid-template-columns:minmax(0,1fr)}
  .col1,.col2,.col3{display:none;height:100vh;height:100dvh;border:0}
  .app[data-view="sections"] .col1{display:flex}
  .app[data-view="list"] .col2{display:flex}
  .app[data-view="note"] .col3{display:flex}
  .mback{white-space:nowrap;flex:none;display:inline-flex;align-items:center;gap:4px;color:var(--accent);font-weight:600;font-size:15px;height:34px;padding:0 6px 0 0}
  .col2-head{padding:14px 16px 10px}
  .pills{padding-left:16px;padding-right:16px}
  .newnote{margin-left:16px;margin-right:16px;width:calc(100% - 32px)}
  .list{padding:0 8px 20px}
  .toolbar{padding:10px 12px;overflow-x:auto;flex-wrap:nowrap}
  .paper-wrap{padding:12px;overflow-x:hidden}
  .tb{flex:none}
  .paper{padding:22px 18px 36px;border-radius:14px}
  .ntitle{font-size:26px}
  .sec .more{opacity:1}
}
