/* Dietz ERP – Branding-Variablen (werden zur Laufzeit aus den Einstellungen gesetzt) */
:root {
  --brand-primary: #E6171F;
  --brand-primary-rgb: 230, 23, 31;
  --brand-primary-dark: #bd1219;
  --brand-primary-light: #fce3e4;
  --brand-sidebar: #101326;
  --brand-sidebar-text: #a6b0cf;
  --brand-topbar: #ffffff;
  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: var(--brand-primary-rgb);
  --bs-link-color: var(--brand-primary);
}
body { font-family: Poppins, 'Open Sans', sans-serif; }
#page-topbar { background: var(--brand-topbar); }
body[data-sidebar=dark] .vertical-menu, body[data-sidebar=dark] .navbar-brand-box { background: var(--brand-sidebar); }
body[data-sidebar=dark] #sidebar-menu ul li a { color: var(--brand-sidebar-text); }
body[data-sidebar=dark] #sidebar-menu ul li a i { color: var(--brand-sidebar-text); opacity: .75; }
body[data-sidebar=dark] #sidebar-menu ul li a.active, body[data-sidebar=dark] #sidebar-menu ul li a.active i { color: #fff; }
body[data-sidebar=dark] #sidebar-menu ul li a.active { background: rgba(255,255,255,.06); border-left: 3px solid var(--brand-primary); }
body[data-sidebar=dark] .menu-title { color: var(--brand-sidebar-text); opacity: .6; }
.navbar-brand-box .logo img { max-width: 160px; object-fit: contain; }
a { color: var(--brand-primary); }
a:hover { color: var(--brand-primary-dark); }
.text-primary { color: var(--brand-primary) !important; }
.bg-primary { background-color: var(--brand-primary) !important; }
.btn-primary { background-color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background-color: var(--brand-primary-dark) !important; border-color: var(--brand-primary-dark) !important; }
.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-soft-primary { color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), .1); border-color: transparent; }
.btn-soft-primary:hover { background: var(--brand-primary); color: #fff; }
.bg-primary.bg-soft, .bg-soft-primary { background-color: rgba(var(--brand-primary-rgb), .18) !important; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-primary-rgb), .6); box-shadow: 0 0 0 .15rem rgba(var(--brand-primary-rgb), .15); }
.form-check-input:checked { background-color: var(--brand-primary); border-color: var(--brand-primary); }
.nav-tabs-custom .nav-item .nav-link.active { color: var(--brand-primary); }
.nav-tabs-custom .nav-item .nav-link::after { background: var(--brand-primary); }
.page-item.active .page-link { background: var(--brand-primary); border-color: var(--brand-primary); }
.badge-soft-primary, .bg-primary-subtle { background: rgba(var(--brand-primary-rgb), .15) !important; color: var(--brand-primary) !important; }
.avatar-title.bg-primary { background: var(--brand-primary) !important; }
.badge.rounded-pill.bg-primary { background: var(--brand-primary) !important; }
.dropdown-item.active, .dropdown-item:active { background: var(--brand-primary); }
.noti-icon .badge { position: absolute; top: 12px; right: 4px; }
.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a.active { background: var(--brand-primary); color: #fff; border-left: 0; }
.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a.active i { color: #fff; }

/* Helfer */
.cursor-pointer { cursor: pointer; }
.hover-shadow { transition: box-shadow .15s, transform .15s; }
.hover-shadow:hover { box-shadow: 0 .5rem 1.25rem rgba(18,38,63,.12); transform: translateY(-2px); }
.avatar-xxs { height: 1.5rem; width: 1.5rem; }
.avatar-xs { height: 2rem; width: 2rem; }
.avatar-img { object-fit: cover; }
.online-dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #adb5bd; right: -1px; bottom: -1px; }
.online-dot.on { background: #34c38f; }
.online-dot.lg { width: 14px; height: 14px; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sticky-top-card { position: sticky; top: 90px; }
.min-h-100 { min-height: 100vh; }
.w-fit { width: fit-content; }
.table-hover tbody tr { cursor: pointer; }
.ws-pre { white-space: pre-wrap; }
.prose p:last-child { margin-bottom: 0; }
.prose img { max-width: 100%; border-radius: 6px; }
.prose ul[data-type=taskList] { list-style: none; padding-left: 0; }
.prose ul[data-type=taskList] li { display: flex; gap: .5rem; }
.prose ul[data-type=taskList] li > label { flex: 0 0 auto; }
.mention { color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), .1); border-radius: 4px; padding: 0 .25rem; font-weight: 500; }
.app-toast { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.app-toast .toast-item { min-width: 260px; max-width: 420px; color: #fff; padding: .75rem 1rem; border-radius: 6px; box-shadow: 0 .5rem 1rem rgba(0,0,0,.18); animation: slideIn .25s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Modal (ohne Bootstrap-JS) */
.erp-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1050; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.erp-modal { background: #fff; border-radius: .4rem; width: 100%; max-width: 640px; box-shadow: 0 1rem 3rem rgba(0,0,0,.3); animation: slideIn .2s ease; }
.erp-modal.lg { max-width: 900px; } .erp-modal.xl { max-width: 1140px; } .erp-modal.sm { max-width: 440px; }
.erp-modal .modal-header, .erp-modal .modal-body, .erp-modal .modal-footer { padding: 1rem 1.25rem; }
.erp-modal .modal-header { border-bottom: 1px solid #eff2f7; display: flex; align-items: center; justify-content: space-between; }
.erp-modal .modal-footer { border-top: 1px solid #eff2f7; display: flex; justify-content: flex-end; gap: .5rem; }

/* Organigramm */
.org-dept { border-top: 4px solid var(--dept-color, var(--brand-primary)); }
.org-person { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 6px; transition: background .15s; }
.org-person:hover { background: #f8f9fa; }
.org-tree { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.org-tree-node { min-width: 240px; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 170px); min-height: 560px; }
@media (max-width: 991px) { .chat-layout { grid-template-columns: 1fr; } .chat-layout .chat-list.hide-mobile { display: none; } .chat-layout .chat-main.hide-mobile { display: none; } }
.chat-list { border-right: 1px solid #eff2f7; display: flex; flex-direction: column; min-height: 0; }
.chat-list-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: .75rem; padding: .7rem 1rem; cursor: pointer; border-bottom: 1px solid #f3f4f7; }
.chat-item:hover, .chat-item.active { background: #f6f7fb; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: #efeae2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23d9d2c5' fill-opacity='.35'%3E%3Ccircle cx='20' cy='20' r='3'/%3E%3Ccircle cx='80' cy='60' r='2'/%3E%3Ccircle cx='40' cy='95' r='2.5'/%3E%3C/g%3E%3C/svg%3E"); }
.chat-head { background: #f7f7f9; border-bottom: 1px solid #eff2f7; padding: .6rem 1rem; display: flex; align-items: center; gap: .75rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 4px; }
.chat-bubble { max-width: 72%; padding: .45rem .7rem; border-radius: 10px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); font-size: .9rem; position: relative; word-break: break-word; }
.chat-bubble.mine { align-self: flex-end; background: #dcf8c6; }
.chat-bubble .meta { font-size: .68rem; color: #8a8f99; text-align: right; margin-top: 2px; }
.chat-bubble .sender { font-size: .75rem; font-weight: 600; color: var(--brand-primary); }
.chat-bubble img.att, .chat-bubble video.att { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; margin: 4px 0; cursor: pointer; }
.chat-bubble .quote { border-left: 3px solid var(--brand-primary); background: rgba(0,0,0,.05); padding: .3rem .5rem; border-radius: 4px; font-size: .8rem; margin-bottom: .3rem; }
.chat-system { align-self: center; background: #e1f3fb; font-size: .72rem; padding: .25rem .7rem; border-radius: 10px; color: #555; margin: 4px 0; }
.chat-date { align-self: center; background: #fff; font-size: .72rem; padding: .2rem .7rem; border-radius: 10px; color: #777; margin: 8px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.chat-compose { background: #f7f7f9; border-top: 1px solid #eff2f7; padding: .6rem .8rem; }
.chat-compose .tiptap { min-height: 42px; max-height: 160px; overflow-y: auto; background: #fff; border-radius: 20px; padding: .5rem 1rem; border: 1px solid #e3e5ea; outline: none; }
.chat-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chat-preview .item { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: #ddd; display: flex; align-items: center; justify-content: center; }
.chat-preview img, .chat-preview video { width: 100%; height: 100%; object-fit: cover; }
.chat-preview .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.lightbox img, .lightbox video { max-width: 95vw; max-height: 92vh; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 1rem; overflow-x: auto; align-items: start; }
.kanban-col { background: #f3f4f7; border-radius: 8px; padding: .75rem; min-height: 300px; }
.kanban-col.over { outline: 2px dashed var(--brand-primary); }
.kanban-card { background: #fff; border-radius: 6px; padding: .7rem .8rem; margin-bottom: .6rem; box-shadow: 0 1px 2px rgba(0,0,0,.08); cursor: grab; border-left: 3px solid transparent; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card.prio-critical { border-left-color: #f46a6a; } .kanban-card.prio-high { border-left-color: #f1b44c; } .kanban-card.prio-medium { border-left-color: #50a5f1; } .kanban-card.prio-low { border-left-color: #74788d; }

/* Rich-Text-Editor */
.rte { border: 1px solid #ced4da; border-radius: .25rem; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px; border-bottom: 1px solid #eff2f7; background: #f8f9fb; }
.rte-toolbar button { border: 0; background: transparent; border-radius: 4px; width: 30px; height: 28px; color: #495057; font-size: 15px; }
.rte-toolbar button:hover { background: #e9ecef; } .rte-toolbar button.active { background: rgba(var(--brand-primary-rgb), .15); color: var(--brand-primary); }
.rte-toolbar .sep { width: 1px; background: #dee2e6; margin: 4px 4px; }
.rte .tiptap { min-height: 140px; padding: .6rem .8rem; outline: none; }
.tiptap p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #adb5bd; float: left; pointer-events: none; height: 0; }
.tiptap img { max-width: 100%; border-radius: 6px; }
.tiptap blockquote { border-left: 3px solid #ccc; margin-left: 0; padding-left: .75rem; color: #666; }
.tiptap pre { background: #2a3042; color: #fff; padding: .6rem .8rem; border-radius: 6px; }
.tiptap ul[data-type=taskList] { list-style: none; padding-left: 0; } .tiptap ul[data-type=taskList] li { display: flex; gap: .5rem; align-items: flex-start; }
.mention-list { background: #fff; border: 1px solid #e3e5ea; border-radius: 6px; box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); max-height: 220px; overflow-y: auto; min-width: 220px; z-index: 3000; }
.mention-list .item { padding: .4rem .7rem; cursor: pointer; display: flex; gap: .5rem; align-items: center; font-size: .85rem; }
.mention-list .item.selected, .mention-list .item:hover { background: rgba(var(--brand-primary-rgb), .1); }

/* Pipeline */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; align-items: start; }

/* Auth */
.account-pages .bg-primary.bg-soft { background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .18), rgba(var(--brand-primary-rgb), .06)) !important; }
.auth-logo-box { width: 72px; height: 72px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -36px; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.auth-logo-box img { width: 44px; height: 44px; object-fit: contain; }

/* Version-Badge in Topbar */
.version-pill { font-size: .72rem; background: #f3f4f7; color: #74788d; border-radius: 12px; padding: 2px 10px; cursor: pointer; }
.version-pill:hover { background: rgba(var(--brand-primary-rgb), .12); color: var(--brand-primary); }
.changelog-type { font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; }
.changelog-type.new { background: #d4f5e9; color: #0f8a5a; } .changelog-type.fix { background: #fde8c8; color: #9b5d00; } .changelog-type.change { background: #dde8fb; color: #2a4f9c; }

/* Settings */
.settings-nav .nav-link { color: #495057; border-radius: 6px; padding: .55rem .9rem; display: flex; align-items: center; gap: .6rem; }
.settings-nav .nav-link.active { background: rgba(var(--brand-primary-rgb), .1); color: var(--brand-primary); font-weight: 500; }
.color-swatch { width: 38px; height: 38px; border-radius: 6px; border: 1px solid #dee2e6; padding: 0; }
.dropzone { border: 2px dashed #ced4da; border-radius: 8px; padding: 1.5rem; text-align: center; color: #74788d; cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), .04); color: var(--brand-primary); }
.stat-card .mini-stat-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.timeline-list { position: relative; padding-left: 1.6rem; }
.timeline-list::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: #eff2f7; }
.timeline-list .item { position: relative; margin-bottom: 1rem; }
.timeline-list .item::before { content: ''; position: absolute; left: -1.6rem; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px #eff2f7; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.photo-grid .ph { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: #eee; cursor: pointer; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .rm { position: absolute; top: 4px; right: 4px; }
.progress-sm { height: 6px; }
.sortable-ghost { opacity: .4; }
.ack-bar { background: linear-gradient(90deg, rgba(var(--brand-primary-rgb), .08), transparent); }
.calendar-chip { font-size: .72rem; }
@media (max-width: 767px) { .kanban { grid-template-columns: repeat(4, 85vw); } .chat-layout { height: calc(100vh - 140px); } }
.settings-nav .nav-link { border: 0; background: transparent; }
.org-person > .position-relative, .chat-item > .position-relative, .chat-head > .position-relative { flex-shrink: 0; }
.pipeline { grid-auto-columns: minmax(230px, 1fr); }

/* ===== Organigramm – Baumansicht (modern) ===== */
.org-tree-wrap { position: relative; background: radial-gradient(circle at 1px 1px, #e4e7ee 1px, transparent 0) 0 0/22px 22px, linear-gradient(180deg, #fafbfd, #f3f4f8); border-radius: 12px; border: 1px solid #eef0f5; }
.ot-toolbar { display: flex; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid #eef0f5; background: rgba(255,255,255,.7); backdrop-filter: blur(6px); border-radius: 12px 12px 0 0; }
.ot-scroll { overflow: auto; padding: 2rem 1rem 3rem; min-height: 520px; }
.ot-canvas { display: inline-block; min-width: 100%; text-align: center; }
.ot-canvas ul { display: flex; justify-content: center; padding: 28px 0 0; margin: 0; list-style: none; position: relative; }
.ot-canvas ul.ot-root { padding-top: 0; }
.ot-canvas li { position: relative; padding: 28px 10px 0; display: flex; flex-direction: column; align-items: center; }
.ot-canvas ul.ot-root > li { padding-top: 0; }
/* Linien: von oben zum Knoten, horizontale Verbindungsleiste zwischen Geschwistern */
.ot-canvas li::before { content: ''; position: absolute; top: 0; left: 50%; width: 2px; height: 28px; background: #cfd4e0; }
.ot-canvas ul.ot-root > li::before { display: none; }
.ot-canvas li::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #cfd4e0; }
.ot-canvas li:first-child::after { left: 50%; } .ot-canvas li:last-child::after { right: 50%; }
.ot-canvas li:only-child::after { display: none; }
.ot-canvas ul.ot-root > li::after { display: none; }
.ot-canvas ul:not(.ot-root)::before { content: ''; position: absolute; top: 0; left: 50%; width: 2px; height: 28px; background: #cfd4e0; }
.ot-node { position: relative; width: 196px; background: #fff; border-radius: 14px; padding: 18px 14px 14px; box-shadow: 0 1px 2px rgba(18,38,63,.06), 0 8px 24px -12px rgba(18,38,63,.25); border: 1px solid #eceef4; cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s; text-align: center; }
.ot-node::before { content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 3px; border-radius: 0 0 4px 4px; background: var(--dept, var(--brand-primary)); }
.ot-node:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(18,38,63,.06), 0 16px 32px -12px rgba(18,38,63,.3); border-color: #e0e3ec; }
.ot-node.selected { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), .18), 0 16px 32px -12px rgba(18,38,63,.3); }
.ot-node.root { background: linear-gradient(180deg, #fff, #fbfbfd); width: 216px; }
.ot-node.dim { opacity: .4; }
.ot-avatar { display: inline-block; padding: 3px; border-radius: 50%; background: linear-gradient(135deg, var(--dept, var(--brand-primary)), rgba(255,255,255,.2)); margin-bottom: 8px; }
.ot-avatar .avatar-md { display: block; }
.ot-avatar img, .ot-avatar .avatar-title { border: 2px solid #fff; }
.ot-name { font-weight: 600; font-size: .9rem; color: #1b2033; line-height: 1.2; }
.ot-pos { font-size: .74rem; color: #74788d; margin-top: 2px; min-height: 1em; }
.ot-badge { display: inline-block; margin-top: 8px; font-size: .66rem; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: rgba(var(--brand-primary-rgb), .1); color: var(--brand-primary); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ot-badge.muted { background: #f1f2f6; color: #74788d; }
.ot-toggle { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); border: 1px solid #e0e3ec; background: #fff; border-radius: 999px; font-size: .7rem; padding: 2px 9px; color: #495057; line-height: 1.4; box-shadow: 0 2px 6px rgba(18,38,63,.12); z-index: 1; }
.ot-toggle:hover { color: var(--brand-primary); border-color: var(--brand-primary); }
.ot-pop { position: absolute; transform: translateX(-50%); width: 300px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px -8px rgba(18,38,63,.35); border: 1px solid #e8eaf0; padding: 14px; z-index: 20; animation: slideIn .15s ease; }
.ot-pop::before { content: ''; position: absolute; top: -7px; left: 50%; margin-left: -7px; width: 14px; height: 14px; background: #fff; border-left: 1px solid #e8eaf0; border-top: 1px solid #e8eaf0; transform: rotate(45deg); }

/* Kachelansicht etwas moderner */
.org-dept { border-top: 0; border-radius: 12px; overflow: hidden; }
.org-dept::before { content: ''; display: block; height: 5px; background: linear-gradient(90deg, var(--dept-color, var(--brand-primary)), color-mix(in srgb, var(--dept-color, var(--brand-primary)) 40%, #fff)); }
.org-person { border-radius: 10px; }
.org-person.bg-light { background: linear-gradient(90deg, #f6f7fb, #fff) !important; border: 1px solid #eef0f5; }

/* Topbar-Ausrichtung */
#page-topbar .header-item { display: inline-flex; align-items: center; justify-content: center; height: 70px; line-height: 1; }
#page-topbar .header-item.noti-icon i { line-height: 1; }
#page-topbar .header-item .avatar-xs { display: inline-flex; }
#page-topbar .header-item > span, #page-topbar .header-item > i.mdi { line-height: 1; vertical-align: middle; }
#page-topbar .noti-icon .badge { top: 16px; right: 6px; }
#page-topbar .version-pill { line-height: 1.6; }
