/* ============================================================
   BASE
============================================================ */
* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: #222;
  background: #f0f0f0;
  max-width: 720px;
  min-width: 320px;
  margin: 0 auto;
  padding: 6px;
}

/* TOAST */
#toast {
  position: fixed; top:16px; left:50%; transform:translateX(-50%);
  background:#4caf50; color:white; padding:10px 20px; border-radius:6px;
  box-shadow:0 2px 8px rgba(0,0,0,.2); display:none; z-index:10000;
  font-size:13px; font-weight:500;
}

/* ============================================================
   BUTTONS BASE
============================================================ */
button {
  border: 1px solid #ccc;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  font-size: 11px;
}
button:hover { background:#f0f0f0; border-color:#999; }

/* Field buttons (paste/copy) */
.fbtn {
  width: 24px; height: 24px;
  padding: 3px;
  flex-shrink: 0;
  display: flex; align-items:center; justify-content:center;
  border-color: #ddd;
}
.fbtn svg { width:14px; height:14px; color:#666; }
.fbtn:hover { background:#555; border-color:#555; }
.fbtn:hover svg { color:white; }

.fbtn-sm {
  width: auto; height: 24px;
  padding: 0 5px;
  font-size: 9px; font-weight: 700;
  color: #888;
  border-color: #ddd;
}
.fbtn-sm:hover { background:#555; color:white; }

/* ============================================================
   EBENE 1: TOOLBAR
============================================================ */
#toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  margin-bottom: 5px;
}
.toolbar-left { flex:1; }
.toolbar-right { display:flex; gap:5px; }

.tbtn {
  width: 32px; height: 32px;
  display:flex; align-items:center; justify-content:center;
  padding:5px;
}
.tbtn svg { width:18px; height:18px; color:#555; }
.tbtn:hover { background:#555; border-color:#555; }
.tbtn:hover svg { color:white !important; }

.upload-warning { border-color:#f44336 !important; animation: blink-border 1.5s infinite; }
.upload-warning svg { color:#f44336 !important; }
.upload-warning:hover svg { color:#f44336 !important; }
.upload-loaded { border-color:#ccc !important; animation:none !important; }
.upload-loaded svg { color:#555 !important; }
@keyframes blink-border { 0%,100%{ box-shadow:0 0 0 0 rgba(244,67,54,0); } 50%{ box-shadow:0 0 0 2px rgba(244,67,54,.18); } }

.upload-warning-text {
  font-size:11px; color:#c62828; font-weight:600;
}

/* ============================================================
   EBENE 2: FÄLLE
============================================================ */
#fallebene {
  background: white;
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
#fallTabs { display:flex; gap:12px; align-items:center; }
.fall-group { display:flex; align-items:center; gap:4px; flex:1; }
.fall-group-label {
  font-size:11px; font-weight:600; color:#888;
  white-space:nowrap;
}
.fall-tab-row { display:flex; gap:3px; flex:1; flex-wrap:wrap; }

.fall-tab {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fall-tab.active {
  background: #1976d2;
  border-color: #1976d2;
  color: white;
}
.fall-tab:hover:not(.active) { background:#e3f2fd; border-color:#90caf9; }

.fall-add-btn {
  width: 22px; height: 22px;
  font-size: 16px; line-height:1;
  border-radius: 4px;
  padding: 0;
  color: #888;
  flex-shrink:0;
}
.fall-add-btn:hover { background:#4caf50; border-color:#4caf50; color:white; }

/* ============================================================
   EBENE 3: TABS
============================================================ */
#tabNav {
  display:flex; gap:3px;
  background:white; border-radius:6px; padding:4px;
  margin-bottom:5px;
  box-shadow:0 1px 3px rgba(0,0,0,.1);
}
.tab-btn {
  flex:1; padding:6px 8px; font-size:12px; font-weight:500;
  color:#666; border:1px solid transparent; background:transparent;
  border-radius:4px; cursor:pointer; transition:all .15s;
}
.tab-btn:hover { background:#f5f5f5; border-color:transparent; color:#333; }
.tab-btn.active { background:#e3f2fd; border-color:#90caf9; color:#1565c0; }

/* ============================================================
   TAB CONTENT
============================================================ */
.tab-content { display:none; }
.tab-content.active { display:block; }

/* ============================================================
   DATEN-TAB GRUNDSTRUKTUR
============================================================ */
.daten-block {
  background: white;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Notizfeld */
.fall-notizen {
  width:100%; min-height:80px; max-height:300px;
  padding:6px 8px; border:1px solid #e0e0e0; border-radius:4px;
  font-size:12px; font-family:inherit; resize:vertical;
  background:#fafafa;
}
.fall-notizen:focus { outline:none; border-color:#90caf9; background:white; }

/* BC Bar */
.bc-bar {
  display:flex; align-items:center; gap:8px;
  margin-bottom:4px;
}
.bc-btn {
  display:flex; align-items:center; gap:5px;
  padding:4px 10px; font-size:11px; font-weight:600;
  border:1px solid #ccc; border-radius:5px;
  background:white; cursor:pointer;
}
.bc-btn svg { width:14px; height:14px; color:#555; }
.bc-btn:hover { background:#e3f2fd; border-color:#90caf9; }
.bc-status { font-size:11px; color:#4caf50; }

/* Layout-Zeilen */
.d-row { margin-bottom:4px; }
.d-row:last-child { margin-bottom:0; }

.d-2col { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.d-2col-contact-top { display:grid; grid-template-columns:1fr; gap:6px; }
.d-2col-name { display:grid; grid-template-columns:2fr 1fr; gap:6px; }
.d-2col-email { display:grid; grid-template-columns:2fr 1fr; gap:6px; }
.d-3col { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }

.d-cell { min-width:0; }

/* Feld + Buttons in einer Zeile */
.d-field-row {
  display:flex; align-items:center; gap:3px; width:100%;
}

/* Inputs */
.d-input {
  flex:1; min-width:0;
  padding: 4px 6px;
  border:1px solid #ddd; border-radius:4px;
  font-size:11px; font-family:inherit;
  background:white;
}
.d-input:focus { outline:none; border-color:#90caf9; }

.d-select {
  padding:3px 4px;
  font-size:11px;
  color:#222;
}
.d-select.placeholder { color:#aaa; }

/* Kundennr kompakt */
.d-input-knd { width:96px; flex:none; }

.date-input { font-size:11px; }

/* Anrede */
.anrede-select { max-width:92px; flex:0 0 92px; }
.betreff-input { width:100%; min-width:0; }
.bc-btn span { line-height:1; }
.bc-btn svg { width:14px; height:14px; color:#555; flex-shrink:0; }
.bc-secondary svg { width:15px; height:15px; }

/* ============================================================
   LIEFERUNGEN
============================================================ */
.lieferung-add-bar {
  margin-bottom:4px;
}
.lieferung-add-btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 10px; font-size:11px; font-weight:600;
  border:1px dashed #aaa; border-radius:5px;
  background:white; cursor:pointer; color:#555;
  width:100%; justify-content:center;
}
.lieferung-add-btn svg { width:13px; height:13px; }
.lieferung-add-btn:hover { background:#e8f5e9; border-color:#4caf50; color:#2e7d32; }

.lieferung-block {
  background:white; border-radius:6px;
  border:1px solid #e0e0e0;
  margin-bottom:4px;
  box-shadow:0 1px 2px rgba(0,0,0,.06);
  overflow:visible;
}
.lieferung-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:5px 8px;
  background:#f8f9fa;
  border-bottom:1px solid #eee;
  cursor:pointer;
  user-select:none;
  border-radius:6px 6px 0 0;
}
.lieferung-header.hidden { display:none; }
.lieferung-header-left { display:flex; align-items:center; gap:6px; font-size:11px; font-weight:600; color:#333; }
.lieferung-header .chevron { width:13px; height:13px; color:#999; transition:transform .2s; }
.lieferung-header.open .chevron { transform:rotate(180deg); }

/* Sendung + Retour in einer Zeile */
.sendung-row {
  display:grid; grid-template-columns:1fr 1fr; gap:6px;
  margin-bottom:4px;
}

.lieferung-del-btn {
  width:20px; height:20px; padding:2px;
  border-color:#ffcdd2; color:#e57373; font-size:12px;
  line-height:1; flex-shrink:0;
}
.lieferung-del-btn:hover { background:#ffebee; border-color:#f44336; color:#c62828; }

.lieferung-body { padding:7px 10px; display:none; }
.lieferung-body.open { display:block; }

/* Lieferant-Zeile */
.lief-row { margin-bottom:4px; }
.lief-row:last-child { margin-bottom:0; }

/* Zustelldatum + Fristen */
.datum-fristen-row {
  display:grid; grid-template-columns:1fr 1fr 1fr; gap:5px;
  margin-bottom:4px;
}
.frist-field {
  display:flex; flex-direction:column; gap:2px;
}
.frist-label { font-size:9px; color:#999; font-weight:500; }
.frist-value {
  padding:3px 5px; border:1px solid #ddd; border-radius:4px;
  font-size:11px; background:#f9f9f9; color:#555;
}
.frist-value.today { color:#c62828; font-weight:700; }
.frist-value.overdue { color:#e65100; font-weight:700; }

/* Artikel */
.artikel-list { margin-top:5px; }

.artikel-item-row {
  display:flex; align-items:center; gap:3px;
  margin-bottom:2px;
}
.artikel-idx {
  font-size:9px; color:#aaa; font-weight:700;
  width:12px; flex-shrink:0; text-align:center;
}

.art-input {
  padding:3px 5px; border:1px solid #ddd; border-radius:3px;
  font-size:11px; font-family:inherit; background:white;
}
.art-input:focus { outline:none; border-color:#90caf9; }
.art-nr  { width:90px; }
.art-gr  { width:60px; }
.art-pr  { width:55px; }
.art-men { width:35px; }
.art-bez { flex:1; min-width:80px; }
.art-ean { width:95px; }

.art-waehrung {
  width:42px; padding:3px 2px; border:1px solid #ddd; border-radius:3px;
  font-size:10px; font-family:inherit; background:white;
}

.artikel-del-btn {
  width:18px; height:18px; padding:1px; flex-shrink:0;
  border-color:#ffcdd2; color:#e57373; font-size:11px; line-height:1;
}
.artikel-del-btn:hover { background:#ffebee; border-color:#f44336; color:#c62828; }

.artikel-add-btn {
  display:inline-flex; align-items:center; gap:3px;
  padding:3px 8px; font-size:10px;
  border:1px dashed #bbb; border-radius:4px;
  background:white; cursor:pointer; color:#777;
  margin-top:3px;
}
.artikel-add-btn svg { width:10px; height:10px; }
.artikel-add-btn:hover { background:#e8f5e9; border-color:#4caf50; color:#2e7d32; }

/* Artikel – bez+ean über artikelnr-Zeile */
.bez-ean-row {
  display:flex; gap:3px; align-items:center; margin-bottom:3px;
}
/* Artikel – 2-Zeilen-Block */
.artikel-block {
  background:#f9f9f9; border-radius:4px;
  border:1px solid #eee; margin-bottom:4px; padding:4px 6px;
}
.artikel-block:last-of-type { margin-bottom:0; }

/* ============================================================
   AKKORDEON
============================================================ */
.akk-block { padding:0; overflow:hidden; }
.akk-header {
  display:flex; justify-content:space-between; align-items:center;
  padding:7px 10px; cursor:pointer; user-select:none;
  font-size:11px; font-weight:600; color:#555;
  background:#fafafa;
}
.akk-header:hover { background:#f0f7ff; }
.akk-header .chevron { width:13px; height:13px; color:#aaa; transition:transform .2s; }
.akk-header:not(.collapsed) .chevron { transform:rotate(180deg); }
.akk-body { padding:7px 10px; }

/* ============================================================
   SUCHEN TAB
============================================================ */
.cat-bar {
  display:flex; gap:5px; margin-bottom:8px;
  padding:6px 8px; background:white; border-radius:6px;
  box-shadow:0 1px 2px rgba(0,0,0,.08);
}
.cat-btn {
  width:36px; height:36px; padding:6px;
  display:flex; align-items:center; justify-content:center;
  border:1px solid #ddd;
}
.cat-btn svg { width:20px; height:20px; color:#888; }
.cat-btn.active svg { color:#2196f3; }
.cat-btn.other-disabled { opacity:.4; pointer-events:none; }

#fieldB {
  margin-bottom:6px; padding:10px 12px;
  background:#e8e8e8; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  min-height:40px; cursor:pointer; transition:background .2s;
}
#fieldB:hover { background:white; }
#searchPlaceholder { font-size:13px; color:#aaa; font-weight:500; }
#searchBox {
  width:100%; padding:6px 10px;
  border:1px solid #ccc; border-radius:4px; font-size:13px;
}

#fieldC { background:white; border-radius:6px; margin-bottom:6px; box-shadow:0 1px 2px rgba(0,0,0,.08); overflow:hidden; transition:max-height .3s; }
#fieldC.collapsed { max-height:0; margin-bottom:0; }
#fieldC.expanded { max-height:250px; }

.tb-list-header { padding:5px 10px; font-size:11px; color:#888; background:#f5f5f5; border-bottom:1px solid #eee; }
#tbList { min-height:250px; max-height:250px; overflow-y:auto; padding:6px; box-sizing:border-box; }
.tb-list-empty { padding:16px; text-align:center; color:#aaa; font-size:12px; }

.tb-item {
  padding:5px 10px; cursor:pointer; border-radius:4px;
  font-size:12px; display:grid; grid-template-columns:1.2em 1fr auto;
  align-items:center; gap:8px; min-height:28px;
}
.tb-item:hover { background:#f0f7ff; }
.tb-letter { font-weight:700; font-size:13px; color:#64b5f6; }
.tb-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fav-icon { width:18px; height:18px; cursor:pointer; color:#ddd; transition:color .15s; flex-shrink:0; }
.fav-icon:hover { color:#ff9999; }
.fav-icon.active { color:#ff9999; fill:#ff9999; }
.tb-item.favorite { background:#fff9f9; border-left:3px solid #ff9999; }

#fieldD { background:white; border-radius:6px; margin-bottom:6px; box-shadow:0 1px 2px rgba(0,0,0,.08); overflow:hidden; transition:max-height .3s; }
#fieldD.collapsed { max-height:0; margin-bottom:0; }
#fieldD.expanded { max-height:400px; }

#tbDisplay { height:280px; overflow-y:auto; padding:12px; }
#tbDisplay h3 { margin-bottom:8px; color:#1976d2; font-size:14px; }
#tbDisplay .tb-display-body { font-size:13px; line-height:1.5; }
#tbDisplay .tb-display-body p { margin:.4em 0 .8em; }
#tbDisplay .tb-display-body ul,#tbDisplay .tb-display-body ol { padding-left:1.4em; margin:.4em 0 .8em; }

.d-buttons { padding:8px 12px; display:flex; justify-content:space-between; align-items:center; border-top:1px solid #eee; gap:6px; }
.editor-btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 12px; font-size:12px; font-weight:500;
}
.editor-btn svg { width:16px; height:16px; color:#555; }
.editor-btn:hover { background:#555 !important; border-color:#555 !important; color:white; }
.editor-btn:hover svg { color:white; }
.nav-buttons { display:flex; gap:5px; }
.nav-btn { width:34px; height:34px; padding:0; display:flex; align-items:center; justify-content:center; }
.nav-btn svg { width:20px; height:20px; color:#555; }
.nav-btn:hover { background:#555 !important; border-color:#555 !important; }
.nav-btn:hover svg { color:white; }

.hinweis-block {
  background:#e8f4f8; border-left:3px solid #b8d4e0;
  padding:8px; margin:8px 0; border-radius:4px;
  color:#2c5f7a; font-size:12px;
}
.hinweis-block::before { content:"💡 "; }

/* ============================================================
   SCHREIBEN TAB
============================================================ */
#writeMiniTabs { display:flex; gap:3px; margin-bottom:6px; }
.mini-tab-btn {
  flex:1; padding:6px; font-size:12px; font-weight:500;
  color:#666; border:1px solid #ddd; background:white; border-radius:4px;
}
.mini-tab-btn:hover { background:#f5f5f5; }
.mini-tab-btn.active { background:#e3f2fd; border-color:#90caf9; color:#1565c0; }

#editorBox { background:white; border-radius:6px; padding:10px; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.toolbar { display:flex; gap:4px; margin-bottom:8px; flex-wrap:wrap; }
.toolbar button { padding:5px 8px; font-size:11px; min-width:28px; }
.toolbar button:hover { background:#555 !important; border-color:#555 !important; color:white; }

#notesInput, #wysiwygEditor {
  width:100%; min-height:110px; padding:8px; border:1px solid #ccc;
  border-radius:4px; font-size:13px; font-family:inherit; resize:vertical;
}
#wysiwygEditor { outline:none; white-space:pre-wrap; }

.translation-buttons { display:flex; gap:8px; margin:8px 0; }
.translation-buttons button { padding:6px 12px; font-size:12px; }
.translation-buttons button:hover { background:#555 !important; border-color:#555 !important; color:white; }

#notesOutput {
  width:100%; min-height:45px; padding:8px; border:1px solid #ccc;
  border-radius:4px; background:#fafafa; font-size:13px; font-family:inherit; resize:vertical;
}
.output-buttons { display:flex; gap:6px; margin-top:6px; justify-content:flex-end; }
.output-buttons button { padding:5px 8px; }
.output-buttons button:hover { background:#555 !important; border-color:#555 !important; color:white; }

.icon-btn {
  display:inline-flex; align-items:center; justify-content:center;
  padding:5px; min-width:28px; min-height:28px;
}
.icon-btn svg { width:16px; height:16px; color:#555; }
.icon-btn:hover svg { color:white; }

.placeholder-dropdown {
  position:absolute; background:white; border:1px solid #ccc; border-radius:4px;
  box-shadow:0 2px 8px rgba(0,0,0,.15); max-height:180px; overflow-y:auto; z-index:1000; min-width:160px;
}
.placeholder-item { padding:6px 10px; cursor:pointer; font-size:12px; font-family:monospace; }
.placeholder-item:hover, .placeholder-item.selected { background:#e8f4f8; }

/* ============================================================
   POPUPS
============================================================ */
.popup {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  background:white; padding:18px; border-radius:8px;
  box-shadow:0 4px 20px rgba(0,0,0,.25); z-index:9999;
  width:90%; max-width:380px;
}
.popup h3 { margin-bottom:12px; font-size:14px; }
.popup label { display:block; margin:8px 0 3px; font-size:12px; font-weight:500; }
.popup input[type=text] { width:100%; padding:6px 8px; border:1px solid #ccc; border-radius:4px; font-size:13px; }
.popup-buttons { margin-top:16px; display:flex; gap:8px; justify-content:flex-end; }
.popup-buttons button { padding:6px 14px; font-size:12px; }
.popup-buttons button:last-child { background:#555 !important; border-color:#555 !important; color:white; }

.set-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; font-size:12px; }
.set-row label { font-size:12px; font-weight:500; }
.set-row input[type=number] { padding:4px 6px; border:1px solid #ccc; border-radius:4px; font-size:12px; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width:500px) {
  .d-3col { grid-template-columns:1fr 1fr; }
  .datum-fristen-row { grid-template-columns:1fr 1fr; }
}


/* Settings v11 */
.settings-popup { max-width: 620px; max-height: 86vh; overflow: auto; }
.settings-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.settings-subtitle { font-size:11px; color:#666; margin-top:2px; }
.settings-tools { display:flex; gap:8px; }
.settings-mini-btn { padding:6px 10px; font-size:12px; }
.settings-accordion-wrap { display:flex; flex-direction:column; gap:10px; }
.settings-accordion { border:1px solid #ddd; border-radius:8px; background:#fafafa; }
.settings-accordion summary { cursor:pointer; list-style:none; padding:10px 12px; font-size:13px; font-weight:600; user-select:none; }
.settings-accordion summary::-webkit-details-marker { display:none; }
.settings-accordion summary::after { content:'▾'; float:right; color:#666; }
.settings-accordion:not([open]) summary::after { content:'▸'; }
.settings-panel { padding:0 12px 12px; }
.settings-stack { flex-direction:column; align-items:flex-start; }
.settings-textarea { width:100%; min-height:90px; font-size:11px; border:1px solid #ccc; border-radius:6px; padding:6px; resize:vertical; }
.settings-textarea-lg { min-height:130px; }
.settings-info, .settings-empty { font-size:11px; color:#666; }


/* v12 settings behavior */
.settings-popup {
  position: fixed;
  top: 16px;
  right: 16px;
  left: auto;
  transform: none;
  width: min(620px, calc(100vw - 32px));
  max-width: 620px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.settings-header { position: sticky; top: 0; background: #fff; padding-bottom: 8px; z-index: 1; }
.settings-subtitle { display:none; }
.settings-help-row {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border:1px solid #ddd; border-radius:8px; background:#fafafa; padding:10px 12px; margin-bottom:10px;
}
.settings-help-row label { margin:0; font-size:13px; font-weight:600; }
.settings-help-row input[type=checkbox] { margin:0; }


/* v14: feste Suche + Fälle-Modus + gespeicherte Fälle */
.cat-bar { display:flex; align-items:center; gap:10px; }
.cat-group { display:flex; align-items:center; gap:6px; }
.cases-btn {
  width:auto; min-width:72px; padding:0 12px;
  border-style:dashed;
}
#fieldB {
  justify-content:flex-start;
  cursor:default;
  background:white;
}
#fieldB:hover { background:white; }
#searchBox { display:block !important; }

#fieldC,
#fieldD { max-height:none; }
#fieldC.collapsed,
#fieldD.collapsed { max-height:none; margin-bottom:6px; }

.case-save-bar {
  display:flex; align-items:center; gap:8px;
  margin:0 0 10px;
}

.case-item {
  position:relative;
  padding:8px 10px;
  border-radius:6px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.case-item:hover { background:#f0f7ff; }
.case-item-top {
  font-size:12px; font-weight:600; color:#1f1f1f;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.case-item-meta,
.case-item-note,
.case-item-date {
  font-size:11px; color:#666;
}
.case-item-note {
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.case-item-date {
  color:#8a8a8a;
}


/* ===== v17 Case Slots / Archiv ===== */
#caseModeBar{display:flex;gap:6px;align-items:center;flex-wrap:wrap;}
.case-mode-btn{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:600;border:1px solid #d0d0d0;border-radius:6px;background:#fff;color:#444;}
.case-mode-btn svg{width:14px;height:14px;}
.case-mode-btn.active{background:#e3f2fd;border-color:#90caf9;color:#1565c0;}
.case-mode-btn.muted-active{background:#f5f5f5;border-color:#ddd;color:#777;opacity:.75;}
.archive-btn{margin-left:8px;}
#caseActionArea{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:6px;}
.case-pill{padding:4px 10px;border:1px solid #d7d7d7;border-radius:999px;background:#fff;font-size:11px;color:#666;}
.case-action-btn{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;font-size:11px;font-weight:600;border:1px solid #ccc;border-radius:5px;background:#fff;color:#444;}
.case-action-btn svg{width:14px;height:14px;}
.case-action-btn:hover{background:#f4f8ff;border-color:#90caf9;color:#1565c0;}
.case-action-btn.danger:hover{background:#fff1f0;border-color:#ef9a9a;color:#c62828;}
.case-action-select{width:auto;min-width:112px;flex:none;}
.hidden{display:none !important;}
.bc-bar{flex-wrap:wrap;}
.bc-bar .bc-btn.hidden{display:none !important;}
.bc-bar.import-active #bcUndoBtn,.bc-bar.import-active #bcResetBtn{display:inline-flex !important;}
#archiveMetaBar{display:none;gap:6px;align-items:center;margin-bottom:6px;}
#archiveMetaBar.active{display:flex;}
.cat-bar.archive-active .cat-group{opacity:.55;pointer-events:none;}
.cases-btn{margin-left:8px;border-style:solid;}
.archive-list-item{border-bottom:1px solid #eee;padding:7px 8px;cursor:pointer;}
.archive-list-item:hover{background:#fafafa;}
.archive-list-item.active{background:#eef5ff;}
.archive-row-top,.archive-row-bottom{display:flex;gap:8px;align-items:center;justify-content:space-between;}
.archive-main{display:flex;gap:6px;align-items:center;min-width:0;flex-wrap:wrap;}
.archive-chip{font-size:10px;padding:1px 6px;border-radius:999px;background:#f3f3f3;color:#666;border:1px solid #e0e0e0;}
.archive-chip.status-open{background:#eef8ee;color:#2e7d32;border-color:#c8e6c9;}
.archive-chip.status-closed{background:#f5f5f5;color:#666;border-color:#ddd;}
.archive-actions{display:flex;gap:4px;flex-shrink:0;}
.archive-mini-btn{padding:3px 8px;font-size:10px;border-radius:4px;}
.archive-secondary{color:#777;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:48%;}
.archive-title{font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:46%;}
.archive-note{color:#666;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:48%;}

.case-mode-btn.archive-open{background:#e3f2fd;border-color:#90caf9;color:#1565c0;}


.confirm-overlay{position:fixed;inset:0;background:rgba(17,24,39,.34);display:flex;align-items:center;justify-content:center;z-index:5000;}
.confirm-overlay.hidden{display:none;}
.confirm-dialog{width:min(420px,calc(100vw - 32px));background:#fff;border:1px solid #d8dde6;border-radius:16px;box-shadow:0 18px 44px rgba(15,23,42,.16);padding:18px;}
.confirm-title{font-weight:700;font-size:15px;margin-bottom:8px;color:#1f2937;}
.confirm-message{font-size:14px;line-height:1.45;color:#374151;margin-bottom:16px;}
.confirm-actions{display:flex;justify-content:flex-end;gap:10px;}

.cases-btn.active{background:#e3f2fd;border-color:#90caf9;color:#1565c0;}
.cases-btn.active:hover{background:#d8ecff;border-color:#64b5f6;color:#0d47a1;}


/* Archiv-Liste Kopfzeile */
#archiveMetaBar { display: none !important; }
.archive-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
.archive-count-label {
  font-weight: 600;
}
.archive-list-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: auto;
}
.archive-list-controls .d-select {
  min-width: 150px;
}
.archive-count-label {
  white-space: nowrap;
}
@media (max-width: 900px) {
  .archive-list-header {
    align-items: stretch;
  }
  .archive-list-controls {
    width: 100%;
  }
  .archive-list-controls .d-select {
    flex: 1 1 180px;
  }
}


/* v32 layout fixes */
.archive-list-header{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:nowrap !important;}
.archive-count-label{flex:0 0 auto;white-space:nowrap;}
.archive-list-controls{display:flex;align-items:center;gap:6px;flex:1 1 auto;justify-content:flex-end;flex-wrap:nowrap !important;min-width:0;}
.archive-list-controls .d-select{min-width:0;width:auto;flex:0 1 150px;max-width:170px;}
.archive-row-bottom{display:flex;align-items:center;gap:10px;justify-content:space-between;}
.archive-row-bottom > .archive-title,.archive-row-bottom > .archive-note{flex:1 1 0;min-width:0;max-width:none;}
.archive-note{text-align:left;}
@media (max-width: 900px){
  .archive-list-header{align-items:center !important;}
  .archive-list-controls{width:auto !important;}
  .archive-list-controls .d-select{flex:0 1 130px;}
}


/* v36 display action split */
.display-actions.hidden{display:none !important;}
.display-actions-archive .editor-btn{margin-right:auto;}
.archive-note{ text-align:left !important; }


/* v42 daten-tab layout */
#block-kunde .d-field-row { min-width:0; }
#block-kunde .d-input { min-width:0; }
@media (max-width:500px) {
  .d-2col-name, .d-2col-email { grid-template-columns:1fr; }
  .anrede-select { flex:0 0 84px; max-width:84px; }
}
