/* One production desk: a vertical order flow and the day's schedule. */
.crm-dashboard-page {gap:14px;}
.crm-dashboard-header {padding-bottom:4px;width:100%;max-width:1440px;align-self:center;}
.crm-dashboard-header h1 {font-size:22px;letter-spacing:-.025em;}
.crm-dashboard-header p {margin-top:4px;font-size:13px;line-height:1.5;}
.crm-dashboard-actions {display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.crm-dashboard-actions .po-primary {background:var(--gold);border-color:var(--gold);color:var(--on-accent);}
.crm-dashboard-actions .po-primary:hover:not(:disabled) {background:var(--gold-hi);border-color:var(--gold-hi);color:var(--on-accent);}
.crm-dashboard {display:grid;grid-template-columns:minmax(0,1fr) clamp(300px,33vw,420px);gap:24px;flex:1;min-height:0;min-width:0;overflow:hidden;width:100%;max-width:1440px;align-self:center;}
.crm-dashboard-demo {grid-template-columns:minmax(0,1fr);}
.crm-dashboard>.crm-agenda-sidebar {min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding:0 4px 16px 0;}
.crm-dashboard-board {display:flex;flex-direction:column;gap:12px;min-height:0;min-width:0;}
.crm-dashboard-toolbar.po-toolbar {display:flex;flex-wrap:wrap;align-items:center;gap:8px;}
.crm-order-search {display:flex;gap:6px;flex:1 1 240px;min-width:0;}
.crm-order-search input {width:100%;flex:1;min-width:0;}
.crm-order-search .po-button {flex:none;}
.crm-dashboard-toolbar .po-filter-toggle {display:inline-flex;}
.crm-dashboard-toolbar .po-filter-options {display:none;}
.crm-dashboard-toolbar .po-filter-options.open {display:flex;flex:1 1 100%;flex-wrap:wrap;gap:8px;}
.crm-dashboard-toolbar .po-filter-options select {flex:1 1 155px;}
.crm-dashboard-metrics.po-metrics {display:flex;flex-wrap:wrap;gap:8px 18px;padding:2px 0 4px;border:0;}
.crm-dashboard-metrics.po-metrics>div {display:flex;align-items:baseline;gap:7px;flex:none;padding:0;border:0;}
.crm-dashboard-metrics.po-metrics dt {margin:0;font-size:12px;}
.crm-dashboard-metrics.po-metrics dd {font-size:13px;font-variant-numeric:tabular-nums;font-weight:600;}
.crm-dashboard-orders {display:flex;flex:1;min-height:0;min-width:0;overflow:hidden;}
.crm-dashboard-orders.crm-order-stream {display:block;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding-right:4px;}
.crm-order-stream>.production-order-cards,.crm-order-stream>.po-list {overflow:visible;min-height:auto;flex:none;}
.crm-dashboard-list {flex:1;min-width:0;padding:8px;background:var(--bg2);}
.crm-dashboard-list .po-order {padding:14px 10px;}
.crm-board-empty {display:flex;align-items:center;gap:12px;justify-content:space-between;padding:14px 16px;border:1px dashed var(--steel-hi);border-radius:8px;background:var(--bg2);}
.crm-board-empty p {margin:0;color:var(--txt-lo);font-size:12px;line-height:1.6;max-width:52ch;}
.crm-board-empty .po-button {flex:none;}
.crm-no-matches {font-size:13px;color:var(--txt-lo);padding:18px 10px;}
.crm-dashboard-page.po-has-editor {padding:0;}
.crm-dashboard-page.po-has-editor>.po-workspace {display:flex;min-width:0;overflow:hidden;}
.crm-dashboard-page .po-workspace>.po-editor {flex:1;padding:18px 22px 0;}
.crm-dashboard-page :is(button,input,select):focus-visible {outline:2px solid var(--gold);outline-offset:2px;}

.crm-clients-dialog.tp-modal {display:flex;flex-direction:column;width:min(1160px,calc(100vw - 40px));height:min(820px,calc(var(--shell-viewport-height,100dvh) - 40px - var(--shell-safe-top,0px) - var(--shell-safe-bottom,0px)));max-height:calc(var(--shell-viewport-height,100dvh) - 24px);padding:0;gap:0;overflow:hidden;color:var(--txt);}
.crm-window-header {display:flex;flex:none;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid var(--steel);background:var(--bg2);}
.crm-window-header h2 {margin:0;font:650 19px var(--font-ui);color:var(--txt-hi);}
.crm-clients-dialog>.crm-clients {flex:1;min-height:0;height:auto;}
.crm-clients-dialog .crm-header h2 {display:none;}
.crm-clients-dialog :is(input:not([type=checkbox]),textarea,select) {min-height:40px;max-width:100%;box-sizing:border-box;border:1px solid var(--steel-hi);border-radius:6px;background:var(--steel-lo);color:var(--txt-hi);padding:10px 11px;font:13px var(--font-ui);}
.crm-clients-dialog textarea {resize:vertical;line-height:1.6;}
.crm-clients-dialog input[type=checkbox] {accent-color:var(--gold);}
.crm-clients-dialog :is(button,input,textarea,select):focus-visible {outline:2px solid var(--gold);outline-offset:2px;}

@media(max-width:1100px) {
 .crm-dashboard {gap:16px;grid-template-columns:minmax(0,1fr) 300px;}
 .crm-dashboard-toolbar .crm-order-search {flex-basis:100%;}
}
@media(max-width:850px) {
 .personal-orders-page.crm-dashboard-page:not(.po-has-editor) {display:flex;overflow-y:auto;overflow-x:hidden;}
 .crm-dashboard-header {flex-wrap:wrap;gap:8px;}
 .crm-dashboard-header .crm-dashboard-actions {margin-left:auto;}
 .crm-dashboard {display:flex;flex-direction:column;flex:none;min-height:auto;overflow:visible;gap:24px;}
 .crm-dashboard-board {min-height:auto;}
 .crm-dashboard-orders {display:block;overflow:visible;flex:none;}
 .crm-dashboard-orders.crm-order-stream {overflow:visible;padding-right:0;}
 .crm-dashboard-orders .production-flow {overflow:visible;min-height:auto;padding-right:0;}
 .crm-dashboard-list {overflow:visible;}
 .crm-dashboard>.crm-agenda-sidebar {max-width:none;overflow:visible;}
 .crm-dashboard-metrics.po-metrics {margin-bottom:0;}
}
@media(max-width:550px) {
 .crm-dashboard-page {padding:12px 10px;gap:12px;}
 .crm-dashboard-header h1 {font-size:20px;}
 .crm-dashboard-header p {display:none;}
 .crm-dashboard-header .crm-dashboard-actions {width:100%;margin:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;}
 .crm-dashboard-actions .po-button {font-size:12px;padding:9px 8px;min-height:44px;}
 .crm-dashboard-toolbar.po-toolbar {display:grid;grid-template-columns:minmax(0,1fr) auto;margin-bottom:0;}
 .crm-dashboard-toolbar .crm-order-search {grid-column:1/-1;flex-basis:auto;}
 .crm-dashboard-toolbar .pc-segmented {grid-column:auto;justify-self:start;}
 .crm-dashboard-toolbar .pc-segmented button {min-height:44px;padding:8px 12px;font-size:12px;}
 .crm-dashboard-toolbar .po-filter-toggle {min-height:44px;font-size:12px;}
 .crm-dashboard-toolbar .po-filter-options.open {grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
 .crm-dashboard-toolbar .po-filter-options select {width:100%;font-size:14px;}
 .crm-dashboard-metrics.po-metrics {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;padding:0;}
 .crm-dashboard-metrics.po-metrics>div {display:flex;flex-direction:column;gap:2px;min-width:0;}
 .crm-dashboard-metrics.po-metrics dt {font-size:12px;line-height:1.5;white-space:nowrap;}
 .crm-dashboard-metrics.po-metrics dd {font-size:14px;}
 .crm-board-empty {align-items:flex-start;flex-direction:column;gap:10px;padding:12px;}
 .crm-clients-dialog.tp-modal {width:calc(100vw - 12px);height:calc(var(--shell-viewport-height,100dvh) - 16px - var(--shell-safe-top,0px) - var(--shell-safe-bottom,0px));}
 .crm-window-header {padding:12px;}
 .crm-window-header h2 {font-size:17px;}
 .crm-clients-dialog :is(input:not([type=checkbox]),textarea,select) {font-size:16px;}
 .crm-dashboard-page .po-workspace>.po-editor {padding:14px 12px 0;}
}
@media(max-height:520px) and (min-width:851px) {
 .crm-dashboard-page {gap:8px;padding:8px 12px;}
 .crm-dashboard-header h1 {font-size:18px;}
 .crm-dashboard-header p {display:none;}
 .crm-dashboard-metrics.po-metrics {display:none;}
 .crm-dashboard-board {gap:8px;}
 .crm-clients-dialog.tp-modal {height:calc(var(--shell-viewport-height,100dvh) - 16px);}
}

/* Workflow colours identify the dot; readable text follows the selected theme. */
.po-list-phase{display:inline-flex;align-items:center;gap:6px;color:var(--txt-hi);font-size:12px;line-height:1.5;white-space:nowrap;}
.po-list-phase i{width:6px;height:6px;flex:none;border-radius:50%;}

/* Dashboard uses its own gaps; the legacy personal-order margins must not add a second gutter. */
.personal-orders-page.crm-dashboard-page:not(.po-has-editor) :is(.po-header,.po-metrics,.po-toolbar){margin-bottom:0;}
