/* Order Management's page structure, shared by every module. */
body[data-page-template='orders'] {
    --order-template-line: #e5eaf1;
    --order-template-muted: #68768a;
}
body[data-page-template='orders'] .workspace-content { padding: 14px 16px; }
body[data-page-template='orders'] .workspace-topbar { min-height:72px; height:72px; flex-basis:72px; }
body[data-page-template='orders'] .workspace-content > :is(main,.page-shell,.migration-shell,.app-shell,.page) {
    width:100%; max-width:none; margin:0; padding:0; min-width:0;
}
body[data-page-template='orders'] .workspace-order-heading {
    display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap;
    gap:8px 12px; margin:0 0 10px; padding:0; border:0; border-radius:0;
    background:none; box-shadow:none; backdrop-filter:none; min-width:0;
}
body[data-page-template='orders'] .workspace-order-heading h1 {
    width:auto; max-width:100%; margin:2px 0; font-size:22px!important;
    line-height:1.35; font-weight:750; text-align:left; color:var(--workspace-ink,#21334d);
}
body[data-page-template='orders'] .workspace-order-heading > :is(.heading,.title-wrap,.workspace-order-heading-copy) { min-width:0; flex:1 1 180px; }
body[data-page-template='orders'] .workspace-order-heading :is(.heading-icon,.title-icon) { display:none; }
body[data-page-template='orders'] .workspace-order-heading :is(p,.subtitle,small) { margin:3px 0 0; font-size:12px; line-height:1.5; color:var(--order-template-muted); }
body[data-page-template='orders'] .workspace-order-heading :is(.topbar-actions,.top-actions,.toolbar,nav) { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
body[data-page-template='orders'] .workspace-order-heading-actions { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
body[data-page-template='orders'] .workspace-order-heading nav > a,
body[data-page-template='orders'] .workspace-order-heading :is(.top-actions,.topbar-actions) > a:not(.assistant-global-tag) {
    display:inline-flex; align-items:center; min-height:32px; padding:6px 10px;
    border:1px solid var(--order-template-line); border-radius:var(--theme-control-radius,4px);
    background:#fff; color:var(--workspace-ink,#21334d); font-size:12px; font-weight:600; text-decoration:none;
}
body[data-page-template='orders'] .workspace-order-heading :is(a,button) { white-space:nowrap; }
body[data-page-template='orders'] .workspace-order-intro {
    background:none; border:0; box-shadow:none; padding:0; margin:0 0 12px;
    border-radius:0; min-width:0; gap:12px;
}
body[data-page-template='orders'] .workspace-order-intro p { font-size:12px; line-height:1.5; color:var(--order-template-muted); }
body[data-page-template='orders'] .workspace-order-intro .hero-kicker { display:none; }
body[data-page-template='orders'] .workspace-order-intro .hero-layout { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
body[data-page-template='orders'] .workspace-order-intro .hero-layout > div:first-child { flex:1 1 320px; min-width:0; }
body[data-page-template='orders'] .workspace-order-intro .hero-mode { display:flex; align-items:center; flex-wrap:wrap; gap:6px; min-width:0; padding:7px 10px; border:1px solid var(--order-template-line); border-radius:4px; }
body[data-page-template='orders'] .workspace-order-intro .hero-mode :is(span,small,strong) { margin:0; font-size:11px; line-height:1.4; }
body[data-page-template='orders'] .workspace-order-panel {
    min-width:0; border:1px solid var(--order-template-line); border-radius:8px;
    padding:12px; background:#fff; box-shadow:none;
}
body[data-page-template='orders'] .workspace-order-panel :is(h2,h3) { font-size:18px; line-height:1.4; }
body[data-page-template='orders'] .workspace-order-panel > .group-heading { display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:10px 12px; margin:-12px -12px 12px; border-bottom:1px solid var(--order-template-line); }
body[data-page-template='orders'] .workspace-order-panel > .group-heading > span:has(h2) { flex:1 1 220px; min-width:0; }
body[data-page-template='orders'] .workspace-order-panel > .group-heading .group-number { width:30px; height:30px; flex:0 0 30px; font-size:12px; border-radius:4px; }
body[data-page-template='orders'] .workspace-order-panel > .group-heading p { margin:3px 0 0; font-size:12px; line-height:1.5; }
body[data-page-template='orders'] .workspace-order-toolbar { gap:6px 8px; margin-top:0; min-width:0; max-width:100%; }
body[data-page-template='orders'] .workspace-content :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select) {
    min-height:34px; padding:6px 10px; font-size:12px; min-width:0; max-width:100%;
}
/* Dialogs live outside workspace-content and need the same readable input inset. */
body[data-page-template='orders'] :is(.workspace-content,dialog) textarea {
    box-sizing:border-box; min-width:0; max-width:100%; padding:10px 12px;
    border:1px solid #d8e0eb; font:inherit; font-size:13px; line-height:1.5;
}
body[data-page-template='orders'] .workspace-content .workspace-control:not(.conversation-row) {
    min-height:32px; padding:6px 10px; font-size:12px; line-height:1.4;
}
body[data-page-template='orders'] .workspace-order-stats {
    display:grid; grid-template-columns:repeat(var(--order-stat-columns,4),minmax(0,1fr));
    gap:10px; margin:16px 0;
}
body[data-page-template='orders'] .workspace-order-stat {
    min-width:0; padding:14px 16px; border:1px solid var(--order-template-line);
    border-radius:8px; box-shadow:none;
}
body[data-page-template='orders'] .workspace-order-stat > :is(span,small) { font-size:12px; line-height:1.5; }
body[data-page-template='orders'] .workspace-order-stat-value { display:block; font-size:26px!important; line-height:1.25; margin-top:6px; font-variant-numeric:tabular-nums; max-width:100%; overflow-wrap:anywhere; white-space:normal; }
body[data-page-template='orders'] .workspace-order-stat-value.workspace-loading { font-size:12px!important; min-height:32px; }
body[data-page-template='orders'] .workspace-table-scroll { max-width:100%; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; border-radius:8px; }
body[data-page-template='orders'] .workspace-order-table { width:100%; border-collapse:collapse; }
body[data-page-template='orders'] .workspace-order-table :is(th,td) { padding:10px 8px; vertical-align:top; line-height:1.45; }
body[data-page-template='orders'] .workspace-order-table th { font-size:10px; font-weight:650; color:var(--order-template-muted); background:#f6f8fc; }
body[data-page-template='orders'] .workspace-order-table td { font-size:12px; border-bottom:1px solid var(--order-template-line); }
body[data-page-template='orders'] .settings-layout { grid-template-columns:minmax(0,1fr); gap:12px; }
body[data-page-template='orders'] .settings-nav { position:static; display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:10px 12px; }
body[data-page-template='orders'] .settings-nav > button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:auto; min-height:34px; padding:6px 10px; grid-template-columns:none; white-space:nowrap; }
body[data-page-template='orders'] .settings-nav :is(.nav-label,.nav-icon,small) { display:none; }
body[data-page-template='orders'] .settings-nav strong { font-size:12px; white-space:nowrap; }
body[data-page-template='orders'].workspace-auth .auth-card { border:1px solid var(--order-template-line); border-radius:8px; box-shadow:none; }
body[data-page-template='orders'].workspace-auth .auth-card h1 { font-size:22px; line-height:1.35; }
@container workspace (max-width:700px) {
    body[data-page-template='orders'] .workspace-order-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
    body[data-page-template='orders'] .workspace-order-stat { padding:12px; }
}
@media(max-width:680px) {
    body[data-page-template='orders'] .workspace-content { padding:10px; }
    body[data-page-template='orders'] .workspace-order-heading { align-items:flex-start; }
    body[data-page-template='orders'] .workspace-order-heading h1 { font-size:19px!important; }
    body[data-page-template='orders'] .workspace-order-panel { padding:10px; }
}
@media(max-height:500px) {
    body[data-page-template='orders'] .workspace-topbar { min-height:48px; height:48px; flex-basis:48px; }
}

/* Shared action rows also apply to dialogs moved outside the content shell. */
body[data-page-template='orders'] :is(.order-actions,.pink-handoff-actions,.form-actions,.modal-footer,.dialog-actions,.assignment-dialog-actions,.top-actions,.topbar-actions,.controls-actions,.form-footer) {
    display:flex; align-items:center; flex-wrap:wrap; gap:8px; min-width:0; max-width:100%;
}
body[data-page-template='orders'] :is(.order-actions,.pink-handoff-actions,.form-actions,.modal-footer,.dialog-actions,.assignment-dialog-actions) > :is(button,.btn,select) {
    flex:0 1 auto; max-width:100%; margin:0; white-space:normal; overflow-wrap:break-word;
}
body[data-page-template='orders'] #orderDetail .order-actions { gap:8px; margin:12px 0; }
body[data-page-template='orders'] #orderDetail .order-detail-grid > div { min-width:0; }
body[data-page-template='orders'] #orderDetail .order-block { min-width:0; }
body[data-page-template='orders'] #orderDetail .order-assignment { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.workspace-profile-link { display:flex; align-items:center; gap:8px; min-width:0; text-decoration:none; }
.workspace-profile-position { color:var(--workspace-ink); font-size:11px; font-weight:600; line-height:1.35; max-width:160px; overflow-wrap:anywhere; }
.workspace-profile-link .avatar { flex:0 0 auto; }
@media(max-width:600px) {
    .workspace-profile-position { max-width:84px; font-size:10px; }
    .workspace-topbar-right { gap:8px; }
    .workspace-breadcrumb { flex:1; }
}

/* Module surfaces use the same type and content inset as Orders. */
body[data-page-template='orders'] :is(.workspace-content,.page-shell,.page-content,.controls,.product-card,.task-item) { font-family:var(--workspace-body-font,'Be Vietnam Pro',Arial,sans-serif); }
body[data-page-template='orders'] .workspace-content :is(h1,h2,h3,h4) { font-family:var(--workspace-heading-font,'Be Vietnam Pro',Arial,sans-serif); }
body[data-page-template='orders'] .workspace-content > .page-shell { width:100%; max-width:none; margin:0; padding:0; }
body[data-page-template='orders'] .page-content { padding:0; }
body[data-page-template='orders'] :is(.catalog-panel,.product-detail,.detail-panel,.task-browser,.task-detail) { min-width:0; max-width:100%; }
body[data-page-template='orders'] .workspace-content :is(.controls,.product-grid,#productGrid) { width:100%; max-width:none; margin-left:0; margin-right:0; }
body[data-page-template='orders'] .workspace-content .workspace { width:100%; min-width:0; margin:12px 0; gap:12px; }
body[data-page-template='orders'] .catalog-panel { padding:12px; }
body[data-page-template='orders'] .product-detail { padding:14px; }
body[data-page-template='orders'] :is(.detail-panel,.catalog-heading,.panel-heading) { margin-bottom:12px; }
body[data-page-template='orders'] :is(.task-list,.product-list) { gap:8px; }
body[data-page-template='orders'] :is(.forecast-actions,.compare-actions,.trend-controls,.range-toggle,.compare-view-switch) { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }

body[data-page-template='orders'] { --workspace-body-font:'Be Vietnam Pro',Arial,sans-serif; --workspace-heading-font:'Be Vietnam Pro',Arial,sans-serif; }
.workspace-language { display:flex; align-items:center; flex-shrink:0; }
.workspace-language select { min-width:0; max-width:126px; min-height:32px; padding:5px 7px; border:1px solid #dfe6ed; border-radius:4px; background:#fff; font:11px var(--workspace-body-font); color:#31556b; }
.workspace-language-guest { display:flex; justify-content:flex-end; padding:12px 16px; }
.workspace-topbar-right { gap:10px; }
@media(max-width:600px) { .workspace-language select { max-width:100px; font-size:10px; } .workspace-topbar-right { gap:6px; } .workspace-profile-position { max-width:64px; } }

@media(max-width:480px) { .workspace-breadcrumb strong { display:none; } .workspace-breadcrumb { flex:0 0 auto; } .workspace-topbar { justify-content:space-between; } }

body[data-page-template='orders'] :is(.catalog-panel,.product-detail,.detail-panel,.task-browser,.task-detail,.grid-item) { border:1px solid var(--order-template-line); border-radius:8px; background:#fff; box-shadow:none; }
body[data-page-template='orders'] #grid-container { width:100%; max-width:none; margin-left:0; margin-right:0; }
body[data-page-template='orders'] .grid-item .card-heading h5 { font-family:var(--workspace-heading-font); font-size:13px; line-height:1.5; }
.workspace-language-guest { position:fixed; top:0; right:0; z-index:10; }

/* Report tabs use the same individual controls and spacing as other action rows. */
body[data-page-template='orders'] :is(.compare-tabs,.range-toggle) {
    display:flex; flex-wrap:wrap; align-items:center; gap:8px;
    min-width:0; max-width:100%; border:0; background:transparent; overflow:visible;
}
body[data-page-template='orders'] :is(.compare-tabs,.range-toggle) > button {
    min-width:0; max-width:100%; height:auto; min-height:34px;
    border:1px solid var(--order-template-line); border-radius:var(--theme-control-radius,4px);
    white-space:normal; overflow-wrap:anywhere;
}

/* Keep small actions readable in toolbars and in ordinary document flow. */
body[data-page-template='orders'] :is(.workspace-content,dialog) :is(.btn.small,.workspace-control.small){padding:8px 12px;min-height:34px}
body[data-page-template='orders'] :is(.workspace-content,dialog) :is(p,.muted,.order-sub,.order-field) + :is(.btn,button.workspace-control){margin-top:10px}
body[data-page-template='orders'] :is(.workspace-content,dialog) :is(.btn,button.workspace-control) + :is(p,.muted,.order-sub,.order-field){margin-top:12px}
