:root{
  --bg:#F7F7F5;
  --card:rgba(255,255,255,.72);
  --card-solid:#ffffff;
  --text:#2f2f2f;
  --muted:#707070;
  --border:rgba(255,255,255,.55);
  --primary:#8CC63F;
  --primary-hover:#99d548;
  --danger:#ef4444;
  --shadow:0 12px 40px rgba(0,0,0,.08);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Arial,sans-serif;
  min-height:100vh;
  color:var(--text);
  background:
    radial-gradient(circle at top right, rgba(140,198,63,.15), transparent 25%),
    radial-gradient(circle at bottom left, rgba(140,198,63,.08), transparent 30%),
    linear-gradient(135deg,#fafaf8,#f2f3ef);
  overflow-x:hidden;
}

.header{
  padding:28px 42px;
}

.brand{
  display:flex;
  align-items:center;
  gap:24px;
  background:rgba(255,255,255,.68);
  backdrop-filter:blur(18px);
  border:1px solid rgba(255,255,255,.5);
  border-radius:24px;
  padding:24px 30px;
  box-shadow:var(--shadow);
}

.logo{
  width:190px;
  object-fit:contain;
}

.brand h1{
  margin:0;
  font-size:34px;
}

.brand p{
  margin:8px 0 0;
  color:var(--muted);
}

main{
  max-width:1450px;
  margin:0 auto;
  padding:10px 32px 40px;
}

.app-active .header{
  margin-left:264px;
}

.app-active main{
  max-width:none;
  margin:0;
}

.app-shell{
  min-width:0;
}

.app-sidebar{
  position:fixed;
  top:24px;
  bottom:24px;
  left:24px;
  z-index:1000;
  width:240px;
  display:flex;
  flex-direction:column;
  padding:24px 18px;
  border:1px solid rgba(255,255,255,.65);
  border-radius:24px;
  background:rgba(255,255,255,.94);
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
}

.sidebar-user{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:6px 8px 22px;
  border-bottom:1px solid #e8e8e5;
  overflow-wrap:anywhere;
}

.sidebar-user span{
  color:var(--muted);
  font-size:14px;
}

.sidebar-nav{
  display:flex;
  flex:1;
  flex-direction:column;
  gap:10px;
  padding-top:18px;
}

.sidebar-nav button{
  margin:0;
  box-shadow:none;
  text-align:left;
  background:transparent;
  color:var(--text);
}

.sidebar-nav button:hover,
.sidebar-nav button.active{
  background:var(--primary);
  color:white;
}

.sidebar-nav #logoutNav{
  margin-top:auto;
  background:var(--danger);
  color:white;
}

.app-content{
  min-width:0;
  margin-left:264px;
}

.app-view{
  min-width:0;
}

.sidebar-toggle{
  display:none;
}

.sidebar-backdrop{
  display:none;
}

.box{
  background:var(--card);
  backdrop-filter:blur(18px);
  border:1px solid rgba(255,255,255,.6);
  border-radius:24px;
  padding:24px;
  box-shadow:var(--shadow);
}

.layout{
  display:grid;
  grid-template-columns:380px 1fr;
  gap:24px;
  margin-top:22px;
}

.tickets-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}

.tickets-heading h2{
  margin:0;
}

.tickets-heading #adminNewTicketButton{
  width:auto;
  min-width:160px;
  margin:0;
  padding:12px 20px;
}

.ticket-form-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px 18px;
}

.ticket-form-wide{
  min-width:0;
}

.ticket-form-submit button{
  margin-top:8px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.topbar > div{
  display:flex;
  align-items:center;
  gap:8px;
}

.topbar .danger.small{
  width:auto !important;
  max-width:140px !important;
  min-width:120px !important;
  padding:10px 22px !important;
  margin:0 !important;
  flex:0 0 auto !important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

h2{
  margin-top:0;
}

label{
  display:block;
  margin-top:14px;
  margin-bottom:6px;
  color:var(--muted);
  font-size:14px;
}

input,
textarea,
select{
  width:100%;
  border-radius:16px;
  border:1px solid #e7e7e7;
  padding:14px;
  background:rgba(255,255,255,.92);
  font-size:14px;
  color:var(--text);
  transition:.2s ease;
}

input:focus,
textarea:focus,
select:focus{
  outline:none;
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(140,198,63,.18);
}

textarea{
  min-height:120px;
  resize:vertical;
}

button{
  width:100%;
  border:none;
  border-radius:16px;
  padding:14px;
  margin-top:16px;
  background:var(--primary);
  color:white;
  font-weight:700;
  cursor:pointer;
  transition:.2s ease;
}

button:hover{
  background:var(--primary-hover);
  transform:translateY(-2px);
}

.button-link{
  display:block;
  width:100%;
  border-radius:16px;
  padding:14px;
  margin-top:16px;
  background:var(--primary);
  color:white;
  font-weight:700;
  text-align:center;
  text-decoration:none;
}

.remember-login{
  display:flex;
  align-items:center;
  gap:10px;
  width:max-content;
  max-width:100%;
  margin-top:14px;
  color:var(--text);
  cursor:pointer;
  user-select:none;
}

.remember-login input{
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--primary);
  flex:0 0 auto;
}

.remember-login span{
  line-height:1.35;
}

.secondary-link{
  background:#f0f0ec;
  color:var(--text);
}

.narrow-page{
  max-width:720px;
}

.field-help,
.form-message{
  color:var(--muted);
  line-height:1.5;
}

.form-message.success{ color:#327a20; }
.form-message.error{ color:#b42318; }

.admin-users{
  margin-top:22px;
}

#usersView .admin-users{
  margin-top:0;
}

.admin-user-form{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
  align-items:end;
}

.admin-create-permissions{
  grid-column:1 / -2;
  display:flex;
  flex-wrap:wrap;
  gap:10px 16px;
  align-items:center;
  min-height:46px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.72);
}

.admin-create-permissions strong{
  margin-right:4px;
}

.admin-create-permissions label,
.user-permissions label{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin:0;
  cursor:pointer;
  font-size:14px;
}

.admin-create-permissions small{
  color:var(--muted);
}

.admin-user-form button,
.admin-user-form input,
.admin-user-form select{
  margin:0;
}

.admin-users-list{
  display:grid;
  gap:12px;
  margin-top:18px;
}

.admin-user-row{
  display:grid;
  grid-template-columns:minmax(220px,1.35fr) minmax(300px,1.65fr) minmax(260px,auto);
  gap:14px;
  align-items:center;
  padding:14px;
  background:rgba(255,255,255,.8);
  border-radius:16px;
}

.user-permissions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.user-permissions label{
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
}

.user-permissions label.disabled{
  cursor:default;
  opacity:.72;
}

.user-permissions input{
  width:auto;
  margin:0;
}

.admin-user-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
}

.admin-user-row button{
  margin:0;
  padding:10px;
}

.secondary{
  background:#f0f0ec;
  color:var(--text);
}

.secondary:hover{
  background:#e7e7e2;
}

.danger{
  background:var(--danger);
}

.small{
  width:auto;
  margin:0;
}

.tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:16px;
}

.toolbar{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  margin-bottom:18px;
}

.status-filter{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  background:rgba(255,255,255,.75);
  border:1px solid #ececec;
  border-radius:16px;
  padding:10px 12px;
}

.status-filter label{
  margin:0;
  display:flex;
  align-items:center;
  gap:6px;
  background:#f5f5f2;
  border-radius:999px;
  padding:8px 12px;
  font-size:13px;
  color:var(--text);
}

.status-filter input{
  width:auto;
}

.stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:20px;
}

.stat{
  background:rgba(255,255,255,.82);
  border:1px solid rgba(255,255,255,.6);
  border-radius:20px;
  padding:20px;
  transition:.2s ease;
}

.stat:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow);
}

.stat strong{
  display:block;
  font-size:30px;
  color:var(--primary);
}

.stat span{
  color:var(--muted);
}

.ticket{
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(16px);
  border:1px solid rgba(255,255,255,.65);
  border-radius:22px;
  margin-bottom:18px;
  transition:.2s ease;
}

.ticket:hover{
  transform:translateY(-3px);
  box-shadow:0 18px 40px rgba(0,0,0,.08);
}

.ticket-compact{
  padding:0;
  margin-bottom:8px;
  cursor:pointer;
  overflow:hidden;
}

.ticket-summary{
  display:grid !important;
  grid-template-columns:minmax(320px,1fr) 180px 180px 360px !important;
  gap:16px !important;
  align-items:center !important;
  padding:14px 16px;
}

.ticket-summary > strong{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.ticket-user,
.ticket-date{
  white-space:nowrap;
}

.ticket-date{
  color:var(--muted);
  font-size:13px;
}

.ticket-state{
  display:flex !important;
  justify-content:flex-end !important;
  align-items:center !important;
  gap:8px !important;
  width:auto !important;
  min-width:260px;
  white-space:nowrap;
}

.ticket-state .badge{
  display:inline-flex !important;
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  flex:0 0 auto !important;
  padding:7px 12px !important;
}

.count{
  color:var(--muted);
  font-size:13px;
}

.meta{
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
}

.desc{
  margin:12px 0;
  line-height:1.6;
  white-space:pre-wrap;
}

.badges{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin-top:10px;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:8px 14px;
  font-size:13px;
  font-weight:700;
}

.status-offen{
  background:#eef9dd;
  color:#76a92e;
}

.status-arbeit{
  background:#fff6da;
  color:#c79500;
}

.status-erledigt{
  background:#e7f3ff;
  color:#388ed3;
}

.prio-hoch{
  background:#ffe4e4;
  color:#dd4b4b;
}

.prio-mittel{
  background:#fff6da;
  color:#c79500;
}

.prio-niedrig{
  background:#eef9dd;
  color:#76a92e;
}

.ticket-actions{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:8px;
  margin-top:18px;
}

.ticket-actions .comments-box,
.ticket-actions .files-box{
  margin-top:0;
}

.ticket-actions button.secondary{
  margin-top:0;
  padding:12px;
  border-radius:14px;
  font-size:13px;
  font-weight:600;
}

.ticket-controls{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  align-items:end;
  margin-top:16px;
}

.ticket-controls label{
  margin:0 0 6px;
}

.comments-box,
.files-box{
  margin-top:18px;
}

.comments-content,
.files-content{
  margin-top:10px;
  border-top:1px solid #ececec;
  padding-top:12px;
}

.comment,
.file-link{
  display:block;
  background:rgba(255,255,255,.85);
  border:1px solid #efefef;
  border-radius:16px;
  padding:14px;
  margin-bottom:10px;
  color:var(--text);
  text-decoration:none;
}

.comment strong{
  display:block;
}

.comment span{
  color:var(--muted);
  font-size:12px;
}

.comment-text{
  white-space:pre-wrap;
}

.empty{
  border:1px dashed #dddddd;
  border-radius:18px;
  padding:26px;
  text-align:center;
  color:var(--muted);
}

.hidden{
  display:none;
}

.upload-zone{
  border:2px dashed #cfcfcf;
  border-radius:18px;
  padding:28px;
  text-align:center;
  cursor:pointer;
  background:rgba(255,255,255,.7);
  transition:.2s ease;
}

.upload-zone:hover{
  border-color:var(--primary);
  background:rgba(255,255,255,.92);
}

.upload-zone.dragging{
  border-color:var(--primary);
  background:#eef9dd;
}

.upload-zone input{
  display:none;
}

.selected-files-box{
  margin-top:12px;
}

.selected-file{
  background:white;
  border-radius:12px;
  padding:10px 14px;
  margin-top:8px;
  border:1px solid #ececec;
}

.checkbox-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0 0 18px;
  color:var(--muted);
  font-size:14px;
}

.checkbox-row input{
  width:auto;
}

.ticket-scope{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:18px 0;
  padding:12px;
  border:1px solid #d9e1d0;
  border-radius:10px;
  background:#f7faf4;
}

.ticket-scope.hidden{
  display:none;
}

.ticket-scope-buttons{
  display:flex;
  gap:8px;
}

.ticket-scope-buttons button{
  margin:0;
}

.ticket-scope-buttons button.active{
  color:#fff;
  background:#5f8c2b;
  border-color:#5f8c2b;
}

.ticket-scope-label{
  color:#36551a;
  white-space:nowrap;
}

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.modal.hidden{
  display:none;
}

.modal-content{
  width:min(1200px,95vw);
  max-height:90vh;
  overflow:auto;
  background:white;
  border-radius:22px;
  padding:24px;
  position:relative;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
}

.ticket-modal-content{
  width:min(1600px,calc(100vw - 32px));
  height:calc(100vh - 32px);
  max-height:none;
}

.admin-ticket-modal-content{
  width:min(860px,calc(100vw - 32px));
  max-height:calc(100vh - 32px);
  padding:30px;
}

.admin-ticket-modal-content .admin-ticket-form-box{
  max-width:none;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
}

.admin-ticket-modal-content .admin-ticket-form-box h2{
  margin:0 52px 12px 0;
  font-size:28px;
}

.admin-ticket-modal-content .ticket-form-grid{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
}

.admin-ticket-modal-content .ticket-form-wide{
  grid-column:1 / -1;
}

.modal-close{
  position:absolute;
  top:12px;
  right:12px;
  width:40px;
  height:40px;
  border:none;
  border-radius:12px;
  cursor:pointer;
  font-size:18px;
  margin:0;
  padding:0;
}

.sales-module{
  padding:28px;
  overflow:hidden;
}

.sales-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
  margin-bottom:22px;
}

.sales-heading h2{
  margin:3px 0 7px;
  font-size:28px;
}

.sales-heading p:not(.analysis-eyebrow){
  margin:0;
  color:var(--muted);
}

.sales-dummy-badge{
  flex:0 0 auto;
  padding:9px 13px;
  border:1px solid #f6d58c;
  border-radius:999px;
  color:#8a5700;
  background:#fff7df;
  font-size:13px;
  font-weight:700;
}

.sales-dummy-badge.live{
  border-color:#b9dba8;
  color:#2f641f;
  background:#eef8e9;
}

.sales-heading-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.sales-heading-actions button{
  width:auto;
  margin:0;
  white-space:nowrap;
}

.sales-kpis{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}

.sales-kpi{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:16px 18px;
  border:1px solid #e8ebe4;
  border-radius:16px;
  background:#fff;
}

.sales-kpi strong{
  font-size:25px;
}

.sales-kpi span{
  color:var(--muted);
  font-size:13px;
}

.sales-kpi.warning strong{
  color:#b26a00;
}

.sales-kpi.revenue strong{
  color:#2f7d32;
}

.sales-toolbar{
  display:grid;
  grid-template-columns:minmax(220px,340px) auto auto minmax(180px,1fr);
  align-items:end;
  gap:10px;
  margin-bottom:18px;
}

.sales-toolbar button{
  width:auto;
  margin:0;
  white-space:nowrap;
}

.sales-toolbar .form-message{
  align-self:center;
  margin:0 0 0 6px;
}

.sales-company-toolbar{
  margin-bottom:18px;
  padding:17px 18px;
  border:1px solid #dce8d4;
  border-radius:18px;
  background:linear-gradient(135deg,#f7fbf3,#edf6e8);
}

.sales-crm-toolbar{
  margin-bottom:18px;
  padding:17px 18px;
  border:1px solid #dfe5ee;
  border-radius:18px;
  background:linear-gradient(135deg,#f7faff,#eef4fb);
}

.sales-demo-badge{
  flex:0 0 auto;
  padding:7px 10px;
  border:1px solid #f0d38c;
  border-radius:999px;
  color:#855a00;
  background:#fff8e5;
  font-size:12px;
  font-weight:800;
}

.sales-crm-controls{
  display:grid;
  grid-template-columns:minmax(220px,1.35fr) minmax(170px,.8fr) minmax(210px,1fr) auto;
  align-items:end;
  gap:10px;
}

.sales-crm-controls input,
.sales-crm-controls select,
.sales-crm-controls button{
  margin:0;
}

.sales-crm-controls button{
  width:auto;
  white-space:nowrap;
}

.sales-crm-toolbar > .form-message{
  margin:10px 2px 0;
  min-height:18px;
}

.sales-company-toolbar-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:14px;
}

.sales-company-toolbar-heading > div{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.sales-company-kicker{
  color:#58882b;
  font-size:11px;
  font-weight:800;
  letter-spacing:.08em;
}

.sales-live-badge{
  display:inline-flex;
  align-items:center;
  gap:7px;
  flex:0 0 auto;
  padding:7px 10px;
  border:1px solid #d7e5ce;
  border-radius:999px;
  color:#426528;
  background:#fff;
  font-size:12px;
  font-weight:700;
}

.sales-live-badge i{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#68a834;
  box-shadow:0 0 0 4px rgba(104,168,52,.14);
}

.sales-company-controls{
  display:grid;
  grid-template-columns:minmax(190px,1.2fr) minmax(190px,1fr) minmax(170px,.85fr) auto auto;
  align-items:end;
  gap:10px;
}

.sales-company-controls input,
.sales-company-controls select,
.sales-company-controls button{
  margin:0;
}

.sales-company-controls button{
  width:auto;
  white-space:nowrap;
}

.sales-company-toolbar > .form-message{
  margin:10px 2px 0;
  min-height:18px;
}

.sales-search{
  margin:0;
}

.sales-search span{
  display:block;
  margin-bottom:7px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

.sales-search input{
  margin:0;
}

.sales-map-layout{
  display:grid;
  grid-template-columns:290px minmax(0,1fr);
  min-height:720px;
  overflow:hidden;
  border:1px solid #dfe4da;
  border-radius:20px;
  background:#fff;
}

.sales-territory-panel{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:18px;
  border-right:1px solid #e5e8e1;
  background:#f9faf7;
  overflow-y:auto;
}

.sales-panel-heading{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding:0 2px 4px;
}

.sales-panel-heading small{
  color:var(--muted);
}

.sales-territory-list{
  display:flex;
  flex-direction:column;
  gap:9px;
}

.sales-territory-card{
  display:grid;
  grid-template-columns:12px minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  width:100%;
  margin:0;
  padding:13px;
  border:1px solid #e1e5dc;
  border-radius:14px;
  color:var(--text);
  background:#fff;
  text-align:left;
}

.sales-territory-card:hover,
.sales-territory-card.active{
  border-color:var(--territory-color,#8CC63F);
  background:#fdfefd;
  box-shadow:0 6px 18px rgba(30,50,20,.08);
}

.sales-territory-color{
  width:12px;
  height:38px;
  border-radius:999px;
  background:var(--territory-color);
}

.sales-territory-person{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}

.sales-territory-person strong{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.sales-territory-person small{
  color:var(--muted);
}

.sales-territory-code{
  padding:5px 7px;
  border-radius:8px;
  background:#f0f2ed;
  font-size:12px;
  font-weight:700;
}

.sales-map-note{
  display:flex;
  flex-direction:column;
  gap:5px;
  margin-top:auto;
  padding:13px;
  border-radius:14px;
  color:#4f5b46;
  background:#eef5e7;
  font-size:12px;
  line-height:1.4;
}

.sales-company-results-panel{
  padding-top:12px;
  border-top:1px solid #dde2d8;
}

.sales-customer-results-panel{
  padding-top:12px;
  border-top:1px solid #dde2d8;
}

.sales-customer-results{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.sales-customer-result{
  display:grid;
  grid-template-columns:10px minmax(0,1fr) auto;
  align-items:center;
  gap:9px;
  width:100%;
  margin:0;
  padding:10px;
  border:1px solid #e0e5dc;
  border-radius:12px;
  color:var(--text);
  background:#fff;
  text-align:left;
}

.sales-customer-result:hover{
  border-color:#7fa7d8;
  background:#f8fbff;
}

.sales-customer-result-main{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.sales-customer-result-main strong,
.sales-customer-result-main small{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.sales-customer-result-main small{
  color:var(--muted);
  font-weight:400;
}

.sales-customer-result > b{
  color:#466540;
  font-size:11px;
}

.sales-customer-dot{
  width:10px;
  height:32px;
  border-radius:999px;
  background:#64748b;
}

.sales-customer-dot.existing{background:#2563eb}
.sales-customer-dot.growth{background:#f59e0b}
.sales-customer-dot.lead{background:#7c3aed}

.sales-customer-empty{
  padding:14px;
  border:1px dashed #cfd7ca;
  border-radius:12px;
  color:var(--muted);
  font-size:12px;
  text-align:center;
}

.sales-company-results-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:9px;
}

.sales-company-results-heading span{
  min-width:28px;
  padding:4px 7px;
  border-radius:999px;
  color:#fff;
  background:#5e9131;
  text-align:center;
  font-size:11px;
  font-weight:800;
}

.sales-company-results{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.sales-company-result{
  display:grid;
  grid-template-columns:34px minmax(0,1fr);
  align-items:center;
  gap:9px;
  width:100%;
  margin:0;
  padding:10px;
  border:1px solid #e1e6dc;
  border-radius:12px;
  color:var(--text);
  background:#fff;
  text-align:left;
}

.sales-company-result:hover{
  border-color:#80ad58;
  background:#f9fcf7;
}

.sales-company-result-icon{
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:10px;
  background:#eef6e7;
  font-size:16px;
}

.sales-company-result > span:last-child{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.sales-company-result strong,
.sales-company-result small{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.sales-company-result small{
  color:var(--muted);
  font-weight:400;
}

.sales-map-card{
  position:relative;
  min-width:0;
  min-height:720px;
  background:#edf1e9;
}

.sales-map{
  width:100%;
  height:720px;
  background:linear-gradient(135deg,#eef2e9,#dfe8d8);
}

.sales-map-search{
  position:absolute;
  top:12px;
  left:56px;
  z-index:600;
  width:min(360px,calc(100% - 250px));
  overflow:hidden;
  border:1px solid rgba(204,213,198,.95);
  border-radius:15px;
  background:rgba(255,255,255,.97);
  box-shadow:0 8px 28px rgba(34,49,27,.2);
  backdrop-filter:blur(8px);
}

.sales-map-search-toggle{
  display:grid;
  grid-template-columns:24px minmax(0,1fr) 18px;
  align-items:center;
  gap:8px;
  width:100%;
  margin:0;
  padding:12px 14px;
  border:0;
  border-radius:0;
  color:#2f4925;
  background:#fff;
  text-align:left;
}

.sales-map-search-toggle > span{
  font-size:24px;
  line-height:1;
}

.sales-map-search-toggle > i{
  font-style:normal;
  text-align:center;
  transition:transform .2s ease;
}

.sales-map-search-panel{
  display:grid;
  gap:11px;
  padding:4px 14px 14px;
  border-top:1px solid #edf0e9;
}

.sales-map-search-panel input,
.sales-map-search-panel select{
  margin:0;
  background:#fff;
}

.sales-map-search-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.sales-map-search-actions button{
  width:100%;
  margin:0;
  padding:10px;
}

.sales-map-search-panel .form-message{
  min-height:0;
  margin:0;
  font-size:11px;
}

.sales-map-search.collapsed{
  width:190px;
}

.sales-map-search.collapsed .sales-map-search-panel{
  display:none;
}

.sales-map-search.collapsed .sales-map-search-toggle > i{
  transform:rotate(180deg);
}

.sales-map-loading{
  position:absolute;
  inset:50% auto auto 50%;
  z-index:500;
  transform:translate(-50%,-50%);
  padding:12px 16px;
  border-radius:12px;
  background:rgba(255,255,255,.94);
  box-shadow:var(--shadow);
  font-weight:700;
}

.sales-map-layers{
  position:absolute;
  top:12px;
  right:12px;
  z-index:500;
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:160px;
  padding:11px 12px;
  border:1px solid rgba(204,213,198,.9);
  border-radius:13px;
  background:rgba(255,255,255,.94);
  box-shadow:0 7px 22px rgba(34,49,27,.14);
  backdrop-filter:blur(7px);
}

.sales-map-layers strong{
  margin-bottom:1px;
  font-size:12px;
}

.sales-map-layers label{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0;
  color:#465040;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
}

.sales-map-layers input{
  width:16px;
  height:16px;
  margin:0;
  accent-color:#6b9f3a;
}

.sales-map-loading.error{
  color:#991b1b;
  background:#fff1f1;
}

.sales-map .leaflet-popup-content-wrapper{
  border-radius:14px;
}

.sales-popup{
  line-height:1.45;
}

.sales-popup strong,
.sales-popup span{
  display:block;
}

.sales-company-marker-shell{
  background:transparent;
  border:0;
}

.sales-company-marker{
  position:relative;
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  border:3px solid #fff;
  border-radius:13px 13px 13px 3px;
  background:#5d9630;
  box-shadow:0 5px 14px rgba(20,45,12,.3);
  transform:rotate(-45deg);
  font-size:15px;
}

.sales-company-marker::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:10px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.25);
}

.sales-company-marker-shell .sales-company-marker{
  color:#fff;
}

.sales-company-marker-shell .sales-company-marker > i{
  font-style:normal;
  transform:rotate(45deg);
}

.sales-company-popup{
  display:flex;
  flex-direction:column;
  gap:5px;
  min-width:210px;
  line-height:1.35;
}

.sales-company-popup strong{
  margin:2px 0;
  font-size:16px;
}

.sales-company-popup span{
  color:#596153;
}

.sales-company-popup-category{
  width:max-content;
  padding:4px 7px;
  border-radius:999px;
  color:#4c7628 !important;
  background:#edf6e5;
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
}

.sales-company-popup a{
  margin-top:3px;
  color:#4f8528;
  font-weight:700;
}

.sales-company-popup small{
  margin-top:4px;
  color:#8a9185;
}

.sales-customer-popup{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:225px;
}

.sales-customer-popup > strong{
  margin-top:2px;
  font-size:16px;
}

.sales-customer-popup > span{
  color:#5b6358;
}

.sales-customer-popup > div{
  display:flex;
  flex-direction:column;
  gap:1px;
  margin:3px 0;
  padding:8px 10px;
  border-radius:10px;
  background:#f1f6ed;
}

.sales-customer-popup > div small{
  color:#687263;
}

.sales-customer-popup > div b{
  color:#345c2b;
  font-size:15px;
}

.sales-customer-popup button{
  width:100%;
  margin:4px 0 0;
  padding:9px 11px;
}

.sales-status-badge{
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:6px 9px;
  border-radius:999px;
  color:#475569;
  background:#eef1f4;
  font-size:11px;
  font-weight:800;
}

.sales-status-badge.existing{color:#1d4ed8;background:#e8efff}
.sales-status-badge.growth{color:#9a5c00;background:#fff3d5}
.sales-status-badge.lead{color:#6d28d9;background:#f1eafe}

.sales-customer-modal{
  width:min(1180px,calc(100vw - 32px));
  max-height:calc(100vh - 32px);
  padding:30px;
  overflow-y:auto;
}

.sales-customer-detail-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding-right:42px;
}

.sales-customer-detail-heading h2{
  margin:4px 0 6px;
  font-size:29px;
}

.sales-customer-detail-heading p:not(.analysis-eyebrow){
  margin:0;
  color:var(--muted);
}

.sales-customer-detail-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:22px 0;
}

.sales-customer-detail-kpis article{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:16px;
  border:1px solid #e2e7de;
  border-radius:15px;
  background:#f9fbf7;
}

.sales-customer-detail-kpis span{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.sales-customer-detail-kpis strong{
  font-size:21px;
}

.risk-niedrig{color:#2f7d32}
.risk-mittel{color:#b26a00}
.risk-hoch{color:#b42318}

.sales-customer-detail-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}

.sales-customer-detail-grid section{
  padding:19px;
  border:1px solid #e2e7de;
  border-radius:16px;
  background:#fff;
}

.sales-customer-detail-grid h3{
  margin:0 0 13px;
}

.sales-customer-detail-grid dl{
  display:flex;
  flex-direction:column;
  gap:11px;
  margin:0;
}

.sales-customer-detail-grid dl > div{
  display:grid;
  grid-template-columns:125px minmax(0,1fr);
  gap:10px;
}

.sales-customer-detail-grid dt{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.sales-customer-detail-grid dd{
  margin:0;
  overflow-wrap:anywhere;
}

.sales-visit-section{
  margin-top:18px;
  padding:19px;
  border:1px solid #e2e7de;
  border-radius:16px;
  background:#f9faf7;
}

.sales-visit-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.sales-visit-heading h3{
  margin:2px 0 0;
}

.sales-visit-heading > span{
  padding:6px 9px;
  border-radius:999px;
  color:#4f6f3c;
  background:#eaf3e4;
  font-size:11px;
  font-weight:800;
}

.sales-visit-timeline{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.sales-visit-timeline article{
  display:grid;
  grid-template-columns:135px minmax(0,1fr);
  gap:16px;
  padding:15px;
  border:1px solid #e3e8df;
  border-radius:14px;
  background:#fff;
}

.sales-visit-date{
  display:flex;
  flex-direction:column;
  gap:5px;
  padding-right:14px;
  border-right:1px solid #e5e9e1;
}

.sales-visit-date span{
  color:#e4a11b;
  letter-spacing:.04em;
}

.sales-visit-timeline h4{
  margin:0 0 5px;
}

.sales-visit-timeline p{
  margin:0 0 7px;
  color:#525b4e;
}

.sales-visit-timeline small{
  color:#697264;
}

.sales-detail-demo-note{
  margin:14px 0 0;
  color:#8a650d;
  font-size:11px;
  text-align:center;
}

.sales-import-modal{
  width:min(1220px,calc(100vw - 32px));
  max-height:calc(100vh - 32px);
  padding:30px;
  overflow-y:auto;
}

.sales-import-heading{
  padding-right:48px;
}

.sales-import-heading h2{
  margin:4px 0 7px;
  font-size:28px;
}

.sales-import-heading p:not(.analysis-eyebrow){
  margin:0;
  color:var(--muted);
}

.sales-import-guide{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
  margin:22px 0 16px;
}

.sales-import-guide div{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  border:1px solid #e2e8dd;
  border-radius:14px;
  background:#f8faf6;
  color:#475342;
  font-size:13px;
  font-weight:700;
}

.sales-import-guide strong{
  display:grid;
  place-items:center;
  width:27px;
  height:27px;
  border-radius:50%;
  color:#fff;
  background:#659637;
}

.sales-import-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  padding:16px;
  border:1px solid #dfe8d8;
  border-radius:17px;
  background:#f7fbf4;
}

.sales-import-dropzone{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
  margin:0;
  padding:15px 18px;
  border:2px dashed #b9cfa8;
  border-radius:14px;
  background:#fff;
  cursor:pointer;
}

.sales-import-dropzone:hover{
  border-color:#6e9e42;
  background:#fbfef9;
}

.sales-import-dropzone.dragging{
  border-color:#5e9131;
  background:#eef8e9;
  box-shadow:0 0 0 4px rgba(94,145,49,.12);
}

.sales-import-dropzone input{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}

.sales-import-dropzone strong{
  color:#315a24;
}

.sales-import-dropzone span{
  overflow:hidden;
  color:var(--muted);
  font-size:12px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.sales-import-form-actions{
  display:flex;
  gap:9px;
}

.sales-import-form-actions button{
  width:auto;
  margin:0;
  white-space:nowrap;
}

.sales-import-preview{
  margin-top:18px;
}

.sales-import-summary{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:9px;
  margin-bottom:16px;
}

.sales-import-summary article{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding:13px;
  border:1px solid #e1e6dc;
  border-radius:13px;
  background:#fafbf9;
}

.sales-import-summary strong{
  font-size:21px;
}

.sales-import-summary span{
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}

.sales-import-summary .success strong{color:#2f7d32}
.sales-import-summary .danger strong{color:#b42318}
.sales-import-summary .warning strong{color:#b26a00}

.sales-import-preview-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:10px;
}

.sales-import-preview-heading > div{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.sales-import-preview-heading small{
  color:var(--muted);
}

.sales-import-preview-heading button{
  width:auto;
  margin:0;
}

.sales-import-table-wrap{
  overflow-x:auto;
  border:1px solid #e0e5dc;
  border-radius:14px;
}

.sales-import-table{
  width:100%;
  border-collapse:collapse;
  min-width:900px;
}

.sales-import-table th,
.sales-import-table td{
  padding:10px 12px;
  border-bottom:1px solid #e8ece5;
  text-align:left;
  font-size:12px;
}

.sales-import-table th{
  color:#465440;
  background:#f2f6ef;
  font-weight:800;
}

.sales-import-table tr:last-child td{
  border-bottom:0;
}

.sales-import-table tr.invalid td{
  background:#fff6f5;
}

.sales-import-action{
  display:inline-flex;
  padding:5px 7px;
  border-radius:999px;
  color:#24631f;
  background:#eaf6e5;
  font-size:10px;
  font-weight:800;
  white-space:nowrap;
}

.sales-import-action.update{color:#1d4ed8;background:#e8efff}
.sales-import-action.skip{color:#9f291f;background:#feeceb}

.sales-import-issues{
  display:grid;
  gap:7px;
  max-height:220px;
  margin-top:12px;
  overflow-y:auto;
}

.sales-import-issues > div{
  display:grid;
  grid-template-columns:190px minmax(0,1fr);
  gap:10px;
  padding:9px 11px;
  border-left:4px solid #e3a11b;
  border-radius:9px;
  background:#fff9eb;
  font-size:12px;
}

.sales-import-issues > div.error{
  border-left-color:#c43b31;
  background:#fff2f1;
}

.sales-import-issues p{
  margin:3px 0;
  color:var(--muted);
  font-size:12px;
}

.sales-import-commit{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-top:16px;
  padding:14px 16px;
  border:1px solid #cfe0c2;
  border-radius:14px;
  background:#f3f9ef;
}

.sales-import-commit p{
  margin:0;
  color:#4b5845;
  font-size:12px;
  line-height:1.5;
}

.sales-import-commit button{
  width:auto;
  margin:0;
  white-space:nowrap;
}

.sales-popup span{
  margin-top:3px;
  color:#636b60;
}

.sales-attribution{
  margin:12px 2px 0;
  color:var(--muted);
  font-size:11px;
}

@media(max-width:1100px){
  .sales-kpis{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .sales-map-layout{
    grid-template-columns:240px minmax(0,1fr);
  }

  .ticket-summary{
    grid-template-columns:1fr !important;
    gap:8px !important;
  }

  .ticket-state{
    justify-content:flex-start !important;
    min-width:0;
  }
}

@media(max-width:1000px){
  .sales-kpis{
    grid-template-columns:1fr 1fr;
  }

  .sales-import-summary{
    grid-template-columns:repeat(3,1fr);
  }

  .sales-import-form{
    grid-template-columns:1fr;
  }

  .sales-toolbar{
    grid-template-columns:1fr 1fr;
  }

  .sales-toolbar .sales-search,
  .sales-toolbar .form-message{
    grid-column:1 / -1;
  }

  .sales-company-controls{
    grid-template-columns:1fr 1fr;
  }

  .sales-crm-controls{
    grid-template-columns:1fr 1fr;
  }

  .sales-map-layout{
    grid-template-columns:1fr;
  }

  .sales-territory-panel{
    border-right:0;
    border-bottom:1px solid #e5e8e1;
  }

  .sales-territory-list{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .sales-map-note{
    margin-top:4px;
  }

  .admin-user-form,
  .admin-user-row{
    grid-template-columns:1fr;
  }
  .layout{
    grid-template-columns:1fr !important;
  }

  .stats{
    grid-template-columns:1fr 1fr;
  }

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

  .logo{
    width:150px;
  }
}

@media(max-width:800px){
  .sales-module{
    padding:17px;
  }

  .sales-heading{
    flex-direction:column;
  }

  .sales-heading-actions{
    justify-content:flex-start;
  }

  .sales-import-modal{
    width:calc(100vw - 16px);
    max-height:calc(100vh - 16px);
    padding:20px 16px;
  }

  .sales-import-guide,
  .sales-import-summary{
    grid-template-columns:1fr 1fr;
  }

  .sales-import-form-actions,
  .sales-import-commit{
    align-items:stretch;
    flex-direction:column;
  }

  .sales-import-form-actions button,
  .sales-import-commit button{
    width:100%;
  }

  .sales-import-issues > div{
    grid-template-columns:1fr;
  }

  .sales-company-toolbar-heading{
    align-items:flex-start;
    flex-direction:column;
  }

  .sales-company-controls{
    grid-template-columns:1fr;
  }

  .sales-crm-controls,
  .sales-customer-detail-kpis,
  .sales-customer-detail-grid{
    grid-template-columns:1fr;
  }

  .sales-map-layout,
  .sales-map-card{
    min-height:620px;
  }

  .sales-map{
    height:620px;
  }

  .sales-map-search{
    top:12px;
    left:52px;
    width:calc(100% - 64px);
  }

  .sales-map-search.collapsed{
    width:180px;
  }

  .sales-map-layers{
    top:auto;
    right:10px;
    bottom:26px;
  }

  .sales-customer-modal{
    width:calc(100vw - 16px);
    max-height:calc(100vh - 16px);
    padding:20px 16px;
  }

  .sales-customer-detail-heading{
    flex-direction:column;
  }

  .sales-visit-timeline article{
    grid-template-columns:1fr;
  }

  .sales-visit-date{
    padding:0 0 9px;
    border-right:0;
    border-bottom:1px solid #e5e9e1;
  }

  .sales-customer-detail-grid dl > div{
    grid-template-columns:1fr;
    gap:3px;
  }

  .sales-toolbar,
  .sales-territory-list{
    grid-template-columns:1fr;
  }

  .sales-toolbar .sales-search,
  .sales-toolbar .form-message{
    grid-column:auto;
  }

  .sales-map-card,
  .sales-map{
    min-height:520px;
    height:520px;
  }

  .app-active .header{
    margin-left:0;
    padding:72px 12px 12px;
  }

  .app-active main{
    padding:0 12px 28px;
  }

  .app-content{
    margin-left:0;
    width:100%;
  }

  .app-sidebar{
    top:0;
    bottom:0;
    left:0;
    width:min(260px,84vw);
    border-radius:0 24px 24px 0;
    transform:translateX(-105%);
    transition:transform .2s ease;
  }

  .app-sidebar.mobile-open{
    transform:translateX(0);
  }

  .sidebar-toggle{
    position:fixed;
    top:12px;
    right:12px;
    z-index:1100;
    display:block;
    width:auto;
    margin:0;
    padding:12px 18px;
  }

  .sidebar-backdrop:not(.hidden){
    position:fixed;
    inset:0;
    z-index:900;
    display:block;
    background:rgba(0,0,0,.45);
  }

  .box{
    max-width:100%;
    padding:18px;
  }

  .toolbar,
  .status-filter{
    min-width:0;
    max-width:100%;
  }

  .ticket-scope{
    align-items:stretch;
    flex-direction:column;
  }

  .ticket-scope-buttons{
    flex-wrap:wrap;
  }

  .ticket-scope-label{
    white-space:normal;
  }

  .modal-content{
    width:calc(100vw - 20px);
    padding:18px;
  }

  .ticket-modal-content{
    width:calc(100vw - 12px);
    height:calc(100vh - 12px);
  }
}
.modal-content .desc{
  white-space:pre-line;
  line-height:1.55;
  margin:24px 0;
  font-size:15px;
}

.modal-content h2{
  padding-right:55px;
}
.modal-content .ticket-actions{
  display:block;
}

.modal-content .comments-box,
.modal-content .files-box{
  margin-top:10px;
}

.modal-content .ticket-actions button.secondary{
  width:100%;
}

.modal-content .comments-content,
.modal-content .files-content{
  width:100%;
}

.modal-content .comments-list{
  display:block;
}

.modal-content .comments-list .comment{
  width:100%;
  margin-bottom:12px;
}

.modal-content .files-list{
  display:block;
}

.modal-content .files-list .file-link{
  width:100%;
  margin-bottom:10px;
}

.modal-content .comment,
.modal-content .file-link{
  margin-bottom:0;
}


/* Admin-Analyse */
.analysis-page{
  display:grid;
  gap:22px;
}

.analysis-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
}

.analysis-eyebrow{
  margin:0 0 8px;
  color:#5f8c2b;
  font-size:12px;
  font-weight:800;
  letter-spacing:.13em;
}

.analysis-header h2{
  margin-bottom:8px;
  font-size:30px;
}

.analysis-subtitle,
.analysis-panel p{
  margin:0;
  color:var(--muted);
}

.analysis-filter{
  display:grid;
  grid-template-columns:minmax(190px,240px) auto;
  gap:8px;
  align-items:end;
}

.analysis-filter label{
  grid-column:1 / -1;
  margin:0;
}

.analysis-filter select,
.analysis-filter button{
  margin:0;
}

.analysis-message{
  min-height:20px;
  margin:-10px 4px -8px;
  color:var(--muted);
}

.analysis-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
}

.analysis-kpi{
  min-height:154px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.analysis-kpi span{
  color:var(--muted);
  font-size:14px;
}

.analysis-kpi strong{
  display:block;
  margin:10px 0 8px;
  color:#5f8c2b;
  font-size:32px;
  line-height:1.1;
  overflow-wrap:anywhere;
}

.analysis-kpi small{
  color:var(--muted);
}

.analysis-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}

.analysis-panel{
  min-width:0;
}

.analysis-panel h3{
  margin:0 0 6px;
}

.analysis-wide{
  grid-column:1 / -1;
}

.breakdown-list{
  display:grid;
  gap:17px;
  margin-top:22px;
}

.breakdown-item{
  min-width:0;
}

.breakdown-label{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:8px;
}

.breakdown-label > span{
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
  overflow-wrap:anywhere;
}

.breakdown-label i{
  width:24px;
  height:24px;
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  background:#eef5e5;
  color:#5f8c2b;
  font-size:11px;
  font-style:normal;
  font-weight:800;
}

.breakdown-label strong{
  flex:0 0 auto;
}

.breakdown-label small{
  color:var(--muted);
  font-weight:400;
}

.breakdown-track{
  height:10px;
  overflow:hidden;
  border-radius:999px;
  background:#e9ece5;
}

.breakdown-track span{
  display:block;
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,#73a934,#a6d45d);
}

.analysis-empty{
  padding:28px 12px;
  color:var(--muted);
  text-align:center;
}

.trend-chart{
  min-height:260px;
  margin-top:22px;
}

.trend-scroll{
  overflow-x:auto;
  padding:8px 2px 4px;
}

.trend-bars{
  min-width:max(100%,calc(var(--trend-columns) * 44px));
  height:240px;
  display:grid;
  grid-template-columns:repeat(var(--trend-columns),minmax(34px,1fr));
  gap:8px;
  align-items:end;
}

.trend-column{
  height:100%;
  display:grid;
  grid-template-rows:24px 1fr 30px;
  gap:5px;
  align-items:end;
  text-align:center;
}

.trend-column strong{
  color:#5f8c2b;
  font-size:12px;
}

.trend-column small{
  overflow:hidden;
  color:var(--muted);
  font-size:10px;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.trend-bar-wrap{
  width:100%;
  height:100%;
  display:flex;
  align-items:flex-end;
  overflow:hidden;
  border-radius:10px 10px 4px 4px;
  background:linear-gradient(to top,rgba(140,198,63,.08),rgba(140,198,63,.02));
}

.trend-bar-wrap span{
  width:100%;
  min-height:8px;
  border-radius:10px 10px 4px 4px;
  background:linear-gradient(180deg,#9bd34f,#6fa42f);
}

@media(max-width:1050px){
  .analysis-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:800px){
  .analysis-header{
    align-items:stretch;
    flex-direction:column;
  }

  .analysis-filter{
    grid-template-columns:1fr;
  }

  .analysis-filter label{
    grid-column:auto;
  }

  .analysis-kpis,
  .analysis-grid{
    grid-template-columns:1fr;
  }

  .analysis-wide{
    grid-column:auto;
  }
}

/* Admin-Inventar */
.inventory-page{
  display:grid;
  gap:22px;
}

.inventory-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
}

.inventory-header h2{
  margin-bottom:8px;
  font-size:30px;
}

.inventory-header-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.inventory-header-actions button{
  width:auto;
  min-width:150px;
  margin:0;
}

.inventory-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
}

.inventory-panel{
  min-width:0;
}

.inventory-toolbar{
  display:grid;
  grid-template-columns:minmax(260px,2fr) repeat(3,minmax(150px,1fr)) minmax(150px,auto);
  gap:10px;
  align-items:center;
}

.inventory-toolbar input,
.inventory-toolbar select,
.inventory-toolbar button{
  margin:0;
}

.inventory-result-line{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin:18px 0 12px;
  color:var(--muted);
  font-size:14px;
}

.inventory-result-line strong{
  color:var(--text);
}

.inventory-table-wrap{
  overflow:auto;
  border:1px solid #e9e9e5;
  border-radius:18px;
  background:rgba(255,255,255,.72);
}

.inventory-table{
  width:100%;
  min-width:1180px;
  border-collapse:collapse;
}

.inventory-table th,
.inventory-table td{
  padding:13px 12px;
  border-bottom:1px solid #ecece8;
  text-align:left;
  vertical-align:middle;
  font-size:13px;
}

.inventory-table th{
  position:sticky;
  top:0;
  z-index:1;
  background:#f4f5f1;
  color:#555;
  font-size:12px;
  letter-spacing:.02em;
  white-space:nowrap;
}

.inventory-table tbody tr:hover{
  background:rgba(140,198,63,.08);
}

.inventory-table tbody tr:last-child td{
  border-bottom:none;
}

.inventory-table td:nth-child(5){
  min-width:250px;
  max-width:360px;
}

.inventory-table td small{
  display:block;
  max-width:340px;
  margin-top:5px;
  overflow:hidden;
  color:var(--muted);
  line-height:1.35;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.inventory-edit-button{
  width:auto;
  min-width:96px;
  margin:0;
  padding:9px 12px;
}

.inventory-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:7px 10px;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}

.inventory-status-ok{
  background:#e7f6d8;
  color:#3f711a;
}

.inventory-status-attention{
  background:#fff3cd;
  color:#835c00;
}

.inventory-status-bad{
  background:#fee2e2;
  color:#a61b1b;
}

.inventory-modal-content{
  width:min(960px,95vw);
}

.inventory-modal-heading{
  padding-right:56px;
}

.inventory-modal-heading h2{
  margin-bottom:8px;
}

.inventory-modal-heading p:last-child{
  margin:0 0 20px;
  color:var(--muted);
}

.inventory-form-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:0 14px;
}

.inventory-form-wide{
  grid-column:1 / -1;
}

.inventory-form-grid textarea{
  min-height:88px;
}

.inventory-form-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:18px;
}

.inventory-form-actions button{
  width:auto;
  min-width:130px;
  margin:0;
}

.inventory-form-actions .danger{
  margin-right:auto;
}

@media(max-width:1200px){
  .inventory-toolbar{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .inventory-toolbar input{
    grid-column:1 / -1;
  }
}

@media(max-width:1000px){
  .inventory-kpis{
    grid-template-columns:1fr 1fr;
  }

  .inventory-header{
    align-items:flex-start;
    flex-direction:column;
  }

  .inventory-header-actions{
    width:100%;
    justify-content:flex-start;
  }
}

@media(max-width:700px){
  .inventory-kpis,
  .inventory-toolbar,
  .inventory-form-grid{
    grid-template-columns:1fr;
  }

  .inventory-toolbar input,
  .inventory-form-wide{
    grid-column:auto;
  }

  .inventory-header-actions,
  .inventory-form-actions{
    flex-direction:column;
    width:100%;
  }

  .inventory-header-actions button,
  .inventory-form-actions button{
    width:100%;
  }

  .inventory-form-actions .danger{
    margin-right:0;
    order:3;
  }
}

/* Inventar 2.3 – Mitarbeiteransicht / MMO-Inventar */
.inventory-employee-toolbar{
  grid-template-columns:minmax(300px,2fr) repeat(2,minmax(170px,1fr)) minmax(160px,auto);
}

.inventory-employee-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.inventory-employee-card{
  width:100%;
  min-height:132px;
  margin:0;
  padding:18px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:16px;
  border:1px solid #e5e8df;
  border-radius:20px;
  background:linear-gradient(145deg,#fff 0%,#f8faf5 100%);
  color:var(--text);
  text-align:left;
  box-shadow:0 8px 24px rgba(37,54,25,.06);
  transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease;
}

.inventory-employee-card:hover{
  transform:translateY(-2px);
  border-color:#a8c983;
  box-shadow:0 14px 34px rgba(37,54,25,.12);
}

.inventory-avatar{
  width:54px;
  height:54px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  border-radius:17px;
  background:linear-gradient(145deg,#6f9f37,#4f7d21);
  color:#fff;
  font-size:17px;
  font-weight:900;
  letter-spacing:.05em;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 8px 20px rgba(78,122,32,.22);
}

.inventory-avatar-unassigned{
  background:linear-gradient(145deg,#8b8f86,#62665e);
}

.inventory-avatar-large{
  width:76px;
  height:76px;
  border-radius:23px;
  font-size:23px;
}

.inventory-profile-main{
  min-width:0;
  display:grid;
  gap:7px;
}

.inventory-profile-title-row{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.inventory-profile-title-row strong{
  overflow:hidden;
  font-size:17px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.inventory-profile-department{
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

.inventory-profile-alert,
.inventory-profile-ok{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 8px;
  font-size:10px;
  font-weight:900;
  white-space:nowrap;
}

.inventory-profile-alert{
  background:#fff0cf;
  color:#805800;
}

.inventory-profile-ok{
  background:#e8f5db;
  color:#497222;
}

.inventory-category-preview{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  overflow:hidden;
}

.inventory-category-chip{
  max-width:112px;
  display:inline-flex;
  align-items:center;
  gap:5px;
  overflow:hidden;
  border:1px solid #e4e8de;
  border-radius:9px;
  padding:5px 7px;
  background:#fff;
  color:#5d6258;
  font-size:10px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.inventory-category-chip b{
  color:#5f8c2b;
  font-size:13px;
}

.inventory-category-more{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}

.inventory-profile-stats{
  display:flex;
  align-items:center;
  gap:14px;
}

.inventory-profile-stats > span{
  min-width:42px;
  display:grid;
  justify-items:center;
}

.inventory-profile-stats strong{
  font-size:18px;
  line-height:1;
}

.inventory-profile-stats small{
  margin-top:4px;
  color:var(--muted);
  font-size:10px;
}

.inventory-profile-stats i{
  color:#6d8f4d;
  font-size:30px;
  font-style:normal;
  font-weight:300;
}

.inventory-character-modal{
  width:min(1180px,96vw);
  padding:28px;
  background:linear-gradient(145deg,#fdfefb,#f3f6ee);
}

.inventory-character-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding-right:46px;
}

.inventory-character-ident{
  display:flex;
  align-items:center;
  gap:18px;
}

.inventory-character-ident h2{
  margin:2px 0 5px;
  padding:0;
  font-size:30px;
}

.inventory-character-ident p:last-child{
  margin:0;
  color:var(--muted);
  font-weight:700;
}

.inventory-character-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.inventory-character-actions button{
  width:auto;
  min-width:180px;
  margin:0;
}

.inventory-character-summary{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin:24px 0 18px;
  padding:12px;
  border:1px solid #e3e8dc;
  border-radius:16px;
  background:rgba(255,255,255,.72);
}

.inventory-character-summary span{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:10px;
  padding:8px 11px;
  background:#eef3e9;
  color:#4f5948;
  font-size:12px;
}

.inventory-character-summary span.has-attention{
  background:#fff0cf;
  color:#805800;
}

.inventory-slot-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}

.inventory-slot{
  min-height:190px;
  position:relative;
  display:grid;
  grid-template-columns:54px minmax(0,1fr);
  gap:13px;
  padding:16px;
  border:1px solid #e2e7dc;
  border-radius:18px;
  background:#fff;
  box-shadow:0 8px 24px rgba(48,63,37,.06);
}

.inventory-slot-attention{
  border-color:#e7c76d;
  box-shadow:0 8px 24px rgba(145,104,0,.09);
}

.inventory-slot-icon{
  width:54px;
  height:54px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #dce5d2;
  border-radius:16px;
  background:linear-gradient(145deg,#edf5e5,#f9fbf7);
  color:#567d2f;
  font-size:28px;
  font-weight:900;
}

.inventory-slot-copy{
  min-width:0;
  padding-right:2px;
}

.inventory-slot-category{
  color:#6b8c4d;
  font-size:10px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}

.inventory-slot h4{
  margin:5px 0 6px;
  font-size:15px;
  line-height:1.35;
}

.inventory-slot p{
  margin:0;
  color:var(--muted);
  font-size:11px;
}

.inventory-slot small{
  display:-webkit-box;
  margin-top:8px;
  overflow:hidden;
  color:#656a61;
  font-size:11px;
  line-height:1.4;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

.inventory-slot-meta{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  margin-top:11px;
  color:var(--muted);
  font-size:10px;
}

.inventory-slot-meta .inventory-status{
  padding:5px 7px;
  font-size:9px;
}

.inventory-slot-actions{
  grid-column:1 / -1;
  align-self:end;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.inventory-slot-actions button{
  width:100%;
  min-width:0;
  margin:0;
  padding:8px 10px;
}

.inventory-slot-delete,
.inventory-profile-delete{
  background:#b42318;
}

.inventory-slot-delete:hover,
.inventory-profile-delete:hover{
  background:#8f1d14;
}

.inventory-person-modal{
  width:min(720px,95vw);
}

.inventory-person-form-grid{
  grid-template-columns:1fr 1fr;
}

.inventory-form-grid select + input,
.inventory-person-form-grid select + input{
  margin-top:-5px;
}

.inventory-form-grid select:disabled{
  opacity:.72;
  cursor:not-allowed;
  background:#eef0eb;
}

@media(max-width:1100px){
  .inventory-employee-grid{
    grid-template-columns:1fr;
  }

  .inventory-slot-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:900px){
  .inventory-employee-toolbar{
    grid-template-columns:1fr 1fr;
  }

  .inventory-employee-toolbar input{
    grid-column:1 / -1;
  }

  .inventory-character-header{
    align-items:flex-start;
    flex-direction:column;
  }

  .inventory-character-actions{
    width:100%;
    justify-content:flex-start;
  }
}

@media(max-width:700px){
  .inventory-employee-toolbar,
  .inventory-slot-grid,
  .inventory-person-form-grid{
    grid-template-columns:1fr;
  }

  .inventory-employee-toolbar input{
    grid-column:auto;
  }

  .inventory-employee-card{
    grid-template-columns:auto minmax(0,1fr);
  }

  .inventory-profile-stats{
    grid-column:1 / -1;
    justify-content:flex-end;
    padding-top:8px;
    border-top:1px solid #e7eadf;
  }

  .inventory-character-ident{
    align-items:flex-start;
  }

  .inventory-avatar-large{
    width:60px;
    height:60px;
    border-radius:18px;
    font-size:18px;
  }

  .inventory-character-ident h2{
    font-size:23px;
  }

  .inventory-character-actions{
    flex-direction:column;
  }

  .inventory-character-actions button{
    width:100%;
  }
}


.inventory-user-link{
  display:inline-flex;
  width:max-content;
  max-width:100%;
  margin-top:5px;
  padding:4px 8px;
  border-radius:999px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:10px;
  font-weight:800;
}

.inventory-user-link-ok{
  background:#e6f5d9;
  color:#3e681f;
}

.inventory-user-link-open{
  background:#fff0cf;
  color:#805800;
}

.inventory-links-modal{
  width:min(1080px,96vw);
  max-height:92vh;
  overflow:auto;
}

.inventory-link-kpis{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin:18px 0;
}

.inventory-link-kpis article{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid #e1e7da;
  border-radius:16px;
  background:#f8faf5;
}

.inventory-link-kpis span{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.inventory-link-kpis strong{
  color:#486d26;
  font-size:25px;
}

.inventory-link-toolbar{
  display:grid;
  grid-template-columns:minmax(250px,1fr) 220px auto;
  gap:10px;
  align-items:center;
  margin-bottom:10px;
}

.inventory-link-toolbar input,
.inventory-link-toolbar select{
  margin:0;
}

.inventory-link-toolbar strong{
  color:var(--muted);
  font-size:12px;
  text-align:right;
}

.inventory-links-list{
  display:grid;
  gap:10px;
  margin-top:12px;
}

.inventory-link-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(320px,.9fr);
  gap:16px;
  align-items:center;
  padding:13px 15px;
  border:1px solid #e2e7dc;
  border-radius:16px;
  background:#fff;
}

.inventory-link-person{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.inventory-link-person .inventory-avatar{
  width:43px;
  height:43px;
  flex:0 0 43px;
  border-radius:14px;
  font-size:13px;
}

.inventory-link-person div{
  min-width:0;
}

.inventory-link-person strong,
.inventory-link-person span{
  display:block;
}

.inventory-link-person strong{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
}

.inventory-link-person span{
  margin-top:3px;
  color:var(--muted);
  font-size:11px;
}

.inventory-link-assignment{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:9px;
  align-items:center;
}

.inventory-link-assignment select{
  min-width:0;
  margin:0;
}

.inventory-link-state{
  display:inline-flex;
  justify-content:center;
  min-width:78px;
  padding:6px 9px;
  border-radius:999px;
  font-size:10px;
  font-weight:900;
}

.inventory-link-state-ok{
  background:#e6f5d9;
  color:#3e681f;
}

.inventory-link-state-open{
  background:#fff0cf;
  color:#805800;
}

@media(max-width:760px){
  .inventory-link-kpis,
  .inventory-link-toolbar,
  .inventory-link-row{
    grid-template-columns:1fr;
  }

  .inventory-link-toolbar strong{
    text-align:left;
  }

  .inventory-link-assignment{
    grid-template-columns:1fr;
  }

  .inventory-link-state{
    width:max-content;
  }
}

/* Hardware-Ticket & automatischer Inventaraustausch – v2.6.0 */
.field-hint {
  display: block;
  margin: 8px 0 6px;
  color: #68706a;
  font-size: 0.84rem;
  line-height: 1.45;
}

@media(max-width:700px){
  .tickets-heading{
    align-items:stretch;
    flex-direction:column;
  }

  .tickets-heading #adminNewTicketButton{
    width:100%;
  }

  .admin-ticket-modal-content{
    width:calc(100vw - 12px);
    max-height:calc(100vh - 12px);
    padding:22px 16px;
  }

  .admin-ticket-modal-content .ticket-form-grid{
    grid-template-columns:1fr;
  }

  .admin-ticket-modal-content .ticket-form-wide{
    grid-column:auto;
  }
}

.hardware-ticket-fields {
  margin: 4px 0 12px;
  padding: 16px;
  border: 1px solid rgba(118, 169, 46, 0.34);
  border-radius: 16px;
  background: rgba(139, 198, 63, 0.08);
}

.hardware-ticket-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.hardware-ticket-heading strong {
  font-size: 1rem;
}

.hardware-ticket-heading span,
.hardware-inventory-message {
  color: #657064;
  font-size: 0.84rem;
}

.hardware-inventory-message {
  min-height: 20px;
  margin: 8px 0 0;
}

.hardware-count {
  background: rgba(118, 169, 46, 0.12);
  border-radius: 999px;
  padding: 4px 8px;
}

.hardware-ticket-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(118, 169, 46, 0.32);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(139, 198, 63, 0.10), rgba(255, 255, 255, 0.96));
}

.hardware-ticket-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.hardware-ticket-card-heading h3 {
  margin: 2px 0 0;
  font-size: 1.16rem;
}

.hardware-eyebrow {
  color: #638d24;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.hardware-decision-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.8rem;
  font-weight: 800;
}

.hardware-decision-open {
  background: #fff3cf;
  color: #805f00;
}

.hardware-decision-exchange {
  background: #e4f5d0;
  color: #3e6812;
}

.hardware-decision-no-exchange {
  background: #e9edf1;
  color: #44505b;
}

.hardware-decision-rejected {
  background: #ffe0e0;
  color: #8d2020;
}

.hardware-ticket-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hardware-ticket-data > div,
.hardware-replacement-result {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.hardware-ticket-data span,
.hardware-replacement-result span {
  color: #6f756f;
  font-size: 0.75rem;
}

.hardware-asset-details,
.hardware-decision-note {
  margin: 12px 0 0;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  white-space: pre-wrap;
}

.hardware-replacement-result {
  margin-top: 12px;
  border-left: 4px solid #8bc63f;
}

.hardware-decision-date {
  display: block;
  margin-top: 8px;
  color: #697069;
}

.hardware-admin-decision {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(67, 79, 65, 0.15);
}

.hardware-admin-decision textarea {
  min-height: 80px;
}

.hardware-decision-actions,
.hardware-exchange-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 10px;
}

.hardware-exchange-form {
  margin-top: 14px;
  padding: 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(67, 79, 65, 0.10);
}

.hardware-exchange-form h4 {
  margin: 0 0 12px;
}

.hardware-exchange-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.hardware-exchange-wide {
  grid-column: 1 / -1;
}

.hardware-new-replacement,
.hardware-existing-replacement {
  margin-top: 10px;
}

@media (max-width: 720px) {
  .hardware-ticket-card-heading {
    display: grid;
  }

  .hardware-decision-badge {
    justify-self: start;
  }

  .hardware-ticket-data,
  .hardware-exchange-grid {
    grid-template-columns: 1fr;
  }

  .hardware-exchange-wide {
    grid-column: auto;
  }
}

/* Wissensbank */
.knowledge-page {
  display: grid;
  gap: 18px;
}

.knowledge-header,
.knowledge-result-line,
.knowledge-card-top,
.knowledge-card-meta,
.knowledge-article-actions,
.ticket-knowledge-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.knowledge-header h2,
.knowledge-article-heading h2 {
  margin: 3px 0 5px;
}

.knowledge-header button {
  width: auto;
  min-width: 160px;
  background: #76a92e;
}

.knowledge-search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 230px) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
}

.knowledge-search-panel input,
.knowledge-search-panel select,
.knowledge-search-panel button {
  margin: 0;
}

.knowledge-search-panel button {
  width: auto;
}

.knowledge-result-line {
  color: #687067;
  padding: 0 4px;
  font-size: 0.88rem;
}

.knowledge-result-line strong {
  color: #263126;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.knowledge-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  cursor: pointer;
  border-top: 4px solid #8bc63f;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.knowledge-card:hover,
.knowledge-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(42, 54, 40, 0.14);
  outline: none;
}

.knowledge-card h3 {
  margin: 15px 0 8px;
  font-size: 1.08rem;
}

.knowledge-card > p {
  flex: 1;
  margin: 0;
  color: #5f675f;
  line-height: 1.5;
}

.knowledge-card-meta {
  align-items: end;
  margin-top: 18px;
  color: #747b73;
  font-size: 0.76rem;
}

.knowledge-category,
.knowledge-draft,
.knowledge-type {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f4d9;
  color: #4f761b;
  font-size: 0.73rem;
  font-weight: 800;
}

.knowledge-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-type {
  background: #edf0f4;
  color: #4e5c69;
}

.knowledge-draft {
  background: #fff0c8;
  color: #806000;
}

.knowledge-empty {
  grid-column: 1 / -1;
}

.knowledge-article-modal,
.knowledge-editor-modal {
  width: min(920px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

#knowledgeArticleModal {
  z-index: 10000;
}

#knowledgeEditorModal {
  z-index: 10001;
}

.knowledge-article-heading {
  padding-right: 38px;
  margin-bottom: 20px;
}

.knowledge-article-heading > p {
  margin: 0;
  color: #717971;
  font-size: 0.82rem;
}

.knowledge-article-section {
  margin-top: 14px;
  padding: 17px 18px;
  border-radius: 14px;
  background: #f5f7f4;
  border-left: 4px solid #c8d0c4;
}

.knowledge-article-section.problem {
  background: #fff8e8;
  border-left-color: #efbd4f;
}

.knowledge-article-section.solution {
  background: #eff8e5;
  border-left-color: #76a92e;
}

.knowledge-article-section h3,
.knowledge-attachments h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
}

.knowledge-article-section p {
  margin: 0;
  line-height: 1.65;
}

.knowledge-keywords {
  margin-top: 14px;
  color: #697169;
  font-size: 0.85rem;
}

.knowledge-attachments {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.attachment-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.attachment-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe5dc;
  border-radius: 16px;
  background: #f7f9f6;
}

.attachment-card-file {
  grid-column: 1 / -1;
}

.attachment-preview {
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  background: #202520;
}

.attachment-preview-loading,
.attachment-preview-error {
  padding: 24px;
  color: #d9dfd7;
  text-align: center;
}

.attachment-preview-error {
  background: #fff4f1;
  color: #9b3b2c;
}

.attachment-image-button {
  width: 100%;
  height: 100%;
  min-height: 220px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}

.attachment-image-button img,
.attachment-preview video {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.attachment-preview video {
  min-height: 220px;
  background: #111;
}

.attachment-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
}

.attachment-card-footer strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card-footer button {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.media-lightbox {
  z-index: 12000;
  padding: 20px;
  background: rgba(8, 11, 8, 0.88);
}

.media-lightbox-content {
  position: relative;
  display: grid;
  width: min(1500px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  place-items: center;
}

.media-lightbox-content img {
  max-width: 100%;
  max-height: calc(100% - 44px);
  border-radius: 12px;
  object-fit: contain;
}

.media-lightbox-content .modal-close {
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
}

.media-lightbox-content p {
  margin: 8px 0 0;
  color: #fff;
  text-align: center;
}

@media (max-width: 760px) {
  .attachment-gallery {
    grid-template-columns: 1fr;
  }
}

.knowledge-article-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 24px;
}

.knowledge-article-actions button {
  width: auto;
}

.knowledge-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.knowledge-form-wide {
  grid-column: 1 / -1;
}

.knowledge-form-grid textarea {
  min-height: 105px;
}

#knowledgeSolution {
  min-height: 180px;
}

.knowledge-publish {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.knowledge-publish input {
  width: auto;
  margin: 0;
}

.knowledge-existing-files {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.knowledge-existing-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f1f4ef;
}

.knowledge-existing-file button {
  width: auto;
}

.ticket-knowledge-suggestions {
  margin-top: 12px;
  padding: 13px;
  border-radius: 13px;
  background: #eff8e5;
  border: 1px solid rgba(118, 169, 46, 0.24);
}

.ticket-knowledge-suggestions > strong {
  display: block;
  margin-bottom: 8px;
  color: #4d701d;
  font-size: 0.84rem;
}

.ticket-knowledge-suggestions > div {
  display: grid;
  gap: 6px;
}

.knowledge-suggestion,
.ticket-knowledge-result,
.knowledge-link-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 11px;
  margin: 0;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: #263126;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(70, 89, 65, 0.12);
}

.knowledge-suggestion:hover,
.ticket-knowledge-result:hover,
.knowledge-link-button:hover {
  background: #f8fbf5;
}

.knowledge-suggestion small,
.ticket-knowledge-result small,
.knowledge-link-button span {
  color: #667064;
  font-size: 0.76rem;
}

.ticket-knowledge-panel {
  margin: 18px 0;
  padding: 16px;
  border-radius: 15px;
  background: #f4f8ef;
  border: 1px solid rgba(118, 169, 46, 0.19);
}

.ticket-knowledge-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.ticket-knowledge-heading span {
  color: #687067;
  font-size: 0.78rem;
}

.ticket-linked-knowledge,
[id^="ticketKnowledgeResults-"] {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.ticket-linked-article {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-linked-article .danger {
  width: auto;
  flex: 0 0 auto;
}

.ticket-knowledge-linker {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid rgba(70, 89, 65, 0.12);
}

.ticket-knowledge-linker input,
.ticket-knowledge-linker button {
  margin: 0;
}

.ticket-knowledge-linker button {
  width: auto;
}

.ticket-knowledge-linker > div {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .knowledge-header,
  .knowledge-result-line,
  .knowledge-card-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-header button,
  .knowledge-search-panel button {
    width: 100%;
  }

  .knowledge-search-panel,
  .knowledge-grid,
  .knowledge-form-grid,
  .ticket-knowledge-linker {
    grid-template-columns: 1fr;
  }

  .knowledge-form-wide,
  .ticket-knowledge-linker > div {
    grid-column: auto;
  }

  .knowledge-suggestion,
  .ticket-knowledge-result,
  .knowledge-link-button {
    align-items: flex-start;
    flex-direction: column;
  }
}


.inventory-exchange-history {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(67, 79, 65, 0.14);
}

.inventory-exchange-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.inventory-exchange-heading h3 {
  margin: 3px 0 0;
}

.inventory-exchange-heading > span {
  color: #667064;
  font-size: 0.82rem;
  font-weight: 700;
}

.inventory-exchange-list {
  display: grid;
  gap: 10px;
}

.inventory-exchange-entry {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(67, 79, 65, 0.09);
}

.inventory-exchange-date,
.inventory-exchange-ticket {
  color: #687067;
  font-size: 0.8rem;
  font-weight: 700;
}

.inventory-exchange-entry > div:nth-child(2) {
  display: grid;
  gap: 3px;
}

.inventory-exchange-entry > div:nth-child(2) > span,
.inventory-exchange-entry small {
  color: #717870;
}

@media (max-width: 720px) {
  .inventory-exchange-heading,
  .inventory-exchange-entry {
    display: grid;
  }

  .inventory-exchange-entry {
    grid-template-columns: 1fr;
  }
}
