:root {
  --brand: #008c95;
  --brand-dark: #006f78;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #d9e2e7;
  --surface: #ffffff;
  --bg: #f4f7f8;
  --danger: #a83232;
  --warning: #b7791f;
  --ok: #287a4b;
}

.customer-website-link {
  color: var(--brand-dark);
  overflow-wrap: anywhere;
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.login-screen {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3f4;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(16, 34, 38, 0.16);
}

.login-card > img {
  display: block;
  width: min(240px, 75%);
  height: auto;
  object-fit: contain;
}

.login-card h1 {
  font-size: 26px;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-message.error {
  color: var(--danger);
  font-weight: 700;
}

.cloud-user-summary {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cloud-locked > .sidebar,
.cloud-locked > main {
  visibility: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  transition: grid-template-columns 0.18s ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  color: var(--brand-dark);
  background: #e5f4f5;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  height: 100vh;
  padding: 24px 18px;
  background: #102226;
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  transition: padding 0.18s ease;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.sidebar-toggle {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(0, 140, 149, 0.35);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-logo {
  width: 164px;
  height: auto;
  display: block;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #bed7dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  color: #d9eef0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.nav-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(0, 140, 149, 0.24);
  color: #fff;
}

body.sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}

.sidebar-collapsed .sidebar {
  padding: 18px 10px;
}

.sidebar-collapsed .sidebar-header {
  display: grid;
  justify-items: center;
}

.sidebar-collapsed .brand {
  margin-bottom: 8px;
}

.sidebar-collapsed .brand-logo {
  width: 52px;
}

.sidebar-collapsed .brand div,
.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  width: 100%;
}

.sidebar-collapsed nav {
  margin-top: 12px;
}

.sidebar-collapsed .nav-item {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px 4px;
  text-align: center;
}

.sidebar-collapsed .nav-icon {
  width: 23px;
  height: 23px;
}

.nav-item[data-view="teamchat"] {
  position: relative;
}

.chat-nav-unread {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.chat-nav-unread[hidden] {
  display: none;
}

.sidebar-collapsed .chat-nav-unread {
  position: absolute;
  top: 0;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  font-size: 10px;
}

main {
  min-width: 0;
}

.topbar {
  min-height: 96px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  display: grid;
  justify-items: start;
}

.topbar-brand-logo {
  display: block;
  width: auto;
  height: 14px;
  max-width: 112px;
  margin-bottom: 5px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

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

.view {
  display: none;
  padding: 28px 32px;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  padding: 18px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.kpi strong {
  font-size: 28px;
}

.content-grid,
.module-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.customer-workspace {
  display: grid;
  gap: 18px;
}

.customer-create-panel > .form-panel {
  max-width: none;
}

.customer-form-panel {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.customer-form-panel h2,
.customer-form-section-label {
  grid-column: 1 / -1;
}

.customer-form-section-label {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.customer-span-2 { grid-column: span 2; }
.customer-span-3 { grid-column: span 3; }
.customer-span-4 { grid-column: span 4; }
.customer-span-6 { grid-column: 1 / -1; }

.customer-form-panel textarea {
  min-height: 72px;
}

.customer-number-line {
  position: relative;
}

.customer-number-line > label {
  display: grid;
  gap: 6px;
}

.customer-number-line .customer-number-button {
  position: absolute;
  top: -2px;
  left: 104px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2d78ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-table th,
.customer-table td {
  padding: 8px 7px;
}

.customer-table th:nth-child(2),
.customer-table td:nth-child(2) {
  min-width: 230px;
}

.customer-table th:nth-child(3),
.customer-table td:nth-child(3) {
  min-width: 150px;
}

.customer-table th:nth-child(4),
.customer-table td:nth-child(4) {
  min-width: 150px;
}

.customer-table th:nth-child(7),
.customer-table td:nth-child(7) {
  min-width: 200px;
}

.receivables-kpis,
.aging-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.receivables-kpis article,
.aging-grid article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fcfc;
}

.receivables-kpis span,
.aging-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.receivables-kpis strong,
.aging-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.receivables-kpis small,
.aging-grid small {
  color: var(--muted);
}

.nested-panel {
  box-shadow: none;
  background: #fbfdfe;
}

.dunning-settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.compact-input {
  width: 120px;
  max-width: 100%;
}

.orders-workspace {
  display: grid;
  gap: 18px;
}

.order-entry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.purchase-entry-form {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.supplier-entry-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.supplier-entry-form > h2,
.supplier-entry-form > button[type="submit"],
.supplier-entry-form > .form-actions {
  grid-column: 1 / -1;
}

.supplier-entry-form > .form-actions,
#machine-form > .form-actions {
  gap: 10px;
}

.purchase-head-panel,
.purchase-position-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.order-head-panel,
.order-position-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.order-entry-form .order-head-panel {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: end;
}

.order-entry-form .order-head-panel > .panel-head,
.order-entry-form .order-head-panel h2,
.order-entry-form .order-head-panel .search-results,
.order-entry-form .order-head-panel .form-actions {
  grid-column: 1 / -1;
}

.order-entry-form .order-head-panel .calculation-preview {
  align-self: start;
}

.order-position-box {
  margin: 0;
}

.order-position-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(160px, .8fr);
  gap: 10px;
  align-items: start;
}

.order-position-grid .search-results,
.order-position-grid .calculation-preview,
.order-position-grid #order-item-mode,
.order-position-grid #order-manual-mode {
  grid-column: 1 / -1;
}

#order-manual-mode:not(.hidden-field) {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(160px, .8fr);
  gap: 10px;
  align-items: end;
}

.order-draft-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
}

.order-draft-panel table {
  min-width: 640px;
}

.draft-line-editor {
  display: grid;
  gap: 10px;
}

.draft-line-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

.draft-line-row:active {
  cursor: grabbing;
}

.draft-line-grid {
  display: grid;
  grid-template-columns: 70px 105px 120px minmax(220px, 1fr) auto 80px 105px 105px 72px 130px;
  gap: 8px;
  align-items: end;
}

.draft-line-grid textarea {
  min-height: 54px;
  resize: vertical;
}

.draft-line-actions {
  display: flex;
  justify-content: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  padding-bottom: 7px;
}

.lower-module {
  margin-top: 18px;
}

.customer-asset-create-only {
  max-width: 420px;
}

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

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.form-panel {
  align-self: start;
  display: grid;
  gap: 12px;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-shell {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-label-with-action {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-start;
}

.line-text-tools {
  display: flex;
  gap: 5px;
  justify-content: flex-start;
}

.rich-editor-icon-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  color: var(--brand-dark);
  cursor: pointer;
  display: inline-grid;
  font-size: 7px;
  font-weight: 900;
  grid-template-columns: 1fr;
  height: 15px;
  justify-items: center;
  line-height: 6px;
  padding: 0 3px;
  width: 16px;
}

.rich-editor-icon-button span:first-child {
  color: #b45309;
}

.rich-editor-icon-button span:last-child {
  color: #1d4ed8;
  text-decoration: underline;
}

.rich-editor-icon-button:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.12);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

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

input[readonly] {
  background: #edf7f8;
  color: var(--brand-dark);
  font-weight: 800;
}

.search {
  max-width: 280px;
}

.table-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.subhead {
  margin-top: 22px;
  margin-bottom: 12px;
}

.customer-detail-row > td {
  padding: 16px;
  background: #f4fbfc;
  border-top: 0;
}

.customer-detail-row .customer-file {
  max-width: 100%;
}

.customer-file {
  display: grid;
  gap: 14px;
}

.file-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.file-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-grid,
.document-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.order-head-summary {
  grid-template-columns: 1fr 1fr 1fr 1fr;
  align-items: stretch;
  gap: 6px;
}

.order-head-summary .detail-item {
  padding: 8px;
  align-content: start;
  gap: 4px;
}

.order-head-summary input:not([type="checkbox"]),
.order-head-summary select {
  padding: 6px 8px;
  min-height: 32px;
}

.order-head-summary .rich-inline-editor {
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  padding: 6px 8px;
}

.order-head-summary .payment-terms-toggle {
  margin: 2px 0 3px;
  font-size: 12px;
  gap: 6px;
}

.order-head-summary .payment-terms-toggle input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}

.document-view > .form-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.document-view > .form-actions .check-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.document-view > .form-actions .check-line input {
  width: auto;
  margin: 0;
}

.order-description-field {
  grid-column: span 2;
}

.order-closing-field {
  grid-column: span 1;
}

.order-payment-field {
  grid-column: span 1;
}

.payment-terms-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.payment-terms-toggle input {
  width: auto;
  margin: 0;
}

.order-closing-editor {
  min-height: 70px;
}

.closing-text-menu-button {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  font-size: 13px;
  letter-spacing: 1px;
}

.order-editor-address-line {
  max-width: 980px;
}

.order-head-summary input,
.order-head-summary select,
.order-head-summary textarea {
  width: 100%;
}

.order-head-summary textarea {
  min-height: 56px;
  resize: vertical;
}

.order-tax-field select {
  margin: 4px 0 7px;
}

.order-type-field select {
  margin-top: 6px;
  padding: 6px 8px;
}

.order-description-field .field-label-with-action {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.file-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 4px solid var(--brand);
  background: #eef8f9;
}

.customer-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.customer-attachment-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.customer-attachment-card img {
  width: 100%;
  height: 96px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.customer-attachment-card strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

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

.customer-attachment-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.document-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 23, 28, 0.48);
}

.document-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1100px, 96vw);
  height: min(860px, 92vh);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 48px rgba(10, 31, 37, 0.28);
}

.document-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fbfc;
}

.document-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  text-decoration: none;
}

.icon-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
}

.document-preview-content {
  min-height: 0;
  background: #eef3f5;
}

.document-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.document-preview-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
}

.service-material-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfc;
}

.service-scan-box,
.service-scan-files {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.service-scan-box h3,
.service-scan-files h3 {
  margin: 0;
}

.manual-service-machine {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfc;
}

.manual-service-machine h3 {
  margin: 0;
  font-size: 14px;
}

.service-material-box h3 {
  margin: 0;
}

.service-material-grid {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 10px;
  align-items: end;
}

.service-manual-material-grid {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.file-chip {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f8f9;
  color: var(--brand-dark);
  font-weight: 900;
}

.warning-note {
  border-left-color: var(--warning);
  background: #fff8e8;
}

.document-view {
  display: grid;
  gap: 8px;
}

.beleg-editor {
  display: grid;
  gap: 10px;
}

.beleg-editor-head,
.beleg-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.beleg-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
}

.beleg-editor-head h4 {
  margin: 0;
}

.beleg-editor-head-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.beleg-line {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
}

.beleg-line.line-kind-lot,
.draft-line-row.line-kind-lot {
  background: #dcfce7;
  border-color: #a7f3d0;
}

.beleg-line.line-kind-title,
.draft-line-row.line-kind-title {
  background: #fef9c3;
  border-color: #fde68a;
}

.beleg-line-grid {
  display: grid;
  grid-template-columns: 70px 110px 120px minmax(260px, 1.5fr) auto 80px 105px 130px 70px 105px;
  gap: 8px;
  align-items: end;
}

.beleg-line-grid label,
.order-insert-box label {
  min-width: 0;
}

.beleg-line-grid textarea {
  min-height: 58px;
  resize: vertical;
}

.beleg-line-actions {
  align-items: center;
  display: grid;
  gap: 5px;
  justify-items: start;
  padding-bottom: 7px;
}

.line-main-actions {
  display: flex;
  gap: 5px;
}

.icon-action {
  align-items: center;
  background: #e6f6f6;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--brand-dark);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  line-height: 1;
  min-width: 24px;
  padding: 0 6px;
}

.icon-action:hover,
.icon-action.active {
  background: var(--brand);
  color: #fff;
}

.icon-action.danger {
  background: #fde2e2;
  color: #9b1c1c;
}

.icon-action.danger:hover {
  background: #9b1c1c;
  color: #fff;
}

.material-note-button {
  font-family: Georgia, serif;
  font-size: 13px;
  font-style: italic;
  height: 22px;
  min-width: 22px;
  padding: 0;
  width: 22px;
}

.material-note-button.active {
  background: var(--brand-dark);
  color: #fff;
}

.line-text-tools .rich-editor-icon-button {
  font-size: 8px;
  height: 22px;
  line-height: 7px;
  width: 22px;
}

.photo-select-button {
  font-family: Arial, sans-serif;
  font-size: 12px;
  height: 22px;
  min-width: 22px;
  padding: 0;
}

.photo-selection-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 360px;
  overflow: auto;
}

.photo-choice {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  gap: 5px;
  padding: 8px;
}

.photo-choice:has(input:checked) {
  background: #e6f6f6;
  border-color: var(--brand);
}

.photo-choice input {
  justify-self: start;
  width: auto;
}

.photo-choice img {
  background: #fff;
  height: 160px;
  object-fit: contain;
  width: 100%;
}

.line-photo-dialog {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.line-format-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.line-format-tools select {
  max-width: 160px;
}

.text-format-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-format-toolbar button {
  min-width: 38px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 50;
}

#invite-password-modal {
  z-index: 100;
}

#invite-password-modal .order-copy-dialog {
  max-width: 520px;
}

#rich-text-modal {
  z-index: 70;
}

.rich-text-dialog {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
  max-width: 860px;
  padding: 18px;
  width: min(860px, calc(100vw - 40px));
}

.order-copy-dialog {
  display: grid;
  gap: 14px;
  width: min(720px, calc(100vw - 40px));
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

dialog.order-copy-dialog:not([open]) {
  display: none;
}

.text-template-dialog {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

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

.machine-edit-dialog {
  max-height: calc(100vh - 48px);
  overflow: auto;
  width: min(820px, calc(100vw - 40px));
}

.machine-edit-wide {
  grid-column: 1 / -1;
}

.text-template-list {
  display: grid;
  gap: 8px;
}

.text-template-standard-item {
  margin-bottom: 8px;
  border-color: #8acbd0;
  background: #f1fbfb;
}

.text-template-item {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.text-template-item p {
  margin: 6px 0 0;
  color: var(--muted);
  white-space: pre-wrap;
}

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

.text-template-editor {
  min-height: 120px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.dialog-head h3 {
  margin: 0 0 4px;
}

.order-copy-current {
  display: grid;
  gap: 8px;
}

.search-result.selected,
.selected-copy-customer {
  border-color: var(--brand);
  background: #eefafa;
}

.selected-copy-customer {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--brand);
  border-radius: 6px;
}

.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.rich-editor-toolbar button {
  background: #e6f6f6;
  border: 0;
  border-radius: 6px;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 10px;
}

.rich-editor-toolbar button.active {
  background: #263238;
  color: #fff;
}

.line-format-tools button.active,
.draft-line-actions button.active,
button.secondary.active {
  background: #263238;
  color: #fff;
}

[data-toggle-print-article-numbers] {
  border: 1px solid var(--line);
  font-size: 12px;
  padding: 7px 10px;
}

[data-toggle-print-article-numbers].active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.table-sort-button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.table-sort-button.active,
.table-sort-button:hover {
  color: var(--brand-dark);
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  background: #eef5f6;
  box-shadow: none;
  outline: none;
}

.table-filter-row th {
  padding: 4px 6px 6px;
  background: #fbfcfc;
}

.table-filter-input {
  width: 100%;
  min-width: 54px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.table-filter-input.is-active {
  background: #d5efed;
  border-color: #218d88;
  color: #125b58;
  font-weight: 700;
}

.table-filter-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.12);
  outline: none;
}

.empty-table-cell {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
}

.rich-text-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 220px;
  outline: none;
  padding: 12px;
}

.rich-inline-editor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.35;
  min-height: 58px;
  outline: none;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.rich-inline-editor:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 140, 149, 0.14);
}

.inline-color-teal {
  color: var(--brand);
}

.inline-color-black {
  color: var(--ink);
}

.inline-color-blue {
  color: #1d4ed8;
}

.inline-color-red {
  color: #b91c1c;
}

.inline-color-orange {
  color: #c2410c;
}

.inline-color-gray {
  color: #4b5563;
}

.inline-size-small {
  font-size: 0.88em;
}

.inline-size-large {
  font-size: 1.16em;
}

.line-bold {
  font-weight: 700;
}

.line-italic {
  font-style: italic;
}

.line-underline {
  text-decoration: underline;
}

.line-color-teal {
  color: var(--brand);
}

.line-color-blue {
  color: #1d4ed8;
}

.line-color-red {
  color: #b91c1c;
}

.line-color-orange {
  color: #c2410c;
}

.line-color-gray {
  color: #4b5563;
}

.italic-control {
  font-style: italic;
}

.underline-control {
  text-decoration: underline;
}

.wide-field {
  min-width: 220px;
}

.line-calculation {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.line-calculation:not([open]) {
  display: none;
}

.line-calculation summary {
  display: none;
}

.calculation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.note-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.customer-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.order-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}

.dashboard-actions {
  gap: 10px;
  margin-bottom: 18px;
}

.cloud-core-status {
  margin-bottom: 18px;
}

.cloud-core-status code {
  font-family: inherit;
  color: var(--muted);
}

.hidden-field {
  display: none;
}

.search-results {
  display: grid;
  gap: 6px;
}

.search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px;
  color: var(--ink);
  background: #f7fbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
  font-weight: 400;
}

.search-result:hover {
  color: var(--ink);
  background: #e5f4f5;
}

.search-result span,
.search-result small {
  color: var(--muted);
  font-size: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf2f4;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.warning {
  color: #7a4a00;
  background: #fff2d5;
}

.badge.danger {
  color: #7c1d1d;
  background: #fde2e2;
}

.badge.ok {
  color: #14532d;
  background: #dcfce7;
}

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

mark {
  padding: 1px 3px;
  border-radius: 4px;
  color: #102226;
  background: #b7edf0;
  font-weight: 800;
}

.note {
  display: inline-block;
  max-width: 260px;
  line-height: 1.35;
}

.article-cell {
  display: grid;
  grid-template-columns: 56px minmax(160px, 1fr);
  gap: 10px;
  align-items: start;
}

.article-photo,
.article-photo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #eef4f5;
}

.article-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  font-weight: 800;
}

.article-detail {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.article-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.article-files {
  display: grid;
  grid-template-columns: 80px repeat(2, minmax(180px, 1fr)) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}

.article-detail-photo {
  width: 80px;
  height: 80px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.multiline {
  white-space: pre-line;
  line-height: 1.35;
}

.price-stack {
  display: grid;
  gap: 3px;
  min-width: 130px;
}

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

.position-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

.calculation-preview,
.order-total {
  padding: 10px 12px;
  border-radius: 6px;
  background: #edf7f8;
  color: var(--brand-dark);
  font-weight: 800;
  line-height: 1.35;
}

.warehouse-correction-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #b8dfe2;
  border-radius: 6px;
  background: #f1fbfb;
}

.warehouse-correction-fields .calculation-preview {
  grid-column: 1 / -1;
  margin: 0;
}

#warehouse-analysis-table {
  overflow-x: auto;
}

.duplicate-check {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.duplicate-check.ok {
  border-color: #a7d9bd;
  background: #ecfdf3;
  color: #14532d;
  font-weight: 700;
}

.duplicate-check.warning {
  border-color: #f0c36a;
  background: #fff8e6;
  color: #7a4a00;
}

.duplicate-row {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.duplicate-row span {
  font-weight: 800;
}

.duplicate-row small {
  color: inherit;
}

.order-total {
  margin-top: 10px;
  text-align: right;
}

.billing-summary {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #edf7f8;
  color: var(--brand-dark);
  font-weight: 800;
}

.chat-list {
  display: grid;
  gap: 12px;
  align-content: start;
  height: clamp(300px, 46vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 12px 2px;
  scrollbar-gutter: stable;
}

.chat-list::-webkit-scrollbar {
  width: 10px;
}

.chat-list::-webkit-scrollbar-track {
  border-radius: 10px;
  background: #edf3f4;
}

.chat-list::-webkit-scrollbar-thumb {
  border: 2px solid #edf3f4;
  border-radius: 10px;
  background: #8ebfc3;
}

.chat-list::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

.customer-orders-table .customer-order-row-open > td {
  border-bottom-color: transparent;
  background: #edf7f8;
}

.customer-orders-table .customer-order-detail-row > td {
  padding: 0 10px 18px;
  border-bottom: 2px solid var(--brand);
  background: #edf7f8;
}

.customer-order-inline-detail {
  padding-top: 10px;
}

.customer-order-inline-detail .document-view {
  background: #fff;
}

.inline-order-close-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.team-chat-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.chat-conversation-panel,
.team-chat-panel {
  min-width: 0;
}

.chat-conversation-list,
.chat-conversation-group {
  display: grid;
  gap: 6px;
}

.chat-conversation-group + .chat-conversation-group {
  margin-top: 16px;
}

.chat-conversation-label {
  padding: 0 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-conversation-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 8px;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.chat-conversation-button:hover,
.chat-conversation-button.active {
  border-color: var(--line);
  background: #edf7f8;
}

.chat-conversation-button.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.chat-conversation-avatar {
  display: grid;
  place-items: center;
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chat-avatar-color, #008c95);
  color: #fff;
  font-weight: 900;
}

.chat-conversation-avatar.channel {
  border-radius: 8px;
  background: var(--brand);
}

.chat-conversation-copy {
  min-width: 0;
}

.chat-conversation-copy strong,
.chat-conversation-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.chat-conversation-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab5be;
}

.chat-conversation-status.online {
  background: #27ae60;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.13);
}

.chat-conversation-status.away {
  background: #d99716;
  box-shadow: 0 0 0 3px rgba(217, 151, 22, 0.15);
}

.chat-conversation-status.unknown {
  background: transparent;
  border: 1px solid #aab5be;
}

.team-presence-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 10px;
}

.team-presence-member {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  color: var(--ink);
  font: inherit;
  text-align: left;
  width: 100%;
}

.team-presence-member.can-chat {
  cursor: pointer;
}

.team-presence-member.can-chat:hover {
  border-color: var(--brand);
  background: #edf7f8;
}

.team-presence-avatar {
  display: grid;
  place-items: center;
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--team-avatar-color, #dceff1);
  color: #fff;
  font-weight: 900;
}

.team-presence-member.online .team-presence-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(44, 166, 111, 0.22);
}

.team-presence-member.away .team-presence-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(217, 151, 22, 0.22);
}

.team-presence-member.pending .team-presence-avatar {
  opacity: 0.7;
}

.team-presence-member.online .team-presence-avatar::after,
.team-presence-member.away .team-presence-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #27ae60;
}

.team-presence-member.away .team-presence-avatar::after {
  background: #d99716;
}

.team-presence-details {
  min-width: 0;
}

.team-presence-details strong,
.team-presence-details span,
.team-presence-details small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-presence-details span,
.team-presence-details small {
  color: var(--muted);
  font-size: 12px;
}

.team-presence-status {
  margin-top: 4px;
  font-weight: 800;
}

.team-presence-status.online {
  color: #147a43;
}

.team-presence-status.away {
  color: #966100;
}

.team-presence-status.pending {
  color: #966100;
}

.drop-zone {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 88px;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  color: var(--brand-dark);
  font-weight: 800;
  text-align: center;
}

.drop-zone span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.drop-zone.drag-over {
  border-color: var(--brand);
  background: #edf7f8;
}

.attachment-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.attachment-preview img {
  width: 64px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.chat-attachment-preview-list { display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px;width:100%; }
.chat-attachment-preview-item { display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:8px;align-items:center;min-width:0;padding:7px;border:1px solid var(--line);border-radius:8px;background:#f7fafb; }
.chat-attachment-preview-item .chat-photo-open { width:64px;height:52px;padding:0;overflow:hidden;border-radius:6px;background:#e5f3f4; }
.chat-attachment-preview-item .chat-photo-open img { width:100%;height:100%;object-fit:cover; }
.chat-attachment-preview-item > span { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px; }
.chat-document-attachment { display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:8px 10px;border:1px solid #b9d7da;border-radius:7px;color:var(--brand-dark);background:#eef8f8;font-weight:700;text-decoration:none;overflow-wrap:anywhere; }
.chat-message .chat-document-attachment { margin-top:6px; }

.chat-message {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

.chat-message.own {
  border-color: rgba(0, 140, 149, 0.45);
  background: #edf7f8;
}

.chat-message div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.chat-message p {
  margin: 0;
  line-height: 1.4;
}

.chat-message img,
.thumb {
  width: 96px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.chat-photo-open { display:inline-flex; padding:0; border:0; background:transparent; cursor:zoom-in; width:fit-content; max-width:100%; border-radius:6px; }
.chat-photo-open:hover { background:transparent; }
.chat-photo-open:focus-visible { outline:3px solid var(--primary, #008c95); outline-offset:3px; }
.chat-photo-open img { display:block; width:96px; height:72px; object-fit:cover; border-radius:6px; }

#chat-list > .chat-message { position:relative; margin-left:34px; margin-right:34px; max-width:calc(100% - 68px); }
.chat-reaction-trigger { position:absolute; top:12px; right:-32px; width:28px; height:28px; padding:0; border:1px solid var(--line); border-radius:50%; background:#fff; color:#5b7076; opacity:0; cursor:pointer; font-size:21px; line-height:1; }
.chat-message.own .chat-reaction-trigger { right:auto; left:-32px; }
.chat-message:hover .chat-reaction-trigger,.chat-message:focus-within .chat-reaction-trigger,.chat-reaction-trigger:focus-visible { opacity:1; }
.chat-message .chat-reactions { display:flex; justify-content:flex-start; flex-wrap:wrap; gap:5px; }
.chat-message .chat-reactions:empty { display:none; }
.chat-reaction-chip { display:inline-flex; align-items:center; gap:4px; min-height:28px; padding:2px 8px; border:1px solid #c9d9dc; border-radius:18px; background:#fff; color:#17313b; font-size:18px; }
.chat-reaction-chip.is-own { border-color:#008c95; background:#e2f4f4; box-shadow:0 0 0 1px #008c9533; }
.chat-reaction-chip span { color:#48626a; font-size:12px; }
.chat-reaction-picker { position:fixed; z-index:10000; display:grid; grid-template-columns:repeat(9,34px); gap:3px; width:max-content; max-width:calc(100vw - 16px); padding:7px; border:1px solid #d2dfe1; border-radius:24px; background:#fff; box-shadow:0 5px 24px #142f3d30; }
.chat-reaction-picker button { display:grid; place-items:center; width:34px; height:34px; padding:0; border:0; border-radius:50%; background:transparent; color:#17313b; font-size:25px; line-height:1; }
.chat-reaction-picker button:hover,.chat-reaction-picker button:focus-visible { background:#e3f3f4; transform:scale(1.12); }
.chat-reaction-picker [hidden] { display:none!important; }
#chat-reaction-status { font-size:13px; color:#9b4c1e; margin:4px 0; }
#chat-reaction-status:empty { display:none; }
@media(hover:none),(pointer:coarse) { .chat-reaction-trigger { opacity:.75; } }
@media(max-width:420px) { .chat-reaction-picker { grid-template-columns:repeat(6,34px); } }

.chat-composer {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-composer-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  align-items: start;
  gap: 10px;
}

.chat-text-field,
.chat-composer-meta label {
  display: grid;
  gap: 6px;
}

.chat-text-field textarea {
  min-height: 86px;
  resize: vertical;
}

.chat-composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.chat-composer-toolbar .text-format-toolbar {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfe;
}

.chat-emoji-picker {
  position: relative;
}

.chat-emoji-menu {
  display: grid;
  grid-template-columns: repeat(7, 38px);
  gap: 5px;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
}

.chat-emoji-menu.hidden-field {
  display: none;
}

.chat-emoji-menu button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 22px;
}

.chat-emoji-menu button:hover {
  background: #edf7f8;
  transform: scale(1.08);
}

.chat-file-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 6px;
  background: #e5f3f4;
  color: var(--brand-dark);
  font-weight: 800;
  cursor: pointer;
}

.chat-file-button input {
  max-width: 220px;
}

.chat-drop-zone {
  min-height: 58px;
  padding: 9px;
}

.chat-send-button {
  margin-left: auto;
  min-width: 190px;
}

.chat-send-status {
  min-height: 20px;
  color: #147a43;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.chat-send-status:empty {
  min-height: 0;
}

.chat-send-status.error {
  color: #b42318;
}

.task-media {
  width: min(260px, 100%);
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000;
}

.task-board-section {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.task-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f8;
}

.task-view-switch label {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  min-width: min(220px, 100%);
}

.task-view-switch select { min-height: 34px; max-width: 100%; }
.task-save-view-dialog { width: min(480px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 10px; }
.task-save-view-dialog::backdrop { background: #102a3266; }
.task-save-view-dialog label { display: grid; gap: 8px; }
#task-view-name-error { color: #a3212a; }

.task-list-status-group { margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.task-list-status-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
  background: #f4f7f8;
}
.task-list-status-group > summary::-webkit-details-marker { display: none; }
.task-list-status-group > summary::before { content: "▸"; color: var(--brand); font-size: 18px; }
.task-list-status-group[open] > summary::before { transform: rotate(90deg); }
.task-list-status-group > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.task-list-status-group > summary h3 { margin: 0; font-size: 14px; }
.task-group-count { color: #52616b; font-size: 13px; }
.task-group-table { overflow-x: auto; }
.task-group-table table { width: 100%; min-width: 1000px; table-layout: fixed; }
.task-group-table th:first-child { width: 30%; }
.task-group-table th:nth-child(2) { width: 13%; }
.task-group-table th:nth-child(7) { width: 13%; }
.task-group-table td { overflow-wrap: anywhere; }

.task-view-switch button {
  min-height: 34px;
}

.task-view-switch button.active {
  color: #fff;
  background: var(--brand);
}

.task-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-space-nav {
  display: grid;
  gap: 12px;
  padding: 10px;
  border-right: 1px solid var(--line);
}

.task-nav-personal {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.task-nav-personal > strong {
  padding: 5px 8px;
  color: var(--brand-dark);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-space-nav button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.task-space-nav button:hover,
.task-space-nav button.active {
  color: var(--brand-dark);
  background: #e5f4f5;
}

.task-space-nav button span {
  color: var(--muted);
  font-size: 12px;
}

.task-nav-space,
.task-nav-folder {
  display: grid;
  gap: 4px;
}

.task-nav-space > strong {
  padding: 5px 8px;
  font-size: 14px;
}

.task-nav-list {
  padding-left: 22px !important;
  font-size: 13px;
}

.task-view-content {
  min-width: 0;
}

.task-create-page {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.task-create-title input {
  min-height: 58px;
  padding: 8px 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 800;
}

.task-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
}

.task-participant-field {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.task-create-participants {
  grid-column: 1 / -1;
}

.task-participant-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-participant-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-person-chip {
  display: inline-flex;
  flex-direction: row;
  gap: 7px;
  align-items: center;
  width: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7f8;
  cursor: pointer;
}

.task-person-chip:has(input:checked) {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #e5f4f5;
}

.task-person-chip input {
  width: auto;
  margin: 0;
}

.task-person-chip span {
  font-size: 13px;
  font-weight: 700;
}

.task-list-title {
  display: grid;
  gap: 5px;
  min-width: 260px;
}

.task-list-title > span {
  color: var(--muted);
  font-size: 12px;
}

.task-list-title .badge {
  margin-right: 6px;
}

.task-complete-check {
  width: 19px;
  height: 19px;
  accent-color: var(--brand);
}

.task-due-date {
  white-space: nowrap;
}

.task-due-date.overdue {
  color: var(--danger);
  font-weight: 800;
}

.task-due-date.today {
  color: #9a6700;
  font-weight: 800;
}

.task-detail-editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: fixed;
  z-index: 1001;
  inset: 20px;
  max-width: 1500px;
  margin: auto;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fbfdfe;
  box-shadow: 0 22px 60px rgba(16, 34, 38, 0.3);
  overflow: hidden;
}

#task-detail:not(.open) {
  display: none;
}

.task-detail-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(16, 34, 38, 0.48);
}

.task-window-open {
  overflow: hidden;
}

.task-detail-window-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.task-detail-window-actions {
  display: flex;
  gap: 8px;
}

.task-detail-scroll {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 20px;
  overflow: auto;
}

.task-detail-breadcrumb {
  color: var(--muted);
  font-size: 13px;
}

.task-detail-title-row {
  align-items: center;
}

.task-detail-title {
  width: min(720px, 100%);
  padding: 4px 0;
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 800;
}

.task-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.task-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.task-detail-main,
.task-activity-panel,
.task-subtasks {
  display: grid;
  gap: 12px;
  align-content: start;
}

.task-activity-panel {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.task-activity-feed {
  display: grid;
  gap: 2px;
  max-height: 420px;
  overflow: auto;
}

.task-activity-item {
  display: grid;
  gap: 4px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.task-activity-item p {
  margin: 0;
}

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

.task-activity-item .thumb {
  width: 100%;
  height: 120px;
  margin-top: 5px;
  object-fit: cover;
}

.task-files-section {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.task-file-drop {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 94px;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 6px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.task-file-drop span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.task-file-drop input {
  width: min(520px, 100%);
  margin-top: 5px;
}

.task-file-drop.drag-over {
  border-color: var(--brand);
  background: #e8f7f7;
}

.task-file-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.task-file-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.task-file-card .thumb,
.task-file-card .task-media {
  width: 100%;
  height: 120px;
  max-height: 120px;
  object-fit: cover;
}

.task-file-card div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.task-file-card strong,
.task-document-link {
  overflow-wrap: anywhere;
  font-size: 13px;
}

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

.task-document-link {
  display: grid;
  place-items: center;
  min-height: 90px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--brand-dark);
  background: #f4f7f8;
  text-align: center;
  text-decoration: none;
}

.task-detail-chat {
  display: grid;
  gap: 9px;
  position: sticky;
  bottom: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: #fbfdfe;
}

.task-detail-chat textarea {
  min-height: 92px;
}

.task-mention-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.task-mention-row > span {
  color: var(--muted);
  font-size: 12px;
}

.task-mention-button {
  min-height: 28px;
  padding: 4px 8px;
  color: var(--brand-dark);
  background: #e5f4f5;
  font-size: 12px;
}

.task-chat-file input {
  margin-top: 5px;
}

.task-subtask-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.task-subtask-row {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.task-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.task-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.task-column.drag-over {
  border: 2px solid var(--brand);
  background: #e8f7f7;
}

.task-column-title {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-transform: uppercase;
}

.task-card {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: grab;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.45;
}

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

.task-status-picker {
  position: relative;
  width: max-content;
}

.task-status-picker summary {
  list-style: none;
}

.task-status-picker summary::-webkit-details-marker {
  display: none;
}

.task-status-button,
.task-status-option {
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.task-status-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 112px;
}

.task-status-chevron {
  font-size: 10px;
  transition: transform 0.15s ease;
}

.task-status-picker[open] .task-status-chevron {
  transform: rotate(180deg);
}

.task-status-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  gap: 10px;
  min-width: 245px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 34, 38, 0.18);
}

.task-status-search {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
}

.task-status-group {
  display: grid;
  gap: 3px;
}

.task-status-group + .task-status-group {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.task-status-group-label {
  padding: 2px 7px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-status-option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.task-status-option.hidden-field {
  display: none;
}

.task-status-option:hover {
  color: var(--ink);
  background: #f1f5f6;
  filter: none;
}

.task-status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  padding: 0;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

.task-status-dot.task-status-not-here,
.task-status-dot.task-status-not-started {
  color: #6b7280;
  background: transparent;
}

.task-status-dot.task-status-working {
  color: #2563eb;
  background: #2563eb;
}

.task-status-dot.task-status-missing {
  color: #dc2626;
  background: #dc2626;
}

.task-status-dot.task-status-complete {
  color: #16803c;
  background: #16803c;
}

.task-status-check {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  text-align: right;
}

.task-status-not-here {
  color: #fff;
  background: #4b5563;
}

.task-status-not-started {
  color: #374151;
  background: #e5e7eb;
}

.task-status-working {
  color: #fff;
  background: #2563eb;
}

.task-status-missing {
  color: #fff;
  background: #dc2626;
}

.task-status-complete {
  color: #fff;
  background: #16803c;
}

.task-status-option:hover,
.task-status-button:hover {
  filter: brightness(0.92);
}

.mini-button {
  padding: 6px 9px;
  color: var(--danger);
  background: #fde2e2;
  font-size: 12px;
}

.mini-button:hover {
  color: #fff;
  background: var(--danger);
}

.mini-action {
  padding: 6px 9px;
  color: var(--brand-dark);
  background: #e5f4f5;
  font-size: 12px;
}

.mini-action:hover {
  color: #fff;
  background: var(--brand-dark);
}

.report-panel {
  max-width: 980px;
  margin: 0 auto;
}

.service-report {
  display: grid;
  gap: 18px;
  color: #111827;
}

.report-brand {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--brand);
}

.report-brand span {
  display: block;
}

.report-logo {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 6px;
}

.report-brand span {
  color: var(--brand-dark);
  font-weight: 800;
}

.report-grid,
.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.service-report textarea {
  min-height: 110px;
}

.field-material-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.field-material-block h3,
.field-material-block p {
  margin: 0;
}

.field-material-block p {
  color: var(--muted);
  font-size: 12px;
}

.field-material-lines {
  display: grid;
  grid-template-columns: 40px 70px 1fr 1fr;
  border-top: 1px solid #111827;
  border-left: 1px solid #111827;
  font-size: 12px;
}

.field-material-lines span {
  min-height: 28px;
  padding: 5px;
  border-right: 1px solid #111827;
  border-bottom: 1px solid #111827;
}

.field-material-lines span:nth-child(-n + 4) {
  min-height: auto;
  font-weight: 800;
  background: #f3f4f6;
}

.signature-grid input {
  min-height: 54px;
}

@media print {
  body {
    display: block;
    background: #fff;
  }

  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .view {
    display: none !important;
    padding: 0;
  }

  #service-report {
    display: block !important;
  }

  .panel,
  .report-panel {
    border: 0;
    padding: 0;
    margin: 0;
  }

  input,
  textarea {
    border: 1px solid #9ca3af;
  }
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

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

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

.import-panel p {
  max-width: 780px;
  color: var(--muted);
  line-height: 1.5;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.import-grid div {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
}

@media (max-width: 1100px) {
  .task-detail-editor {
    inset: 10px;
  }

  .task-create-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .task-detail-meta {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .task-detail-body {
    grid-template-columns: 1fr;
  }

  .task-activity-panel {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

  .supplier-entry-form,
  .customer-form-panel,
  .form-grid.two,
  .detail-grid,
  .document-summary,
  .customer-edit-grid,
  .article-detail-grid,
  .article-files,
  .customer-attachment-upload,
  .service-material-grid,
  .service-manual-material-grid,
  .beleg-line-grid,
  .draft-line-grid,
  .calculation-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .customer-span-3,
  .customer-span-4,
  .customer-span-6 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .order-head-summary .detail-item {
    grid-column: 1 / -1;
  }
  .task-create-grid {
    grid-template-columns: 1fr;
  }

  .task-workspace {
    grid-template-columns: 1fr;
  }

  .task-space-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .supplier-entry-form,
  .customer-form-panel,
  .form-grid.two,
  .detail-grid,
  .document-summary,
  .note-editor,
  .customer-edit-grid,
  .article-detail-grid,
  .article-files,
  .customer-attachment-upload,
  .service-material-grid,
  .service-manual-material-grid,
  .beleg-line-grid,
  .draft-line-grid,
  .calculation-grid {
    grid-template-columns: 1fr;
  }

  .customer-span-2,
  .customer-span-3,
  .customer-span-4,
  .customer-span-6 {
    grid-column: 1 / -1;
  }
}

.import-grid span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.order-split-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.order-editor-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 16px;
}

#orders:not(.order-create-mode) .order-entry-form {
  display: none;
}

#orders.order-create-mode #order-editor-panel {
  display: none;
}

#orders.order-editor-mode .order-entry-form,
#orders.order-editor-mode .orders-workspace > .panel > .panel-head,
#orders.order-editor-mode #orders-table {
  display: none !important;
}

#orders.order-editor-mode:not(.order-split-mode) #order-split-panel,
#orders.order-split-mode #order-editor-panel,
#orders.order-split-mode #order-pagination {
  display: none !important;
}

#orders.order-split-mode #order-split-panel {
  display: block !important;
}

.quick-insert-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.order-insert-box .quick-insert-tools,
.order-position-box .quick-insert-tools {
  gap: 5px;
  margin-bottom: 8px;
}

.order-insert-box .quick-insert-tools button,
.order-position-box .quick-insert-tools button {
  font-size: 12px;
  padding: 5px 8px;
}

.order-position-box.insert-kind-title #order-item-mode,
.order-position-box.insert-kind-title #order-item-preview,
.order-position-box.insert-kind-title .order-quantity-field,
.order-position-box.insert-kind-title .order-price-field,
.order-position-box.insert-kind-title .order-discount-field,
.order-position-box.insert-kind-title .order-manual-price-field,
.order-position-box.insert-kind-lot #order-item-mode,
.order-position-box.insert-kind-lot #order-item-preview,
.order-position-box.insert-kind-lot .order-quantity-field,
.order-position-box.insert-kind-lot .order-price-field,
.order-position-box.insert-kind-lot .order-discount-field,
.order-position-box.insert-kind-lot .order-manual-price-field,
.order-position-box.insert-kind-text #order-item-mode,
.order-position-box.insert-kind-text #order-item-preview,
.order-position-box.insert-kind-text .order-quantity-field,
.order-position-box.insert-kind-text .order-price-field,
.order-position-box.insert-kind-text .order-discount-field,
.order-position-box.insert-kind-text .order-manual-price-field,
.order-position-box.insert-kind-subtotal #order-item-mode,
.order-position-box.insert-kind-subtotal #order-item-preview,
.order-position-box.insert-kind-subtotal .order-quantity-field,
.order-position-box.insert-kind-subtotal .order-price-field,
.order-position-box.insert-kind-subtotal .order-discount-field,
.order-position-box.insert-kind-subtotal .order-manual-price-field,
.order-position-box.insert-kind-surcharge #order-item-mode,
.order-position-box.insert-kind-surcharge #order-item-preview,
.order-position-box.insert-kind-surcharge .order-quantity-field,
.order-position-box.insert-kind-surcharge .order-price-field,
.order-position-box.insert-kind-surcharge .order-manual-price-field,
.order-position-box.insert-kind-discount #order-item-mode,
.order-position-box.insert-kind-discount #order-item-preview,
.order-position-box.insert-kind-discount .order-quantity-field,
.order-position-box.insert-kind-discount .order-price-field,
.order-position-box.insert-kind-discount .order-manual-price-field {
  display: none;
}

.order-insert-box {
  border-color: var(--brand);
  display: block;
  margin: 10px 0;
  padding: 9px 10px;
}

.order-insert-box h3 {
  margin: 0 0 6px;
}

.order-insert-box > .calculation-preview {
  margin-bottom: 6px;
  padding: 7px 10px;
}

.order-insert-box .quick-insert-tools {
  margin-bottom: 7px;
}

.order-insert-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  gap: 10px 12px;
  align-items: start;
}

.order-insert-main,
.order-insert-side {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.order-insert-box .inline-fields {
  align-content: start;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.order-insert-box h3,
.order-insert-box > .calculation-preview,
.quick-insert-tools,
.insert-actions {
  grid-column: 1 / -1;
}

.order-insert-box > label:first-of-type,
.order-insert-box > .search-results,
.order-insert-box > #customer-order-item-preview,
.order-insert-box > label:has(#customer-order-line-kind),
.order-insert-box .insert-text-field {
  grid-column: 1;
}

.order-insert-box > label:has(#customer-order-manual-photo) {
  grid-column: 2;
}

.order-position-grid {
  grid-auto-flow: row dense;
}

.order-position-grid > #order-item-mode,
.order-position-grid > #order-item-preview,
.order-position-grid > label:has(#order-line-kind) {
  grid-column: 1;
}

.order-position-grid > .order-discount-field,
.order-position-grid > .inline-fields {
  grid-column: 2;
}

.order-position-grid > #order-price-preview {
  grid-column: 1 / -1;
}

.order-insert-box textarea {
  min-height: 42px;
}

.order-insert-box input,
.order-insert-box select,
.order-insert-box textarea {
  padding-top: 7px;
  padding-bottom: 7px;
}

.order-insert-box .insert-actions {
  margin-top: 7px;
}

@media (max-width: 900px) {
  .order-insert-body {
    grid-template-columns: 1fr;
  }
}

.insert-kind-lot #customer-order-item-search,
.insert-kind-lot #customer-order-item-results,
.insert-kind-lot #customer-order-item-preview,
.insert-kind-lot .inline-fields,
.insert-kind-title #customer-order-item-search,
.insert-kind-title #customer-order-item-results,
.insert-kind-title #customer-order-item-preview,
.insert-kind-title .inline-fields,
.insert-kind-text #customer-order-item-search,
.insert-kind-text #customer-order-item-results,
.insert-kind-text #customer-order-item-preview,
.insert-kind-text .inline-fields,
.insert-kind-subtotal #customer-order-item-search,
.insert-kind-subtotal #customer-order-item-results,
.insert-kind-subtotal #customer-order-item-preview,
.insert-kind-subtotal .insert-text-field,
.insert-kind-subtotal .inline-fields,
.insert-kind-surcharge #customer-order-item-search,
.insert-kind-surcharge #customer-order-item-results,
.insert-kind-surcharge #customer-order-item-preview,
.insert-kind-surcharge .insert-quantity-field,
.insert-kind-surcharge .insert-price-field,
.insert-kind-surcharge .insert-text-field,
.insert-kind-discount #customer-order-item-search,
.insert-kind-discount #customer-order-item-results,
.insert-kind-discount #customer-order-item-preview,
.insert-kind-discount .insert-quantity-field,
.insert-kind-discount .insert-price-field,
.insert-kind-discount .insert-text-field {
  display: none;
}

.insert-kind-surcharge .inline-fields,
.insert-kind-discount .inline-fields {
  grid-template-columns: repeat(2, minmax(160px, 240px));
}

.insert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-top: 8px;
}

.beleg-line[draggable="true"] {
  cursor: grab;
}

.beleg-line.dragging {
  opacity: 0.55;
}

.beleg-line.drag-target {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 150, 150, 0.14);
}

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

.split-selection-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.split-selection-tools .muted {
  margin-right: auto;
}

.split-document {
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.split-document > label {
  display: grid;
  gap: 7px;
}

.split-document > label input,
.split-document > label select {
  width: 100%;
}

.split-search-status {
  min-height: 18px;
  padding: 5px 1px 0;
}

.split-line-list {
  max-height: 68vh;
  overflow: auto;
  padding-right: 3px;
}

.split-document-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 8px 0 10px;
  padding-bottom: 10px;
  gap: 12px;
}

.split-document-head span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.split-total {
  background: #e6f6f6;
  border-radius: 6px;
  color: var(--teal-dark);
  font-weight: 800;
  padding: 8px 10px;
  white-space: nowrap;
}

.split-line-list {
  display: grid;
  gap: 8px;
}

.split-select-all { display:flex; align-items:center; gap:8px; margin:8px 0; font-size:12px; font-weight:600; }
.split-select-all input { width:auto; }

.split-line-row {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
  display: grid;
  gap: 10px;
  grid-template-columns: 24px 82px minmax(0, 1fr) 150px;
  padding: 10px;
}

.split-line-row.structure {
  background: #fffbe8;
}

.split-line-row.selected {
  background: #e6f6f6;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 150, 150, 0.12);
}

.split-line-select {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.split-line-pos {
  color: var(--teal-dark);
  font-weight: 800;
  white-space: nowrap;
}

.split-line-main {
  min-width: 0;
}

.split-line-main strong,
.split-line-main span {
  display: block;
}

.split-line-main span {
  color: var(--text);
  line-height: 1.35;
  margin-top: 3px;
}

.split-line-values {
  text-align: right;
}

.split-line-values span,
.split-line-values strong {
  display: block;
}

.split-line-values span {
  color: var(--muted);
  font-size: 13px;
}

.split-drop-zone.is-drag-over {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(0, 150, 150, 0.16);
}

.split-line-row.split-insert-before { box-shadow: inset 0 4px 0 var(--brand); }
.split-line-row.split-insert-after { box-shadow: inset 0 -4px 0 var(--brand); }

@media (max-width: 980px) {
  body,
  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .sidebar-collapsed .sidebar {
    padding: 12px 18px;
  }

  .sidebar-collapsed .sidebar-header {
    display: flex;
    align-items: center;
  }

  .sidebar-collapsed .brand {
    margin: 0;
  }

  .sidebar-collapsed .brand-logo {
    width: 142px;
  }

  .sidebar-collapsed .sidebar-toggle {
    width: 42px;
  }

  .sidebar-collapsed nav {
    display: none;
  }

  nav {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
  }

  .topbar,
  .module-layout,
  .order-entry-form,
  .purchase-entry-form,
  .order-split-grid,
  .content-grid,
  .team-chat-workspace {
    grid-template-columns: 1fr;
  }

  .team-presence-list {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .chat-conversation-list {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 14px;
  }

  .chat-conversation-group + .chat-conversation-group {
    margin-top: 0;
  }

  .kpi-grid,
  .import-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .view {
    padding: 20px;
  }

  nav,
  .kpi-grid,
  .import-grid,
  .team-presence-list {
    grid-template-columns: 1fr;
  }

  .panel {
    overflow-x: auto;
  }

  .chat-conversation-list,
  .chat-composer-meta {
    grid-template-columns: 1fr;
  }

  .chat-composer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-emoji-menu {
    grid-template-columns: repeat(5, 38px);
  }

  .chat-send-button {
    margin-left: 0;
    width: 100%;
  }

  .chat-list {
    height: 42vh;
    min-height: 260px;
  }
}

/* Werkstattrolle: sensible Verwaltungs- und Preisfunktionen bleiben unsichtbar. */
.role-hidden,
body.role-workshop #seed-data,
body.role-workshop #clear-data,
body.role-workshop #show-customer-create,
body.role-workshop #customer-create-panel,
body.role-workshop .customer-asset-create-only,
body.role-workshop #inventory-form,
body.role-workshop #show-order-create,
body.role-workshop #open-order-split,
body.role-workshop #order-split-panel,
body.role-workshop #order-create-form,
body.role-workshop [data-create-order-copy],
body.role-workshop [data-toggle-order-calculations],
body.role-workshop [data-toggle-section-summary],
body.role-workshop [data-toggle-print-article-numbers],
body.role-workshop [data-lock-order],
body.role-workshop [data-unlock-order],
body.role-workshop [data-save-inventory-detail],
body.role-workshop [data-create-service-invoice] {
  display: none !important;
}

body.role-workshop #inventory .module-layout {
  grid-template-columns: minmax(0, 1fr);
}
.vat-id-check-field {
  display: grid;
  gap: 6px;
  align-self: stretch;
}

.vat-id-check-field label {
  display: grid;
  gap: 6px;
}

.vat-id-check-field .mini-action {
  justify-self: start;
}

/* Subtotal mode is only needed when inserting or editing a subtotal. */
.order-position-box:not(.insert-kind-subtotal) .order-subtotal-scope-field,
.order-insert-box:not(.insert-kind-subtotal) .insert-subtotal-scope-field {
  display: none;
}
.subtotal-scope-field {
  grid-column: span 3;
}
.line-kind-subtotal .structure-sum-field {
  grid-column: span 2;
}
@media (max-width: 600px) {
  .subtotal-scope-field, .line-kind-subtotal .structure-sum-field { grid-column: 1 / -1; }
}

.cloud-load-notice {
  margin: 16px 32px 0;
  padding: 12px 16px;
  border: 1px solid #e5cd92;
  border-radius: 6px;
  background: #fff8e6;
  color: #69521c;
}

/* Shift-drag copies a position; the line marks its insertion point. */
.beleg-line.position-copy-before, .draft-line-row.position-copy-before {
  box-shadow: 0 -3px 0 var(--brand);
}
.beleg-line.position-copy-after, .draft-line-row.position-copy-after {
  box-shadow: 0 3px 0 var(--brand);
}

/* Artikelrecherche, Lagerjournal und mobile Leseansicht */
.article-history-dialog { width: min(1200px, 96vw); max-height: 92vh; overflow: auto; }
.history-table-scroll { overflow-x: auto; }
.warehouse-history-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 14px 0; }
.warehouse-history-controls label { min-width: 150px; flex: 1; }
.warehouse-history-controls p { width: 100%; margin: 4px 0; }
.mobile-read-only-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mobile-read-only-switch input { width: auto; }
.chat-message audio, .attachment-preview audio { max-width: 100%; width: 320px; }
.chat-document-link { margin: 4px 4px 4px 0; }
.chat-incoming-popup { position: fixed; inset: 20px 20px auto auto; margin: 0; z-index: 2147483647; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 20px; color: var(--ink); border: 1px solid var(--line); border-top: 5px solid var(--brand); border-radius: 12px; background: #fff; box-shadow: 0 16px 50px #10222655; text-align: left; }
.chat-incoming-popup button { margin: 0; }
.chat-alert-eyebrow { color: var(--brand-dark); font-size: 11px; letter-spacing: .06em; font-weight: 800; margin-bottom: 12px; }
.chat-alert-heading { display: flex; gap: 12px; align-items: start; }
.chat-alert-icon { font-size: 26px; line-height: 1; color: var(--brand); }
.chat-alert-heading strong { display: block; font-size: 17px; line-height: 1.3; }
.chat-alert-heading small { display: block; color: var(--muted); margin-top: 4px; }
.chat-incoming-popup p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; margin: 16px 0; }
.chat-alert-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-incoming-popup [data-chat-alert-note]:empty { display: none; }
.chat-incoming-popup [data-chat-alert-note] { color: var(--muted); font-size: 12px; }
body.mobile-read-only #customer-create-panel,
body.mobile-read-only #inventory-form,
body.mobile-read-only #warehouse-form,
body.mobile-read-only #machine-form,
body.mobile-read-only #service-form,
body.mobile-read-only #warranty-claim-form,
body.mobile-read-only #order-create-form,
body.mobile-read-only #order-split-panel,
body.mobile-read-only #show-customer-create,
body.mobile-read-only #show-machine-create,
body.mobile-read-only #show-order-create,
body.mobile-read-only #open-order-split,
body.mobile-read-only [data-save-inventory-detail],
body.mobile-read-only [data-save-customer-detail],
body.mobile-read-only [data-rich-editor-target]:not(#chat-form [data-rich-editor-target]):not(#task-form [data-rich-editor-target]),
body.mobile-read-only #seed-data,
body.mobile-read-only #clear-data,
body.mobile-read-only #test-cloud-write { display: none !important; }
body.mobile-read-only #inventory .module-layout,
body.mobile-read-only #warehouse .module-layout,
body.mobile-read-only #service .module-layout { grid-template-columns: minmax(0, 1fr); }
body.mobile-read-only .mobile-read-only-switch { color: var(--brand-dark); font-weight: 700; }
@media (max-width: 700px) {
  .chat-layout, .chat-workspace, .task-workspace { display: flex; flex-direction: column; min-width: 0; }
  .chat-conversation-list { max-height: 180px; overflow-y: auto; }
  .chat-composer-meta { grid-template-columns: 1fr; }
  .chat-composer-toolbar { gap: 8px; flex-wrap: wrap; }
  .chat-composer-toolbar button { min-height: 42px; }
  .chat-composer-meta label:last-child { display: none; }
  .article-history-dialog { padding: 14px; }
  .warehouse-history-controls label { flex-basis: 44%; min-width: 120px; }
  .chat-incoming-popup { inset: max(12px, env(safe-area-inset-top)) 12px auto auto; width: calc(100vw - 24px); max-height: calc(100dvh - 32px); padding: 16px; }
  .mobile-read-only-switch { width: 100%; }
}
@media (max-width: 980px) {
  .sidebar { position: relative; height: auto; max-width: 100%; }
  main { min-width: 0; }
}
@media (max-width: 700px) {
  .team-chat-workspace, .chat-panel, .chat-composer, .chat-message-list { min-width: 0; max-width: 100%; }
  .chat-conversation-list, .team-presence-list { grid-template-columns: 1fr; min-width: 0; }
}

.inventory-delete-button { background: #a62d37; color: #fff; }
.inventory-delete-button:hover { background: #85232c; }
body.mobile-read-only [data-delete-inventory-detail] { display: none !important; }

/* Breite Materialliste; Anlageformular wird nur auf Wunsch geöffnet. */
#inventory > .module-layout { grid-template-columns: minmax(0, 1fr); }
#inventory > .module-layout.inventory-create-open { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
#inventory-table { overflow-x: auto; }
#inventory-table td { padding-top: 8px; padding-bottom: 8px; vertical-align: top; }
#inventory-table .article-cell { grid-template-columns: 40px minmax(280px, 1fr); gap: 8px; }
#inventory-table .article-photo, #inventory-table .article-photo-placeholder { width: 40px; height: 40px; }
#inventory-table .multiline { line-height: 1.25; white-space: normal; }
#inventory-table .price-stack { min-width: 110px; gap: 1px; }
#inventory-table th:first-child { width: 34%; }
#inventory-table .table-filter-input { min-width: 60px; }
#inventory-table th:nth-child(2) select { max-width: 180px; }
#inventory-table th:first-child .table-filter-input { min-width: 260px; }
body.role-workshop #show-inventory-create, body.mobile-read-only #show-inventory-create { display: none !important; }
@media (max-width: 980px) {
  #inventory > .module-layout.inventory-create-open { grid-template-columns: minmax(0, 1fr); }
}

/* Schmalerer Lagerplatz; VK2-Ansicht für die Suche am Kundenbildschirm. */
#inventory-table th:first-child { width: 38%; }
#inventory-table [data-inventory-column="Lagerplatz"] { width: 54px; max-width: 54px; min-width: 0; overflow-wrap: anywhere; }
#inventory-table [data-inventory-column="Lagerplatz"] .table-filter-input { width: 54px; min-width: 0; max-width: 54px; padding-left: 4px; padding-right: 4px; }
#inventory-table th[data-inventory-column="Lagerplatz"] { font-size: 11px; }
.inventory-price-toggle { margin-left: 4px; white-space: nowrap; padding: 3px 5px; font-size: 11px; }
.inventory-price-toggle[aria-pressed="true"] { background: var(--brand); color: #fff; }
.inventory-vk2-price { white-space: nowrap; font-weight: 600; }
#inventory.inventory-vk2-only #inventory-table [data-inventory-column="Lagerwert"],
#inventory.inventory-vk2-only #show-inventory-create,
#inventory.inventory-vk2-only #inventory-form { display: none !important; }

#inventory-table th[data-inventory-column="Lagerplatz"] { padding-left: 4px; padding-right: 4px; overflow-wrap: normal; }
#inventory-table th[data-inventory-column="Preise"] { white-space: nowrap; }
#inventory-table .article-cell.article-no-photo { grid-template-columns: minmax(280px, 1fr); }

/* Keep warehouse, shelf and partial quantity on the same visual line. */
#inventory-table .inventory-stock-line { height: 25px; line-height: 25px; white-space: nowrap; }
#inventory-table .inventory-stock-total { margin-top: 3px; border-top: 1px solid #d8e3e5; font-weight: 700; color: #5f6b73; }
#inventory-table .inventory-stock-line .badge { display: inline-block; line-height: 1.15; vertical-align: middle; }

.customer-file-disclosure { display: block; }
.customer-file-disclosure > summary { cursor: pointer; align-items: center; list-style: none; }
.customer-file-disclosure > summary::-webkit-details-marker { display: none; }
.customer-file-disclosure > summary::before { content: "▸"; color: var(--brand-dark); font-size: 18px; }
.customer-file-disclosure[open] > summary::before { content: "▾"; }
.customer-file-disclosure > summary h3 { margin-right: auto; }
.customer-file-section-body { display: grid; gap: 12px; margin-top: 12px; }
.customer-orders-table [hidden] { display: none; }

.inventory-label-dialog {
  width: min(1360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.label-dialog-grid { display: grid; grid-template-columns: 1fr 1.25fr .7fr; gap: 20px; }
.label-dialog-grid > section { min-width: 0; }
.label-search-results, .label-queue { max-height: 48vh; overflow-y: auto; }
.label-search-result { display: grid; width: 100%; text-align: left; gap: 4px; margin-bottom: 6px; padding: 8px; }
.label-search-result span { font-size: 12px; }
.label-queue-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; align-items: start; border-bottom: 1px solid var(--line); padding: 10px 0; }
.label-queue-row textarea { width: 100%; min-height: 64px; font-size: 12px; }
.label-queue-row input { width: 100%; }
.label-placement { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 10px; }
.label-placement button { min-height: 26px; padding: 4px; background: #eef8f9; color: #1b7178; border: 1px solid var(--line); }
.label-placement button.used { background: #e5e7eb; color: #8b939a; }
.label-placement button.selected { background: var(--brand); color: white; border-color: var(--brand); }
.label-dialog-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.label-dialog-footer > strong { margin-right: auto; }
@media (max-width: 1000px) {
  .label-dialog-grid { grid-template-columns: 1fr 1fr; }
  .label-dialog-grid > section:last-child { grid-column: 1 / -1; max-width: 400px; }
}
@media (max-width: 600px) {
  .label-dialog-grid { grid-template-columns: 1fr; }
  .label-queue-row { grid-template-columns: minmax(0, 1fr) 64px; }
  .label-queue-row > button { grid-column: 1 / -1; }
  .label-search-results, .label-queue { max-height: 35vh; }
}
.customer-orders-table .table-filter-input { min-width: 65px; }

.article-cart-dialog { width: min(1100px, 95vw); max-height: 90vh; overflow: auto; margin: auto; }
.article-cart-list { max-height: 56vh; overflow: auto; margin: 16px 0; }
.article-cart-row { display: grid; grid-template-columns: 24px minmax(0,1fr) 110px auto; gap: 14px; align-items: start; padding: 12px; border-bottom: 1px solid var(--line); }
.article-cart-row input[type="checkbox"] { width: 18px; }
.article-cart-row .multiline { max-height: 100px; overflow: auto; }
@media(max-width: 650px) { .article-cart-row { grid-template-columns: 24px minmax(0,1fr) 90px; } .article-cart-row > button { grid-column: 2 / 4; } }

#billing-address-correction-dialog { width: min(720px, 94vw); max-height: 92vh; border: 1px solid #ccdce0; border-radius: 10px; padding: 22px; color: #17212b; }
#billing-address-correction-dialog::backdrop { background: rgba(10, 30, 35, .45); }
#billing-address-correction-dialog form { display: grid; gap: 14px; }
#billing-address-correction-dialog label { display: grid; gap: 6px; }
#billing-address-correction-dialog .check-line { display: flex; }

.chat-scheduled-panel { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.chat-scheduled-panel > summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); }
.chat-scheduled-item { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f5fafb; }
.chat-scheduled-item > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.chat-scheduled-item p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.chat-scheduled-item time, .chat-scheduled-item small { color: var(--muted); font-size: 12px; }
.chat-scheduled-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-schedule-edit-form { display: grid; gap: 12px; }
.chat-schedule-edit-form label { display: grid; gap: 6px; }
.invoice-exception-menu { flex-basis: 100%; border-top: 1px solid #d7e1e4; padding-top: 8px; font-size: 12px; }
.invoice-exception-menu summary { cursor: pointer; color: #536771; }
.invoice-exception-menu button { margin: 6px 0; }

.chat-device-setup { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.chat-device-setup summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); }
.chat-device-setup p { line-height: 1.5; }
.chat-device-setup a { display: inline-block; margin: 6px 12px 6px 0; }

/* Gemeinsames OP-Nebenbuch */
.accounting-section summary { cursor:pointer; font-weight:700; color:var(--primary); padding:10px 0; }
.accounting-section form { margin-top:12px; display:grid; gap:12px; }
.accounting-dialog { width:min(1100px,calc(100vw - 32px)); max-height:90vh; overflow:auto; border:1px solid var(--line); border-radius:12px; padding:22px; }
.accounting-dialog::backdrop { background:rgb(17 24 39 / .45); }
.accounting-dialog:not([open]) { display:none; }
.accounting-dialog form { display:grid; gap:12px; padding:16px; background:#f3fafb; border-radius:8px; margin:16px 0; }
.accounting-notice { padding:15px 0; border-top:1px solid var(--line); }
.accounting-notice p { white-space:pre-wrap; }
.accounting-error { color:#a32424; font-weight:700; }
#accounting-status { min-height:1.5em; }
#accounting[hidden], #accounting [hidden] { display:none !important; }
@media(max-width:640px) { .accounting-dialog { padding:12px; }.accounting-dialog .form-grid { grid-template-columns:1fr; } }
.purchase-order-card { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.purchase-order-card > summary { display: grid; grid-template-columns: 160px minmax(180px,1.4fr) minmax(125px,.7fr) minmax(160px,.8fr) 160px; align-items: center; gap: 16px; padding: 16px; cursor: pointer; list-style: none; background: #f8fbfc; }
.purchase-order-card[open] > summary { background: #eaf6f5; border-bottom: 1px solid var(--line); }
.purchase-order-card > summary small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.purchase-expand-label { color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.purchase-expand-label::before { content: '▸ '; }
.purchase-order-card[open] .purchase-expand-label::before { content: '▾ '; }
.purchase-order-content { padding: 18px; }
.purchase-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.purchase-tracking-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; margin-bottom: 24px; }
.purchase-tracking-grid > form, .purchase-tracking-grid > section { min-width: 0; padding: 16px; background: #f9fbfc; border: 1px solid var(--line); border-radius: 8px; }
.purchase-tracking-grid h3 { margin: 0 0 14px; font-size: 15px; }
.purchase-tracking-grid label { display: grid; gap: 5px; margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.purchase-tracking-grid .inline-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.purchase-tracking-grid input, .purchase-tracking-grid select, .purchase-tracking-grid textarea { width: 100%; min-width: 0; }
.purchase-note-journal { max-height: 300px; overflow: auto; margin-top: 14px; }
.purchase-note-journal article { padding: 10px 0; border-top: 1px solid var(--line); }
.purchase-note-journal article p { white-space: normal; overflow-wrap: anywhere; margin: 5px 0; }
.purchase-note-journal small, .purchase-document-list small { color: var(--muted); font-size: 11px; }
.purchase-document-list { padding-left: 18px; max-height: 200px; overflow: auto; }
.purchase-document-list li { margin-bottom: 10px; overflow-wrap: anywhere; }
.purchase-document-list small { display: block; margin-top: 4px; }
.purchase-receipt-scroll { overflow-x: auto; }
.purchase-receipt-table { min-width: 1080px; width: 100%; }
.purchase-receipt-table td { vertical-align: top; }
.purchase-receipt-table td:nth-child(2) { min-width: 210px; max-width: 360px; }
.purchase-receipt-table td:nth-child(2) span, .purchase-receipt-table td:nth-child(2) small { display: block; margin-top: 5px; }
.purchase-receipt-table input[type=number] { width: 100px; }
.purchase-receipt-table input[type=date] { width: 145px; }
.purchase-receipt-table input[name=location] { width: 140px; }
.purchase-receipt-table select { min-width: 125px; }
.purchase-warning { color: #966100; font-weight: 700; }
.purchase-receipt-feedback { color: #147a43; font-weight: 600; }
.purchase-journal { margin-top: 18px; padding: 12px; border-top: 1px solid var(--line); }
.purchase-journal > summary { cursor: pointer; font-weight: 700; }
.purchase-followup-popup { position: fixed; inset: auto auto 22px 95px; width: min(520px,calc(100vw - 120px)); z-index: 10000; margin: 0; border: 1px solid #78bbb9; border-left: 5px solid var(--brand); border-radius: 10px; background: #fff; color: var(--ink); padding: 18px; box-shadow: 0 10px 40px #0003; }
.purchase-followup-popup .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.purchase-followup-popup a.button { display: inline-block; text-decoration: none; padding: 9px 12px; border-radius: 5px; background: #eaf6f5; color: var(--brand-dark); font-size: 13px; font-weight: 700; }
.purchase-followup-popup small { color: var(--muted); }
@media(max-width:1100px) { .purchase-tracking-grid { grid-template-columns:1fr; } .purchase-order-card > summary { grid-template-columns:1fr 1.5fr; } .purchase-expand-label { grid-column:1/-1; } }
@media(max-width:600px) { .purchase-order-card > summary { grid-template-columns:1fr; gap:10px; } .purchase-tracking-grid .inline-fields { grid-template-columns:1fr; } .purchase-followup-popup { left:15px; width:calc(100vw - 30px); } }
.purchase-folder-link { display: inline-block; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--brand-dark); text-decoration: none; font-size: 13px; font-weight: 600; }

.document-discount-editor { margin: 16px 0; padding: 16px; border: 1px solid var(--border, #d7e1e4); border-radius: 10px; background: #f2f9f9; }
.document-discount-editor h4 { margin: 0 0 6px; }
.document-discount-editor p { margin: 6px 0 12px; }
.document-discount-fields { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(140px, 1fr) minmax(120px, 1fr) auto; gap: 12px; align-items: end; }
.document-discount-fields label { min-width: 0; }
.document-discount-fields input, .document-discount-fields select { width: 100%; }
.split-document .document-discount-fields { grid-template-columns: minmax(150px, 2fr) minmax(120px, 1fr); }
@media (max-width: 800px) { .document-discount-fields, .split-document .document-discount-fields { grid-template-columns: 1fr; } }
.document-discount-editor:focus-within { border-color: #008c95; box-shadow: 0 0 0 3px rgba(0, 140, 149, .13); }

/* Dichte Belegprüfung, unabhängig von den Druckvorlagen. */
.document-view-switch { display: inline-flex; gap: 0; border: 1px solid #b5d0d3; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.document-view-switch button { border: 0; border-radius: 0; padding: 6px 10px; background: #f1f6f7; color: #355e63; font-size: 12px; }
.document-view-switch button[aria-pressed="true"] { background: #008c95; color: #fff; }
.compact-order-head, .compact-order-discount { border: 1px solid #d5e2e4; border-radius: 6px; margin: 6px 0; background: #f5fafa; }
.compact-order-head > summary, .compact-order-discount > summary { padding: 7px 10px; cursor: pointer; font-size: 12px; font-weight: 600; color: #355e63; }
.compact-order-head .order-head-summary { padding: 8px; }
.compact-document-view .beleg-editor { gap: 5px; }
.compact-document-view .beleg-editor-head { padding: 7px 9px; flex-wrap: wrap; gap: 6px; }
.compact-document-view .beleg-editor-head h4 { font-size: 13px; }
.compact-document-view .beleg-editor-head-actions { flex-wrap: wrap; gap: 6px; }
.compact-document-view .beleg-editor-head-actions > button { font-size: 12px; padding: 6px 8px; }
.compact-document-view > .form-actions { margin: 6px 0; gap: 8px; font-size: 12px; }
.compact-document-view > .form-actions button { font-size: 12px; padding: 5px 8px; }
.compact-order-hint { margin: 0 0 4px; color: #60747c; font-size: 11px; }
.compact-table-wrap { overflow: auto; max-height: calc(100vh - 315px); min-height: 160px; border: 1px solid #c7d5da; border-radius: 5px; scrollbar-gutter: stable; }
.compact-order-table { width: 100%; min-width: 1000px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; line-height: 1.25; }
.compact-order-table .compact-col-open { width: 28px; }
.compact-order-table .compact-col-pos { width: 70px; }
.compact-order-table .compact-col-sku { width: 145px; }
.compact-order-table .compact-col-qty { width: 65px; }
.compact-order-table .compact-col-unit { width: 44px; }
.compact-order-table .compact-col-price { width: 100px; }
.compact-order-table .compact-col-discount { width: 70px; }
.compact-order-table .compact-col-total { width: 110px; }
.compact-order-table .compact-col-currency { width: 46px; }
.compact-order-table th, .compact-order-table .compact-summary-row td { height: 27px; padding: 4px 6px; border: 0; border-bottom: 1px solid #dde5e8; border-right: 1px solid #e5ecee; white-space: nowrap; vertical-align: middle; }
.compact-order-table thead th { position: sticky; top: 0; z-index: 3; background: #e7f0f2; color: #243e48; font-weight: 700; font-size: 11px; }
.compact-order-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.compact-summary-row { background: #fff; cursor: pointer; }
.compact-summary-row:nth-child(even) { background: #f8fbfc; }
.compact-order-table .compact-kind-title, .compact-order-table .compact-kind-lot { background: #fff9d9; font-weight: 700; }
.compact-order-table .compact-kind-lot { background: #e3f4ef; }
.compact-order-table .compact-kind-subtotal { background: #edf4f5; font-weight: 700; }
.compact-order-table .compact-summary-row:hover, .compact-order-table .compact-summary-row.is-open { background: #dff1f3; }
.compact-summary-row:focus-visible { outline: 2px solid #008c95; outline-offset: -2px; }
.compact-description { overflow: hidden; text-overflow: ellipsis; }
.compact-line-total { font-weight: 600; }
.compact-alternative { font-size: 10px; color: #79591f; }
.compact-line-open { background: transparent; color: #38666d; border: 0; padding: 0; width: 16px; height: 18px; line-height: 18px; font-size: 12px; }
.compact-detail-row > td { padding: 10px; background: #eef7f8; border-bottom: 1px solid #b9d5d9; white-space: normal; }
.compact-detail-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.compact-detail-heading button { padding: 5px 9px; font-size: 12px; }
.compact-detail-row .beleg-line { cursor: default; }
.compact-order-table tfoot td { position: sticky; bottom: 0; z-index: 2; background: #e8f4f4; border-top: 2px solid #8ebcbe; padding: 8px; }
.compact-order-totals { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 24px; }
.compact-order-totals strong { margin-left: 6px; }
.compact-editor-panel > .panel-head { margin-bottom: 8px; }
.compact-editor-panel > .panel-head h3 { margin: 0 0 3px; font-size: 15px; }
.compact-editor-panel > .panel-head p { margin: 0; font-size: 12px; }
.compact-editor-panel > .panel-head button { font-size: 12px; padding: 6px 9px; }
.compact-document-view, .compact-table-wrap { overflow-anchor: none; }
.compact-document-identity { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 14px; margin: 0 0 6px; padding: 8px 10px; background: #e7f3f4; border: 1px solid #bfd7da; border-radius: 5px; font-size: 12px; }
.compact-document-identity > strong, .compact-document-identity > span:not(.compact-identity-subject) { flex-shrink: 0; }
.compact-identity-subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #536b73; }
/* Gleiche Fensterhöhe beim Auf-/Zuklappen verhindert ein Nachrutschen der Seite. */
.compact-table-wrap { height: calc(100vh - 315px); }

/* Internal reference photos remain separate from document print photos. */
.internal-photo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.internal-photo-card { display: grid; gap: 6px; min-width: 0; }
.internal-photo-card img { width: 100%; height: 130px; object-fit: contain; background: white; }
.internal-photo-card span { display: block; overflow-wrap: anywhere; font-size: 12px; }
.internal-photo-large { display: block; width: 100%; max-height: 55vh; object-fit: contain; margin: 12px 0; background: white; }
#internal-position-photo-error { color: #a32626; }

.note-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-field-heading button { flex-shrink: 0; min-width: 28px; padding: 3px 7px; }
.customer-note-large-dialog { width: min(1100px, 94vw); height: min(820px, 90vh); background: white; border-radius: 10px; padding: 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 50px #0003; }
.customer-note-large-dialog .dialog-head { flex-shrink: 0; }
#customer-note-large-text { flex: 1; min-height: 180px; resize: none; font-size: 16px; line-height: 1.6; }
#customer-note-large-error { color: #a32626; white-space: pre-wrap; }
[data-customer-note-text] { white-space: pre-wrap; }

.purchase-split-dialog { width: min(1740px, 96vw); height: 94vh; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: white; border-radius: 10px; }
.purchase-split-dialog > p { margin: 0; }
.purchase-split-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; flex: 1; min-height: 0; }
.purchase-split-panes > section { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.purchase-split-panes h4, .purchase-split-panes p { margin: 0; }
.purchase-split-panes select { width: 100%; }
.purchase-source-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.purchase-split-lines { flex: 1; overflow: auto; min-height: 160px; border: 1px solid var(--line); border-radius: 6px; }
.purchase-split-lines table { width: 100%; font-size: 12px; }
.purchase-split-lines th { position: sticky; top: 0; background: #e6f6f6; z-index: 1; }
.purchase-split-lines td { padding: 6px; vertical-align: top; }
.purchase-split-lines td span, .purchase-split-lines td small { display: block; white-space: pre-wrap; }
.purchase-split-lines tr[draggable="true"] { cursor: grab; }
.purchase-split-lines tr.purchase-source-selected { background:#e6f6f6; }
.purchase-select-all { display:flex; align-items:center; gap:6px; white-space:nowrap; font-size:12px; }
.purchase-select-all input { width:auto; }
.purchase-line-extra { margin:6px 0; max-width:230px; }
.purchase-line-extra small { display:block; }
.purchase-line-photos { display:flex; gap:4px; flex-wrap:wrap; margin:4px 0; }
.purchase-line-photos img { width:52px; height:44px; object-fit:contain; border:1px solid var(--line); background:white; border-radius:4px; }
.purchase-line-usage { display:flex; gap:8px; margin-top:6px; }
.purchase-line-usage label { display:flex; align-items:center; gap:3px; font-size:11px; }
.purchase-line-usage input { width:auto; }
.purchase-photo-upload { display:inline-block; cursor:pointer; }
.purchase-line-extra input[data-field] { width:100%; font-size:12px; padding:5px; }
.task-automation-rules-dialog { width:min(720px,94vw); max-height:90vh; overflow:auto; border:1px solid var(--line); border-radius:10px; padding:24px; }
.task-automation-rules-dialog form { border-top:1px solid var(--line); padding:14px 0; display:grid; gap:10px; }
.purchase-split-lines input[type="number"] { width: 88px; padding: 6px; }
.purchase-split-lines textarea { min-width: 150px; min-height: 65px; font-size: 12px; }
.purchase-pending-line { background: #e6f6f6; }
.purchase-drop-active { outline: 3px solid var(--brand); background: #e6f6f6; }
@media(max-width: 900px) { .purchase-split-panes { grid-template-columns: 1fr; overflow: auto; } .purchase-split-panes > section { min-height: 380px; } }

.position-select-handle { display: block; width: 100%; min-width: 44px; padding: 7px 6px; min-height: 30px; color: #17232e; background: white; border: 1px solid #bdd0d5; border-radius: 5px; cursor: grab; font-size: 13px; font-weight: 700; }
.position-select-handle[aria-pressed="false"]:hover { background: white; color: #17232e; }
.position-select-handle[aria-pressed="true"] { color: white; background: #008c95; border-color: #006f76; }
.beleg-line.position-selected, .draft-line-row.position-selected { background: #dcf3f2; border-color: #008c95; box-shadow: inset 4px 0 #008c95; }
tr.compact-summary-row.position-selected > td { background: #d1efed !important; box-shadow: inset 0 1px #8ac8c6, inset 0 -1px #8ac8c6; }
.compact-summary-row .position-select-handle { padding: 3px; min-height: 23px; font-size: 12px; }
.position-selected [contenteditable="true"] { background: #f5fdfc; }
[data-position-context].position-copy-before { box-shadow: inset 0 4px #008c95 !important; }
[data-position-context].position-copy-after { box-shadow: inset 0 -4px #008c95 !important; }
.beleg-editor[inert] { opacity: .65; }

html.position-copy-drag, html.position-copy-drag * { cursor: copy !important; }

/* Purchasing overview and content editor. */
.purchase-overview-scroll, .purchase-line-editor-scroll { overflow-x: auto; }
.purchase-overview-table { width: 100%; min-width: 1150px; border-collapse: collapse; }
.purchase-overview-table > thead > tr > th { padding: 9px 7px; background: #eef7f8; vertical-align: top; }
.purchase-column-filters input { width: 100%; min-width: 80px; padding: 6px; font-size: 12px; }
.purchase-column-filters th:nth-child(3) input, .purchase-column-filters th:nth-child(4) input { min-width: 155px; }
.purchase-overview-row > td { padding: 10px 7px; border-bottom: 1px solid #d7e4e6; vertical-align: top; }
.purchase-overview-row small { display: block; font-size: 11px; color: #637381; margin-top: 4px; }
.purchase-overview-subject { max-width: 250px; overflow-wrap: anywhere; }
.purchase-overview-details[hidden] { display: none; }
.purchase-overview-details > td { padding: 0; }
.purchase-overview-details > td > details > summary { display: none; }
.purchase-overview-details .purchase-order-card { margin: 0 0 15px; }
.purchase-content-editor { border: 1px solid #b9dadd; border-radius: 7px; padding: 14px; margin: 12px 0 18px; background: #f5fbfb; }
.purchase-content-editor h3 { margin: 0 0 12px; }
.purchase-content-editor .inline-fields > label { flex: 1; min-width: 220px; }
.purchase-line-editor-table { width: 100%; min-width: 790px; margin-top: 12px; }
.purchase-line-editor-table td, .purchase-line-editor-table th { padding: 7px; vertical-align: top; }
.purchase-line-editor-table textarea { width: 100%; min-width: 280px; min-height: 66px; }
.purchase-line-editor-table input[type="number"] { width: 105px; }
.purchase-line-editor-table [data-field="unit"] { width: 60px; margin-top: 5px; }
.purchase-line-editor-table td small { display: block; max-width: 140px; }
.purchase-line-editor-table [data-line-total] { text-align: right; white-space: nowrap; font-weight: 700; }
.purchase-edit-selected > td { background: #d8f0ef; }
.purchase-edit-selection { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.purchase-add-lines { padding: 10px; background: white; border: 1px solid #d6e3e5; border-radius: 5px; margin: 10px 0; }
.purchase-add-lines > summary { cursor: pointer; font-weight: 700; color: #147c85; }
.purchase-add-lines > label { margin-top: 12px; }
.purchase-item-result { display: block; text-align: left; width: 100%; margin: 5px 0; font-weight: 400; }
.purchase-item-result span { display: block; font-size: 12px; }
[data-purchase-edit-feedback] { color: #126c75; font-weight: 600; }
.purchase-content-editor .checkbox-label,
#purchase-form .checkbox-label { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.purchase-content-editor .checkbox-label input,
#purchase-form .checkbox-label input { width: 17px; height: 17px; min-height: 0; margin: 0; flex: 0 0 17px; accent-color: #008c95; }
.currency-feedback { display: block; color: #587078; line-height: 1.4; }
#exchange-wrap[hidden], #inventory-detail-exchange-wrap[hidden] { display: none !important; }
.stock-report-panel { margin-bottom: 20px; min-width: 0; }
.stock-report-question { display: flex; gap: 12px; align-items: end; }
.stock-report-question label { flex: 1; }
.stock-report-examples, .stock-report-actions, .stock-report-totals, .stock-report-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.stock-report-filters { display: grid; grid-template-columns: repeat(3,minmax(150px,1fr)); gap: 12px; }
.stock-report-totals { padding: 14px; background: #e9f5f6; border-radius: 8px; }
.stock-report-warning { padding: 10px 12px; background: #fff8e5; color: #745115; border-radius: 6px; }
.stock-report-negative { color: #b4232b; font-weight: 800; }
.stock-report-table { overflow: auto; max-height: 620px; }
.stock-report-table table { min-width: 1050px; }
.stock-report-table th { position: sticky; top: 0; z-index: 1; background: #e9f5f6; }
.stock-report-table td { vertical-align: top; max-width: 300px; }
.stock-report-table summary { cursor: pointer; white-space: normal; }
.stock-report-description { white-space: pre-wrap; max-width: 340px; font-size: 12px; line-height: 1.45; margin-top: 5px; }
.stock-report-table .numeric { text-align: right; white-space: nowrap; }
.stock-report-pages { justify-content: space-between; }
@media (max-width: 850px) { .stock-report-filters { grid-template-columns: repeat(2,minmax(130px,1fr)); } }
@media (max-width: 560px) { .stock-report-question { display: grid; } .stock-report-filters { grid-template-columns: 1fr; } }
.stock-report-ai { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; background: #f4f8f9; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }

/* Read-only warehouse lookup directly beside document article numbers. */
button.line-stock-button { display:inline-flex; align-items:center; gap:3px; padding:2px 5px; min-height:22px; border:1px solid #c8e0e3; border-radius:4px; background:#edf7f8; color:#217984; font-size:10px; font-weight:600; line-height:1.2; vertical-align:middle; white-space:nowrap; }
button.line-stock-button:hover, button.line-stock-button:focus-visible { background:#d4eef0; outline-offset:2px; }
.compact-order-table .compact-col-sku { width:190px; }
.line-stock-dialog { width:min(580px, calc(100vw - 32px)); max-height:85vh; overflow:auto; box-sizing:border-box; padding:20px; border:1px solid #c8e0e3; border-radius:10px; color:#26343d; background:white; box-shadow:0 12px 45px #102d3540; }
.line-stock-dialog::backdrop { background:#152d3566; }
.line-stock-dialog .dialog-head { align-items:flex-start; }
.line-stock-dialog .dialog-head p { margin:6px 0 14px; font-size:13px; }
.line-stock-table { overflow-x:auto; }
.line-stock-table table { width:100%; }
.line-stock-table td, .line-stock-table th { padding:9px 7px; }
@media print { .line-stock-button, .line-stock-dialog { display:none !important; } }

button.article-group-add { display:inline-flex; justify-content:center; align-items:center; width:23px; height:23px; min-height:23px; padding:0; border:1px solid #c8e0e3; border-radius:4px; background:#e8f5f6; color:#217984; font-size:17px; line-height:1; }
.article-group-dialog { width:min(500px,calc(100vw - 32px)); max-height:85vh; overflow:auto; box-sizing:border-box; padding:22px; border:1px solid #c8e0e3; border-radius:10px; color:#26343d; box-shadow:0 12px 45px #102d3540; }
.article-group-dialog::backdrop { background:#152d3566; }
.article-group-dialog form { display:grid; gap:14px; }
.article-group-dialog .dialog-head { align-items:center; }
.article-group-dialog .dialog-head h3 { margin:0; }
.article-group-dialog .muted { font-size:12px; }
.article-group-error { color:#a52222; margin:0; }

.customer-phone-field { display:grid; gap:6px; align-content:start; min-width:0; }
.customer-phone-heading { display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0; }
.customer-phone-heading label { margin:0; white-space:nowrap; }
.customer-phone-person { font-size:11px; font-weight:500; color:#47757b; overflow-wrap:anywhere; }
input.customer-phone-name { flex:1; width:110px; min-width:85px; max-width:210px; min-height:23px; height:23px; padding:2px 6px; font-size:11px; font-weight:400; background:#f6fafb; }

.order-edit-audit { display:block; font-size:12px; }
.order-audit-last { display:block; margin-top:3px; font-size:10px; line-height:1.35; color:#47757b; }
.order-edit-audit-full { display:flex; flex-wrap:wrap; align-items:baseline; gap:5px 18px; margin:6px 0 12px; color:#657184; }
.order-edit-audit-full .order-audit-last { font-size:11px; margin-top:0; }

.stock-report-disclosure { margin-bottom:20px; min-width:0; }
.stock-report-disclosure > summary { cursor:pointer; color:#217984; font-size:15px; font-weight:700; }
.stock-report-disclosure > summary small { margin-left:10px; color:#657184; font-size:11px; font-weight:400; }
.stock-report-disclosure[open] > summary { margin-bottom:16px; }
.stock-report-disclosure > .stock-report-panel { margin-bottom:0; }
.stock-report-disclosure .panel-head h2 { display:none; }
@media(max-width:600px) { .stock-report-disclosure > summary small { display:block; margin:5px 0 0 16px; } }
.accounting-review-dialog { width:min(940px,94vw); max-width:940px; max-height:90vh; overflow:auto; }
.accounting-review-dialog label { display:grid; gap:.35rem; margin:.75rem 0; }
.accounting-review-dialog select,.accounting-review-dialog input,.accounting-review-dialog textarea { width:100%; box-sizing:border-box; }
.accounting-review-dialog .actions { flex-wrap:wrap; }
.accounting-review-reference { padding:12px; background:#eef7f7; border-left:3px solid #218c8d; overflow-wrap:anywhere; }
#accounting-review-authorization { padding:12px 16px; border:1px solid var(--line); background:#eef7f7; border-radius:8px; }
#accounting-review-authorization label { display:flex; align-items:flex-start; gap:10px; }
#accounting-review-authorization[hidden],#accounting-review-issued-label[hidden] { display:none; }
#accounting-review-authorization input[type="checkbox"] { width:18px; height:18px; flex:0 0 18px; margin-top:2px; }
#accounting-review-pdf-link a { font-weight:600; }
#accounting-review-history { font-size:.9rem; }

#accounting-proof-result .accounting-proof-rule { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
#accounting-proof-result .accounting-proof-rule input { width:18px; height:18px; min-height:0; margin:0; padding:0; flex:0 0 18px; accent-color:var(--brand); }

/* Customer callback numbers in the document editor header. */
.order-editor-phones { display:flex; flex-wrap:wrap; gap:6px 16px; margin:6px 0 0; font-size:12px; }
.order-editor-phone { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.order-editor-phone-number { user-select:text; white-space:nowrap; font-weight:600; }
.order-editor-email-address { user-select:text; overflow-wrap:anywhere; font-weight:600; }
.order-editor-phone button { padding:3px 7px; font-size:11px; }
.order-editor-phone-status { flex-basis:100%; }
.order-editor-phone-status:empty { display:none; }
.order-editor-phone-empty { margin:6px 0 0; font-size:12px; }

.article-photo-gallery { display:flex; flex-wrap:wrap; gap:6px; }
.article-photo-open { padding:0; background:transparent; border:0; line-height:0; cursor:zoom-in; }
.article-photo-open:hover { background:transparent; outline:2px solid var(--primary, #048b8c); outline-offset:2px; }
#article-photo-viewer { width:min(1200px,96vw); max-width:96vw; height:92vh; max-height:92vh; padding:16px; border:1px solid var(--line); border-radius:10px; }
#article-photo-viewer[open] { display:flex; flex-direction:column; gap:10px; }
#article-photo-viewer::backdrop { background:rgba(16,30,35,.75); }
.article-viewer-head { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.article-viewer-head h2 { margin:0; font-size:16px; overflow-wrap:anywhere; }
.article-viewer-tools { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.article-viewer-tools button { padding:6px 10px; }
.article-viewer-status { margin:0; font-size:12px; }
.article-viewer-image { flex:1; min-height:0; overflow:auto; display:grid; place-items:center; background:#e9eef0; }
.article-viewer-image img { display:block; max-width:100%; max-height:100%; object-fit:contain; }
.article-viewer-image.is-zoomed { display:block; }
.article-viewer-image.is-zoomed img { max-width:none; max-height:none; height:auto; margin:auto; }

.position-photo-preview{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:6px}.position-photo-preview img{max-width:150px;max-height:100px;object-fit:contain}.position-photo-preview small{color:var(--muted)}

/* Task attachment viewer, including unsaved screenshots. */
.task-media-open{padding:0;border:0;background:transparent;display:inline-flex;align-items:center;cursor:zoom-in;vertical-align:middle;max-width:100%}.task-media-open:hover{background:#e6f3f3}.task-media-open:focus-visible{outline:3px solid #008c95;outline-offset:3px}.task-media-open .thumb{display:block;object-fit:contain}.task-video-preview{display:inline-flex;flex-direction:column;gap:6px}.task-document-link{cursor:pointer;text-decoration:underline;overflow-wrap:anywhere}#task-media-viewer{width:min(1100px,calc(100vw - 24px));max-height:94vh;overflow:auto;border:1px solid #b9ced0;border-radius:12px;padding:22px;color:#17313b;background:#fff}#task-media-viewer::backdrop{background:#0c1825c9}#task-media-viewer .panel-head{display:flex;justify-content:space-between;align-items:center;gap:15px}#task-media-viewer h2{font-size:21px;margin:0}#task-media-viewer [data-name]{overflow-wrap:anywhere}#task-media-viewer [data-media]{display:flex;justify-content:center;background:#f1f5f5;min-height:150px}#task-media-viewer [data-media] img,#task-media-viewer [data-media] video{display:block;max-width:100%;max-height:70vh;object-fit:contain}#task-media-viewer iframe{width:100%;height:70vh;border:0}.task-media-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:14px}#task-media-viewer [data-status]{white-space:pre-wrap}#warranty-photo-editor label[hidden]{display:none!important}@media(max-width:600px){#task-media-viewer{padding:14px}.task-media-actions{gap:8px}}

/* Article photo removals are only applied by the existing save action. */
.article-photo-tile { display:flex; flex-direction:column; gap:6px; align-items:flex-start; max-width:160px; }
.article-photo-remove { display:flex; gap:5px; align-items:center; font-size:12px; color:#a62232; cursor:pointer; }
.article-photo-remove input { width:auto; margin:0; }
.article-photo-tile:has([data-remove-article-photo]:checked) img { opacity:.3; }
.article-photo-tile:has([data-remove-article-photo]:checked) { outline:1px dashed #a62232; outline-offset:3px; }

/* Dates, times and due hints stay inside the task column. */
.task-due-date { display:inline-flex; flex-direction:column; align-items:flex-start; gap:2px; white-space:normal; }
.task-due-day, .task-due-time { white-space:nowrap; }
.task-due-hint { font-size:11px; }

/* Compact customer overview; full notes remain available in place. */
.customer-table > tbody > tr:not(.customer-detail-row) > td { padding:6px 7px; vertical-align:top; }
.customer-note-short { display:block; max-width:210px; overflow-wrap:anywhere; }
.customer-note-disclosure { width:190px; max-width:100%; }
.customer-note-disclosure summary { cursor:pointer; color:inherit; }
.customer-note-disclosure summary:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
.customer-note-preview { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; line-height:1.3; max-height:2.6em; overflow-wrap:anywhere; }
.customer-note-toggle { color:var(--brand); font-size:11px; font-weight:700; }
.customer-note-toggle::after { content:"Mehr anzeigen"; }
.customer-note-disclosure[open] .customer-note-preview { display:none; }
.customer-note-disclosure[open] .customer-note-toggle::after { content:"Zuklappen"; }
.customer-note-full { margin-top:5px; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.35; }

.customer-note-disclosure summary { display:block; list-style:none; }
.customer-note-disclosure summary::-webkit-details-marker { display:none; }
.customer-note-toggle::before { content:"▸ "; }
.customer-note-disclosure[open] .customer-note-toggle::before { content:"▾ "; }

/* Team-Chat: eingehend links, eigene und geplante Nachrichten rechts. */
#chat-list { grid-template-columns: minmax(0, 1fr); }
#chat-list > .chat-message { justify-self: start; width: fit-content; max-width: min(80%, 820px, calc(100% - 68px)); min-width: min(240px, calc(100% - 68px)); box-sizing: border-box; overflow-wrap: anywhere; border-radius: 12px 12px 12px 3px; }
#chat-list > .chat-message.own { justify-self: end; background: #dff1f2; border-color: #8dc6cc; border-radius: 12px 12px 3px 12px; }
#chat-list > .chat-message.scheduled { border: 1px dashed var(--brand); background: #f0f8f9; }
#chat-list .chat-message-header { flex-wrap: wrap; align-items: baseline; }
#chat-list .chat-schedule-label { font-size: 12px; font-weight: 700; color: var(--brand-dark); }
#chat-list .chat-scheduled-actions { justify-content: flex-start; }
@media (max-width: 640px) { #chat-list > .chat-message { max-width: min(90%, calc(100% - 68px)); min-width: min(180px, calc(100% - 68px)); } }

/* Bestätigungen eigener Team-Chat-Nachrichten. */
#chat-list .chat-receipt { justify-self: end; font-size: 11px; color: #566a73; text-align: right; }
#chat-list .chat-receipt.is-read { color: #087fc3; font-weight: 700; }
#chat-list .chat-receipt.is-unsent { color: #a3212a; }

/* Personenbezogene Bestätigungsübersicht eigener Team-Nachrichten. */
#chat-list button.chat-receipt { background: transparent; border: 0; border-radius: 4px; padding: 4px 2px; min-height: 28px; max-width: 100%; white-space: normal; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#chat-list button.chat-receipt:hover { background: #d0e9ec; }
#chat-list button.chat-receipt:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#chat-list button.chat-receipt:disabled { text-decoration: none; cursor: default; }
.chat-receipt-details-dialog { width: min(880px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 12px; color: #20313a; background: #fff; box-sizing: border-box; }
.chat-receipt-details-dialog::backdrop { background: #102a3266; }
.chat-receipt-details-header, .chat-receipt-details-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chat-receipt-details-header h2 { margin: 0; }
.chat-receipt-table-scroll { overflow-x: auto; }
.chat-receipt-details-dialog table { width: 100%; min-width: 480px; border-collapse: collapse; margin: 12px 0; }
.chat-receipt-details-dialog th, .chat-receipt-details-dialog td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.chat-receipt-details-dialog thead { background: #edf7f8; }
.chat-receipt-details-dialog small { display: block; margin-top: 4px; color: var(--muted); }
.chat-receipt-read-time { color: #087fc3; font-weight: 600; }
@media (max-width: 640px) { .chat-receipt-details-dialog { padding: 16px; } }

/* Kompakte Details direkt unter der Nachrichtenzeit, für Team- und Direktchats. */
#chat-list .chat-message-header { align-items: flex-start; }
#chat-list .chat-message-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-left: auto; }
#chat-list .chat-message-meta > span { white-space: nowrap; }
#chat-list .chat-message-meta button.chat-receipt { min-height: 0; margin: 0; padding: 0; line-height: 1.2; }

/* Nachrichtenaktionen: Mausmenü und auf Touchgeräten sichtbare Alternative. */
.chat-message-actions-trigger { position:absolute; top:44px; right:-32px; width:28px; height:28px; padding:0; border:1px solid var(--line); border-radius:50%; background:#fff; color:#48626a; font-size:21px; line-height:1; opacity:0; }
.chat-message.own .chat-message-actions-trigger { right:auto; left:-32px; }
.chat-message:hover .chat-message-actions-trigger,.chat-message:focus-within .chat-message-actions-trigger { opacity:1; }
@media(hover:none),(pointer:coarse) { .chat-message-actions-trigger { opacity:.8; } }
.chat-message-action-menu { position:fixed; z-index:10001; display:grid; gap:3px; padding:6px; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 5px 24px #142f3d30; }
.chat-message-action-menu button { text-align:left; background:#fff; color:#17313b; padding:10px 14px; }
.chat-message-action-menu button:hover,.chat-message-action-menu button:focus-visible { background:#e2f4f4; }
.chat-message .chat-quote { display:block; border-left:3px solid #008c95; border-radius:4px; background:#ffffff99; padding:8px 10px; margin-bottom:8px; max-height:180px; overflow:auto; }
.chat-message .chat-quote strong,.chat-message .chat-quote > span { display:block; font-size:13px; }
.chat-forward-label { display:block; font-size:12px; font-style:italic; color:#48626a; margin-bottom:6px; }
.chat-reply-preview { display:flex; justify-content:space-between; align-items:start; gap:10px; padding:10px 12px; border-left:3px solid #008c95; border-radius:6px; background:#e2f4f4; }
.chat-reply-preview p { white-space:pre-wrap; margin:4px 0 0; font-size:13px; max-height:90px; overflow:auto; }
.chat-reply-preview button { padding:2px 8px; background:transparent; color:#17313b; font-size:22px; }
.chat-forward-dialog { width:min(480px,calc(100vw - 24px)); max-height:85vh; overflow:auto; margin:auto; border:1px solid var(--line); border-radius:12px; padding:22px; color:#17313b; background:#fff; }
.chat-forward-dialog::backdrop { background:#102a3266; }
.chat-forward-dialog label { display:grid; gap:6px; }
.chat-forward-preview { white-space:pre-wrap; max-height:180px; overflow:auto; background:#f2f7f8; padding:10px; border-radius:6px; }
.chat-action-buttons { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }

/* Separate NEUMEIER Chat-App. Der Chat bleibt parallel vollständig im ERP erhalten. */
.chat-app-brand-icon,
.task-app-brand-icon,
.chat-app-only,
.task-app-only,
.chat-mobile-back { display: none; }
.chat-presence-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
body.chat-app-mode .chat-launch-link { display: none; }
body.task-app-mode .task-launch-link { display: none; }
body.chat-app-mode #task-activity-notice,
body.chat-app-mode #tasks,
body.chat-app-mode #task-create,
body.chat-app-mode #task-save-view-dialog { display: none !important; }

html.chat-app-mode,
html.chat-app-mode body { width: 100%; height: 100%; min-height: 100%; overflow: hidden; background: #e9f1f2; }
body.chat-app-mode { display: block; }
body.chat-app-mode > .sidebar { display: none !important; }
body.chat-app-mode > main { display: flex; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; flex-direction: column; }
body.chat-app-mode .topbar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 120;
  min-height: 72px;
  padding: 10px 22px;
  border-bottom-color: #cbdcdf;
  box-shadow: 0 2px 12px rgba(16,34,38,.08);
}

/* Separate NEUMEIER Aufgaben-App. Daten, Rechte und Bearbeitung bleiben identisch zum ERP. */
html.task-app-mode,
html.task-app-mode body { min-height: 100%; background: #edf3f4; }
body.task-app-mode { display: block; }
body.task-app-mode > .sidebar { display: none !important; }
body.task-app-mode > main { min-height: 100dvh; }
body.task-app-mode .topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  min-height: 72px;
  padding: 10px 22px;
  border-bottom-color: #cbdcdf;
  box-shadow: 0 2px 12px rgba(16,34,38,.08);
}
body.task-app-mode .topbar-title {
  grid-template-columns: 48px minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
body.task-app-mode .task-app-brand-icon {
  display: block;
  grid-row: 1 / 3;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,111,120,.22);
}
body.task-app-mode .topbar-brand-logo { display: none; }
body.task-app-mode .topbar-title .eyebrow { grid-column: 2; margin: 0; font-size: 11px; }
body.task-app-mode .topbar-title h1 { grid-column: 2; font-size: 23px; }
body.task-app-mode .task-app-only { display: inline-flex; align-items: center; }
body.task-app-mode .task-app-only[hidden] { display: none !important; }
body.task-app-mode #current-user,
body.task-app-mode #seed-data,
body.task-app-mode #clear-data { display: none !important; }
body.task-app-mode #cloud-load-notice { margin: 10px 18px 0; }
body.task-app-mode .view:not(#tasks):not(#task-create) { display: none !important; }
body.task-app-mode #tasks,
body.task-app-mode #task-create { max-width: 1720px; width: 100%; margin-inline: auto; }
body.task-app-mode #tasks > .lower-module { display: none !important; }
body.task-app-mode #tasks > .panel { border-radius: 14px; box-shadow: 0 10px 30px rgba(16,34,38,.08); }

html.task-app-mode .login-screen {
  background: radial-gradient(circle at top, #d9eff0 0%, #edf4f5 45%, #e4edef 100%);
}
html.task-app-mode .login-card { border-top-width: 0; border-radius: 16px; }
html.task-app-mode .login-card::before {
  content: "";
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: url("assets/neumeier-aufgaben-app-icon-192.png") center/cover no-repeat;
  box-shadow: 0 6px 18px rgba(0,111,120,.25);
}
html.task-app-mode .login-card > img { display: none; }

@media (max-width: 700px) {
  body.task-app-mode .topbar {
    min-height: 62px;
    padding: max(7px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 7px max(10px, env(safe-area-inset-left));
    gap: 8px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  body.task-app-mode .task-app-brand-icon { width: 42px; height: 42px; border-radius: 10px; }
  body.task-app-mode .topbar-title { grid-template-columns: 42px minmax(0,1fr); column-gap: 9px; }
  body.task-app-mode .topbar-title .eyebrow { display: none; }
  body.task-app-mode .topbar-title h1 { grid-row: 1 / 3; align-self: center; font-size: 18px; }
  body.task-app-mode .topbar .actions { gap: 5px; }
  body.task-app-mode #task-open-erp { display: none; }
  body.task-app-mode .topbar .actions .button-link,
  body.task-app-mode .topbar .actions button { padding: 8px 10px; font-size: 12px; }
  body.task-app-mode #cloud-user-summary { display: none !important; }
  body.task-app-mode #tasks,
  body.task-app-mode #task-create { padding: 12px; }
  body.task-app-mode #tasks > .panel { border: 0; border-radius: 0; box-shadow: none; }
}
body.chat-app-mode .topbar-title {
  grid-template-columns: 48px minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
body.chat-app-mode .chat-app-brand-icon {
  display: block;
  grid-row: 1 / 3;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,111,120,.22);
}
body.chat-app-mode .topbar-brand-logo { display: none; }
body.chat-app-mode .topbar-title .eyebrow {
  grid-column: 2;
  margin: 0;
  font-size: 11px;
}
body.chat-app-mode .topbar-title h1 {
  grid-column: 2;
  font-size: 23px;
}
body.chat-app-mode .chat-app-only { display: inline-flex; align-items: center; }
body.chat-app-mode .chat-app-only[hidden] { display: none !important; }
body.chat-app-mode #current-user,
body.chat-app-mode #seed-data,
body.chat-app-mode #clear-data { display: none !important; }
body.chat-app-mode #cloud-load-notice { margin: 10px 18px 0; }
body.chat-app-mode #teamchat {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px 18px;
}
body.chat-app-mode #teamchat > .orders-workspace { height: 100%; min-height: 0; overflow: hidden; }
body.chat-app-mode .team-presence-panel { display: none; }
body.chat-app-mode .team-chat-workspace {
  grid-template-columns: minmax(270px, 320px) minmax(0,1fr);
  gap: 0;
  height: 100%;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid #bfd3d6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(16,34,38,.13);
}
body.chat-app-mode .chat-conversation-panel,
body.chat-app-mode .team-chat-panel {
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.chat-app-mode .chat-conversation-panel {
  overflow-y: auto;
  padding: 18px 12px;
  border-right: 1px solid #d6e3e5;
  background: #f8fbfb;
}
body.chat-app-mode .chat-conversation-panel > .panel-head { padding: 0 7px; }
body.chat-app-mode .chat-conversation-button {
  grid-template-columns: 42px minmax(0,1fr) 9px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 11px;
}
body.chat-app-mode .chat-conversation-button.active {
  border-color: #aad0d4;
  background: #dff1f2;
  box-shadow: inset 4px 0 0 var(--brand);
}
body.chat-app-mode .chat-conversation-avatar { width: 42px; height: 42px; }
body.chat-app-mode .chat-conversation-copy strong { font-size: 14px; }
body.chat-app-mode .chat-conversation-copy small { font-size: 12px; }
body.chat-app-mode .team-chat-panel { display: flex; flex-direction: column; padding: 0; }
body.chat-app-mode .team-chat-panel > .panel-head {
  flex: 0 0 auto;
  min-height: 68px;
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid #d6e3e5;
  background: #fff;
}
body.chat-app-mode .team-chat-panel > .panel-head h2 { font-size: 17px; }
body.chat-app-mode .team-chat-panel > .panel-head .muted { font-size: 12px; }
body.chat-app-mode #chat-search { width: min(280px, 36vw); }
body.chat-app-mode #chat-list {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  padding: 22px 24px 16px;
  background: linear-gradient(135deg, #f1f7f7 0%, #eaf3f3 100%);
}
body.chat-app-mode #chat-list > .chat-message {
  max-width: min(74%, 760px);
  border-color: #cbdcdf;
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16,34,38,.08);
}
body.chat-app-mode #chat-list > .chat-message.own {
  border-color: #98c8cd;
  border-radius: 15px 15px 4px 15px;
  background: #d9eff0;
}
body.chat-app-mode .chat-composer {
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid #cbdcdf;
  background: #fff;
  box-shadow: 0 -4px 14px rgba(16,34,38,.05);
}
body.chat-app-mode .chat-composer-meta { grid-template-columns: minmax(220px, 1fr); }
body.chat-app-mode .chat-composer-meta label:nth-child(1),
body.chat-app-mode .chat-composer-meta label:nth-child(2) { display: none; }
body.chat-app-mode .chat-text-field textarea {
  min-height: 58px;
  max-height: 180px;
  border-radius: 14px;
  background: #f6f9f9;
  resize: vertical;
}
body.chat-app-mode .chat-composer-toolbar { justify-content: flex-start; gap: 8px; }
body.chat-app-mode .chat-file-button input { display: none; }
body.chat-app-mode .chat-file-button,
body.chat-app-mode #chat-record-voice,
body.chat-app-mode #chat-emoji-toggle { min-height: 40px; border-radius: 20px; }
body.chat-app-mode .chat-send-button {
  min-width: 130px;
  margin-left: auto;
  border-radius: 20px;
}
body.chat-app-mode .chat-drop-zone { display: none; }
body.chat-app-mode .team-chat-panel > p.muted:not(#chat-unread-status):not(#chat-push-status) { display: none; }
body.chat-app-mode #chat-unread-status,
body.chat-app-mode #chat-push-status { margin: 0; padding: 0 16px 5px; background: #fff; font-size: 11px; }
body.chat-app-mode .chat-conversation-panel > details {
  margin: 14px 6px 0;
  padding: 10px;
  border: 1px solid #d6e3e5;
  border-radius: 9px;
  background: #fff;
}
body.chat-app-mode .chat-conversation-panel > details summary { cursor: pointer; font-weight: 800; color: var(--brand-dark); }
body.chat-app-mode .chat-device-setup button { width: 100%; margin-top: 8px; }

html.chat-app-mode .login-screen {
  background: radial-gradient(circle at top, #d9eff0 0%, #edf4f5 45%, #e4edef 100%);
}
html.chat-app-mode .login-card { border-top-width: 0; border-radius: 16px; }
html.chat-app-mode .login-card::before {
  content: "";
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: url("assets/neumeier-chat-app-icon-192.png") center/cover no-repeat;
  box-shadow: 0 6px 18px rgba(0,111,120,.25);
}
html.chat-app-mode .login-card > img { display: none; }

@media (max-width: 700px) {
  body.chat-app-mode .topbar {
    min-height: 62px;
    padding: max(7px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 7px max(10px, env(safe-area-inset-left));
    gap: 8px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  body.chat-app-mode .chat-app-brand-icon { width: 42px; height: 42px; border-radius: 10px; }
  body.chat-app-mode .topbar-title { grid-template-columns: 42px minmax(0,1fr); column-gap: 9px; }
  body.chat-app-mode .topbar-title .eyebrow { display: none; }
  body.chat-app-mode .topbar-title h1 { grid-row: 1 / 3; align-self: center; font-size: 19px; }
  body.chat-app-mode .topbar .actions { gap: 5px; }
  body.chat-app-mode #chat-open-erp { display: none; }
  body.chat-app-mode .topbar .actions .button-link,
  body.chat-app-mode .topbar .actions button { padding: 8px 10px; font-size: 12px; }
  body.chat-app-mode #cloud-user-summary { display: none !important; }
  body.chat-app-mode #teamchat { padding: 0; }
  body.chat-app-mode .team-chat-workspace {
    display: block;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body.chat-app-mode .chat-conversation-panel,
  body.chat-app-mode .team-chat-panel { height: 100%; }
  body.chat-app-mode.chat-mobile-list .team-chat-panel { display: none; }
  body.chat-app-mode:not(.chat-mobile-list) .chat-conversation-panel { display: none; }
  body.chat-app-mode:not(.chat-mobile-list) .chat-mobile-back { display: inline-flex; flex: 0 0 auto; }
  body.chat-app-mode .chat-conversation-panel { padding: 12px 8px; border-right: 0; overflow-x: hidden; overflow-y: auto; }
  body.chat-app-mode .chat-conversation-list { display: grid; max-height: none; overflow: visible; grid-template-columns: 1fr; gap: 4px; }
  body.chat-app-mode .chat-conversation-group + .chat-conversation-group { margin-top: 14px; }
  body.chat-app-mode .team-chat-panel > .panel-head { min-height: 60px; padding: 8px 10px; gap: 8px; }
  body.chat-app-mode .team-chat-panel { overflow: hidden; }
  body.chat-app-mode .team-chat-panel > .panel-head > div { flex: 1 1 auto; min-width: 0; }
  body.chat-app-mode .team-chat-panel > .panel-head h2,
  body.chat-app-mode .team-chat-panel > .panel-head .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.chat-app-mode #chat-search { display: none; }
  body.chat-app-mode #chat-list {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    height: auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px 10px 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
  body.chat-app-mode #chat-list > .chat-message {
    flex: 0 0 auto;
    align-self: flex-start;
    width: auto;
    height: auto;
    min-height: max-content;
    max-width: calc(100% - 52px);
    min-width: min(160px, calc(100% - 56px));
    margin-left: 26px;
    margin-right: 26px;
    padding: 10px;
    overflow: hidden;
  }
  body.chat-app-mode #chat-list > .chat-message.own { align-self: flex-end; }
  body.chat-app-mode #chat-list > .chat-message > * { flex-shrink: 0; }
  body.chat-app-mode #chat-list .chat-message-header { min-height: 0; }
  body.chat-app-mode #chat-list > .chat-message p { white-space: normal; overflow-wrap: anywhere; }
  body.chat-app-mode .chat-composer { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  body.chat-app-mode #chat-attachment-preview { max-height:24dvh;overflow:auto; }
  body.chat-app-mode .chat-attachment-preview-list { grid-template-columns:1fr; }
  body.chat-app-mode .chat-attachment-preview-item { grid-template-columns:54px minmax(0,1fr) auto; }
  body.chat-app-mode .chat-attachment-preview-item .chat-photo-open { width:54px;height:46px; }
  body.chat-app-mode .chat-composer-meta { display: none; }
  body.chat-app-mode .chat-text-field .field-label-with-action { display: none; }
  body.chat-app-mode .chat-text-field textarea { min-height: 50px; max-height: 120px; }
  /* iOS vergrößert die gesamte Web-App beim Fokus auf kleinere Formularschrift. */
  body.chat-app-mode .chat-text-field textarea,
  body.chat-app-mode .chat-composer input,
  body.chat-app-mode .chat-composer select {
    font-size: 16px;
    touch-action: manipulation;
  }
  body.chat-app-mode .chat-composer-toolbar {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) minmax(0,1fr) 76px;
    gap: 6px;
    align-items: center;
  }
  body.chat-app-mode .chat-composer-toolbar .text-format-toolbar { display: none; }
  body.chat-app-mode .chat-file-button,
  body.chat-app-mode #chat-record-voice,
  body.chat-app-mode #chat-emoji-toggle {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 6px;
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
  }
  body.chat-app-mode .chat-send-button { width: 100%; min-width: 0; min-height: 38px; margin: 0; padding: 7px 6px; }
  body.chat-app-mode #chat-unread-status,
  body.chat-app-mode #chat-push-status { display: none; }
}
