.usr-overlay { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .48); backdrop-filter: blur(3px); }
.usr-dialog { width: min(1480px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border, #dce3ee); border-radius: 18px; background: var(--panel, #fff); color: var(--text, #172033); box-shadow: 0 24px 80px rgba(15, 23, 42, .2); font-size: 13px; }
.usr-dialog *, .usr-dialog *::before, .usr-dialog *::after { box-sizing: border-box; }
.usr-dialog [hidden] { display: none !important; }
.usr-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 23px 28px 18px; border-bottom: 1px solid var(--border, #dce3ee); }
.usr-eyebrow { color: #4f46e5; font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.usr-header h2 { margin: 5px 0 6px; font-size: 23px; letter-spacing: -.025em; }
.usr-header h2 small { margin-left: 7px; color: var(--muted, #64748b); font-size: 16px; font-weight: 500; }
.usr-header p { margin: 0; color: var(--muted, #64748b); font-size: 12px; }
.usr-close { padding: 4px 12px !important; font-size: 24px !important; line-height: 1.2; }
.usr-nav { display: flex; flex-wrap: wrap; gap: 3px; flex: 0 0 auto; padding: 0 24px; border-bottom: 1px solid var(--border, #dce3ee); background: #f9fafc; }
.usr-nav button { border: 0; border-bottom: 3px solid transparent; padding: 14px 17px 11px; background: transparent; color: #64748b; cursor: pointer; font: inherit; font-size: 12px; font-weight: 650; }
.usr-nav button[aria-current="page"] { border-color: #4f46e5; color: #4338ca; }
.usr-content { min-height: 180px; flex: 1 1 auto; overflow: auto; padding: 24px 28px 30px; overscroll-behavior: contain; }
.usr-content h3 { margin: 0 0 6px; font-size: 17px; }
.usr-content h4 { margin: 24px 0 8px; font-size: 14px; }
.usr-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.usr-section-heading p { margin: 0; font-size: 12px; line-height: 1.65; color: var(--muted, #64748b); }
.usr-subheading { margin-top: 28px; }
.usr-segment { display: inline-flex; flex: 0 0 auto; padding: 3px; border: 1px solid #dbe0ed; border-radius: 10px; background: #f1f4f9; }
.usr-segment button { border: 0; border-radius: 7px; padding: 8px 11px; background: transparent; color: #64748b; font: inherit; font-size: 12px; cursor: pointer; }
.usr-segment button[aria-pressed="true"] { background: #fff; color: #4338ca; box-shadow: 0 1px 5px rgba(15, 23, 42, .1); font-weight: 750; }
.usr-context { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid #dce7f5; border-radius: 10px; background: #f7faff; color: #64748b; font-size: 12px; }
.usr-context b { margin-left: 7px; color: #283954; }
.usr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 12px; }
.usr-kpi { min-width: 0; padding: 17px 18px 13px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fafbfe; }
.usr-kpi > span { display: block; color: #64748b; font-size: 12px; }
.usr-kpi strong { display: block; margin: 8px 0 5px; font-size: 27px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.usr-kpi strong small { margin-left: 6px; color: #64748b; font-size: 12px; font-weight: 500; }
.usr-kpi p { margin: 0; color: #758298; line-height: 1.6; font-size: 11px; }
.usr-kpi.is-fast { border-color: #fbcab3; background: #fff8f0; }
.usr-kpi.is-fast strong { color: #c45b18; }
.usr-kpi.is-standard { border-color: #bae2eb; background: #f2fbfc; }
.usr-kpi.is-standard strong { color: #0f7b86; }
.usr-risk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.usr-risk-kpis strong { font-size: 20px; }
.usr-kpi.is-danger { border-color: #fecaca; background: #fff5f5; }
.usr-kpi.is-danger strong, .usr-loss { color: #c42a3f; }
.usr-note { margin: 10px 0 16px; color: #64748b; font-size: 12px; line-height: 1.8; }
.usr-note b { color: #334155; }
.usr-simple-reason { margin: 17px 0 4px; padding: 13px 16px; border-left: 3px solid #818cf8; border-radius: 0 8px 8px 0; background: #f5f7ff; color: #334155; font-size: 14px; line-height: 1.8; }
.usr-advanced > summary { color: #64748b; font-size: 12px; }
.usr-advanced > .usr-section-heading { margin-top: 20px; }
.usr-alert { margin: 16px 0; padding: 13px 16px; border: 1px solid #f5d69c; border-radius: 11px; background: #fffbef; color: #8a5316; line-height: 1.65; }
.usr-alert strong { font-size: 13px; }
.usr-alert ul { margin: 7px 0 0; padding-left: 20px; font-size: 12px; }
.usr-alert li + li { margin-top: 3px; }
.usr-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 18px 0; padding: 24px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; color: #475569; }
.usr-empty p { max-width: 800px; margin: 0; line-height: 1.8; }
.usr-empty .btn { margin-top: 8px; }
.usr-explain { margin: 16px 0; padding: 14px 16px; border: 1px solid #e0e5ee; border-radius: 11px; background: #fafbfe; line-height: 1.85; }
.usr-explain summary { color: #334155; font-weight: 700; cursor: pointer; }
.usr-explain ol, .usr-explain ul { margin: 12px 0 0; padding-left: 22px; color: #596579; font-size: 12px; }
.usr-explain li + li { margin-top: 9px; }
.usr-explain .usr-table-wrap { margin-top: 12px; }
.usr-explain p { margin-bottom: 0; color: #64748b; font-size: 12px; }
.usr-table-wrap { overflow: auto; border: 1px solid #e1e7ee; border-radius: 10px; }
.usr-dialog table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 12px; }
.usr-dialog th { padding: 10px 12px; background: #f2f5fa; color: #5c6c81; font-size: 11px; font-weight: 650; white-space: nowrap; }
.usr-dialog td { padding: 11px 12px; border-top: 1px solid #e9edf3; color: #334155; vertical-align: top; font-variant-numeric: tabular-nums; }
.usr-dialog td.usr-loss { color: #c42a3f; }
.usr-dialog td small, .usr-dialog th small { display: block; margin-top: 4px; font-size: 10px; font-weight: 400; color: #728199; }
.usr-proposals td b { display: block; margin-top: 4px; }
.usr-proposals td { white-space: nowrap; }
.usr-proposals .usr-reason { min-width: 210px; max-width: 400px; white-space: normal; font-size: 11px; line-height: 1.65; }
.usr-badge { display: inline-block; padding: 3px 6px; border-radius: 5px; font-size: 10px; font-weight: 650; }
.usr-badge.is-fast { background: #fff0d5; color: #a45711; }
.usr-badge.is-standard { background: #e2f3f5; color: #087280; }
.usr-legend { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 15px; }
.usr-legend span { padding: 5px 8px; border-radius: 4px; font-size: 10px; }
.usr-legend .usr-planned { border: 1px dashed #8b98ae; background: #fff; }
.usr-dialog .phase-production { background: #e3efff; color: #345483; }
.usr-dialog .phase-standard { background: #e9e0fa; color: #655086; }
.usr-dialog .phase-matson { background: #fff1b8; color: #846715; }
.usr-dialog .phase-arrival { background: #ffe6d2; color: #99572a; }
.usr-dialog .phase-available { background: #dbefdb; color: #326b3a; }
.usr-timeline { min-width: 2000px; table-layout: fixed; }
.usr-timeline th, .usr-timeline td { width: 70px; border-right: 1px solid #e2e8f0; padding: 8px 6px; font-size: 10px; text-align: center; vertical-align: middle; }
.usr-timeline th:nth-child(1), .usr-timeline td:nth-child(1) { width: 150px; text-align: left; }
.usr-timeline td:nth-child(1) b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; font-size: 10px; }
.usr-timeline th:nth-child(2), .usr-timeline td:nth-child(2) { width: 60px; }
.usr-timeline th:nth-child(3), .usr-timeline td:nth-child(3) { width: 80px; }
.usr-timeline th:nth-child(4), .usr-timeline td:nth-child(4) { width: 115px; }
.usr-timeline tbody .is-planned td { border-top-style: dashed; }
.usr-timeline tbody .is-planned td[class*="phase-"] { box-shadow: inset 0 0 0 1px #b1aac1; border: 1px dashed #b1aac1; }
.usr-timeline tfoot th { text-align: right; }
.usr-timeline tfoot td { font-weight: 700; background: #f5f8ff; }
.usr-timeline-scroll { max-height: clamp(240px, calc(100dvh - 430px), 620px); position: relative; isolation: isolate; }
.usr-timeline thead th { position: sticky; top: 0; height: 48px; z-index: 5; }
.usr-timeline thead th:first-child { left: 0; z-index: 9; }
.usr-timeline tbody td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 2px 0 3px rgba(30, 41, 59, .07); }
.usr-timeline .usr-current-stock td { position: sticky; top: 48px; z-index: 4; height: 84px; border-top: 2px solid #cbd5e1; border-bottom: 2px solid #cbd5e1; background: #fff; }
.usr-timeline .usr-current-stock td:first-child { left: 0; z-index: 8; background: #f1f5f9; }
.usr-timeline .usr-current-stock td:first-child b { color: #334155; font-size: 12px; }
.usr-timeline .usr-stock-week { overflow: hidden; }
.usr-stock-green { position: absolute; top: 17px; height: 23px; border-top: 1px solid #80b980; border-bottom: 1px solid #80b980; background: #b9dfb7; }
.usr-stock-period { position: relative; display: block; margin-bottom: 5px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; color: #23582e; font-size: 9px; font-weight: 650; }
.usr-stock-empty { display: block; color: #7b8799; font-size: 9px; }
.usr-timeline .usr-stock-week small { position: relative; color: #57795c; font-size: 9px; }
.usr-timeline tfoot td, .usr-timeline tfoot th { position: sticky; bottom: 0; z-index: 5; border-top: 2px solid #b8c5d7; }
.usr-timeline tfoot th { left: 0; z-index: 8; background: #edf2f8; }
.usr-timeline tfoot td.usr-week-safe { background: #e5f3e5; color: #286735; }
.usr-timeline tfoot td.usr-week-low { background: #fff0cf; color: #945f16; }
.usr-timeline tfoot td.usr-week-stockout { background: #ffe3e3; color: #b62337; }
.usr-timeline tfoot td.usr-week-unknown { background: #f1f4f8; color: #718096; }
.usr-timeline tfoot td small { color: inherit; }
.usr-timeline .usr-inweek-arrival { margin: 0 0 3px; padding: 2px; background: #ffe6d2; color: #99572a; }
.usr-dialog .usr-timeline-toggle { margin: 0; white-space: nowrap; font-size: 11px; font-weight: 500; }
.usr-daily-table { max-height: 390px; }
.usr-daily-table thead th { position: sticky; top: 0; z-index: 1; }
.usr-below td { background: #fff7f2; }
.usr-chart { margin: 16px 0; padding: 14px 15px 3px; border: 1px solid #e1e7ee; border-radius: 11px; background: #fff; }
.usr-chart figcaption { display: flex; justify-content: space-between; gap: 12px; color: #596b82; font-size: 11px; }
.usr-chart figcaption span { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.usr-chart figcaption i { width: 18px; border-top: 3px solid #4f46e5; }
.usr-chart figcaption i.baseline { border-color: #b1baca; border-top-style: dashed; margin-left: 10px; }
.usr-chart svg { display: block; width: 100%; min-height: 125px; }
.usr-chart svg text { fill: #8090a6; font-size: 10px; }
.usr-chart-threshold { stroke: #d6dce7; stroke-dasharray: 4 4; }
.usr-chart-baseline { stroke: #a4afc0; stroke-width: 1.7; stroke-dasharray: 5 4; fill: none; }
.usr-chart-plan { stroke: #4f46e5; stroke-width: 2.1; fill: none; }
.usr-dialog form { margin: 0 0 20px; }
.usr-dialog fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.usr-dialog label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; color: #526076; font-size: 12px; font-weight: 600; }
.usr-dialog input, .usr-dialog select, .usr-dialog textarea { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid #d6deea; border-radius: 7px; background: #fff; color: #243249; font: inherit; font-weight: 400; }
.usr-dialog input:focus, .usr-dialog select:focus, .usr-dialog textarea:focus { outline: 2px solid #a5b4fc; outline-offset: 1px; border-color: #818cf8; }
.usr-dialog input::placeholder, .usr-dialog textarea::placeholder { color: #94a0b2; font-size: 11px; }
.usr-dialog input:disabled { background: #f3f5f8; color: #7b879a; }
.usr-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; }
.usr-dialog .usr-check { flex-direction: row; align-items: center; font-weight: 500; }
.usr-check input { width: 16px; min-height: 16px; margin: 0; }
.usr-dialog .usr-profit-input { max-width: 290px; }
.usr-batch-editor { padding: 17px; margin: 15px 0 !important; border: 1px solid #c7d2fe; border-radius: 11px; background: #f8faff; }
.usr-batch-editor h4 { margin: 0 0 15px; }
.usr-actions { display: flex; gap: 8px; }
.usr-timeline-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.usr-dialog .usr-week-button { display: block; width: 100%; min-height: 34px; padding: 2px; background: transparent; border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.usr-dialog .usr-week-button:hover { background: #e5eaff; border-radius: 5px; }
.usr-dialog .usr-batch-button { padding: 0; border: 0; background: transparent; color: #4338ca; font: inherit; font-weight: 700; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.usr-dialog .usr-batch-button:hover { text-decoration: underline; }
.usr-quick-batch .usr-actions { flex-wrap: wrap; }
.usr-quick-batch [data-usr-stage-note] { color: #8b5319; }
.usr-event-list article { padding: 16px 0; border-top: 1px solid #e2e8f0; }
.usr-event-list header { display: flex; justify-content: space-between; gap: 15px; color: #334155; }
.usr-event-list header span, .usr-event-list small { color: #728096; font-size: 11px; }
.usr-event-list p { white-space: pre-wrap; line-height: 1.75; margin: 9px 0; }
.usr-footer { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 64px; padding: 12px 28px; border-top: 1px solid #e2e8f0; background: #fafbfe; }
.usr-footer > div:last-child { flex: 0 0 auto; display: flex; gap: 8px; }
.usr-feedback { color: #64748b; font-size: 12px; line-height: 1.65; }
.usr-feedback.is-error { color: #b4233b; }
.usr-feedback.is-success { color: #0f7b63; }
.usr-dialog button:focus-visible, .usr-dialog summary:focus-visible { outline: 2px solid #818cf8; outline-offset: 3px; }
.usr-dialog button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 1000px) {
  .usr-overlay { padding: 10px; }
  .usr-dialog { max-height: calc(100dvh - 20px); }
  .usr-header, .usr-content { padding: 18px; }
  .usr-footer { padding: 12px 18px; }
  .usr-section-heading { align-items: flex-start; flex-direction: column; }
  .usr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usr-risk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .usr-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usr-nav { padding: 0 9px; }
}
@media (max-width: 600px) {
  .usr-overlay { padding: 0; }
  .usr-dialog { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .usr-header h2 { font-size: 19px; }
  .usr-header h2 small { font-size: 13px; }
  .usr-nav button { font-size: 11px; padding: 10px 8px 8px; }
  .usr-kpi { padding: 12px; }
  .usr-kpi strong { font-size: 23px; }
  .usr-risk-kpis { grid-template-columns: 1fr; }
  .usr-form-grid { grid-template-columns: 1fr; }
  .usr-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .usr-chart figcaption { flex-direction: column; }
}

.usr-timeline .usr-current-stock.is-unknown td { background: #f1f5f9; }
.usr-supply-confirm { padding: 10px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; }
