:root {
  --ssv2-page: #f5f0eb;
  --ssv2-paper: #fff;
  --ssv2-rail: #2d2a26;
  --ssv2-ink: #182235;
  --ssv2-muted: #6b7280;
  --ssv2-line: #e3e7ed;
  --ssv2-warm-line: #d6c5b0;
  --ssv2-box: #f5b948;
  --ssv2-green: #22c55e;
  --ssv2-green-dark: #15803d;
  --ssv2-blue: #2563eb;
  --ssv2-amber: #a16207;
  --ssv2-red: #b91c1c;
  --ssv2-shadow: 0 18px 42px rgba(45, 42, 38, .07);
}

/* Shared authenticated shell: mirrors the approved workspace mockup. */
body.ss-workspace-page { --ss-rail-width: 232px; --ss-topbar-height: 70px; }
.ss-workspace-rail { width: 232px; }
.ss-rail-brand { min-height: 70px; padding: 0 18px; }
.ss-rail-brand svg { width: 34px; height: 34px; }
.ss-rail-brand-name { font-size: 20px; }
.ss-rail-label { margin: 18px 17px 7px; }
.ss-rail-nav { padding: 0 10px; gap: 3px; }
.ss-rail-link { min-height: 39px; padding: 8px 10px; border-radius: 9px; font-size: 12px; }
.ss-rail-link[aria-current="page"] { box-shadow: 0 0 0 3px rgba(34,197,94,.28); }
.ss-rail-count { margin-left: auto; min-width: 21px; padding: 3px 6px; border-radius: 99px; color: #7c4a03; background: #f8dfa4; font-size: 9px; text-align: center; }
.ss-workspace-topbar { min-height: 70px; padding: 0 24px; }
.ss-topbar-inner { max-width: none; }
.ss-global-search { width: min(500px,45vw); }
.ss-global-search input { height: 40px; font-size: 13px; }
.ss-mode-switch { display: inline-flex; padding: 4px; border: 1px solid rgba(99,86,69,.16); border-radius: 10px; background: rgba(255,255,255,.62); }
.ss-mode-switch a { min-width: 62px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; border-radius: 7px; color: var(--ssv2-muted); font-size: 10px; font-weight: 900; text-decoration: none; white-space: nowrap; }
.ss-mode-switch a[aria-current="page"] { color: var(--ssv2-ink); background: white; box-shadow: 0 1px 4px rgba(45,42,38,.1); }
.ss-notification-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid rgba(99,86,69,.18); border-radius: 9px; background: rgba(255,255,255,.78); }
.ss-notification-button span { width: 11px; height: 11px; border-radius: 50%; background: var(--ssv2-ink); }
.ss-profile-button { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 4px; border: 1px solid rgba(99,86,69,.18); border-radius: 9px; color: var(--ssv2-ink); background: rgba(255,255,255,.78); font-size: 11px; font-weight: 850; }
.ss-avatar { width: 27px; height: 27px; display: inline-grid; place-items: center; border-radius: 50%; color: #704007; background: var(--ssv2-box); font-size: 9px; font-weight: 900; }

/* Workspace V2 primitives. Prefixing keeps legacy flow controls stable. */
.ssv2-main { width: 100%; max-width: 1536px; margin: 0 auto; padding: 26px 26px 60px; }
.ssv2-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.ssv2-eyebrow { margin: 0 0 6px; color: var(--ssv2-green-dark); font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.ssv2-page-head h1 { margin: 0; color: var(--ssv2-ink); font-size: clamp(26px,3vw,38px); font-weight: 950; letter-spacing: -.045em; line-height: 1.05; }
.ssv2-page-subtitle { margin: 7px 0 0; color: var(--ssv2-muted); font-size: 13px; line-height: 1.45; }
.ssv2-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ssv2-head-actions .ssv2-button { width:118px; }
.ssv2-button { min-width: 96px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid #d4d9e1; border-radius: 8px; color: #374151; background: white; font-size: 11px; font-weight: 850; text-decoration: none; white-space: nowrap; transition: transform .15s,background .15s,border-color .15s; }
.ssv2-button:hover { background: #f9fafb; border-color: #bac1cc; }
.ssv2-button:active { transform: translateY(1px); }
.ssv2-button.primary { color: white; border-color: var(--ssv2-green-dark); background: var(--ssv2-green-dark); }
.ssv2-button.primary:hover { background: #116b34; }
.ssv2-button.blue { color: white; border-color: var(--ssv2-blue); background: var(--ssv2-blue); }
.ssv2-button.danger { color: var(--ssv2-red); border-color: #fecaca; }
.ssv2-button.small { min-width: 78px; min-height: 32px; padding: 0 10px; font-size: 10px; }
.ssv2-card { overflow: hidden; border: 1px solid var(--ssv2-line); border-radius: 13px; background: var(--ssv2-paper); box-shadow: 0 1px 2px rgba(31,41,55,.03); }
.ssv2-card-head { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--ssv2-line); }
.ssv2-card-title { margin: 0; color: var(--ssv2-ink); font-size: 15px; font-weight: 900; }
.ssv2-card-help { margin: 4px 0 0; color: var(--ssv2-muted); font-size: 10px; line-height: 1.4; }
.ssv2-status { min-width: 72px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border: 1px solid #d8dde5; border-radius: 999px; color: #5f6878; background: #f8fafc; font-size: 8px; font-weight: 900; line-height: 1; white-space: nowrap; }
.ssv2-status.active { color: #087a3d; border-color: #b6edcc; background: #ecfdf3; }
.ssv2-status.review { color: #92550b; border-color: #f4d168; background: #fffbeb; }
.ssv2-status.error { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.ssv2-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.ssv2-metric { min-height: 86px; padding: 15px; border: 1px solid var(--ssv2-line); border-radius: 12px; background: white; }
.ssv2-metric-label { color: #697386; font-size: 9px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.ssv2-metric-value { margin-top: 6px; color: var(--ssv2-ink); font-size: 24px; font-weight: 950; line-height: 1; }
.ssv2-metric-note { margin-top: 6px; color: var(--ssv2-green-dark); font-size: 9px; font-weight: 750; }
.ssv2-dashboard-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(300px,.85fr); gap: 14px; }
.ssv2-start-card { position: relative; overflow: hidden; min-height: 264px; padding: 24px; border: 1px solid #e8c574; border-radius: 14px; background: linear-gradient(135deg,#fffdf6,#fbf0d4); }
.ssv2-start-card::after { content:""; position:absolute; width:260px; height:260px; right:-90px; bottom:-150px; border-radius:50%; background:rgba(34,197,94,.09); }
.ssv2-start-card h2 { max-width: 650px; margin: 0; color: var(--ssv2-ink); font-size: 25px; font-weight: 950; letter-spacing: -.035em; line-height: 1.12; }
.ssv2-start-card > p:not(.ssv2-eyebrow) { max-width: 720px; margin: 10px 0 0; color: #5f6570; font-size: 12px; line-height: 1.55; }
.ssv2-start-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.ssv2-workflow { position: relative; z-index:1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-top: 22px; }
.ssv2-workflow-step { min-height: 43px; display: flex; align-items:center; gap:8px; padding: 8px; border: 1px solid rgba(116,87,38,.14); border-radius: 8px; color:#4b5563; background:rgba(255,255,255,.58); font-size:9px; font-weight:800; }
.ssv2-workflow-step span { width:21px; height:21px; display:inline-grid; place-items:center; flex:none; border-radius:50%; color:white; background:var(--ssv2-ink); font-size:8px; }
.ssv2-side-stack { display:grid; align-content:start; gap:14px; }
.ssv2-attention-row,.ssv2-timeline-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:11px 14px; border-top:1px solid #edf0f4; }
.ssv2-attention-row:first-child,.ssv2-timeline-row:first-child { border-top:0; }
.ssv2-attention-icon { width:26px; height:26px; display:grid; place-items:center; border-radius:8px; color:#8a5209; background:#fff3cf; font-size:11px; font-weight:900; }
.ssv2-attention-copy strong,.ssv2-timeline-copy strong { display:block; color:var(--ssv2-ink); font-size:10px; }
.ssv2-attention-copy span,.ssv2-timeline-copy span { display:block; margin-top:3px; color:var(--ssv2-muted); font-size:9px; }
.ssv2-summary-card { padding:15px; border:1px solid var(--ssv2-line); border-radius:12px; background:white; }
.ssv2-summary-card h3 { margin:0 0 10px; color:var(--ssv2-ink); font-size:12px; font-weight:900; }
.ssv2-summary-row { display:flex; justify-content:space-between; gap:12px; padding:7px 0; border-top:1px solid #edf0f4; color:var(--ssv2-muted); font-size:9px; }
.ssv2-summary-row strong { color:var(--ssv2-ink); text-align:right; }
.ssv2-timeline { margin-top:14px; }
.ssv2-timeline-dot { width:9px; height:9px; border-radius:50%; background:var(--ssv2-green); box-shadow:0 0 0 4px #e8faee; }
.ssv2-timeline-time { color:var(--ssv2-muted); font-size:9px; white-space:nowrap; }
.ssv2-empty { min-height: 250px; display:grid; place-items:center; padding:36px; text-align:center; }
.ssv2-empty-mark { width:50px; height:50px; display:grid; place-items:center; margin:0 auto 12px; border-radius:14px; background:#f4ede5; font-size:24px; }
.ssv2-empty h2 { margin:0; color:var(--ssv2-ink); font-size:17px; font-weight:900; }
.ssv2-empty p { margin:6px 0 0; color:var(--ssv2-muted); font-size:11px; }

/* Batch pipeline: the real intake flow arranged like the approved mockup. */
.ss-batch-workspace {
  width:100%;
  max-width:1536px;
  display:grid;
  grid-template-columns:minmax(0,1.75fr) minmax(270px,.7fr);
  grid-template-areas:"intake sidebar" "current current";
  gap:14px;
  margin:0 auto;
  padding:16px 26px 60px;
}
.ss-batch-intake { grid-area:intake; min-width:0; }
.ss-batch-sidebar { grid-area:sidebar; min-width:0; display:grid; align-content:start; gap:14px; }
.ss-batch-current { grid-area:current; min-width:0; }
.ss-batch-new-card { min-height:520px; }
.ss-batch-new-body { padding:18px; }
.ss-batch-dropzone {
  min-height:190px;
  display:grid;
  place-items:center;
  border-color:#d8c8b5;
  background:linear-gradient(145deg,#fffdf9,#fbf6ef);
}
.ss-batch-dropzone:hover { background:#fffdf7; }
.ss-batch-cluster-callout { border-color:#efd07d !important; background:#fffbeb !important; }
.ss-batch-log { overflow:hidden; }
.ss-batch-log > summary::-webkit-details-marker,
.ss-batch-profile > summary::-webkit-details-marker { display:none; }
.ss-batch-profile-summary {
  min-height:62px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 15px;
  cursor:pointer;
  list-style:none;
}
.ss-batch-profile-summary strong { display:block; color:var(--ssv2-ink); font-size:12px; }
.ss-batch-profile-summary small { display:block; margin-top:3px; color:var(--ssv2-muted); font-size:9px; line-height:1.35; }
.ss-batch-profile[open] .ss-batch-profile-summary { border-bottom:1px solid var(--ssv2-line); }
.ss-batch-current-list { min-height:86px; }
.ss-batch-current-message { margin:0; padding:30px 16px; color:var(--ssv2-muted); font-size:10px; text-align:center; }
.ss-batch-current-row {
  display:grid;
  grid-template-columns:minmax(180px,.9fr) minmax(220px,1.25fr) 92px;
  align-items:center;
  gap:14px;
  min-height:66px;
  padding:10px 16px;
  border-top:1px solid #edf0f4;
}
.ss-batch-current-row:first-child { border-top:0; }
.ss-batch-current-identity { min-width:0; }
.ss-batch-current-title { overflow:hidden; color:var(--ssv2-ink); font-size:11px; font-weight:900; text-overflow:ellipsis; white-space:nowrap; }
.ss-batch-current-meta { margin-top:4px; overflow:hidden; color:var(--ssv2-muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.ss-batch-current-progress { min-width:0; }
.ss-batch-current-progress-line { display:flex; align-items:center; justify-content:space-between; gap:10px; color:#505968; font-size:9px; font-weight:800; }
.ss-batch-current-progress-line span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ss-batch-current-track { width:100%; height:5px; display:block; margin-top:7px; overflow:hidden; border:0; border-radius:99px; background:#e8ebef; }
.ss-batch-current-track::-webkit-progress-bar { background:#e8ebef; }
.ss-batch-current-track::-webkit-progress-value { border-radius:99px; background:var(--ssv2-green); }
.ss-batch-current-track::-moz-progress-bar { border-radius:99px; background:var(--ssv2-green); }
.ss-batch-current-action { justify-self:end; }

/* Quick Snap is a first-class workspace mode on desktop as well as mobile. */
#assembly-dialog { border:0; color:var(--ssv2-ink); }
#assembly-dialog::backdrop { background:rgba(28,25,23,.56); backdrop-filter:blur(2px); }
@media (min-width:861px) {
  #assembly-dialog { width:calc(100vw - 232px); height:calc(100vh - 70px); margin:70px 0 0 232px; border-radius:0; }
  #assembly-dialog > div { min-height:calc(100vh - 70px); }
  #assembly-dialog main { width:min(760px,100%); margin:0 auto; padding:28px; }
}

/* Dense real queue surfaces. */
body.ss-workspace-page #sales-toolbar { gap: 7px; }
body.ss-workspace-page #sales-toolbar .control-select,
body.ss-workspace-page #sales-toolbar .control-input { min-height: 38px; height:38px; padding:0 11px; border-color:#d9dee6; border-radius:8px; background:white; font-size:11px; box-shadow:none; }
body.ss-workspace-page #refresh-btn { min-width:38px; min-height:38px; width:38px; height:38px; padding:8px; }
body.ss-workspace-page .sticky-header { position:static; border:0; box-shadow:none; background:transparent; }
body.ss-workspace-page .sticky-header > .sales-page-head { max-width:1536px; padding:25px 26px 12px; }
body.ss-workspace-page #sales-toolbar { max-width:1536px; padding:0 26px 14px; }
body.ss-workspace-page main[aria-labelledby="sales-heading"] { max-width:1536px; padding:0 26px 60px; }
body.ss-workspace-page .queue-section { border-color:var(--ssv2-line); border-radius:13px; box-shadow:0 1px 2px rgba(31,41,55,.03); }
body.ss-workspace-page #view-financials { overflow:visible; background:white; }
body.ss-workspace-page .batch-queue-row { min-height:50px; padding-top:7px; padding-bottom:7px; }
body.ss-workspace-page .batch-action-button,
body.ss-workspace-page .active-inventory-action { min-width:68px; width:68px; height:30px; min-height:30px; padding:0 7px; border-radius:7px; font-size:9px; }
body.ss-workspace-page .active-inventory-action.ss-row-icon { min-width:32px; width:32px; padding:0; font-size:11px; }
.ss-row-more summary::-webkit-details-marker { display:none; }
.ss-row-more-menu { position:absolute; z-index:35; top:calc(100% + 5px); right:0; min-width:126px; overflow:hidden; border:1px solid var(--ssv2-line); border-radius:8px; background:white; box-shadow:0 12px 30px rgba(31,41,55,.14); }
.ss-row-more-menu a { min-height:34px; display:flex; align-items:center; padding:0 11px; color:#374151; font-size:10px; font-weight:800; text-decoration:none; }
.ss-row-more-menu a:hover { background:#f3f4f6; }
body.ss-workspace-page .active-inventory-status,
body.ss-workspace-page .batch-status-pill { width:72px; min-width:72px; height:20px; font-size:8px; }
body.ss-workspace-page #financials-body > [role="listitem"] { min-height:50px; }
body.ss-workspace-page #financial-snapshot-panel { background:#fbfcfd; }
[data-workspace-view="settings"] > .min-w-0 > .card { margin-bottom:14px !important; box-shadow:0 1px 2px rgba(31,41,55,.03); }
.ss-listing-editor-notice { margin:10px 0 0; padding:10px 11px; border:1px solid #f2cf68; border-radius:9px; color:#854d0e; background:#fffbeb; font-size:10px; line-height:1.45; }
.ss-listing-editor-form input { min-height:38px; border-radius:8px; }

@media (max-width: 1040px) {
  .ssv2-dashboard-grid { grid-template-columns:1fr; }
  .ssv2-side-stack { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ss-batch-workspace {
    grid-template-columns:1fr;
    grid-template-areas:"intake" "sidebar" "current";
  }
  .ss-batch-sidebar { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ss-batch-profile { grid-column:1/-1; }
}
@media (max-width: 860px) {
  .ss-mode-switch { margin-left:auto; }
  .ssv2-main { padding:18px 14px 86px; }
  .ssv2-page-head { align-items:flex-start; flex-direction:column; }
  .ssv2-head-actions { width:100%; justify-content:flex-start; }
  .ssv2-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.ss-workspace-page .sticky-header > .sales-page-head { padding:18px 14px 10px; }
  body.ss-workspace-page #sales-toolbar { padding:0 14px 12px; }
  body.ss-workspace-page main[aria-labelledby="sales-heading"] { padding:0 14px 86px; }
  .ss-batch-workspace { padding:12px 14px 86px; }
}
@media (max-width: 560px) {
  .ss-profile-name,.ss-notification-button { display:none; }
  .ss-profile-button { width:36px; padding:3px; }
  .ssv2-metrics,.ssv2-side-stack { grid-template-columns:1fr; }
  .ssv2-workflow { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ssv2-start-actions,.ssv2-head-actions { display:grid; grid-template-columns:1fr 1fr; }
  .ssv2-start-actions .ssv2-button:first-child { grid-column:1/-1; }
  .ssv2-button { width:100%; min-width:0; padding:0 8px; font-size:10px; }
  .ss-batch-sidebar { grid-template-columns:1fr; }
  .ss-batch-profile { grid-column:auto; }
  .ss-batch-current-row { grid-template-columns:minmax(0,1fr) 76px; gap:8px; }
  .ss-batch-current-progress { grid-column:1/-1; grid-row:2; }
  .ss-batch-current-action { grid-column:2; grid-row:1; }
  .ss-batch-new-body { padding:13px; }
  .ss-batch-dropzone { min-height:160px; }
}
@media (max-width: 390px) {
  .ss-workspace-topbar { padding-inline:8px; }
  .ss-topbar-inner { gap:6px; }
  .ss-mode-switch { padding:3px; }
  .ss-mode-switch a { min-width:48px; height:28px; padding-inline:5px; font-size:9px; }
  .ss-profile-button { width:32px; min-height:32px; }
  .ss-avatar { width:24px; height:24px; }
}
