:root{
  --bg:#0f1217;
  --panel:#151a22;
  --panel2:#10141b;
  --text:#e7ecf3;
  --muted:#a7b0c0;
  --accent:#ff4d4d;
  --border:#2a3140;
  --paper:#ffffff;
  --ink:#111;
  --header-cols: 1fr 180px 70px 70px 50px;
}

@font-face{
  font-family:"Grundschrift";
  src:url("../../vendor/fonts/grundschrift/Grundschrift-Regular.otf") format("opentype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}
@font-face{
  font-family:"Grundschrift";
  src:url("../../vendor/fonts/grundschrift/Grundschrift-Bold.otf") format("opentype");
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

.topbar{
  display:flex;
  gap:16px;
  align-items:flex-start;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, var(--panel), var(--panel2));
}

.brand .logo{font-weight:800; letter-spacing:.3px}
.brand .sub{color:var(--muted); font-size:12px; margin-top:2px}

.controls{
  display:flex;
  gap:10px;
  align-items:flex-end;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.controls label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.controls input{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.controls select{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.controls input[type="range"]{
  padding:0;
}
.controls button{
  padding:9px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
}
.controls button.primary{border-color:#2f6; }
.controls button.danger{border-color:#f44;}

.settings{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:12px 16px;
  border-bottom:1px solid var(--border);
}

.template-panel{
  flex:1;
  min-width:320px;
}
.template-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}
.template-actions{
  display:flex;
  gap:8px;
}
.template-actions button{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
}
.template-actions .danger{border-color:#f44;}
.template-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:10px;
}
.template-row label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.template-row input,
.template-row select{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.template-default{
  flex-direction:row !important;
  align-items:center;
  gap:8px !important;
  margin-top:18px;
  color:var(--text) !important;
}

.weekday-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap:10px;
  width:min(980px, 100%);
}
.day-card{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background:var(--panel2);
}
.day-card .day{font-size:12px; color:var(--muted);}
.day-card .row{display:flex; align-items:center; justify-content:space-between; margin-top:8px;}
.day-card input{
  width:56px;
  padding:7px 8px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}

.hint{color:var(--muted); font-size:12px; line-height:1.3}

.layout{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:0;
  height: calc(100vh - 80px - 64px);
}

.sidebar{
  border-right:1px solid var(--border);
  background:linear-gradient(180deg, var(--panel2), #0b0e13);
  overflow:auto;
}
.canvas{
  overflow:auto;
  padding:16px;
  padding-bottom:88px;
}

.panel{padding:14px;}
.panel-title{font-weight:700; margin-bottom:10px;}
.page-list{display:flex; flex-direction:column; gap:10px;}

.range-section{
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:var(--panel2);
}
.range-section.active{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(255,77,77,0.2);
}
.range-header{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background:linear-gradient(180deg, #121720, #0f1217);
  border-bottom:1px solid var(--border);
}
.range-header.active{
  background:linear-gradient(180deg, #22161a, #151017);
  border-bottom-color:#8a3a48;
}
.range-toggle{
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  border-radius:8px;
  width:28px;
  height:28px;
  cursor:pointer;
}
.range-title{
  font-weight:700;
}
.range-title-wrap{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.range-actions{
  margin-left:auto;
  display:flex;
  gap:6px;
}
.range-actions button{
  padding:6px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
  font-size:12px;
}
.range-actions .danger{border-color:#f44;}
.range-body.hidden{
  display:none;
}

.list-addbar{
  display:flex;
  gap:10px;
  align-items:flex-end;
  padding:10px 12px;
  border-top:1px dashed var(--border);
}
.list-addbar label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.list-addbar input{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.list-addbar button{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
}

.dialog-modal{
  position:fixed;
  inset:0;
  background:rgba(10,12,16,0.6);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.dialog-card{
  width:min(520px, 92vw);
  background:#0f1217;
  border:1px solid #2a3140;
  border-radius:16px;
  padding:16px;
  color:var(--text);
  box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.dialog-title{
  font-weight:700;
  margin-bottom:10px;
}
.dialog-body{
  display:grid;
  gap:10px;
}
.dialog-body label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.dialog-body input,
.dialog-body select{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.restore-options{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:12px;
}
.dialog-actions button{
  padding:9px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
}
.dialog-actions .primary{border-color:#2f6;}

.vector-export-range-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height:min(42vh, 320px);
  overflow:auto;
  padding:8px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#0b0e13;
}
.dialog-body label.vector-export-all-option,
.dialog-body label.vector-export-range-option{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  font-size:13px;
  color:var(--text);
}
.dialog-body label.vector-export-all-option input,
.dialog-body label.vector-export-range-option input{
  margin:0;
  width:16px;
  height:16px;
}

.hidden{display:none !important;}

.template-card{
  width:min(980px, 95vw);
}

.list-addbar{
  display:flex;
  gap:8px;
  align-items:flex-end;
  flex-wrap:wrap;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#0b0e13;
}
.list-addbar label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.list-addbar input{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.list-addbar .add-page{
  padding:7px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
  font-size:12px;
}

.day-section{display:flex; flex-direction:column; gap:8px;}
.day-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#0b0e13;
}
.day-title{font-weight:700;}
.day-actions .day-add{
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
  font-size:12px;
}
.day-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.day-list.drag-over{
  outline:2px dashed #ff4d4d;
  outline-offset:4px;
}

.page-item{
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#0b0e13;
  cursor:pointer;
  position:relative;
  transition:border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.page-item.active{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(255,77,77,0.25) inset, 0 0 0 2px rgba(255,77,77,0.18);
  background:linear-gradient(180deg, #1d1418, #120f15);
}
.page-item.active::before{
  content:"";
  position:absolute;
  left:-1px;
  top:8px;
  bottom:8px;
  width:4px;
  border-radius:999px;
  background:var(--accent);
}
.page-item .preview{
  margin-top:6px;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
  background:#0b0e13;
  aspect-ratio: 210 / 297;
  height:120px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.page-item .preview img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background:#fff;
}
.page-item .preview .empty{
  font-size:11px;
  color:var(--muted);
}
.page-item .row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.page-item .page-del{
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  border-radius:8px;
  padding:2px 6px;
  cursor:pointer;
}
.page-item.dragging{
  opacity:0.6;
}
.page-item.drop-before{
  border-top:2px solid #ff4d4d;
}
.page-item.drop-after{
  border-bottom:2px solid #ff4d4d;
}
.page-item:hover{border-color:#3a4560;}
.page-item .meta{color:var(--muted); font-size:12px; margin-top:3px; display:flex; justify-content:space-between;}

.tag-list{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  margin-top:6px;
}
.tag-badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid #2a3140;
  background:#131923;
  font-size:11px;
  color:#e7ecf3;
}
.tag-remove{
  border:none;
  background:transparent;
  color:#a7b0c0;
  cursor:pointer;
  font-size:12px;
  line-height:1;
}
.tag-input{
  width:100%;
  margin-top:6px;
  padding:6px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  font-size:12px;
}
.tag-suggestions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:6px;
}
.tag-suggestion{
  padding:4px 8px;
  border-radius:999px;
  border:1px dashed #2a3140;
  background:#0b0e13;
  color:#a7b0c0;
  font-size:11px;
  cursor:pointer;
}

.page-tags{
  margin:8px auto 0;
  width:210mm;
  max-width:100%;
  padding:8px;
  border:1px dashed var(--border);
  border-radius:10px;
  background:#0b0e13;
}
.page-tags .tag-meta{
  font-size:11px;
  color:var(--muted);
  margin-top:6px;
}

.page-host{
  display:flex;
  justify-content:center;
  align-items:flex-start;
}
.a4-scale{
  margin:0 auto;
  position:relative;
  flex:0 0 auto;
}

/* A4 Seite */
.a4{
  width:210mm;
  height:297mm;
  background:var(--paper);
  color:var(--ink);
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  position:relative;
  overflow:hidden;
  font-family:"Grundschrift", "Comic Sans MS", "Segoe Print", cursive;
}

/* Rahmen + Layout ähnlich Beispiel */
.page-frame{
  position:absolute;
  inset:10mm;
  display:none;
}

.page-header{
  position:absolute;
  top:10mm;
  left:10mm;
  right:10mm;
  height:18mm;
  border:2px solid #222;
  display:grid;
  grid-template-columns: var(--header-cols);
}

.header-cell{
  border-right:2px solid #222;
  padding:2mm 2mm;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  font-size:11pt;
}
.header-cell:last-child{border-right:none;}
.header-label{font-size:10pt; color:#333}
.header-value{padding-top:2mm;font-size:14pt;font-weight:700}
.ha-cell{
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:10pt;
}
.ha-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
}
.home-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  margin-left:2px;
  vertical-align:middle;
}
.home-icon svg{
  width:30px;
  height:30px;
  fill:#111;
}

.page-titlebar{
  position:absolute;
  top:34mm;
  left:10mm;
  right:10mm;
  height:10mm;
  background:#ff6666;
  border:2px solid #222;
  display:flex;
  align-items:center;
  padding:0 4mm;
  font-weight:800;
}

/* Inhalt: hier füllt Drop-Inhalt die ganze Fläche */
.page-body{
  position:absolute;
  top:28mm;
  left:10mm;
  right:10mm;
  bottom:10mm;
  border:2px solid #222;
  border-top:0;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
}

.dropzone{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  user-select:none;
}

.dropzone.dragover{
  outline: 4px dashed #ff4d4d;
  outline-offset: -10px;
}

.fill-media{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background:#fff;
}

/* kleine Overlay-Controls */
.overlay{
  position:absolute;
  top:8px;
  right:8px;
  display:flex;
  gap:8px;
}
.overlay button{
  padding:6px 8px;
  border-radius:10px;
  border:1px solid #bbb;
  background:#fff;
  cursor:pointer;
  font-size:12px;
}

.editor-modal{
  position:fixed;
  inset:0;
  background:rgba(10,12,16,0.75);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.editor-card{
  width:min(1200px, 96vw);
  background:#0f1217;
  color:#e7ecf3;
  border:1px solid #2a3140;
  border-radius:14px;
  padding:12px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.editor-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.editor-title{font-weight:700;}
.editor-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.editor-actions button{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid #2a3140;
  background:#0b0e13;
  color:#e7ecf3;
  cursor:pointer;
}
.editor-actions button.primary{
  border-color:#2f6;
}
.editor-canvas-wrap{
  background:#0b0e13;
  border:1px solid #2a3140;
  border-radius:12px;
  padding:8px;
}
.editor-canvas{
  display:block;
  width:100%;
  height:auto;
  background:#111;
}
.editor-hint{
  margin-top:8px;
  font-size:12px;
  color:#a7b0c0;
}

.progress-modal{
  position:fixed;
  inset:0;
  background:rgba(10,12,16,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.progress-card{
  width:min(420px, 92vw);
  background:#0f1217;
  color:#e7ecf3;
  border:1px solid #2a3140;
  border-radius:14px;
  padding:16px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.progress-title{font-weight:700; margin-bottom:8px;}
.progress-meta{font-size:12px; color:#a7b0c0; margin-bottom:10px;}
.progress-bar{
  height:10px;
  background:#0b0e13;
  border:1px solid #2a3140;
  border-radius:999px;
  overflow:hidden;
}
.progress-bar-fill{
  height:100%;
  background:#2f6;
  width:0%;
  transition:width 0.2s ease;
}
.process-card{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:6px;
}
.process-spinner{
  width:28px;
  height:28px;
  border-radius:999px;
  border:3px solid #2a3140;
  border-top-color:#2f6;
  animation:process-spin 0.9s linear infinite;
}
.process-card .progress-title{
  margin:0;
}
.process-card .progress-meta{
  margin:0;
}
@keyframes process-spin{
  to { transform: rotate(360deg); }
}

.footer-bar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  height:64px;
  background:#0f1217;
  border-top:1px solid #2a3140;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:8px 12px;
  gap:12px;
  z-index:9990;
}
.footer-left{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
  overflow:hidden;
}
.footer-tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  max-height:26px;
  overflow:hidden;
}
.footer-tags .tag-input{
  max-width:200px;
}
.footer-meta{
  font-size:11px;
  color:var(--muted);
}
.footer-right{
  display:flex;
  align-items:center;
  gap:6px;
}
.footer-right button{
  padding:6px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
  font-size:12px;
}
.footer-right #zoomLabel{
  font-size:12px;
  color:var(--muted);
  min-width:50px;
  text-align:right;
}

.media-card{
  width:min(1200px, 96vw);
  max-height:90vh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.media-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  margin-bottom:10px;
}
.media-toolbar label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.media-toolbar input,
.media-toolbar select{
  padding:7px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
}
.media-body{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap:12px;
  overflow:hidden;
  min-height:420px;
}
.media-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap:10px;
  overflow:auto;
  padding-right:6px;
}
.media-item{
  border:1px solid var(--border);
  border-radius:10px;
  background:#0b0e13;
  padding:6px;
  cursor:pointer;
}
.media-item.active{border-color:#2f6; box-shadow:0 0 0 2px rgba(47,255,102,0.2) inset;}
.media-thumb{
  width:100%;
  aspect-ratio: 3 / 4;
  border-radius:8px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.media-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
.media-item .media-tags{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.media-item .media-meta{
  margin-top:6px;
  font-size:11px;
  color:var(--muted);
}
.media-preview{
  border:1px solid var(--border);
  border-radius:12px;
  background:#0b0e13;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
}
.media-preview img{
  width:100%;
  height:auto;
  background:#fff;
  border-radius:8px;
  border:1px solid #1a2230;
}
.media-preview .media-preview-empty{
  color:#a7b0c0;
  font-size:12px;
}
.media-preview button{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0e13;
  color:var(--text);
  cursor:pointer;
}
.media-preview .primary{border-color:#2f6;}

.media-toggle{
  min-width:120px;
}
.footer-left .tag-suggestions{
  max-height:18px;
  overflow:hidden;
}
