/* ── YellowBuilding Corporate Identity ── */
:root {
  --yb-yellow:   #FFC400;
  --yb-charcoal: #1C1C1E;
  --yb-slate:    #3C3C41;
  --yb-offwhite: #F5F5F5;
  --yb-graphite: #2B2B2E;

  /* Typography tokens.  The compact workspace scale is deliberately
     separate from the standalone-page default so embedded pages can match
     the workspace tree without changing every legacy page at once. */
  --yb-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --yb-text-ui: 0.875rem;
  --yb-text-meta: 0.75rem;
  --yb-text-heading: 1.375rem;
  --yb-text-emphasis: 1rem;

  /* Bootstrap primary token → Warm Yellow */
  --bs-primary:     #FFC400;
  --bs-primary-rgb: 255, 196, 0;

  --bs-link-color:       var(--yb-charcoal);
  --bs-link-hover-color: var(--yb-slate);
}

/* ── Typography ── */
body {
  font-family: var(--yb-font-sans);
  background-color: var(--yb-offwhite);
  color: var(--yb-charcoal);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--yb-charcoal);
}

/* ── Navigation ── */
.yb-navbar {
  background-color: var(--yb-graphite);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.yb-navbar .nav-link {
  color: rgba(245, 245, 245, 0.85);
}

.yb-navbar .nav-link:hover,
.yb-navbar .nav-link.active {
  color: var(--yb-yellow) !important;
}

.yb-navbar .dropdown-menu {
  background-color: var(--yb-charcoal);
  border-color: var(--yb-slate);
}

.yb-navbar .dropdown-item {
  color: var(--yb-offwhite);
}

.yb-navbar .dropdown-item:hover,
.yb-navbar .dropdown-item:focus,
.yb-navbar .dropdown-item.active {
  background-color: var(--yb-slate);
  color: var(--yb-yellow);
}

.user-avatar {
  --user-avatar-size: 2rem;
  width: var(--user-avatar-size);
  height: var(--user-avatar-size);
  min-width: var(--user-avatar-size);
  max-width: var(--user-avatar-size);
  aspect-ratio: 1 / 1;
  flex: 0 0 var(--user-avatar-size);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: 1;
}

.user-avatar-sm {
  --user-avatar-size: 2rem;
}

.user-avatar-md {
  --user-avatar-size: 4.5rem;
}

.user-avatar-nav {
  --user-avatar-size: 1.75rem;
}

.user-avatar > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar > i {
  font-size: calc(var(--user-avatar-size) * 0.62);
}

/* ── Primary button — Yellow / Charcoal text ── */
.btn-primary {
  --bs-btn-bg:              var(--yb-yellow);
  --bs-btn-border-color:    var(--yb-yellow);
  --bs-btn-color:           var(--yb-charcoal);
  --bs-btn-hover-bg:        #e6b000;
  --bs-btn-hover-border-color: #e6b000;
  --bs-btn-hover-color:     var(--yb-charcoal);
  --bs-btn-active-bg:       #cc9e00;
  --bs-btn-active-border-color: #cc9e00;
  --bs-btn-active-color:    var(--yb-charcoal);
  --bs-btn-focus-shadow-rgb: 255, 196, 0;
}

/* ── Secondary button — Off White / Charcoal ── */
.btn-outline-primary {
  --bs-btn-color:              var(--yb-charcoal);
  --bs-btn-border-color:       var(--yb-charcoal);
  --bs-btn-hover-bg:           var(--yb-charcoal);
  --bs-btn-hover-color:        var(--yb-offwhite);
  --bs-btn-hover-border-color: var(--yb-charcoal);
  --bs-btn-active-bg:          var(--yb-slate);
  --bs-btn-active-color:       var(--yb-offwhite);
}

/* ── Text / border utilities ── */
.text-primary {
  color: var(--yb-yellow) !important;
}

.border-primary {
  border-color: var(--yb-yellow) !important;
}

/* ── YB theme: replace Bootstrap's hardcoded #0d6efd ──
   Bootstrap 5.3 bakes the old primary blue into several component variables
   that ignore --bs-primary (checked controls, focus rings, nav-pills/-tabs
   active). Re-map them to the YB palette. The active/checked state uses Deep
   Graphite for contrast with the white checkmark / light pill text; Yellow
   stays reserved for primary buttons and accents. */
.form-check-input:checked {
  background-color: var(--yb-charcoal);
  border-color: var(--yb-charcoal);
}
.form-check-input:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--yb-slate);
  box-shadow: 0 0 0 0.25rem rgba(28, 28, 30, 0.20);
}
.nav-pills {
  --bs-nav-pills-link-active-bg:    var(--yb-charcoal);
  --bs-nav-pills-link-active-color: var(--yb-offwhite);
}
.nav-tabs {
  --bs-nav-tabs-link-active-color: var(--yb-charcoal);
}

/* ── Cards ── */
.card {
  background-color: #ffffff;
  border-color: rgba(60, 60, 65, 0.18);
}

.card-header {
  background-color: rgba(60, 60, 65, 0.05);
  border-bottom-color: rgba(60, 60, 65, 0.12);
}

.card-accent {
  border-top: 4px solid var(--yb-yellow);
}

/* ── Brand hero block (used on home / landing) ── */
.brand-hero {
  background: linear-gradient(120deg, rgba(255, 196, 0, 0.07), rgba(255, 196, 0, 0.02));
  border: 1px solid rgba(255, 196, 0, 0.18);
  border-radius: 1rem;
}

/* ── List interactions ── */
.list-group-item-action:hover {
  background-color: rgba(255, 196, 0, 0.08);
}

/* ── Tables ── */
.table-sm th,
.table-sm td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

/* ── Print ── */
@media print {
  .navbar, .btn, form.card, a.btn, [type="submit"] { display: none !important; }
  body { background: white !important; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; }
  .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #f8f8f8 !important; }
  a { text-decoration: none; color: inherit; }
}

/* ── Perf panel (dev only) ── */
#perf-panel {
  position: fixed; bottom: 12px; right: 12px;
  background: #0b1a2a; color: #fff;
  padding: 10px 12px; border-radius: 8px;
  font-size: 12px; z-index: 9999;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
#perf-panel-title { font-weight: 600; margin-bottom: 4px; }

/* ── Multiline text display ── */
.pre-wrap { white-space: pre-wrap; overflow-wrap: break-word; }

/* ── Spacing scale & semantic tokens ── */
:root {
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --border-radius:     0.375rem;
  --border-color:      rgba(60, 60, 65, 0.18);
  --muted-color:       #6c757d;
  --section-bg:        #ffffff;
  --form-footer-bg:    #ffffff;
  --table-header-bg:   rgba(60, 60, 65, 0.05);
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.page-header-left  { flex: 1 1 0; min-width: 0; }
.page-header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--yb-charcoal);
  margin: 0;
  line-height: 1.3;
}
.page-header-subtitle {
  color: var(--muted-color);
  font-size: 0.875rem;
  margin-top: 0.125rem;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Section card ── */
.section-card { margin-bottom: var(--space-lg); }
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--table-header-bg);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.section-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-color);
  margin: 0;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--muted-color);
}
.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--yb-charcoal);
  margin-bottom: var(--space-xs);
}
.empty-state-description {
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

/* ── Sticky form actions ── */
.sticky-form-actions {
  position: sticky;
  bottom: 0;
  background: var(--form-footer-bg);
  border-top: 1px solid var(--border-color);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  z-index: 10;
}
@media print { .sticky-form-actions { display: none !important; } }

/* ── Filter bar ── */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--yb-yellow);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}
.filter-bar-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Status badges ── */
.badge-active   { background-color: #198754; color: #fff; }
.badge-inactive { background-color: #6c757d; color: #fff; }
.badge-overdue  { background-color: #dc3545; color: #fff; }
.badge-due-soon { background-color: #ffc107; color: var(--yb-charcoal); }

/* Document file-type icons */
.document-file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}

.document-file-name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.document-kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font-size: 1rem;
}

.doc-kind-pdf {
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.2);
  color: #b42318;
}

.doc-kind-word {
  background: rgba(13, 110, 253, 0.12);
  border-color: rgba(13, 110, 253, 0.2);
  color: #0b5ed7;
}

.doc-kind-excel {
  background: rgba(25, 135, 84, 0.12);
  border-color: rgba(25, 135, 84, 0.2);
  color: #157347;
}

.doc-kind-powerpoint {
  background: rgba(253, 126, 20, 0.14);
  border-color: rgba(253, 126, 20, 0.22);
  color: #c45a0a;
}

.doc-kind-email {
  background: rgba(108, 117, 125, 0.14);
  border-color: rgba(108, 117, 125, 0.22);
  color: #495057;
}

.doc-kind-image {
  background: rgba(13, 202, 240, 0.14);
  border-color: rgba(13, 202, 240, 0.24);
  color: #087990;
}

.doc-kind-generic {
  background: rgba(33, 37, 41, 0.08);
  border-color: rgba(33, 37, 41, 0.12);
  color: #495057;
}

.list-group-item.active .document-kind-icon {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Docs list layout */
.docs-table {
  min-width: 72rem;
}

.docs-table .docs-col-id,
.docs-table .docs-col-date,
.docs-table .docs-col-actions {
  width: 1%;
  white-space: nowrap;
}

.docs-table .docs-col-type {
  min-width: 10rem;
}

.docs-table .docs-col-description {
  min-width: 14rem;
}

.docs-table .docs-col-file {
  min-width: 18rem;
}

.docs-table .docs-col-reference {
  min-width: 14rem;
}

.docs-table .docs-col-actions {
  min-width: 11rem;
}

.docs-table td.docs-col-description,
.docs-table td.docs-col-reference {
  white-space: normal;
  overflow-wrap: anywhere;
}

.docs-table .ref-item {
  font-size: 0.8rem;
  line-height: 1.5;
}

.docs-file-label {
  display: flex;
  width: 100%;
  max-width: 100%;
}

.docs-table-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
}

.docs-file-state {
  line-height: 1.2;
}

.docs-table-action-buttons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
  flex-wrap: nowrap;
}

.docs-table-action-buttons form {
  margin: 0;
}

/* Preview / document layout */
.doc-upload-form { width: 100%; }

.document-preview-card {
  min-height: 36rem;
}

.document-preview-frame {
  width: 100%;
  min-height: 36rem;
  display: block;
  background: #fff;
}

.document-preview-empty {
  min-height: 18rem;
}

/* Checklist Kanban */
.checklist-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(12rem, 1fr));
  gap: 0.75rem;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.checklist-kanban-column {
  min-width: 12rem;
  background: #f8f9fa;
  border: 1px solid rgba(33, 37, 41, 0.1);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
}

.checklist-kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem;
  border-bottom: 1px solid rgba(33, 37, 41, 0.08);
}

.checklist-kanban-list {
  min-height: 11rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  flex: 1;
}

.checklist-kanban-list-active {
  background: rgba(13, 110, 253, 0.06);
}

.checklist-kanban-card {
  background: #fff;
  border: 1px solid rgba(33, 37, 41, 0.12);
  border-radius: 0.5rem;
  padding: 0.75rem;
  box-shadow: 0 1px 2px rgba(33, 37, 41, 0.06);
}

.checklist-kanban-card[draggable="true"] {
  cursor: grab;
}

.checklist-kanban-card.is-dragging {
  opacity: 0.55;
}

.checklist-card-edit {
  color: #495057;
  line-height: 1;
}

.checklist-card-delete {
  color: #dc3545;
  line-height: 1;
}

.checklist-task-text,
.checklist-card-remark {
  overflow-wrap: anywhere;
}

.checklist-card-meta {
  color: #6c757d;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.checklist-card-remark {
  color: #495057;
  font-size: 0.875rem;
  line-height: 1.4;
}

.checklist-status-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
  flex: 0 0 auto;
  background: #6c757d;
}

.checklist-status-dot-open { background: #6c757d; }
.checklist-status-dot-in_progress { background: #0d6efd; }
.checklist-status-dot-blocked { background: #dc3545; }
.checklist-status-dot-done { background: #198754; }
.checklist-status-dot-n_a { background: #adb5bd; }

@media (max-width: 1199.98px) {
  .checklist-kanban {
    grid-template-columns: repeat(5, minmax(13.5rem, 1fr));
  }
}


/* ════════════════════════════════════════════
   WORKSPACE
   ════════════════════════════════════════════ */

/* Three-column grid */
.ws-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  grid-template-rows: 100%;
  height: calc(100vh - 56px); /* subtract navbar */
  overflow: hidden;
}

.ws-left {
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.ws-main {
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  /* Standard workspace content: match the left context controls rather than
     inheriting Bootstrap's larger 16px body text. */
  font-size: var(--yb-text-ui);
}

.ws-right {
  background: #f8f9fa;
  border-left: 1px solid #dee2e6;
  overflow-y: auto;
  padding: 1rem 0.875rem;
}

/* Context switcher */
.ws-context-switcher {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.ws-context-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.375rem;
  text-decoration: none;
  color: #495057;
  font-size: var(--yb-text-ui);
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.ws-context-btn:hover {
  background: #e9ecef;
  color: #212529;
}

.ws-context-btn.active {
  background: var(--yb-yellow, #FFC107);
  color: #212529;
}

.ws-context-btn i {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Tree */
.ws-tree-header {
  padding: 0.5rem 0.875rem;
  font-size: var(--yb-text-meta);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  border-bottom: 1px solid #dee2e6;
}

.ws-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.ws-tree-item {
  position: relative;
  display: flex;
  align-items: center;
}

.ws-tree-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: #343a40;
  font-size: var(--yb-text-ui);
  padding: 0.3rem 0.75rem;
  border-radius: 0.25rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-tree-link:hover {
  background: #e9ecef;
  color: #212529;
}

.ws-tree-item.active > .ws-tree-link {
  background: rgba(255, 193, 7, 0.2);
  color: #212529;
  font-weight: 600;
}

.ws-tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-tree-count {
  font-size: var(--yb-text-meta);
  color: #6c757d;
  background: #e9ecef;
  border-radius: 999px;
  padding: 0 0.4rem;
  flex-shrink: 0;
}

.ws-tree-toggle-icon {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  color: #6c757d;
  font-size: var(--yb-text-meta);
}

.ws-tree-depth-0 > .ws-tree-link { padding-left: 0.75rem; font-weight: 600; }
.ws-tree-depth-1 > .ws-tree-link { padding-left: 1.5rem; }
.ws-tree-depth-2 > .ws-tree-link { padding-left: 2.25rem; color: #6c757d; }
.ws-tree-depth-3 > .ws-tree-link { padding-left: 3rem; color: #6c757d; }

/* Main header */
.ws-main-header {
  margin-bottom: 1rem;
}

.ws-breadcrumb {
  margin-bottom: 0.5rem;
}

.ws-breadcrumb .breadcrumb {
  font-size: var(--yb-text-meta);
}

.ws-page-title {
  font-size: var(--yb-text-heading);
  font-weight: 700;
  margin-bottom: 0.1rem;
  line-height: 1.3;
}

.ws-page-subtitle {
  font-size: var(--yb-text-ui);
}

/* KPI grid */
.ws-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ws-kpi-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.ws-kpi-value {
  font-size: var(--yb-text-heading);
  font-weight: 700;
  line-height: 1.2;
  color: #212529;
}

.ws-kpi-label {
  font-size: var(--yb-text-meta);
  color: #6c757d;
  margin-top: 0.15rem;
}

/* Sections */
.ws-section {
  margin-bottom: 1.5rem;
}

.ws-section-title {
  font-size: var(--yb-text-meta);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.ws-section-link {
  font-size: var(--yb-text-meta);
  color: #6c757d;
  text-decoration: none;
}

.ws-section-link:hover { color: #343a40; text-decoration: underline; }

/* Tables */
.ws-table {
  font-size: var(--yb-text-ui);
}

/* Canonical forms and detail pages render inside .ws-main when opened from a
   workspace.  Bootstrap gives controls a root-relative 1rem size, so make
   their ordinary text follow the same compact workspace baseline. */
.ws-main .table,
.ws-main .form-control,
.ws-main .form-select,
.ws-main .form-check-label,
.ws-main .form-label,
.ws-main .btn,
.ws-main .input-group-text,
.ws-main .dropdown-item,
.ws-main .dropdown-header,
.ws-main .alert {
  font-size: var(--yb-text-ui);
}

.ws-main small,
.ws-main .small,
.ws-main .form-text,
.ws-main .page-header-subtitle,
.ws-main .empty-state-description {
  font-size: var(--yb-text-meta);
}

.ws-main .page-header-title {
  font-size: var(--yb-text-heading);
}

.ws-main .section-card-title {
  font-size: var(--yb-text-meta);
}

.ws-main .empty-state-title,
.ws-main h6,
.ws-main .h6 {
  font-size: var(--yb-text-emphasis);
}

/* Bootstrap's .small is metadata in workspace prose, but several existing
   tables and definition lists use it for ordinary record values.  Keep those
   values at the standard UI size without a disruptive template-by-template
   rewrite; muted table cells remain secondary metadata. */
.ws-main td.small:not(.text-muted),
.ws-main th.small,
.ws-main dl.small {
  font-size: var(--yb-text-ui);
}

.ws-main dl.small dt {
  font-size: var(--yb-text-meta);
}

.ws-main dl.small dd {
  font-size: var(--yb-text-ui);
}

/* Per-column autofilter (BUGS.md #1) */
.ws-col-filter .btn-link {
  line-height: 1;
  vertical-align: middle;
  text-decoration: none;
}

.ws-col-filter-menu {
  /* Filter choices are interactive data, not secondary metadata. */
  font-size: var(--yb-text-ui);
  min-width: 200px;
  max-width: 280px;
}

.ws-col-filter-options {
  max-height: 220px;
  overflow-y: auto;
}

.ws-col-filter-options label {
  cursor: pointer;
  font-weight: 400;
}

/* Measurement summary tiles (BUGS.md #8) */
.ws-measurement-tile {
  transition: box-shadow 0.1s, transform 0.1s;
}

.ws-measurement-tile:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-1px);
}

.ws-measurement-tile--oil {
  cursor: pointer;
}

/* Panel tabs */
/* Section row: one line of labelled links. Without JS the strip wraps;
   workspace.js adds --scroll, which keeps it on one line and shows the
   Zurück/Weiter buttons only while the row overflows. */
.ws-panel-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
}

.ws-panel-tabs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.ws-panel-tabs--scroll .ws-panel-tabs-strip {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.ws-panel-tabs--scroll .ws-panel-tabs-strip::-webkit-scrollbar {
  display: none;
}

.ws-panel-tabs-scroll {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #495057;
}

.ws-panel-tabs-scroll[hidden] {
  display: none;
}

.ws-panel-tabs-scroll:hover:not(:disabled) {
  background: #e9ecef;
  color: #212529;
}

.ws-panel-tabs-scroll:disabled {
  opacity: 0.35;
  cursor: default;
}

.ws-panel-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 0.375rem;
  font-size: var(--yb-text-ui);
  white-space: nowrap;
  text-decoration: none;
  color: #495057;
  border: 1px solid transparent;
  transition: background 0.1s;
}

/* Inset so the ring is not clipped by the scrolling strip. */
.ws-panel-tab:focus-visible,
.ws-panel-tabs-scroll:focus-visible {
  outline: 2px solid var(--yb-charcoal);
  outline-offset: -2px;
}

.ws-panel-tab.active:focus-visible {
  outline-color: var(--yb-yellow);
}

.ws-panel-tab:hover {
  background: #e9ecef;
  color: #212529;
}

.ws-panel-tab.active {
  background: #212529;
  color: #ffffff;
  border-color: #212529;
}

/* Action buttons (right rail) */
.ws-actions {
  margin-bottom: 1rem;
}

.ws-action-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.625rem;
  border-radius: 0.375rem;
  font-size: var(--yb-text-ui);
  text-decoration: none;
  color: #212529;
  background: #ffffff;
  border: 1px solid #dee2e6;
  margin-bottom: 0.375rem;
  cursor: pointer;
  transition: background 0.1s;
}

.ws-action-btn:hover { background: #f0f0f0; color: #212529; }
.ws-action-btn--primary { background: var(--yb-yellow, #FFC107); border-color: var(--yb-yellow, #FFC107); font-weight: 600; }
.ws-action-btn--primary:hover { background: #e6ac00; }
.ws-action-btn--disabled { color: #adb5bd; border-color: #e9ecef; cursor: not-allowed; }
.ws-action-btn--disabled:hover { background: #ffffff; }

/* Rail items */
.ws-rail-item {
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  margin-bottom: 0.375rem;
  background: #ffffff;
  border: 1px solid #dee2e6;
}

.ws-rail-item--due { border-left: 3px solid #dc3545; }
.ws-rail-item--decision { border-left: 3px solid #0d6efd; }
.ws-rail-item--ai { border-left: 3px solid #6f42c1; }

.ws-rail-item-title {
  font-size: var(--yb-text-ui);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.125rem;
}

.ws-rail-item-meta {
  font-size: var(--yb-text-meta);
  color: #6c757d;
}

.ws-priority { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }
.ws-priority--hoch { color: #dc3545; }
.ws-priority--mittel { color: #fd7e14; }
.ws-priority--niedrig { color: #6c757d; }

/* Card grid (mandant/object lists) */
.ws-card-grid {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.ws-card-link {
  text-decoration: none;
  color: inherit;
}

.ws-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
  background: #ffffff;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ws-card:hover {
  border-color: #adb5bd;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.ws-card-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #495057;
}

.ws-card-body { flex: 1; min-width: 0; }
.ws-card-title { font-weight: 600; font-size: var(--yb-text-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-card-meta { font-size: var(--yb-text-meta); color: #6c757d; }
.ws-card-arrow { color: #adb5bd; font-size: 0.8rem; }

/* Task/doc lists */
.ws-task-list, .ws-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ws-task-link, .ws-doc-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.25rem;
  text-decoration: none;
  color: #343a40;
  font-size: var(--yb-text-ui);
}

.ws-task-link:hover, .ws-doc-link:hover { background: #f0f0f0; }
.ws-task-meta { margin-left: auto; font-size: var(--yb-text-meta); color: #6c757d; flex-shrink: 0; }

/* Detail list */
.ws-detail-list dt { font-size: var(--yb-text-meta); color: #6c757d; font-weight: 400; }
.ws-detail-list dd { font-size: var(--yb-text-ui); font-weight: 500; }

/* Status pills */
.ws-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  display: inline-block;
}

.ws-pill--open      { background: #f0f0f0; color: #6c757d; }
.ws-pill--inprogress { background: #cfe2ff; color: #084298; }
.ws-pill--blocked   { background: #f8d7da; color: #842029; }
.ws-pill--resolved  { background: #d1e7dd; color: #0a3622; }
.ws-pill--closed    { background: #e2e3e5; color: #41464b; }

/* Responsive — iPad (768px-1024px): collapse right rail below main */
@media (max-width: 1024px) {
  .ws-layout {
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr auto;
    height: auto;
    overflow: visible;
  }

  .ws-right {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    overflow-y: visible;
  }

  .ws-right .ws-section { min-width: 220px; flex: 1; margin-bottom: 0; }
}

/* Responsive — phone (<768px): stack all columns */
@media (max-width: 767.98px) {
  .ws-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .ws-left {
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }

  .ws-right {
    grid-column: 1;
  }
}

/* ── Renter workspace — bucket cards ───────────────────────────────────────── */
.ws-bucket-card {
  transition: box-shadow 0.15s;
  cursor: pointer;
}
.ws-bucket-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10) !important;
}
.ws-bucket-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  flex-shrink: 0;
}

/* ── Kanban board (Service context) ── */
.ws-kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}
.ws-kanban-col {
  background: var(--bs-secondary-bg);
  border-radius: 0.5rem;
  overflow: hidden;
}
.ws-kanban-col-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.75rem;
  font-size: var(--yb-text-ui);
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}
.ws-kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  max-height: 600px;
  overflow-y: auto;
}
.ws-kanban-card {
  display: block;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 0.5rem 0.625rem;
  transition: box-shadow 0.15s;
}
.ws-kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: var(--bs-primary);
}
.ws-kanban-card-title {
  font-size: var(--yb-text-ui);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ws-kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: var(--yb-text-meta);
  color: var(--bs-secondary-color);
}
.ws-kanban-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  font-size: var(--yb-text-ui);
  color: var(--bs-secondary-color);
}
.ws-kanban-card--dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.ws-kanban-col--drop-target {
  outline: 2px dashed var(--bs-primary);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--bs-primary) 8%, transparent);
}
.ws-kanban-col-footer {
  padding: 0.4rem 0.75rem 0.6rem;
  border-top: 1px solid var(--bs-border-color);
}
.ws-kanban-cards.ws-kanban-empty {
  min-height: 3rem;
}

/* ── Accounting (P7) ───────────────────────────────────────────────────────── */

/* Compact journal so VAT code+amount and all columns fit on one line. */
.acc-journal-table {
  font-size: 0.8125rem;
}
.acc-journal-table td,
.acc-journal-table th {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

/* Hierarchy indentation for the grouped Kontenplan and Bilanz/Erfolgsrechnung.
   Used via class names (acc-indent-0 … acc-indent-5) — CSP blocks inline styles. */
.acc-indent-0 { padding-left: 0.5rem; }
.acc-indent-1 { padding-left: 1.5rem; }
.acc-indent-2 { padding-left: 2.5rem; }
.acc-indent-3 { padding-left: 3.5rem; }
.acc-indent-4 { padding-left: 4.5rem; }
.acc-indent-5 { padding-left: 5.5rem; }

/* ── Reporting Centre — guided report builder (Proposal C) ──────────────────
   Three-step wizard: Geltungsbereich → Bericht → Optionen. Step 2/3 content
   is built by reporting_wizard.js from the report registry (JSON script
   tag) — these classes only supply the visual shell. */
.rpt-wizard { min-height: 26rem; }
.rpt-step { padding: 1.25rem; }
.rpt-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: #e7e7e9;
  color: #4e4e53;
  font-size: 0.75rem;
  font-weight: 700;
}
.rpt-step-num.active { background: var(--yb-charcoal); color: #fff; }
.rpt-step-title { font-size: 1rem; font-weight: 700; }
.rpt-step-help { margin: 0.5rem 0 1rem; color: #73737a; font-size: 0.8rem; }
.rpt-tree-line {
  margin: 0.1rem 0 0.75rem 1.6rem;
  padding-left: 0.9rem;
  border-left: 1px solid #d2d2d6;
}
.rpt-tree-group {
  margin: 0.5rem 0 0.15rem;
  color: #73737a;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rpt-scope-row.selected,
.rpt-report-row.selected {
  background: #fff7d9;
  border-radius: 6px;
}
.rpt-report-row { border-radius: 6px; padding: 0.5rem; }
.rpt-report-group {
  margin: 0.9rem 0 0.3rem;
  color: #73737a;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rpt-report-group:first-child { margin-top: 0; }
.rpt-summary-box {
  padding: 0.75rem;
  border: 1px solid var(--yb-offwhite);
  border-radius: 6px;
  background: var(--yb-offwhite);
}
.rpt-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.35rem 0;
  color: #626269;
  font-size: 0.8rem;
}
.rpt-summary-line b { color: var(--yb-charcoal); font-weight: 650; text-align: right; }

/* ── Dashboard (Handlungsbedarf / Warten auf Freigabe) ─────────────────────── */
.dash-card {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  background: #ffffff;
  overflow: hidden;
}
.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #dee2e6;
}
.dash-card-title {
  font-size: var(--yb-text-emphasis);
  font-weight: 700;
  margin: 0;
}
.dash-card-sub {
  font-size: var(--yb-text-meta);
  color: #6c757d;
  margin: 0.125rem 0 0;
}
.dash-horizons { display: block; }
.dash-count {
  flex-shrink: 0;
  font-size: var(--yb-text-meta);
  background: var(--yb-offwhite);
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
}
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eef0f2;
}
.dash-item:last-child { border-bottom: 0; }
.dash-item-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #495057;
}
.dash-item-body { flex: 1; min-width: 0; }
.dash-item-title { font-weight: 600; overflow-wrap: anywhere; }
.dash-item-meta { font-size: var(--yb-text-meta); color: #6c757d; overflow-wrap: anywhere; }
.dash-item-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}
.dash-urgency {
  font-size: var(--yb-text-meta);
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
  white-space: nowrap;
}
.dash-urgency--overdue { background: #f8d7da; color: #842029; }
.dash-urgency--today { background: #ffe69c; color: #664d03; }
.dash-urgency--upcoming { background: #fff3cd; color: #664d03; }
.dash-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-top: 1px solid #dee2e6;
}
.dash-empty { margin: 0; padding: 1rem; color: #6c757d; }
.dash-dropzone {
  border: 2px dashed #adb5bd;
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 1rem 0.75rem;
  text-align: center;
  cursor: default;
}
.dash-dropzone-icon { font-size: 1.5rem; color: #6c757d; }
.dash-dropzone-title { font-weight: 600; margin-top: 0.25rem; }
.dash-dropzone-sub { font-size: var(--yb-text-meta); color: #6c757d; }
.dash-dropzone-status {
  margin-top: 0.625rem;
  font-size: var(--yb-text-meta);
  background: var(--yb-offwhite);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
}
.dash-dropzone-notice { margin-top: 0.5rem; font-size: var(--yb-text-meta); color: #842029; }
@media (max-width: 575.98px) {
  .dash-item { flex-wrap: wrap; }
  .dash-item-side { width: 100%; justify-content: flex-start; }
}
