/* ═══════════════════════════════════════════════
   HOCHRUNTER OS — Legacy Bridge
   Kompatibilitäts-Aliase für alte Klassen-Namen.
   Ermöglicht schrittweise Migration ohne
   sofortige Änderungen in den Views.
   ═══════════════════════════════════════════════ */

/* ── Alte Farb-Aliase ────────────────────────── */
/* Diese Klassen erscheinen noch in einigen Views */
.text-ok   { color: var(--ok)   !important; }
.text-err  { color: var(--err)  !important; }
.text-warn { color: var(--warn) !important; }

/* ── Filter-Bar-Klassen (global) ─────────────── */
/* Wurden in orders.php durch Bootstrap-Utilities ersetzt,
   stehen aber ggf. noch in anderen Modulen */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-input {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  transition: border-color .15s;
}
.filter-input:focus {
  outline: none;
  border-color: var(--z-400);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}
.filter-select {
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  cursor: pointer;
}
.filter-reset {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all .1s;
  white-space: nowrap;
}
.filter-reset:hover { background: var(--z-100); color: var(--ink); }

/* ── Partner-Bank Klassen ─────────────────────── */
.prt-bank-name { display: block; font-size: 10px; color: var(--muted); margin-bottom: 1px; }
.prt-bank-iban { display: block; font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 600; color: var(--ink); letter-spacing: .04em; }
.prt-bank-bic  { display: block; font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted); }

/* ── Alte Responsive-Grid-Klassen ────────────── */
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.g2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }

@media (max-width: 850px) {
  .g3 { grid-template-columns: 1fr 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}

/* ── Age-Chip (Auftrags-Alter) ───────────────── */
.age-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  padding: 0 5px;
  height: 16px;
  border-radius: var(--r-full);
  white-space: nowrap;
  vertical-align: middle;
}
.age-chip.urgent { color: var(--err); background: var(--err-bg); border-color: var(--err-bd); }

/* ── Mono Number Emphasis ────────────────────── */
.num-em {
  font-family: 'Geist Mono', monospace;
  font-weight: 700;
  letter-spacing: -.03em;
}

/* ── Section Card Header ─────────────────────── */
.card-section-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--z-400);
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Count Badge ─────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--z-100);
  color: var(--z-700);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--z-200);
}

/* Form System 2026: responsive baseline for legacy and JS-generated forms */
body.app-shell {
  --hos-form-bg: #ffffff;
  --hos-form-border: #d9e0df;
  --hos-form-border-strong: #9fb0aa;
  --hos-form-focus: #1f7a4d;
  --hos-form-focus-ring: rgba(31, 122, 77, .14);
  --hos-form-muted-bg: #f6f8f7;
  --hos-form-text: #10201a;
  --hos-form-muted: #66736f;
}

body.app-shell form,
body.app-shell .modal-body,
body.app-shell .hos-modal {
  min-width: 0;
}

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

body.app-shell .form-grid,
body.app-shell .cm-grid,
body.app-shell .dispatch-form,
body.app-shell .anr-ot-grid,
body.app-shell .anr-direct-grid,
body.app-shell .customer-form-grid,
body.app-shell .partner-form-grid,
body.app-shell .settings-grid,
body.app-shell .invoice-form-grid,
body.app-shell .quote-form-grid,
body.app-shell .eo-billing-switch,
body.app-shell .ow2-work-notes-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 14px;
  min-width: 0;
}

body.app-shell .dispatch-field-wide,
body.app-shell .cm-field.span-2,
body.app-shell .cm-field-full,
body.app-shell .field-wide,
body.app-shell label[style*="grid-column:1/-1"],
body.app-shell label[style*="grid-column: 1 / -1"] {
  grid-column: 1 / -1;
}

body.app-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not(#hos-global-search-input):not(#ld-search-input):not(#customer-search),
body.app-shell select,
body.app-shell textarea,
body.app-shell .form-inp,
body.app-shell .cm-inp,
body.app-shell .inv-field,
body.app-shell .inv-inp,
body.app-shell .doc-select,
body.app-shell .doc-date,
body.app-shell .inline-status-select,
body.app-shell .filter-select,
body.app-shell .filter-chip-sel,
body.app-shell .aircall-search-input,
body.app-shell .anr-note-input,
body.app-shell .ord-cancel-select,
body.app-shell .ow2-status-manual-select,
body.app-shell .av-sel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--hos-form-border) !important;
  border-radius: 8px !important;
  background-color: var(--hos-form-bg) !important;
  color: var(--hos-form-text) !important;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.35;
  padding: 10px 12px !important;
  outline: none;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .02);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

body.app-shell textarea,
body.app-shell .anr-note-input {
  min-height: 96px;
  resize: vertical;
}

body.app-shell input::placeholder,
body.app-shell textarea::placeholder {
  color: #8a9692;
}

/* Suchfelder (#hos-global-search-input, #ld-search-input, #customer-search)
   sind aus der Formular-Chrome-Regel ausgenommen — sonst Border-in-Border
   in .hos-search. Weitere Sucheingaben: class hos-search + Reset unten. */
body.app-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not(#hos-global-search-input):not(#ld-search-input):not(#customer-search):focus,
body.app-shell select:focus,
body.app-shell textarea:focus,
body.app-shell .form-inp:focus,
body.app-shell .cm-inp:focus,
body.app-shell .inv-field:focus,
body.app-shell .inv-inp:focus {
  border-color: var(--hos-form-focus) !important;
  box-shadow: 0 0 0 3px var(--hos-form-focus-ring), 0 1px 2px rgba(15, 23, 42, .04) !important;
}

/* hos-search: komplett aus Formular-Chrome raus (sonst Border-in-Border) */
body.app-shell .hos-search input,
body.app-shell .hos-search input:focus {
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
  font-size: 12.5px !important;
  line-height: 1.3 !important;
  color: var(--product-ink, #0b0d0c) !important;
}
body.app-shell .hos-search input[type="search"]::-webkit-search-decoration,
body.app-shell .hos-search input[type="search"]::-webkit-search-cancel-button,
body.app-shell .hos-search input[type="search"]::-webkit-search-results-button,
body.app-shell .hos-search input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

body.app-shell input[readonly],
body.app-shell input:disabled,
body.app-shell select:disabled,
body.app-shell textarea:disabled {
  background-color: var(--hos-form-muted-bg) !important;
  color: var(--hos-form-muted) !important;
  cursor: not-allowed;
}

body.app-shell select,
body.app-shell select.form-inp,
body.app-shell .filter-select,
body.app-shell .filter-chip-sel,
body.app-shell .doc-select,
body.app-shell .inline-status-select,
body.app-shell .ord-cancel-select,
body.app-shell .ow2-status-manual-select,
body.app-shell .av-sel {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366736f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 16px !important;
  padding-right: 40px !important;
}

body.app-shell input[type="checkbox"],
body.app-shell input[type="radio"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--hos-form-focus);
}

body.app-shell .modal-footer,
body.app-shell .hos-modal-actions,
body.app-shell .cm-actions,
body.app-shell .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

body.app-shell .modal-footer > *,
body.app-shell .hos-modal-actions > *,
body.app-shell .cm-actions > *,
body.app-shell .form-actions > * {
  min-width: 0;
}

body.app-shell .hos-modal {
  width: min(100%, calc(100vw - 32px));
}

body.app-shell .modal-body {
  max-width: 100%;
}

body.app-shell table input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
body.app-shell table select,
body.app-shell table textarea {
  min-height: 40px;
  font-size: 13px;
}

body.app-shell .qb-item-row {
  min-width: 0;
}

body.app-shell .qb-item-row input,
body.app-shell .qb-item-row select {
  min-width: 0 !important;
}

@media (max-width: 900px) {
  body.app-shell .form-grid,
  body.app-shell .cm-grid,
  body.app-shell .dispatch-form,
  body.app-shell .anr-ot-grid,
  body.app-shell .anr-direct-grid,
  body.app-shell .customer-form-grid,
  body.app-shell .partner-form-grid,
  body.app-shell .settings-grid,
  body.app-shell .invoice-form-grid,
  body.app-shell .quote-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)) !important;
  }

  body.app-shell .table-responsive,
  body.app-shell .inv-items-wrap,
  body.app-shell .quote-items-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 720px) {
  body.app-shell .form-grid,
  body.app-shell .cm-grid,
  body.app-shell .dispatch-form,
  body.app-shell .anr-ot-grid,
  body.app-shell .anr-direct-grid,
  body.app-shell .customer-form-grid,
  body.app-shell .partner-form-grid,
  body.app-shell .settings-grid,
  body.app-shell .invoice-form-grid,
  body.app-shell .quote-form-grid,
  body.app-shell .eo-billing-switch,
  body.app-shell .ow2-work-notes-form {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  body.app-shell .hos-modal {
    width: min(100%, calc(100vw - 18px));
    max-height: calc(100dvh - 18px);
    border-radius: 12px;
  }

  body.app-shell .modal-body {
    padding: 16px !important;
  }

  body.app-shell .modal-footer {
    justify-content: stretch;
    padding: 12px 16px !important;
  }

  body.app-shell .modal-footer button,
  body.app-shell .modal-footer .btn,
  body.app-shell .modal-footer .btn-primary,
  body.app-shell .modal-footer .btn-secondary {
    flex: 1 1 180px;
    justify-content: center;
  }

  body.app-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
  body.app-shell select,
  body.app-shell textarea {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  body.app-shell .qb-item-row {
    grid-template-columns: 1fr 1fr !important;
  }

  body.app-shell .qb-item-row > :first-child,
  body.app-shell .qb-item-row > .qb-desc,
  body.app-shell .qb-item-row > button:last-child {
    grid-column: 1 / -1;
  }

  body.app-shell form[style*="display:flex"],
  body.app-shell form[style*="display: flex"] {
    flex-wrap: wrap;
  }
}

/* Navigation harmony: quiet premium accent, no color overlays.
   Deckungsgleich mit --product-primary (#0f766e) - vorher wich der
   Sidebar-Akzent (#2f6f58) vom Dashboard-Akzent ab, jetzt ein Wert. */
body.app-shell {
  --os-green: #0f766e;
  --os-green-strong: #0b625c;
  --os-green-soft: #e8f2f0;
  --os-green-faint: #f2f8f7;
  --os-green-line: rgba(15, 118, 110, .18);
  --os-nav-ink: #17231f;
  --os-nav-muted: #607069;
  --os-blue: var(--os-green);
  --os-blue-soft: var(--os-green-soft);
  --accent: var(--os-green);
  --accent-lt: var(--os-green-soft);
  --accent-md: rgba(15, 118, 110, .14);
  --brand: var(--os-green);
  --brand-dim: var(--os-green-soft);
  --brand-border: var(--os-green-line);
}

/* Nur Farb-/Schatten-Kosmetik - Layout (Grid/Position/Hoehe/Padding) kommt
   ausschliesslich aus 02-shell.css. */
body.app-shell .topbar {
  background: rgba(249, 250, 248, .94) !important;
  border-bottom: 1px solid rgba(23, 35, 31, .075) !important;
  box-shadow: none !important;
}

body.app-shell .topbar--scrolled {
  background: rgba(249, 250, 248, .97) !important;
  box-shadow: 0 1px 0 rgba(23, 35, 31, .06), 0 12px 34px rgba(23, 35, 31, .045) !important;
}

body.app-shell .sidebar {
  background: #fbfcfb !important;
  border-right-color: rgba(23, 35, 31, .075) !important;
}

body.app-shell .sidebar::before,
body.app-shell .topbar::before,
body.app-shell .topbar::after {
  display: none !important;
  content: none !important;
}

body.app-shell .sidebar-logo,
body.app-shell .sidebar-avatar,
body.app-shell .topbar-user-avatar {
  background: var(--os-nav-ink) !important;
  box-shadow: 0 10px 24px rgba(23, 35, 31, .12) !important;
}

body.app-shell .sidebar .nav-item:hover,
body.app-shell .sidebar .nav-item:not(.active):hover {
  background: var(--os-green-faint) !important;
  color: var(--os-green-strong) !important;
}

body.app-shell .sidebar .nav-item.active,
body.app-shell .sidebar:not(:hover) .nav-item.active,
body.app-shell .sidebar:hover .nav-item.active {
  background: var(--os-green-soft) !important;
  border-color: var(--os-green-line) !important;
  color: var(--os-green-strong) !important;
  box-shadow: inset 3px 0 0 var(--os-green), 0 1px 2px rgba(23, 35, 31, .035) !important;
}

body.app-shell .sidebar .nav-item.active::before {
  display: none !important;
  content: none !important;
}

body.app-shell .sidebar .nav-item.active .nav-icon,
body.app-shell .sidebar:hover .nav-item.active .nav-icon,
body.app-shell .sidebar:not(:hover) .nav-item.active .nav-icon {
  color: var(--os-green-strong) !important;
}

body.app-shell .nav-cb-badge {
  background: #edf4f0 !important;
  color: var(--os-green-strong) !important;
  border: 1px solid var(--os-green-line) !important;
}

body.app-shell .os-action--primary,
body.app-shell .os-btn-primary {
  background: var(--os-nav-ink) !important;
  border-color: var(--os-nav-ink) !important;
  color: #fff !important;
  box-shadow: 0 14px 30px rgba(23, 35, 31, .16) !important;
}

body.app-shell .os-action--primary:hover,
body.app-shell .os-btn-primary:hover {
  background: #0f1714 !important;
  border-color: #0f1714 !important;
  box-shadow: 0 16px 36px rgba(23, 35, 31, .20) !important;
}
