/* Office palette and layout. The sidebar is present only for office roles. */
body.work-mode:has(.office-sidebar) {
  --office-ground: #0e1928;
  --office-rail: #101e30;
  --office-panel: #15263a;
  --office-subtle: #1c3148;
  --office-hover: #223d57;
  --office-selected: #21374e;
  --office-line: #3a5068;
  --office-input: #61758d;
  --office-text: #f1f5fa;
  --office-muted: #b5c6d8;
  --office-accent: #ffb66f;
  --office-action: #ffa653;
  --office-action-text: #152337;
  --office-warning-bg: #3e3022;
  --office-warning: #ffce92;
  --office-success-bg: #193c33;
  --office-success: #a0ebc5;
  --office-danger-bg: #482a39;
  --office-danger: #ffc1cc;
  --office-info-bg: #1d3c5c;
  --office-info: #b9dcff;
  background: var(--office-ground);
  color: var(--office-text);
}
body.work-mode[data-office-theme="light"]:has(.office-sidebar) {
  color-scheme: light;
  --office-ground: #fff;
  --office-rail: #f4f7fa;
  --office-panel: #fff;
  --office-subtle: #f1f5f9;
  --office-hover: #e9eff5;
  --office-selected: #eaf3ff;
  --office-line: #cbd6e1;
  --office-input: #8798ac;
  --office-text: #17283a;
  --office-muted: #4a5d71;
  --office-accent: #195c9e;
  --office-action: #154b7d;
  --office-action-text: #fff;
  --office-warning-bg: #fff1dc;
  --office-warning: #7b4409;
  --office-success-bg: #e7f5ec;
  --office-success: #15603d;
  --office-danger-bg: #fbe9ed;
  --office-danger: #92213a;
  --office-info-bg: #e5f1ff;
  --office-info: #194f85;
  --bg: var(--office-ground);
  --panel: var(--office-panel);
  --panel2: var(--office-subtle);
  --panel3: var(--office-hover);
  --border: var(--office-line);
  --fg: var(--office-text);
  --muted: var(--office-muted);
  --orange: var(--office-warning);
  --green: var(--office-success);
  --red: var(--office-danger);
  --ring: var(--office-accent);
  --shadow: 0 18px 45px #142e4a30;
}

body.work-mode:has(.office-sidebar) .work-header.office-sidebar {
  background: var(--office-rail);
  border-color: var(--office-line);
}
body.work-mode:has(.office-sidebar) .office-sidebar .brand-word,
body.work-mode:has(.office-sidebar) .office-sidebar .work-role { color: var(--office-text); }
body.work-mode:has(.office-sidebar) .office-sidebar .brand-baza,
body.work-mode:has(.office-sidebar) .office-sidebar .brand-symbol { color: var(--office-accent); }
body.work-mode:has(.office-sidebar) .office-sidebar .work-account { border-color: var(--office-line); }
body.work-mode:has(.office-sidebar) .office-sidebar :is(.brand-caption,.office-nav-caption,.work-role small,.work-online,.work-exit) {
  color: var(--office-muted);
}
body.work-mode:has(.office-sidebar) .office-sidebar .work-online.office-offline { color: var(--office-danger); }
body.work-mode:has(.office-sidebar) .office-sidebar .work-online:before { background: var(--office-success); box-shadow: none; }
body.work-mode:has(.office-sidebar) .office-sidebar .work-online.office-offline:before { background: var(--office-danger); }
body.work-mode:has(.office-sidebar) .office-account-avatar { background: var(--office-subtle); color: var(--office-accent); border-color: var(--office-line); }
body.work-mode:has(.office-sidebar) .office-sidebar .work-nav button {
  color: var(--office-muted);
  background: transparent;
  min-height: 43px;
  font-size: 14px;
}
body.work-mode:has(.office-sidebar) .office-sidebar .work-nav button:hover,
body.work-mode:has(.office-sidebar) .office-sidebar .work-nav button.active {
  background: var(--office-selected);
  border-color: var(--office-line);
  color: var(--office-text);
}
body.work-mode:has(.office-sidebar) .office-sidebar .work-nav button.active {
  color: var(--office-accent);
  box-shadow: inset 3px 0 var(--office-accent);
}
body.work-mode:has(.office-sidebar) .office-sidebar .sirik-view-scale {
  background: var(--office-subtle);
  color: var(--office-text);
  border-color: var(--office-line);
}
body.work-mode:has(.office-sidebar) .office-sidebar .sirik-view-scale-title { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) .office-sidebar .sirik-view-scale button {
  background: var(--office-panel);
  color: var(--office-text);
  border-color: var(--office-input);
}
body.work-mode:has(.office-sidebar) .office-sidebar .sirik-view-scale button:hover:not(:disabled) { background: var(--office-hover); }

.office-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  min-height: 40px;
  border: 1px solid var(--office-input);
  border-radius: 6px;
  background: var(--office-panel);
  color: var(--office-text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.office-theme-toggle:hover, .office-theme-toggle[aria-pressed="true"] {
  background: var(--office-selected);
  border-color: var(--office-accent);
  color: var(--office-accent);
}

body.work-mode:has(.office-sidebar) .office-sidebar + .work-office :is(.work-hero h1,.production-heading h1,.office-empty h2) { color: var(--office-text); }
body.work-mode:has(.office-sidebar) .office-sidebar + .work-office :is(.work-eyebrow,.section-eyebrow,.work-hero p,.production-heading p,.trash-hint,.office-empty p) { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) .office-sidebar + .work-office :is(.work-hero p,.production-heading p) { font-size: 14px; }
body.work-mode:has(.office-sidebar) :is(.work-hero h1,.production-heading h1) > span { color: var(--office-accent); }
body.work-mode:has(.office-sidebar) .office-sidebar + .work-office .work-filterbar { border-color: var(--office-line); margin-bottom: 16px; }
body.work-mode:has(.office-sidebar) .work-filterbar button {
  border-color: var(--office-line);
  background: var(--office-panel);
  color: var(--office-text);
  min-height: 40px;
  font-size: 13px;
}
body.work-mode:has(.office-sidebar) .work-filterbar button:hover { background: var(--office-hover); color: var(--office-text); }
body.work-mode:has(.office-sidebar) .work-filterbar button.active {
  background: var(--office-selected);
  color: var(--office-accent);
  border-color: var(--office-accent);
}
body.work-mode:has(.office-sidebar) .work-filterbar button small { background: var(--office-subtle); color: var(--office-muted); font-size: 11px; }
body.work-mode:has(.office-sidebar) .office-sidebar + .work-office .work-filterbar button.active small {
  background: var(--office-info-bg);
  color: var(--office-info);
}
body.work-mode:has(.office-sidebar) .work-filterbar button[data-filter="attention"] small { background: var(--office-warning-bg); color: var(--office-warning); }

.office-search-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 17px; }
.office-search { position: relative; width: min(100%, 378px); display: block; }
.office-search > svg { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); pointer-events: none; color: var(--office-muted); }
body.work-mode:has(.office-sidebar) .office-search input { width: 100%; min-height: 42px; padding: 8px 12px 8px 40px; font-size: 14px; border-radius: 6px; }
.office-search-result { color: var(--office-muted); font-size: 13px; }
.office-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.office-search-empty { padding: 14px; border: 1px solid var(--office-line); border-radius: 7px; color: var(--office-muted); margin: 0; }
.office-job-list [hidden] { display: none !important; }

body.work-mode:has(.office-sidebar) :is(.office-job-list .work-job,.office-workspace-grid > .office-detail-panel,.office-empty) {
  background: var(--office-panel);
  border-color: var(--office-line);
  box-shadow: none;
}
body.work-mode:has(.office-sidebar) .office-job-list .work-job.expanded { background: var(--office-selected); border-color: var(--office-accent); box-shadow: inset 3px 0 var(--office-accent); }
body.work-mode:has(.office-sidebar) .office-job-list .work-job-heading { padding: 13px 15px; gap: 8px; color: var(--office-text); }
body.work-mode:has(.office-sidebar) .office-job-list .work-job-heading:hover { background: var(--office-hover); }
body.work-mode:has(.office-sidebar) .office-job-list .work-job-title b { font-size: 15px; color: var(--office-text); }
body.work-mode:has(.office-sidebar) .office-job-list :is(.work-job-title small,.work-due,.work-job-count small) { color: var(--office-muted); font-size: 12px; }
body.work-mode:has(.office-sidebar) .office-job-list .work-job-count { color: var(--office-text); font-variant-numeric: tabular-nums; }
body.work-mode:has(.office-sidebar) .office-job-list .office-due-overdue { color: var(--office-danger); font-weight: 700; }
body.work-mode:has(.office-sidebar) .office-job-list .office-job-alert { color: var(--office-warning); font-size: 12px; font-weight: 700; }
body.work-mode:has(.office-sidebar) :is(.office-job-list,.office-detail-panel) .progress { background: var(--office-line); }
body.work-mode:has(.office-sidebar) :is(.office-job-list,.office-detail-panel) .progress > span { background: var(--office-accent); }
body.work-mode:has(.office-sidebar) :is(.office-job-list,.office-detail-panel) .progress.complete > span { background: var(--office-success); }
body.work-mode:has(.office-sidebar) :is(.chip,.office-job-list .work-job-heading .chip) { background: var(--office-subtle) !important; color: var(--office-text); }
body.work-mode:has(.office-sidebar) :is(.chip.orange,.office-job-list .work-job-heading .chip.orange) { background: var(--office-warning-bg) !important; color: var(--office-warning); }
body.work-mode:has(.office-sidebar) :is(.chip.blue,.office-job-list .work-job-heading .chip.blue) { background: var(--office-info-bg) !important; color: var(--office-info); }
body.work-mode:has(.office-sidebar) :is(.chip.green,.office-job-list .work-job-heading .chip.green) { background: var(--office-success-bg) !important; color: var(--office-success); }
body.work-mode:has(.office-sidebar) :is(.chip.red,.office-job-list .work-job-heading .chip.red) { background: var(--office-danger-bg) !important; color: var(--office-danger); }
body.work-mode:has(.office-sidebar) .office-detail-panel :is(h2,h3,.work-composition-line strong,.work-detail-progress strong,.work-composition-line > b) { color: var(--office-text); }
body.work-mode:has(.office-sidebar) .office-detail-panel :is(.office-detail-meta,.work-job-note,.office-detail-progress,.work-detail-progress,.office-composition-title > span,.work-composition-columns,.work-composition-line,.work-composition-line .sku,.work-composition-line > b small,.office-line-kit,.source-list) { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) .office-detail-panel :is(.office-composition-title,.work-composition-columns,.work-composition-line,.work-detail-footer,.source-list) { border-color: var(--office-line); }
body.work-mode:has(.office-sidebar) .office-detail-panel .office-detail-meta { font-size: 13px; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-columns { font-size: 12px; text-transform: none; font-weight: 700; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line { padding-block: 13px; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line strong { font-size: 15px; }
body.work-mode:has(.office-sidebar) .office-detail-panel :is(.work-composition-line .sku,.office-line-kit) { font-size: 12px; }
body.work-mode:has(.office-sidebar) .office-detail-panel .office-line-kit { color: var(--office-text); font-weight: 600; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line > b { font-variant-numeric: tabular-nums; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line.complete > b { color: var(--office-success); }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line.has-change { background: var(--office-warning-bg); border-left-color: var(--office-warning); padding-inline: 8px; }
body.work-mode:has(.office-sidebar) .office-detail-panel .office-change-warning { border-color: var(--office-warning); background: var(--office-warning-bg); color: var(--office-warning) !important; }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line .work-warning { color: var(--office-danger) !important; }
body.work-mode:has(.office-sidebar) .office-detail-panel .source-list { background: var(--office-subtle); }
body.work-mode:has(.office-sidebar) .office-detail-panel .work-detail-footer .btn.red { background: var(--office-danger-bg); color: var(--office-danger); border-color: var(--office-line); }
body.work-mode:has(.office-sidebar) :is(input:not([type="checkbox"]),select,textarea) { background: var(--office-panel); color: var(--office-text); border-color: var(--office-input); }
body.work-mode:has(.office-sidebar) :is(input,textarea)::placeholder { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) :is(input,select,textarea,button,a,summary):focus-visible { outline: 2px solid var(--office-accent); outline-offset: 2px; box-shadow: none; }
body.work-mode:has(.office-sidebar) .field label { color: var(--office-text); }
body.work-mode:has(.office-sidebar) .btn.primary { background: var(--office-action); border-color: var(--office-action); color: var(--office-action-text); }
body.work-mode:has(.office-sidebar) .btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
body.work-mode:has(.office-sidebar) :is(.btn.ghost,.btn.outline) { color: var(--office-text); background: var(--office-panel); border-color: var(--office-input); }
body.work-mode:has(.office-sidebar) :is(.btn.ghost,.btn.outline):hover:not(:disabled) { background: var(--office-hover); }

/* The same semantic colors cover office tools, editing and print controls. */
body.work-mode:has(.office-sidebar) :is(.card,.team-panel,.worker-stat-card,.plan-kpis > div,.stock-row,.report-filters,.production-totals,.team-table,.team-table-scroll,.modal,.modal-body,.label-popup) {
  background: var(--office-panel); border-color: var(--office-line); color: var(--office-text);
}
body.work-mode:has(.office-sidebar) :is(.plan-kpis strong,.stock-main strong,.stock-main > b,.worker-stat-main,.worker-stat-heading h2,.production-products h2,.team-panel h2,.team-table td:first-child strong,.production-totals strong,.modal strong,.catalog-card strong) { color: var(--office-text); }
body.work-mode:has(.office-sidebar) :is(.plan-kpis span,.plan-kpis small,.stock-main small,.stock-heading,.worker-stat-heading p,.production-products > p,.worker-stat-count > span,.worker-stat-meta dt,.worker-stat-last,.team-panel p,.team-people small,.team-table td,.team-table th,.team-table small,.report-effective-range,.production-totals > p,.label-form-product small,.label-form-info,.printer-state span,.printer-state small,.printer-pair-code small,.detail-line .sku,.detail-line .meta,.detail-line .fraction span,.import-product code,.import-product .import-qty) { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) :is(.worker-stat-meta dd,.label-count strong,.label-popup button) { color: var(--office-text); }
body.work-mode:has(.office-sidebar) :is(.worker-stat-link,.catalog-card code,.printer-pair-code strong,.printer-steps p b:first-child,.import-empty > span) { color: var(--office-accent); }
body.work-mode:has(.office-sidebar) :is(.worker-stat-count .kits-count,.team-table .kits-count,.label-complete,.printer-verified) { color: var(--office-success); }
body.work-mode:has(.office-sidebar) :is(.worker-stat-avatar,.modal-head,.modal-foot,.draft-line,.import-empty,.import-total,.detail-line,.printer-state,.team-table tr:nth-child(even),.team-people > div,.stock-detail,.label-popup button:hover,.label-popup button:focus) { background: var(--office-subtle); border-color: var(--office-line); color: var(--office-text); }
body.work-mode:has(.office-sidebar) :is(.worker-stat-meta,.team-table th,.team-table td,.team-people,.stock-heading) { border-color: var(--office-line); }
body.work-mode:has(.office-sidebar) .worker-stat-main:hover { background: var(--office-hover); }
body.work-mode:has(.office-sidebar) .worker-stat-card.selected { border-color: var(--office-accent); box-shadow: none; }
body.work-mode:has(.office-sidebar) :is(.note,.empty) { background: var(--office-subtle); border-color: var(--office-line); color: var(--office-text); }
body.work-mode:has(.office-sidebar) :is(.note.warn,.production-legacy,.line-change,.work-details > .removed-line-changes,.printer-issue,.import-product.unresolved,.printer-pair-code) { background: var(--office-warning-bg); border-color: var(--office-warning); color: var(--office-warning); }
body.work-mode:has(.office-sidebar) :is(.note.danger,.detail-line .caution) { background: var(--office-danger-bg); border-color: var(--office-danger); color: var(--office-danger) !important; }
body.work-mode:has(.office-sidebar) :is(.line-change-added,.import-product,.label-complete) { background: var(--office-success-bg); border-color: var(--office-success); }
body.work-mode:has(.office-sidebar) :is(.line-change strong,.removed-line-changes li > span:last-child,.printer-issue span,.label-pill,.import-warning,.caution) { color: var(--office-warning); }
body.work-mode:has(.office-sidebar) .line-change-added :is(strong,span) { color: var(--office-success); }
body.work-mode:has(.office-sidebar) .label-pill { background: var(--office-warning-bg); }
body.work-mode:has(.office-sidebar) .label-count { color: var(--office-muted); }
body.work-mode:has(.office-sidebar) .label-count > svg { color: var(--office-accent); }
body.work-mode:has(.office-sidebar) .label-count.is-complete > svg { color: var(--office-success); }
body.work-mode:has(.office-sidebar) .label-message { color: var(--office-muted) !important; }
body.work-mode:has(.office-sidebar) .label-error { color: var(--office-danger) !important; }
body.work-mode:has(.office-sidebar) :is(.label-print,.label-menu-toggle) { border-color: var(--office-accent); background: var(--office-panel); color: var(--office-accent); }
body.work-mode:has(.office-sidebar) :is(.label-print,.label-menu-toggle):hover:not(:disabled) { background: var(--office-selected); }
body.work-mode:has(.office-sidebar) .modal-overlay { backdrop-filter: none; }

@media (max-width: 900px) {
  body.work-mode:has(.office-sidebar) .office-sidebar .work-nav button { border-color: var(--office-line); font-size: 12px; }
  body.work-mode:has(.office-sidebar) .office-sidebar .work-account { flex-wrap: wrap; justify-content: flex-end; }
  body.work-mode:has(.office-sidebar) .office-sidebar .office-theme-toggle { min-height: 35px; font-size: 12px; }
}
@media (max-width: 600px) {
  body.work-mode:has(.office-sidebar) .office-sidebar .work-account { flex-direction: column; gap: 4px; }
  body.work-mode:has(.office-sidebar) .office-detail-panel .office-line-kit::before,
  body.work-mode:has(.office-sidebar) .office-detail-panel .work-composition-line > b::after { color: var(--office-muted); }
  body.work-mode:has(.office-sidebar) .work-filterbar button { min-height: 38px; font-size: 12px; }
}
@media print { .office-search-bar { display: none !important; } }
