:root{
  --bg:#090c11;--panel:#0e131a;--panel2:#111720;--line:#202936;
  --text:#edf1f6;--muted:#778392;--accent:#795cff;--accent2:#927cff;
  --danger:#ff6472
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}
button,input,textarea{font:inherit}
button{cursor:pointer}
.app{min-height:100vh;display:grid;grid-template-columns:280px minmax(0,1fr) 290px;background:radial-gradient(circle at 50% -15%,#171d29 0,#090c11 42%)}
.sidebar{background:rgba(13,18,25,.96);border-right:1px solid var(--line);padding:20px 15px;display:flex;flex-direction:column}
.right{background:rgba(13,18,25,.96);border-left:1px solid var(--line);padding:20px 17px}
.brand{display:flex;align-items:center;gap:11px;margin:2px 7px 21px}.logo{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,var(--accent),#4d91ff);display:grid;place-items:center;font-weight:850;font-size:20px}.brand b{display:block;font-size:15px}.brand small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.new-btn{border:0;border-radius:10px;padding:12px 14px;background:var(--accent);color:white;font-weight:750;box-shadow:0 8px 25px #795cff22}.new-btn:hover{background:var(--accent2)}
.search{margin:13px 0}.search input{width:100%;border:1px solid var(--line);outline:0;background:#090d13;color:var(--text);padding:10px 11px;border-radius:9px}.search input:focus{border-color:#5540b4}
.notes{flex:1;overflow:auto;padding-right:2px}.note{padding:12px 10px;border:1px solid transparent;border-radius:10px;margin-bottom:4px;cursor:pointer}.note:hover{background:#151b24}.note.active{background:#171e29;border-color:#2b3543}.note-title{font-size:13px;font-weight:680;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.note-date{font-size:10px;color:#596574;margin-top:6px}.no-notes{text-align:center;color:#5c6877;font-size:12px;padding:22px 5px}
.side-bottom{border-top:1px solid var(--line);padding-top:13px;display:flex;justify-content:space-between;color:var(--muted);font-size:11px}.side-bottom button{border:0;background:none;color:#697584}.side-bottom button:hover{color:white}
.main{min-width:0;display:flex}.empty{margin:auto;text-align:center;padding:30px}.empty-icon{width:58px;height:58px;border-radius:16px;background:#171d27;color:#a592ff;display:grid;place-items:center;margin:0 auto 15px;font-size:25px}.empty h1{font-size:24px;margin:0 0 8px}.empty p{color:var(--muted);font-size:13px;margin:0 0 20px}
.editor{width:100%;min-height:100vh;display:flex;flex-direction:column;padding:25px 32px 18px}.hidden{display:none!important}.editor-head{display:flex;align-items:center;gap:14px;border-bottom:1px solid var(--line);padding-bottom:16px}.editor-head>input{flex:1;min-width:0;background:transparent;border:0;outline:0;color:var(--text);font-size:23px;font-weight:760}.editor-head>input::placeholder{color:#505b69}.actions{display:flex;align-items:center;gap:7px}.actions span{font-size:10px;color:#697687;margin-right:4px}.actions button{border:1px solid var(--line);background:#151b24;color:#cdd5df;border-radius:8px;padding:8px 10px;font-size:11px}.actions button:hover{background:#1a222d}.actions .delete:hover{color:var(--danger);border-color:#55323a}
#content{flex:1;width:100%;min-height:55vh;resize:none;border:0;outline:0;background:transparent;color:#dce2ea;padding:22px 2px;font:14px/1.75 "SFMono-Regular",Consolas,"Liberation Mono",monospace}#content::placeholder{color:#4b5665}
.editor footer{border-top:1px solid var(--line);padding-top:11px;display:flex;justify-content:space-between;color:#596575;font-size:10px}
.card{background:#0e131a;border:1px solid var(--line);border-radius:12px;padding:15px;margin-bottom:11px}.card label{display:block;color:#697687;letter-spacing:.15em;font-size:9px;margin-bottom:10px}.card h2{font-size:15px;margin:0 0 7px}.card p,.card li{font-size:11px;line-height:1.65;color:var(--muted)}.card ul{padding-left:17px;margin:0}.card code{font-size:12px;color:#9c8aff}
@media(max-width:1000px){.app{grid-template-columns:250px minmax(0,1fr)}.right{display:none}}
@media(max-width:650px){.app{display:block}.sidebar{height:43vh;border-right:0;border-bottom:1px solid var(--line)}.main{min-height:57vh}.editor{min-height:57vh;padding:17px}.editor-head{align-items:flex-start;flex-direction:column}.actions{width:100%;flex-wrap:wrap}.editor-head>input{width:100%}}

.actions button:disabled{opacity:.42;cursor:not-allowed}
.editor-head>input:disabled,#content[readonly]{color:#8e98a6;cursor:default}

.files-panel{
  border-top:1px solid var(--line);
  padding-top:16px;
  margin-top:4px;
}

.files-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  margin-bottom:10px;
}

.files-label{
  display:block;
  color:#697687;
  letter-spacing:.15em;
  font-size:9px;
  margin-bottom:5px;
}

.files-head h3{
  margin:0;
  font-size:13px;
}

.upload-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #30275f;
  background:#17132a;
  color:#a996ff;
  border-radius:8px;
  padding:8px 11px;
  font-size:11px;
  font-weight:700;
  cursor:pointer;
}

.upload-btn:hover{
  background:#211b3a;
  border-color:#4a3c8c;
}

.files-list{
  display:flex;
  flex-direction:column;
  gap:5px;
  max-height:180px;
  overflow:auto;
}

.drop-zone{
  border:1px dashed #354052;
  border-radius:10px;
  padding:11px 13px;
  margin-bottom:10px;
  color:#738092;
  background:#0b1017;
  font-size:10px;
  text-align:center;
  transition:border-color .18s,background .18s,color .18s;
}

.drop-zone.dragging{
  border-color:var(--accent2);
  background:#18152a;
  color:#c3b9ff;
}

.drop-zone.disabled{
  opacity:.45;
  cursor:not-allowed;
}

.files-empty{
  color:#596575;
  font-size:11px;
  padding:13px 2px;
}

.file-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 9px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#0e131a;
}

.file-row:hover{
  background:#131923;
}

.file-icon{
  width:34px;
  height:34px;
  flex:none;
  display:grid;
  place-items:center;
  border-radius:7px;
  background:#171e29;
  color:#927cff;
  font-size:9px;
  font-weight:800;
}

.file-info{
  min-width:0;
  flex:1;
}

.file-name{
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.file-meta{
  color:#596575;
  font-size:9px;
  margin-top:3px;
}

.file-actions{
  display:flex;
  gap:4px;
  flex:none;
}

.file-actions button{
  border:1px solid var(--line);
  background:#151b24;
  color:#aeb7c3;
  border-radius:6px;
  padding:5px 7px;
  font-size:9px;
  cursor:pointer;
}

.file-actions button:hover{
  color:white;
  background:#1b2330;
}

.file-actions .file-delete:hover{
  color:var(--danger);
  border-color:#55323a;
}


/* FILE MODAL */

.file-modal{
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:25px;
}

.file-modal.hidden{
  display:none!important;
}

.file-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(5px);
}

.file-modal-box{
  position:relative;
  width:min(1000px,100%);
  max-height:min(85vh,800px);
  display:flex;
  flex-direction:column;
  background:#0d1219;
  border:1px solid #293341;
  border-radius:14px;
  box-shadow:0 30px 100px rgba(0,0,0,.55);
  overflow:hidden;
}

.file-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  padding:15px 17px;
  border-bottom:1px solid var(--line);
}

.file-modal-head>div{
  min-width:0;
}

.file-modal-head span{
  display:block;
  color:#6d7887;
  font-size:8px;
  letter-spacing:.15em;
  margin-bottom:4px;
}

.file-modal-head h2{
  margin:0;
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.modal-close{
  width:32px;
  height:32px;
  flex:none;
  border:1px solid var(--line);
  border-radius:8px;
  background:#151b24;
  color:#aab3bf;
  font-size:20px;
  line-height:1;
}

.modal-close:hover{
  color:white;
  background:#1c2531;
}

.file-preview{
  flex:1;
  min-height:250px;
  overflow:auto;
  background:#090d13;
}

.image-preview{
  display:block;
  max-width:100%;
  max-height:calc(85vh - 150px);
  margin:auto;
  object-fit:contain;
}

.preview-loading{
  min-height:280px;
  display:grid;
  place-items:center;
  color:var(--muted);
  font-size:12px;
}

.code-preview{
  margin:0;
  padding:18px;
  min-height:100%;
  color:#dce2ea;
  font:12px/1.7 "SFMono-Regular",Consolas,
    "Liberation Mono",monospace;
  white-space:pre;
  tab-size:2;
}

.code-preview code{
  font:inherit;
}

.no-preview{
  min-height:300px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  text-align:center;
  padding:30px;
}

.no-preview-icon{
  width:55px;
  height:55px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:#171e29;
  color:#927cff;
  font-size:20px;
  font-weight:800;
  margin-bottom:14px;
}

.no-preview h3{
  margin:0 0 6px;
  font-size:15px;
}

.no-preview p{
  color:var(--muted);
  font-size:11px;
  max-width:380px;
  line-height:1.6;
  margin:0 0 17px;
}

.no-preview button{
  border:0;
  border-radius:8px;
  background:var(--accent);
  color:white;
  padding:9px 13px;
  font-size:11px;
  font-weight:700;
  cursor:pointer;
}

.file-modal-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  padding:11px 15px;
  border-top:1px solid var(--line);
}

.file-modal-actions button,
.download-file-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  background:#151b24;
  color:#cdd5df;
  border-radius:8px;
  padding:8px 11px;
  font-size:10px;
  cursor:pointer;
  text-decoration:none;
}

.file-modal-actions button:hover,
.download-file-btn:hover{
  background:#1b2330;
  color:white;
}

.download-file-btn{
  background:var(--accent);
  border-color:var(--accent);
  color:white;
}

.download-file-btn:hover{
  background:var(--accent2);
}

.note-title-row{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}

.note-title-row .note-title{
  min-width:0;
  flex:1;
}

.note-lock{
  flex:none;
  font-size:11px;
  line-height:1;
  opacity:.9;
}


/* =========================================================
   PASSWORD MODALS
   ========================================================= */

.password-modal{
  position:fixed;
  inset:0;
  z-index:2000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.password-modal.hidden{
  display:none!important;
}

.password-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.74);
  backdrop-filter:blur(6px);
}

.password-box{
  position:relative;
  width:min(430px,100%);
  background:#0d1219;
  border:1px solid #293341;
  border-radius:14px;
  box-shadow:0 30px 100px rgba(0,0,0,.6);
  overflow:hidden;
}

.password-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  padding:17px;
  border-bottom:1px solid var(--line);
}

.password-head>div{
  min-width:0;
}

.password-head span{
  display:block;
  color:#697687;
  letter-spacing:.15em;
  font-size:8px;
  margin-bottom:5px;
}

.password-head h2{
  margin:0;
  font-size:15px;
}

.password-body{
  padding:18px 17px;
}

.password-body p{
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
  margin:0 0 15px;
}

.password-body label{
  display:block;
  color:#7a8695;
  font-size:10px;
  margin-bottom:6px;
}

.password-body input{
  width:100%;
  border:1px solid var(--line);
  outline:0;
  background:#090d13;
  color:var(--text);
  padding:11px 12px;
  border-radius:9px;
}

.password-body input:focus{
  border-color:#5540b4;
}

.password-error{
  margin-top:10px;
  color:#ff7b87;
  background:#29151a;
  border:1px solid #4e2931;
  border-radius:8px;
  padding:9px 10px;
  font-size:10px;
}

.password-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:7px;
  padding:12px 15px;
  border-top:1px solid var(--line);
}

.password-actions button{
  border:1px solid var(--line);
  background:#151b24;
  color:#cdd5df;
  border-radius:8px;
  padding:8px 11px;
  font-size:10px;
}

.password-actions button:hover{
  background:#1b2330;
  color:white;
}

.password-actions .password-primary{
  background:var(--accent);
  border-color:var(--accent);
  color:white;
  font-weight:700;
}

.password-actions .password-primary:hover{
  background:var(--accent2);
}

.password-actions .danger-password{
  color:#ff7b87;
  border-color:#55323a;
}

.password-actions button:disabled{
  opacity:.55;
  cursor:wait;
}

.modal-close{
  width:32px;
  height:32px;
  flex:none;
  border:1px solid var(--line);
  border-radius:8px;
  background:#151b24;
  color:#aab3bf;
  font-size:20px;
  line-height:1;
}

.modal-close:hover{
  color:white;
  background:#1c2531;
}


/* =========================================================
   MOBILE PASSWORD MODAL
   ========================================================= */

@media(max-width:650px){

  .password-modal{
    padding:10px;
  }

  .password-box{
    width:100%;
  }

  .password-actions{
    justify-content:stretch;
  }

  .password-actions button{
    flex:1;
  }
}



/* MOBILE */

@media(max-width:650px){

  .files-head{
    align-items:flex-start;
    flex-direction:column;
  }

  .upload-btn{
    width:100%;
  }

  .file-row{
    align-items:flex-start;
  }

  .file-actions{
    flex-wrap:wrap;
    justify-content:flex-end;
  }

  .file-modal{
    padding:10px;
  }

  .file-modal-box{
    max-height:92vh;
  }

  .file-actions .file-open,
  .file-actions .file-download{
    display:none;
  }

}
