/* PDF-Toolkit Cloud — Dark-Theme (portiert aus dem Desktop-THEME) */
:root {
  --bg: #1C1C1E; --bg-panel: #2C2C2E; --bg-card: #3A3A3C; --bg-input: #48484A;
  --text: #FFFFFF; --text-muted: #AEAEB2; --text-hint: #6D6D72;
  --accent: #0A84FF; --accent-h: #409CFF;
  --success: #32D74B; --warning: #FFD60A; --danger: #FF453A;
  --border: #48484A; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.accent { color: var(--accent); }
code { background: var(--bg-card); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
h1, h2, h3 { font-weight: 650; }
h2 { margin: 0 0 4px; font-size: 22px; }
h3 { margin: 4px 0 10px; font-size: 15px; color: var(--text-muted); }

/* ── Buttons / Inputs ── */
.btn {
  background: var(--bg-card); color: var(--text); border: none;
  border-radius: 10px; padding: 10px 18px; font-size: 15px; font-weight: 550;
  cursor: pointer; transition: background .15s; touch-action: manipulation;
}
.btn:hover { background: var(--bg-input); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-block { width: 100%; margin-top: 14px; }
.btn-danger { color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #ff6b62; }
.iconbtn {
  background: var(--bg-card); border: none; color: var(--text);
  border-radius: 9px; padding: 7px 12px; font-size: 15px; cursor: pointer;
}
.iconbtn:hover { background: var(--bg-input); }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; background: var(--bg-input); color: var(--text);
  border: 1px solid transparent; border-radius: 9px; padding: 11px 12px;
  font-size: 15px; margin: 5px 0 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
label { font-size: 13px; color: var(--text-muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14.5px; color: var(--text); cursor: pointer; }
.check input { width: auto; margin: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row input { flex: 1; }

/* ── Auth ── */
.auth-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, #16324f 0%, var(--bg) 55%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px;
  box-shadow: 0 22px 60px rgba(0,0,0,.5);
}
.auth-lang { display: flex; justify-content: flex-end; margin: -12px -8px 4px 0; }
.auth-logo { font-size: 40px; }

/* Sprachumschalter — kompakt, in Topbar und auf der Login-Karte */
select.lang-select {
  width: auto; padding: 5px 26px 5px 9px; margin: 0;
  font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
  background-color: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
select.lang-select:hover { color: var(--text); }
.auth-card h1 { margin: 8px 0 2px; font-size: 24px; }
.auth-card form { margin-top: 18px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-legal { text-align: center; margin: 18px 0 0; }
.auth-legal a { color: var(--text-muted); text-decoration: none; }
.auth-legal a:hover { color: var(--accent); }
.auth-error {
  margin-top: 14px; background: rgba(255,69,58,.12); color: #ff8078;
  border: 1px solid rgba(255,69,58,.35); padding: 10px 12px;
  border-radius: 9px; font-size: 14px;
}

/* ── App-Layout ── */
.app { display: grid; height: 100dvh;
  grid-template-rows: 54px 1fr;
  grid-template-columns: 216px 1fr;
  grid-template-areas: "top top" "side main"; }
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px;
  background: var(--bg-panel); border-bottom: 1px solid var(--border);
  padding: 0 14px;
}
.topbar-title { font-weight: 650; font-size: 16px; flex: 1; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.nav-toggle { display: none; }
.sidebar {
  grid-area: side; background: var(--bg-panel); border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 3px;
}
.navitem {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; color: var(--text-muted);
  padding: 11px 13px; font-size: 14.5px; border-radius: 9px;
  cursor: pointer; text-align: left; width: 100%;
}
.navitem:hover { background: var(--bg-card); color: var(--text); }
.navitem.active { background: var(--accent); color: #fff; }
.sidebar-spacer { flex: 1; }
.quota { padding: 10px 12px; }
.quota-label { font-size: 12px; color: var(--text-hint); margin-bottom: 6px; }
.quota-bar { height: 6px; background: var(--bg-card); border-radius: 4px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.content { grid-area: main; overflow-y: auto; padding: 26px clamp(14px, 4vw, 44px) 90px; }
.tool { max-width: 860px; margin: 0 auto; }
.tool-head { margin-bottom: 18px; }
.tool-head p { margin: 2px 0 0; }
.panel {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-top: 16px;
}
.panel .btn-primary { margin-top: 8px; }
.panel-danger { border-color: rgba(255,69,58,.45); }
.panel-danger h3 { color: var(--danger); }
.panel-danger .btn-danger-solid { margin-top: 8px; }
.account-info { line-height: 1.9; }
.account-info .k { color: var(--text-muted); display: inline-block; min-width: 132px; }
.picker-h { margin-top: 22px; }

/* ── Gesperrte (passwortgeschützte) Dateien ── */
.thumb-locked {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--text-muted); font-size: 20px;
}
.badge-locked { background: rgba(255,214,10,.16); color: var(--warning); }

/* ── Seiten-Organizer ── */
.orggrid {
  display: grid; gap: 12px; margin: 14px 0 18px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
.orgtile {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; touch-action: none;
  cursor: grab; user-select: none;
}
.orgtile.dragging { opacity: .45; pointer-events: none; cursor: grabbing; }
.orgtile.del { opacity: .4; }
.orgtile.del .orgthumb::after {
  content: "gelöscht"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,69,58,.22); color: #fff; font-size: 12px; font-weight: 600;
  border-radius: 7px;
}
.orgthumb {
  position: relative; height: 132px; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
  background: var(--bg); border-radius: 7px;
}
.orgthumb img { max-width: 100%; max-height: 100%; transition: transform .15s; }
.orgbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2px; margin-top: 7px;
}
.orgbar button {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 13px; padding: 3px 5px; border-radius: 6px; cursor: pointer;
}
.orgbar button:hover { background: var(--bg-input); color: var(--text); }
.orgnum { font-size: 12px; color: var(--text-muted); min-width: 20px; text-align: center; }
.org-actions { flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* ── Bilder → PDF ── */
.dropzone-sm { padding: 18px; margin-bottom: 12px; }
.imglist { display: grid; gap: 8px; margin: 0 0 14px; }
.imgitem {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border-radius: 9px; padding: 7px 10px;
}
.imgitem img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.imgitem .imgname { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgitem .imgmeta { color: var(--text-hint); font-size: 12px; }
.imgitem button {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px 6px; border-radius: 6px; font-size: 13px;
}
.imgitem button:hover { background: var(--bg-input); color: var(--text); }
input[type=range] { width: 100%; margin: 6px 0 12px; accent-color: var(--accent); }

/* ── Dropzone / Upload ── */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 30px; text-align: center; transition: border-color .2s, background .2s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(10,132,255,.07); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone-icon { font-size: 30px; }
.upload-progress {
  margin-top: 12px; background: var(--bg-panel); border-radius: 9px;
  padding: 10px 14px; font-size: 14px; color: var(--text-muted);
}

/* ── Dateiliste ── */
.filelist { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.fileitem {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px;
}
.fileitem .thumb {
  width: 42px; height: 54px; border-radius: 6px; object-fit: cover;
  background: var(--bg-card); flex-shrink: 0; cursor: pointer;
}
.fileinfo { flex: 1; min-width: 0; }
.filename { font-weight: 560; font-size: 14.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.filemeta { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.fileactions { display: flex; gap: 6px; flex-shrink: 0; }
.badge {
  font-size: 10.5px; padding: 2px 7px; border-radius: 20px;
  background: var(--bg-card); color: var(--text-muted); margin-left: 6px;
}

/* ── Picker (Dateiauswahl in Werkzeugen) ── */
.picker { display: flex; flex-direction: column; gap: 6px; }
.pickitem {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 13px; cursor: pointer; user-select: none;
}
.pickitem:hover { border-color: var(--text-hint); }
.pickitem.sel { border-color: var(--accent); background: rgba(10,132,255,.08); }
.pickorder {
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-hint); flex-shrink: 0;
}
.pickitem.sel .pickorder { background: var(--accent); color: #fff; }
.picker-empty { color: var(--text-hint); padding: 18px; text-align: center;
  border: 1px dashed var(--border); border-radius: 10px; }

/* ── Radios / etc ── */
.radio-row { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.radio { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.radio input[type=radio] { width: auto; margin: 0; }
.inline-num { width: 64px !important; margin: 0 !important; padding: 6px 8px !important; }
.inline-text { width: 140px !important; margin: 0 !important; padding: 6px 8px !important; flex: 1; }

/* ── Vorschläge ── */
.sugg-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sugg {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 18px; font-size: 13.5px; cursor: pointer;
}
.sugg:hover { border-color: var(--accent); }

/* ── Jobs ── */
.jobstatus {
  margin-top: 12px; padding: 11px 14px; border-radius: 9px;
  background: var(--bg-card); font-size: 14px;
}
.jobstatus.ok { color: var(--success); }
.jobstatus.err { color: var(--danger); }
.spinner {
  display: inline-block; width: 13px; height: 13px; margin-right: 8px;
  border: 2px solid var(--text-hint); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Zertifikate ── */
.cert-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.certitem {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; cursor: pointer;
}
.certitem.sel { border-color: var(--accent); background: rgba(10,132,255,.08); }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; margin: 8px 0; }

/* ── Signatur-Platzierung ── */
.sign-page-nav { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.sign-canvas-wrap {
  position: relative; display: inline-block; max-width: 100%;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  touch-action: none;
}
.sign-canvas-wrap img { display: block; max-width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.sign-rect {
  position: absolute; border: 2px solid var(--accent);
  background: rgba(10,132,255,.18); pointer-events: none;
}

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  padding: 14px;
}
.modal-box {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 14px; width: min(880px, 100%); max-height: 94dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modal-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { overflow: auto; padding: 14px; text-align: center; background: #404040; }
.modal-body img { max-width: 100%; height: auto; box-shadow: 0 8px 30px rgba(0,0,0,.45); }

/* ── Toasts ── */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(420px, 92vw); }
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 16px; font-size: 14px;
  box-shadow: 0 10px 34px rgba(0,0,0,.5); animation: slideup .25s ease;
}
.toast.ok { border-color: rgba(50,215,75,.5); }
.toast.err { border-color: rgba(255,69,58,.55); }
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } }

/* ── Hinweis auf der Login-Karte (kein Fehler, darum nicht rot) ── */
.auth-note {
  margin-top: 14px; background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 13.5px; line-height: 1.5;
}

/* ── Banner für unbestätigte E-Mail-Adressen (dezent, kein Rot) ── */
.verify-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; margin-bottom: 16px;
  font-size: 13.5px; color: var(--text-muted);
}
.verify-banner > span { flex: 1; min-width: 200px; }
.verify-banner .btn.small { padding: 6px 12px; font-size: 12.5px; }

/* ── Admin-Dashboard ── */
.statgrid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.stat {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-value { font-size: 23px; font-weight: 650; margin-top: 4px; line-height: 1.2; }
.stat-sub { font-size: 11.5px; color: var(--text-hint); margin-top: 5px; }
.stat-bar {
  height: 6px; background: var(--bg-card); border-radius: 4px;
  overflow: hidden; margin-top: 9px;
}
.stat-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.stat-fill.warn, .quota-fill.warn { background: var(--danger); }

/* Balkendiagramm — reines CSS, keine Bibliothek */
.chart {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 10px; align-items: end; height: 150px; padding-top: 6px;
}
.bar-col { display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; gap: 4px; }
.bar-val { font-size: 12px; color: var(--text-muted); height: 15px; }
.bar {
  width: 100%; max-width: 46px; min-height: 2px; background: var(--accent);
  border-radius: 5px 5px 0 0; transition: height .3s;
}
.bar-lbl { font-size: 10.5px; color: var(--text-hint); white-space: nowrap; }

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admintable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.admintable th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-muted);
  padding: 0 12px 8px 0; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admintable td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.admintable tr:last-child td { border-bottom: none; }
.admintable .u-mail { font-weight: 550; word-break: break-all; }
.admintable .quota-bar { margin-top: 5px; min-width: 110px; }
.admintable .btn.small { padding: 6px 10px; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ── Mobil (iOS / kleine Screens) ── */
@media (max-width: 760px) {
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .chart { height: 128px; gap: 6px; }
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar {
    position: fixed; top: 54px; left: 0; bottom: 0; width: 240px; z-index: 50;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 14px 0 40px rgba(0,0,0,.45);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-toggle { display: block; }
  .topbar-user #user-label { display: none; }
  .content { padding: 18px 14px 110px; }
  .fileactions .btn { padding: 8px 10px; font-size: 13px; }
}
