/* One PC workspace; admin, planning and mobile never receive this marker. */
body.user-portal-page[data-cfc-desktop-board] .user-portal-header,
body.user-portal-page[data-cfc-desktop-board] .wood-processing-titlebar,
body.user-portal-page[data-cfc-desktop-board] .wood-processing-summary,
body.user-portal-page[data-cfc-desktop-board] .user-stat-summary { display: none !important; }
body.user-portal-page[data-cfc-desktop-board] {
  background: linear-gradient(135deg, #e7edf1, #f4f7f9 55%, #dde6ec);
}
body.user-portal-page[data-cfc-desktop-board] main.user-portal-shell {
  box-sizing: border-box; width: 100%; max-width: none; min-width: 0;
  margin: 0 auto; padding: 8px 12px 12px; overflow: visible;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px 8px;
  position: relative; z-index: 30; box-sizing: border-box; min-width: 0; min-height: 39px;
  padding: 5px 10px; border: 1px solid #94a3b8; border-radius: 8px 8px 0 0; background: #e8eef2;
}
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel { overflow: visible; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head { margin-top: 0; border-radius: 0; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .cfc-desktop-toolbar { margin: -18px -18px 0; border-top: 0; border-inline: 0; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .cfc-desktop-toolbar.cfc-desktop-toolbar--standalone {
  margin: 0 0 8px; border: 1px solid #94a3b8; border-radius: 8px;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-page-actions { margin-right: auto; min-width: 0; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-page-actions,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-page-actions > div,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-actions {
  display: flex !important; flex-wrap: wrap; align-items: center; gap: 5px;
  min-width: 0; margin-block: 0; padding: 0;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-actions { justify-content: flex-end; }
/* Browser page tools use the original controls in one dropdown. */
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] {
  display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] > [data-billet-notification-slot] { grid-column: 1 / -1; min-width: 0; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] > .cfc-desktop-actions {
  flex-wrap: nowrap; gap: 5px; min-width: 0;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions { min-width: 0; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel {
  position: fixed; z-index: 60; box-sizing: border-box; width: min(282px,calc(100vw - 16px));
  padding: 7px; overflow: auto; overscroll-behavior: contain; border: 1px solid #c5d1df;
  border-radius: 10px; background: #fff; color: #172033; box-shadow: 0 10px 35px #172b4640;
  text-align: left;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .cfc-desktop-page-actions,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .cfc-desktop-page-actions > div,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-tools {
  display: grid !important; grid-template-columns: minmax(0,1fr); gap: 3px; width: 100%; margin: 0;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .cfc-desktop-functions-tools:not(:first-child) {
  border-top: 1px solid #e2e8f0; margin-top: 6px; padding-top: 6px;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel :is(.user-action-button,.user-stat-action) {
  display: flex; justify-content: flex-start; width: 100%; max-width: none; height: auto; min-height: 36px;
  border: 0; border-radius: 6px; padding: 9px 10px; font-size: 12px; text-decoration: none;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .user-stat-edit-control { width: 100%; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .user-stat-edit-control > .user-stat-action-edit { width: 100%; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel .user-import-clock {
  display: block; height: auto; white-space: normal; padding: 8px 10px;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-panel :focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
@media (max-width: 1050px) {
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] > .cfc-desktop-actions { gap: 4px; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] .user-profile-pill { max-width: 140px; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar[data-cfc-functions] > .cfc-desktop-actions .user-action-button { padding-inline: 7px; }
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar [hidden] { display: none !important; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-actions > form { margin: 0; padding: 0; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-action-button,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-profile-pill,
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-stat-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  box-sizing: border-box; height: 28px; min-height: 28px; width: auto; min-width: 0;
  max-width: 240px; margin: 0; padding: 3px 9px; border: 1px solid #94a3b8;
  border-radius: 5px; background: #fff; color: #172033; box-shadow: none;
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.15; white-space: nowrap; cursor: pointer;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar :is(.user-action-button, .user-stat-action):hover { background: #dbeafe; color: #172033; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar svg { width: 14px; height: 14px; flex-shrink: 0; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .profile-avatar { width: 20px; height: 20px; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-profile-pill strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-profile-pill small { display: none; }
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .user-import-clock { font-size: 11px; min-height: 28px; padding: 3px 6px; }
/* Give the main page menu a clear, compact identity within the toolbar. */
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle {
  gap: 8px; height: 30px; min-height: 30px; min-width: 124px; padding: 0 11px;
  border-color: #204b63; border-radius: 7px; background: #24566f; color: #fff;
  box-shadow: 0 1px 2px #12364b24; font-size: 12px; font-weight: 700; line-height: 1;
  transform: none; transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle:hover {
  border-color: #175370; background: #1b637f; color: #fff;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle[aria-expanded="true"] {
  border-color: #153f56; background: #173f56; color: #fff; box-shadow: 0 0 0 3px #0284c71a;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle:focus-visible {
  outline: 2px solid #0284c7; outline-offset: 2px;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle > svg {
  width: 15px; height: 15px; stroke-width: 1.8;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar .cfc-desktop-functions-toggle > .cfc-desktop-functions-chevron {
  width: 12px; height: 12px; margin-left: 2px; opacity: .85; transition: transform 160ms ease;
}
body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-toggle[aria-expanded="true"] .cfc-desktop-functions-chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-toggle,
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-functions-chevron { transition: none; }
}
body.user-portal-page[data-cfc-desktop-board] :is(.user-stat-titlebar, .user-settings-titlebar, .user-portal-welcome, .wood-processing-panel-head) {
  box-sizing: border-box; min-width: 0; min-height: 0; padding: 12px 16px;
  border: 1px solid #8fa0ad; border-bottom: 3px solid #0891b2;
  background: repeating-linear-gradient(135deg, transparent 0 16px, #ffffff08 16px 18px), linear-gradient(110deg, #151e26, #263845);
  color: #fff; box-shadow: none;
}
body.user-portal-page[data-cfc-desktop-kind="workspace"] :is(.user-stat-titlebar, .user-settings-titlebar, .user-portal-welcome) { margin: 0 0 10px; border-radius: 0 0 6px 6px; }
body.user-portal-page[data-cfc-desktop-board] :is(.user-stat-titlebar, .user-settings-titlebar, .user-portal-welcome) h1 {
  margin: 0; color: #fff; font-size: 21px; line-height: 1.2;
}
body.user-portal-page[data-cfc-desktop-board] :is(.user-stat-titlebar, .user-settings-titlebar, .user-portal-welcome) .user-kicker { margin: 0 0 6px; color: #38bdf8; font-size: 9px; }
body.user-portal-page[data-cfc-desktop-board] :is(.user-stat-titlebar, .user-settings-titlebar, .user-portal-welcome) p:not(.user-kicker) { display: none; }
body.user-portal-page[data-cfc-desktop-board] .user-settings-content { margin-top: 0; }
body.user-portal-page[data-cfc-desktop-board] :is(.user-material-panel, .user-import-panel, .user-billet-panel, .user-settings-panel) {
  border-color: #8fa0ad; background: #eef2f5; border-radius: 6px; box-shadow: 0 8px 20px #17232d12;
}
body.user-portal-page[data-cfc-desktop-board] :is(.user-material-toolbar, .user-import-toolbar, .user-billet-toolbar) { gap: 8px; margin-bottom: 10px; }
body.user-portal-page[data-cfc-desktop-board] :is(.user-material-toolbar, .user-import-toolbar, .user-billet-toolbar) h2 { font-size: 18px; }
body.user-portal-page[data-cfc-desktop-board] :is(.user-material-table, .user-import-entry-table, .user-import-history-table, .user-wood-report-table, .user-billet-table) thead th {
  background: #1c2933; color: #fff; border-color: #8fa0ad;
}
body.user-portal-page[data-cfc-desktop-board] .wood-processing-table thead th:not(.processing-col-stage-group):not(.processing-col-delivery-group):not(.processing-col-delivery-child):not(.processing-col-painting-child):not(.processing-col-welding-child):not(.processing-col-grinding-child) { background: #1c2933; color: #fff; }
body.user-portal-page[data-cfc-desktop-board] .user-portal-footer { margin-top: 12px; padding-top: 8px; }
@media (max-width: 1100px) {
  body.user-portal-page[data-cfc-desktop-board] main.user-portal-shell { padding-inline: 8px; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar { padding-inline: 6px; }
}

/* Shared production board contrast, including the former wood paper theme. */
body.user-portal-page[data-cfc-desktop-kind="processing"] {
  --wood-paper: #ffffff; --wood-panel: #eef2f5; --wood-border: #8fa0ad;
  --wood-ink: #172833; --wood-bark-dark: #172833; --wood-muted: #526575;
}
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel {
  padding: 18px; border-color: #8fa0ad; background: #eef2f5; border-radius: 8px;
}
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head { margin: 0 -18px 14px; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head h2 { color: #fff; font-size: 21px; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head .user-kicker { color: #38bdf8; font-size: 9px; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head :is(.wood-processing-month, .wood-processing-row-count, .wood-processing-scale-control) { color: #d5e1e9; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .processing-month-value { color: #7dd3fc; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .processing-panel-month { color: #dff4ff; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-panel-head .wood-processing-scale-control output { color: #fff; background: #304859; }
body.user-portal-page[data-cfc-desktop-kind="processing"] :is(.wood-processing-month-picker input, .wood-processing-search) { border-color: #7890a2; color: #14232e; background: #f7f9fb; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-month-arrow { border-color: #71899b; color: #e3f5ff; background: #334b5c; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-month-arrow:hover { background: #056b9d; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-daily-actions { padding: 10px; border: 1px solid #b1bdc6; border-radius: 6px; background: linear-gradient(180deg, #f7f9fa, #e7ecef); }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-formula-display label { color: #354a5a; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-formula-display textarea { border-color: #8296a5; color: #172833; background: #fff; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-daily-tools :is(.wood-processing-daily-history-toggle, .wood-processing-report-open) { border-color: #506b7e; color: #fff; background: linear-gradient(180deg, #3e5b6f, #263d4d); }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-table-wrap { border: 2px solid #63798a; border-radius: 5px; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-table :is(th, td) { border-color: #b4c3cd; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-table tbody tr:not(.wood-processing-lsx-total):nth-child(even) td { background: #ebf1f5; }
body.user-portal-page[data-cfc-desktop-kind="processing"] .wood-processing-table tbody tr:not(.wood-processing-lsx-total):hover td { background: #dcebf4; }

/* The Windows/web viewport owns one bounded workspace; wide tables scroll. */
@media screen {
  html[data-cfc-desktop-viewport] { width: 100%; height: 100%; overflow: hidden; }
  html[data-cfc-desktop-viewport] body.user-portal-page[data-cfc-desktop-board] {
    box-sizing: border-box; width: 100%; max-width: 100vw; height: 100dvh;
    min-height: 0; margin: 0; overflow: hidden;
  }
  body.user-portal-page[data-cfc-desktop-board] main.user-portal-shell {
    height: 100dvh; max-height: 100dvh; max-width: 100%; min-height: 0;
    overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable;
  }
  body.user-portal-page[data-cfc-desktop-board] main.user-portal-shell > :is(section, form, div),
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-form {
    box-sizing: border-box; min-width: 0; max-width: 100%;
  }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-toolbar { position: sticky; top: -8px; }
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-panel-tools {
    display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%;
  }
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-search { min-width: 180px; max-width: 100%; }
  body.user-portal-page[data-cfc-desktop-board] main.user-portal-shell .cfc-desktop-table-scroll:not(dialog *):not([role="dialog"] *):not(.user-wood-report-preview *):not(.wood-processing-report-overlay *) {
    box-sizing: border-box; min-width: 0; max-width: 100%; min-height: 0 !important;
    height: auto !important; max-height: var(--cfc-table-max-height, 60dvh) !important;
    overflow-x: auto !important; overflow-y: auto !important;
    overscroll-behavior-inline: contain; scrollbar-gutter: stable;
    scrollbar-color: #63798a #e3eaf0; scrollbar-width: auto;
  }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-table-scroll:focus-visible { outline: 2px solid #0891b2; outline-offset: 2px; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-table-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-table-scroll::-webkit-scrollbar-track { background: #e3eaf0; }
  body.user-portal-page[data-cfc-desktop-board] .cfc-desktop-table-scroll::-webkit-scrollbar-thumb { background: #63798a; border: 2px solid #e3eaf0; border-radius: 6px; }
}

@media screen {
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-panel-head { flex-direction: row; flex-wrap: wrap; align-items: center; }
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-panel-head > div:first-child { min-width: 0; flex: 0 1 auto; }
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-panel-tools { flex-direction: row; flex: 1 1 760px; width: auto; gap: 8px; }
  body.user-portal-page[data-cfc-desktop-board] .wood-processing-panel-tools .wood-processing-search { flex: 1 1 280px; width: auto; min-width: 180px; max-width: 420px; }
}
.onlyoffice-session-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
.onlyoffice-session-error[hidden] { display: none !important; }
.onlyoffice-session-error button { white-space: nowrap; }
