@font-face{
  font-family:"TeDejaVuSerif";
  src:url("../fonts/DejaVuSerif.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"TeDejaVuSerif";
  src:url("../fonts/DejaVuSerif-Bold.ttf") format("truetype");
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"TeDejaVuSerif";
  src:url("../fonts/DejaVuSerif-Italic.ttf") format("truetype");
  font-weight:400;
  font-style:italic;
  font-display:swap;
}

@font-face{
  font-family:"TeDejaVuSerif";
  src:url("../fonts/DejaVuSerif-BoldItalic.ttf") format("truetype");
  font-weight:700;
  font-style:italic;
  font-display:swap;
}

#tese-editor-app{
  --brand:#12B3B6;
  --brand-dark:#0E8E90;
  --bg:#f7f8fa;
  --panel:#ffffff;
  --ink:#0e1720;
  --muted:#5b6570;
  --line:#e1e5ea;
  --shadow:0 10px 24px rgba(0,0,0,.08);

  --accent:var(--brand);
  --accent-2:#e6f8f8;

  --te-bg:var(--bg);
  --te-paper:var(--panel);
  --te-ink:var(--ink);
  --te-muted:var(--muted);
  --te-line:var(--line);
  --te-brand:var(--brand);
  --te-brand-dark:var(--brand-dark);
  --te-brand-soft:#e8fbfb;
  --te-shadow:var(--shadow);

  --te-page-w:210mm;
  --te-page-h:297mm;
  --te-pad-top:25.4mm;
  --te-pad-right:25.4mm;
  --te-pad-bottom:25.4mm;
  --te-pad-left:25.4mm;
  --te-first-indent:1.27cm;

  position:relative;
  z-index:0;
  color:var(--te-ink);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

#tese-editor-app *{
  box-sizing:border-box;
}

.tb-preview{
  display:none !important;
}

#tese-editor-app .te-toolbar{
  position:sticky;
  top:12px;
  z-index:2;
  display:flex;
  flex-direction:column;
  gap:12px;
  width:calc(100% + 140px);
  margin:0 -70px 12px;
  padding:10px 14px 12px;
  background:rgba(255,255,255,.9);
  backdrop-filter:blur(10px);
  border:1px solid var(--te-line);
  border-radius:16px;
  box-shadow:var(--te-shadow);
}

#tese-editor-app .te-toolbar-row{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

#tese-editor-app .te-toolbar-row--buttons{
  flex-wrap:nowrap;
  justify-content:center;
  gap:10px;
  width:100%;
}

#tese-editor-app .te-toolbar-row--meta{
  justify-content:space-between;
  align-items:center;
  flex-wrap:nowrap;
  gap:16px;
  width:100%;
}

#tese-editor-app .te-toolbar-meta-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  flex:1 1 auto;
  flex-wrap:nowrap;
}

#tese-editor-app #te-clear-document{
  flex:0 0 auto;
  align-self:center;
}

#tese-editor-app .te-toolbar-group{
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  align-items:center;
  min-width:max-content;
}

#tese-editor-app .te-toolbar-group--end{
  margin-left:auto;
  flex-wrap:nowrap;
  min-width:0;
}

#tese-editor-app .te-toolbar-hint{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:10px;
  font-size:11px;
  line-height:1.35;
  color:var(--te-muted);
  padding:2px 2px 0;
  min-width:0;
  white-space:nowrap;
}

#tese-editor-app .te-toolbar-hint strong{
  color:var(--te-ink);
}

#tese-editor-app .te-toolbar-hint kbd{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:18px;
  padding:0 6px;
  border:1px solid var(--te-line);
  border-radius:6px;
  background:var(--panel);
  color:var(--te-ink);
  font:600 11px/1 system-ui, sans-serif;
  box-shadow:0 1px 0 rgba(0,0,0,.04);
}

#tese-editor-app .te-toolbar button{
  position:relative;
  z-index:0;
}

#tese-editor-app .te-toolbar button.is-active,
#tese-editor-app .te-toolbar button.active{
  z-index:1;
}

#tese-editor-app .te-toolbar button:not(.te-svg-btn){
  appearance:none;
  border:1px solid var(--te-line);
  background:var(--panel);
  color:var(--te-ink);
  border-radius:10px;
  padding:8px 12px;
  font-size:14px;
  line-height:1;
  cursor:pointer;
  transition:border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

#tese-editor-app .te-toolbar button:not(.te-svg-btn):hover,
#tese-editor-app .te-toolbar button:not(.te-svg-btn).is-active,
#tese-editor-app .te-toolbar button:not(.te-svg-btn).active{
  border-color:var(--te-brand);
  background:var(--te-brand-soft);
  color:var(--te-brand-dark);
}

#tese-editor-app .te-toolbar button:not(.te-svg-btn):disabled,
#tese-editor-app .te-toolbar button:not(.te-svg-btn)[aria-disabled="true"]{
  opacity:.5;
  cursor:not-allowed;
  color:var(--te-muted);
  background:var(--te-soft);
  border-color:var(--te-line);
  transform:none;
  box-shadow:none;
}

#tese-editor-app .te-toolbar button:not(.te-svg-btn):disabled:hover,
#tese-editor-app .te-toolbar button:not(.te-svg-btn)[aria-disabled="true"]:hover{
  color:var(--te-muted);
  background:var(--te-soft);
  border-color:var(--te-line);
}

#tese-editor-app .te-toolbar button:not(.te-svg-btn):focus-visible{
  outline:none;
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.12);
}

#tese-editor-app .te-file-label{
  font-size:12px;
  color:var(--te-muted);
  white-space:nowrap;
}

#tese-editor-app .te-file-input{
  min-width:220px;
  max-width:100%;
  padding:8px 10px;
  border:1px solid var(--te-line);
  border-radius:10px;
  font-size:14px;
  color:var(--te-ink);
  background:var(--panel);
}

#tese-editor-app .te-toolbar .te-svg-btn{
  width:46px;
  height:46px;
  min-width:46px;
}

#tese-editor-app.te-svg-icons-pending .te-toolbar .te-svg-btn .tb-icon{
  visibility:hidden;
}

#tese-editor-app .te-file-input:focus{
  outline:none;
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.12);
}

#tese-editor-app .te-statusbar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:14px;
  padding:0 6px;
  color:var(--te-muted);
  font-size:13px;
}

#tese-editor-app .te-sep{
  padding:0 6px;
  opacity:.55;
}

#tese-editor-app .te-layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 320px;
  gap:18px;
  align-items:start;
}

#tese-editor-app .te-layout--notes-hidden{
  grid-template-columns:minmax(0, 1fr);
}

#tese-editor-app .te-stage-wrap{
  min-width:0;
  padding:16px;
  background:var(--te-bg);
  border:1px solid var(--te-line);
  border-radius:20px;
}

#tese-editor-app .te-editor{
  width:var(--te-page-w);
  max-width:100%;
  margin:0 auto;
  min-height:var(--te-page-h);
  padding:var(--te-pad-top) var(--te-pad-right) var(--te-pad-bottom) var(--te-pad-left);
  outline:none;
  overflow-wrap:anywhere;
  font-family:"TeDejaVuSerif", Georgia, "Times New Roman", serif;
  font-size:12pt;
  line-height:2;
  color:var(--te-ink);
  background:var(--te-paper);
  box-shadow:0 12px 32px rgba(0,0,0,.08);
  border:1px solid #edf1f5;
}

#tese-editor-app .te-editor h1,
#tese-editor-app .te-editor h2,
#tese-editor-app .te-editor p,
#tese-editor-app .te-editor ul{
  max-width:100%;
}

#tese-editor-app .te-editor h1{
  font-size:22pt;
  line-height:1.35;
  margin:38pt 0 12pt;
  font-weight:700;
  text-align:justify;
  text-indent:0;
}

#tese-editor-app .te-editor h2{
  font-size:14.5pt;
  line-height:1.55;
  margin:22pt 0 6pt;
  font-weight:600;
  text-align:justify;
  text-indent:0;
}

#tese-editor-app .te-editor > h1:first-child,
#tese-editor-app .te-editor > h2:first-child{
  margin-top:0;
}

#tese-editor-app .te-editor p{
  margin:0;
  min-height:2em;
  text-align:justify;
  text-indent:var(--te-first-indent);
}

#tese-editor-app .te-editor h1 + p,
#tese-editor-app .te-editor h2 + p{
  text-indent:var(--te-first-indent);
}

#tese-editor-app .te-editor ul{
  margin:0 0 0 var(--te-first-indent);
  padding:0 0 0 var(--te-first-indent);
  text-align:left;
}

#tese-editor-app .te-editor li{
  margin:0;
  text-align:left;
}

#tese-editor-app .te-editor a{
  font:inherit;
  color:var(--te-brand-dark);
  text-decoration:underline;
  word-break:break-all;
}

#tese-editor-app .te-footnote-ref{
  font-size:10px;
  vertical-align:super;
  cursor:pointer;
  color:var(--te-brand-dark);
  font-weight:700;
  user-select:none;
}

#tese-editor-app .te-footnote-ref.is-active{
  background:var(--te-brand-soft);
  border-radius:4px;
}

#tese-editor-app .te-notes-panel{
  position:sticky;
  top:88px;
  z-index:1;
  background:var(--panel);
  border:1px solid var(--te-line);
  border-radius:16px;
  padding:14px;
  box-shadow:var(--shadow);
}

#tese-editor-app .te-layout--notes-hidden .te-notes-panel{
  display:none;
}

#tese-editor-app .te-notes-head{
  margin-bottom:10px;
}

#tese-editor-app .te-notes-title{
  color:var(--te-ink);
  font-size:14px;
  font-weight:700;
}

#tese-editor-app .te-notes-subtitle{
  color:var(--te-muted);
  font-size:12px;
}

#tese-editor-app .te-notes-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

#tese-editor-app .te-note-card{
  border:1px solid var(--te-line);
  border-radius:12px;
  padding:10px;
  background:var(--panel);
}

#tese-editor-app .te-note-card.is-active{
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.1);
}

#tese-editor-app .te-note-row{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
  margin-bottom:8px;
}

#tese-editor-app .te-note-id{
  font-size:12px;
  color:var(--te-ink);
  font-weight:700;
}

#tese-editor-app .te-note-actions{
  display:flex;
  gap:6px;
}

#tese-editor-app .te-note-btn{
  appearance:none;
  border:1px solid var(--te-line);
  background:var(--panel);
  color:var(--te-muted);
  border-radius:8px;
  padding:5px 8px;
  font-size:12px;
  cursor:pointer;
  transition:border-color .16s ease, color .16s ease, background-color .16s ease;
}

#tese-editor-app .te-note-btn:hover{
  border-color:var(--te-brand);
  color:var(--te-brand-dark);
  background:var(--te-brand-soft);
}

#tese-editor-app .te-note-input{
  width:100%;
  min-height:74px;
  resize:vertical;
  border:1px solid var(--te-line);
  border-radius:10px;
  padding:10px;
  font:inherit;
  font-family:"TeDejaVuSerif", Georgia, "Times New Roman", serif;
  font-size:10pt;
  line-height:1.45;
  color:var(--te-ink);
  background:var(--panel);
}

#tese-editor-app .te-note-input:focus{
  outline:none;
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.12);
}

#tese-editor-app .te-note-empty{
  color:var(--te-muted);
  font-size:13px;
}

#tese-editor-app .te-modal[hidden]{
  display:none;
}

#tese-editor-app .te-modal{
  position:fixed;
  inset:0;
  z-index:80;
}

#tese-editor-app.te-modal-open .te-layout,
#tese-editor-app.te-modal-open .te-toolbar,
#tese-editor-app.te-modal-open .te-statusbar{
  pointer-events:none;
}

#tese-editor-app.te-modal-open .te-modal{
  pointer-events:auto;
}

#tese-editor-app .te-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(14,23,32,.42);
  backdrop-filter:blur(4px);
}

#tese-editor-app .te-modal-card{
  position:relative;
  width:min(720px, calc(100vw - 32px));
  margin:3vh auto 0;
  background:var(--panel);
  border:1px solid var(--te-line);
  border-radius:18px;
  box-shadow:0 24px 70px rgba(0,0,0,.18);
  padding:18px;
}

#tese-editor-app .te-modal-card--footnote{
  width:min(560px, calc(100vw - 32px));
}

#tese-editor-app .te-command-card{
  position:relative;
  width:min(560px, calc(100vw - 32px));
  margin:8vh auto 0;
  background:var(--panel);
  border:1px solid var(--te-line);
  border-radius:16px;
  box-shadow:0 24px 70px rgba(0,0,0,.18);
  padding:14px;
}

#tese-editor-app .te-command-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}

#tese-editor-app .te-command-head h3{
  margin:0;
  font-size:15px;
  color:var(--te-ink);
}

#tese-editor-app .te-command-copy{
  margin-bottom:8px;
  color:var(--te-muted);
  font-size:12px;
}

#tese-editor-app .te-command-input{
  width:100%;
  border:1px solid var(--te-line);
  border-radius:10px;
  padding:11px 12px;
  font:500 15px/1.3 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--te-ink);
  background:var(--panel);
}

#tese-editor-app .te-command-input:focus{
  outline:none;
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.12);
}

#tese-editor-app .te-command-list{
  display:flex;
  flex-direction:column;
  gap:4px;
  max-height:min(340px, 50vh);
  overflow:auto;
  margin-top:10px;
}

#tese-editor-app .te-command-item{
  appearance:none;
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid transparent;
  border-radius:10px;
  padding:9px 10px;
  color:var(--te-ink);
  background:transparent;
  text-align:left;
  cursor:pointer;
}

#tese-editor-app .te-command-item .tb-icon{
  width:20px;
  height:20px;
}

#tese-editor-app .te-command-label{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
}

#tese-editor-app .te-command-empty{
  padding:12px;
  color:var(--te-muted);
  font-size:13px;
}

#tese-editor-app .te-modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}

#tese-editor-app .te-modal-head h3{
  margin:0;
  font-size:18px;
  color:var(--te-ink);
}

#tese-editor-app .te-modal-close{
  appearance:none;
  border:1px solid var(--te-line);
  background:var(--panel);
  color:var(--te-muted);
  border-radius:10px;
  width:38px;
  height:38px;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

#tese-editor-app .te-modal-close:hover{
  border-color:var(--te-brand);
  color:var(--te-brand-dark);
  background:var(--te-brand-soft);
}

#tese-editor-app .te-shortcuts-grid{
  display:grid;
  gap:10px;
}

#tese-editor-app .te-shortcut-row{
  display:grid;
  grid-template-columns:minmax(160px,1.1fr) 1fr 1fr;
  gap:12px;
  align-items:center;
  padding:10px 12px;
  border:1px solid var(--te-line);
  border-radius:12px;
  background:#fbfcfd;
  font-size:14px;
  color:var(--te-muted);
}

#tese-editor-app .te-shortcut-row strong{
  color:var(--te-ink);
}

#tese-editor-app .te-footnote-copy{
  margin-bottom:10px;
  color:var(--te-muted);
  font-size:13px;
}

#tese-editor-app .te-footnote-input{
  width:100%;
  min-height:140px;
  resize:vertical;
  border:1px solid var(--te-line);
  border-radius:12px;
  padding:12px 14px;
  font:inherit;
  font-family:"TeDejaVuSerif", Georgia, "Times New Roman", serif;
  font-size:11pt;
  line-height:1.55;
  color:var(--te-ink);
  background:var(--panel);
}

#tese-editor-app .te-footnote-input:focus{
  outline:none;
  border-color:var(--te-brand);
  box-shadow:0 0 0 3px rgba(18,179,182,.12);
}

#tese-editor-app .te-footnote-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
}

#tese-editor-app .te-footnote-btn{
  appearance:none;
  border:1px solid var(--te-line);
  border-radius:10px;
  padding:9px 14px;
  font-size:14px;
  cursor:pointer;
  transition:border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

#tese-editor-app .te-footnote-btn--ghost{
  background:var(--panel);
  color:var(--te-muted);
}

#tese-editor-app .te-footnote-btn--ghost:hover{
  border-color:var(--te-brand);
  background:var(--te-brand-soft);
  color:var(--te-brand-dark);
}

#tese-editor-app .te-footnote-btn--primary{
  border-color:var(--te-brand);
  background:var(--te-brand);
  color:#fff;
}

#tese-editor-app .te-footnote-btn--primary:hover{
  border-color:var(--te-brand-dark);
  background:var(--te-brand-dark);
}

@media (max-width:1200px){
  #tese-editor-app .te-layout{
    grid-template-columns:1fr;
  }

  #tese-editor-app .te-notes-panel{
    position:static;
    z-index:auto;
  }
}

@media (max-width:1100px){
  #tese-editor-app{
    --te-page-w:min(100%, 210mm);
  }

  #tese-editor-app .te-stage-wrap{
    padding:10px;
  }
}

@media (max-width:1024px){
  #tese-editor-app .te-toolbar{
    width:calc(100% + 64px);
    margin:0 -32px 12px;
    padding:10px 12px;
  }

  #tese-editor-app .te-toolbar-row{
    gap:6px;
  }

  #tese-editor-app .te-toolbar-row--buttons{
    justify-content:flex-start;
    column-gap:10px;
    row-gap:12px;
  }

  #tese-editor-app .te-toolbar-row--meta{
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }

  #tese-editor-app .te-toolbar-meta-left{
    width:100%;
    align-items:flex-start;
  }

  #tese-editor-app .te-toolbar-group{
    gap:8px;
  }

  #tese-editor-app .te-toolbar-group--end{
    margin-left:0;
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
  }

  #tese-editor-app .te-file-input{
    min-width:180px;
    flex:1 1 220px;
  }

  #tese-editor-app .te-toolbar-hint{
    display:none;
  }

}

@media (max-width:760px){
  #tese-editor-app{
    width:100%;
    max-width:100%;
    min-width:0;
    overflow-x:hidden;
  }

  #tese-editor-app .te-toolbar{
    position:static;
    width:100%;
    max-width:100%;
    min-width:0;
    margin:0 0 12px;
    padding:10px;
  }

  #tese-editor-app .te-toolbar-row--buttons{
    flex-wrap:wrap;
    justify-content:flex-start;
  }

  #tese-editor-app .te-toolbar-group{
    flex-wrap:wrap;
    min-width:0;
    max-width:100%;
  }

  #tese-editor-app .te-toolbar-meta-left{
    flex-wrap:wrap;
    min-width:0;
  }

  #tese-editor-app .te-toolbar button:not(.te-svg-btn){
    padding:7px 10px;
    font-size:13px;
  }

  #tese-editor-app .te-file-label{
    width:100%;
  }

  #tese-editor-app .te-file-input{
    min-width:0;
    width:100%;
  }

  #tese-editor-app .te-toolbar-group--end{
    width:100%;
  }

  #tese-editor-app .te-shortcut-row{
    grid-template-columns:1fr;
    gap:6px;
  }

  #tese-editor-app .te-footnote-actions{
    flex-direction:column-reverse;
  }

  #tese-editor-app .te-footnote-btn{
    width:100%;
  }
}

@media (hover:none), (pointer:coarse){
  #tese-editor-app .te-toolbar-hint{
    display:none;
  }

}
