:root {
  --prod-green: #1b6261;
  --prod-ink: #173a37;
  --prod-muted: #6b7773;
  --prod-paper: #fbf9f4;
  --prod-line: #ced5cf;
  --prod-blue: #dbe8e7;
  --prod-yellow: #f3e6ad;
  --prod-red: #b85c67;
  --prod-lilac: #e3deeb;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.production-main { max-width: 1760px; margin-left: 240px; padding: 30px 40px 48px; }
.production-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 25px; border-bottom: 1px solid #ced4ce; }
.production-topbar p, .group-panel-heading p, .ledger-heading p, .section-title p { margin: 0 0 5px; color: #6d7a75; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; }
.production-topbar h1, .group-panel-heading h2, .ledger-heading h2, .section-title h2 { margin: 0; color: #23413d; font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; font-weight: 600; }
.production-topbar h1 { font-size: 29px; line-height: 1.2; }
.production-topbar > div > span { display: block; margin-top: 7px; color: #697570; font-size: 13px; }
.topbar-actions { display: grid; grid-template-columns: auto auto; align-items: center; justify-items: end; gap: 7px 9px; }
.topbar-actions small { grid-column: 1 / -1; color: #7a8681; font-size: 9px; font-weight: 500; }
.primary-action { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 9px 14px; border: 1px solid var(--prod-green); border-radius: 6px; background: var(--prod-green); color: #fff; font-size: 12px; font-weight: 700; }
.primary-action svg, .refresh-action svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-action:hover { background: #144e4d; }
.refresh-action { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 9px 12px; border: 1px solid #bfcac3; border-radius: 6px; background: #fff; color: #315c54; font-size: 11px; font-weight: 700; }
.refresh-action:hover { border-color: #78978d; background: #f4f7f4; }
.refresh-action:disabled { cursor: wait; opacity: .65; }
.refresh-action.loading svg { animation: refresh-spin .8s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

.production-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 26px 0 30px; overflow: hidden; border: 1px solid var(--prod-line); border-radius: 7px; background: var(--prod-paper); }
.production-summary > div { position: relative; min-height: 104px; padding: 20px 22px; border-right: 1px solid #d7dcd7; }
.production-summary > div:last-child { border-right: 0; }
.production-summary span, .production-summary small { display: block; color: #697570; }
.production-summary span { font-size: 12px; }
.production-summary b { display: block; margin: 10px 0 4px; color: #1b423e; font-size: 29px; font-variant-numeric: tabular-nums; line-height: 1; }
.production-summary small { font-size: 10px; }
.production-summary > div::after { position: absolute; top: 21px; right: 20px; width: 10px; height: 10px; border-radius: 50%; background: var(--prod-blue); content: ""; }
.production-summary > div:nth-child(2)::after { background: var(--prod-yellow); }
.production-summary > div:nth-child(3)::after { background: #dce9d3; }
.production-summary > div:nth-child(4)::after { background: var(--prod-lilac); }

.today-production, .daily-queue { margin-bottom: 30px; overflow: hidden; border: 1px solid var(--prod-line); border-radius: 7px; background: var(--prod-paper); }
.today-production { border-top: 3px solid var(--prod-green); background: #fff; }
.today-production-heading, .daily-queue-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; padding: 19px 20px 17px; border-bottom: 1px solid #d9ddd9; }
.today-production-heading p, .daily-queue-heading p, .carryover-heading p { margin: 0 0 4px; color: #74817b; font-size: 9px; font-weight: 700; letter-spacing: 1.15px; }
.today-production-heading h2, .daily-queue-heading h2, .carryover-heading h3 { margin: 0; color: #23413d; font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; font-weight: 600; }
.today-production-heading h2, .daily-queue-heading h2 { font-size: 21px; }
.today-production-heading > div > span, .daily-queue-heading > div > span { display: block; margin-top: 5px; color: #77837e; font-size: 10px; }
.daily-date-controls { display: flex; align-items: center; gap: 7px; }
.daily-date-controls button, .daily-date-controls input { height: 36px; border: 1px solid #c6d0c9; border-radius: 5px; background: #fff; color: #315c54; font-size: 11px; }
.daily-date-controls button { min-width: 36px; padding: 0 10px; font-weight: 700; }
.daily-date-controls button:hover { border-color: #78978d; background: #f4f7f4; }
.daily-date-controls input { min-width: 138px; padding: 7px 9px; outline: none; }
.daily-date-controls .queue-today { background: var(--prod-green); color: #fff; border-color: var(--prod-green); }
.selection-library-link { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 11px; border: 1px solid #bdcac3; border-radius: 5px; color: #315c54; font-size: 10px; font-weight: 700; text-decoration: none; }
.selection-library-link:hover { border-color: #78978d; background: #f4f7f4; }

.today-production-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #dfe3df; background: #f2f6f2; }
.today-production-metrics > div { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 10px 18px; border-right: 1px solid #dfe3df; }
.today-production-metrics > div:last-child { border-right: 0; }
.today-production-metrics span { color: #60726b; font-size: 10px; }
.today-production-metrics b { color: #1e514a; font-size: 20px; font-variant-numeric: tabular-nums; }
.today-production-columns, .today-product-row { display: grid; grid-template-columns: minmax(210px, 1.15fr) 116px 138px minmax(230px, 1.25fr) 116px; gap: 16px; }
.today-production-columns { align-items: center; min-height: 36px; padding: 7px 18px; border-bottom: 1px solid #e1e4e0; color: #79857f; font-size: 9px; font-weight: 700; }
.today-product-row { align-items: center; min-height: 94px; padding: 14px 18px; border-bottom: 1px solid #e0e3df; background: #fff; }
.today-product-row:last-child { border-bottom: 0; }
.today-product-row:hover { background: #fdfdfb; }
.today-product-row.is-missing { background: #fffdfa; }
.today-product-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.today-product-identity img, .today-product-placeholder { flex: 0 0 50px; width: 50px; height: 50px; border: 1px solid #d8ddd7; border-radius: 5px; background: #f3f3ed; object-fit: cover; }
.today-product-placeholder { display: grid; place-items: center; color: #8ba098; font-size: 20px; }
.today-product-identity div { min-width: 0; }
.today-product-identity b, .today-product-identity span { display: block; }
.today-product-identity b { overflow: hidden; color: #28443e; font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.today-product-identity span { margin-top: 5px; color: #7a8680; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.today-selection-info, .today-production-status { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.today-selection-info small, .today-production-status small { overflow: hidden; max-width: 100%; color: #7b8781; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.selection-status, .ledger-state { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 4px; background: #e8efeb; color: #315b53; font-size: 9px; font-weight: 700; }
.ledger-state.missing { background: #f5e5d8; color: #8b553d; }
.today-next-action { padding: 9px 11px; border-left: 3px solid #cdddc8; background: #f4f8f2; }
.today-next-action p { display: -webkit-box; margin: 0; overflow: hidden; color: #3d514b; font-size: 10px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.today-product-actions { display: grid; gap: 6px; }
.today-product-actions button, .today-product-actions a { display: grid; min-height: 30px; padding: 6px 8px; place-items: center; border: 1px solid #c7d0ca; border-radius: 5px; background: #fff; color: #365f57; font-size: 9px; font-weight: 700; text-align: center; text-decoration: none; }
.today-product-actions .primary { border-color: var(--prod-green); background: var(--prod-green); color: #fff; }
.today-product-actions button:hover, .today-product-actions a:hover { filter: brightness(.96); }
.today-production-empty { display: grid; min-height: 150px; place-content: center; justify-items: center; padding: 28px; text-align: center; }
.today-production-empty[hidden] { display: none; }
.today-production-empty b { color: #385049; font-size: 13px; }
.today-production-empty span { margin-top: 5px; color: #7e8984; font-size: 10px; }
.today-production-empty a { margin-top: 12px; color: #1b6261; font-size: 10px; font-weight: 700; }

.daily-queue-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #dfe3df; background: #f6f6f1; }
.daily-queue-metrics > div { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 10px 18px; border-right: 1px solid #dfe3df; }
.daily-queue-metrics > div:last-child { border-right: 0; }
.daily-queue-metrics span { color: #6e7b75; font-size: 10px; }
.daily-queue-metrics b { color: #244b45; font-size: 20px; font-variant-numeric: tabular-nums; }

.daily-queue-columns, .daily-queue-row { display: grid; grid-template-columns: minmax(175px, 1.05fr) minmax(250px, 1.6fr) 118px minmax(210px, 1.3fr) 94px; gap: 16px; }
.daily-queue-columns { align-items: center; min-height: 36px; padding: 7px 18px; border-bottom: 1px solid #e1e4e0; color: #79857f; font-size: 9px; font-weight: 700; }
.daily-queue-row { align-items: center; min-height: 102px; padding: 14px 18px; border-bottom: 1px solid #e0e3df; background: #fff; }
.daily-queue-row:last-child { border-bottom: 0; }
.daily-queue-row:hover { background: #fdfdfb; }
.queue-product, .queue-stage, .queue-actions { min-width: 0; }
.queue-product b, .queue-product span { display: block; }
.queue-product b { overflow-wrap: anywhere; color: #28443e; font-size: 12px; line-height: 1.45; }
.queue-product span { margin-top: 5px; color: #7a8680; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.queue-completed time { color: #78857f; font-size: 9px; font-weight: 700; }
.queue-completed p, .queue-next p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: #465b55; font-size: 10px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.queue-stage { display: grid; justify-items: start; gap: 6px; }
.queue-stage small { color: #818c87; font-size: 9px; }
.queue-next { padding: 9px 11px; border-left: 3px solid #e5d493; background: #faf7ed; }
.queue-next p { margin: 0; color: #3d514b; }
.queue-actions { display: grid; gap: 6px; }
.queue-actions button, .carryover-row button { min-height: 30px; border: 1px solid #c7d0ca; border-radius: 5px; background: #fff; color: #365f57; font-size: 9px; font-weight: 700; }
.queue-actions button:first-child, .carryover-row button { border-color: var(--prod-green); background: var(--prod-green); color: #fff; }
.queue-actions button:hover, .carryover-row button:hover { filter: brightness(.96); }
.daily-queue-empty { display: grid; min-height: 130px; place-content: center; justify-items: center; padding: 28px; text-align: center; }
.daily-queue-empty[hidden] { display: none; }
.daily-queue-empty b { color: #385049; font-size: 13px; }
.daily-queue-empty span { margin-top: 5px; color: #7e8984; font-size: 10px; }

.carryover-block { border-top: 1px solid #d9ddd9; background: #f3f2ec; }
.carryover-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 15px 18px 11px; }
.carryover-heading h3 { font-size: 17px; }
.carryover-heading > span { color: #77837e; font-size: 9px; }
.carryover-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #dfe2de; }
.carryover-row { display: grid; grid-template-columns: minmax(145px, 1fr) 105px minmax(170px, 1.2fr) 76px; align-items: center; gap: 12px; min-height: 82px; padding: 12px 18px; border-right: 1px solid #dfe2de; border-bottom: 1px solid #dfe2de; background: #faf9f5; }
.carryover-row:nth-child(even) { border-right: 0; }
.carryover-status { display: grid; justify-items: start; gap: 5px; }
.carryover-status small { color: #7b8781; font-size: 8px; }
.carryover-row > p { display: -webkit-box; margin: 0; overflow: hidden; color: #465a54; font-size: 9px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.carryover-row button { padding: 6px 8px; }
.carryover-empty { margin: 0; padding: 20px; border-top: 1px solid #dfe2de; color: #78847e; font-size: 10px; text-align: center; }
.carryover-empty[hidden] { display: none; }

.record-workspace { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 540px; overflow: hidden; border: 1px solid var(--prod-line); border-radius: 7px; background: #fff; }
.group-panel { border-right: 1px solid var(--prod-line); background: #f4f3ed; }
.group-panel-heading { padding: 20px 18px 15px; border-bottom: 1px solid #d9ddd9; }
.group-panel-heading h2 { font-size: 19px; }
.group-list { display: grid; padding: 8px; }
.group-button { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 55px; padding: 9px 10px; border: 0; border-radius: 5px; background: transparent; color: #3d524d; text-align: left; }
.group-button:hover { background: #e9ece5; }
.group-button.active { background: #fff; box-shadow: inset 3px 0 0 var(--prod-green), 0 1px 3px #173a3712; }
.group-button span { min-width: 0; }
.group-button b, .group-button small { display: block; }
.group-button b { color: #294842; font-size: 13px; }
.group-button small { margin-top: 3px; overflow: hidden; color: #808b86; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.group-button strong { display: grid; min-width: 24px; height: 24px; padding: 0 6px; place-items: center; border-radius: 12px; background: #e4e8e2; color: #68756f; font-size: 10px; font-variant-numeric: tabular-nums; }
.group-button.active strong { background: var(--prod-blue); color: #28534d; }
.group-button.group-special { background: #f7faf7; }
.group-button.group-special.special-first { position: relative; margin-top: 13px; }
.group-button.group-special.special-first::before { position: absolute; top: -7px; right: 8px; left: 8px; height: 1px; background: #d4dad4; content: ""; }
.group-button.group-special b { color: #215b54; }

.ledger-panel { min-width: 0; }
.ledger-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; min-height: 92px; padding: 18px 20px; border-bottom: 1px solid var(--prod-line); background: var(--prod-paper); }
.ledger-heading h2 { font-size: 21px; line-height: 1.25; }
.ledger-heading > div > span { display: block; margin-top: 6px; color: #77837e; font-size: 10px; }
.ledger-filters { display: flex; gap: 8px; }
.ledger-filters input, .ledger-filters select { height: 36px; border: 1px solid #cbd3cd; border-radius: 5px; background: #fff; color: #29433d; outline: none; }
.ledger-filters input { width: 230px; padding: 7px 10px; }
.ledger-filters select { min-width: 100px; padding: 7px 9px; }
.ledger-filters input:focus, .ledger-filters select:focus { border-color: #789a83; box-shadow: 0 0 0 3px #789a8324; }
.ledger-columns, .record-main { display: grid; grid-template-columns: minmax(170px, 1.25fr) 150px minmax(210px, 1.55fr) minmax(190px, 1.35fr) 118px; gap: 16px; }
.ledger-columns { align-items: center; min-height: 38px; padding: 8px 18px; border-bottom: 1px solid #e0e3df; background: #f5f6f2; color: #79857f; font-size: 9px; font-weight: 700; }
.record-list { background: #fff; }
.record-row { border-bottom: 1px solid #dfe3df; }
.record-row:last-child { border-bottom: 0; }
.record-row:hover { background: #fdfdfb; }
.record-row.expanded { background: #fcfbf7; }
.record-main { align-items: center; min-height: 112px; padding: 15px 18px; }
.record-main > * { min-width: 0; }
.product-identity > div { display: flex; align-items: flex-start; gap: 8px; }
.product-identity h3 { margin: 0; overflow-wrap: anywhere; color: #253f39; font-size: 13px; line-height: 1.45; }
.priority-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #8da198; }
.priority-dot.high { background: var(--prod-red); }
.priority-dot.medium { background: #d29b43; }
.product-identity > p { margin: 8px 0 0 15px; color: #77837e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.5; }
.product-identity > p span { margin-left: 7px; padding: 2px 5px; border-radius: 3px; background: #edf0eb; color: #5b6d66; font-family: inherit; }
.product-project { display: flex; align-items: flex-start; gap: 6px; margin: 7px 0 0 15px; color: #64736d; font-size: 9px; line-height: 1.45; }
.product-project > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.project-tag { flex: 0 0 auto; padding: 2px 5px; border-radius: 3px; background: #f1dfb7; color: #765b20; font-weight: 700; }
.project-tag.project-series { background: #dce8d4; color: #426342; }
.stage-cell { display: grid; justify-items: start; gap: 8px; }
.stage-cell small { color: #818c87; font-size: 9px; line-height: 1.45; }
.stage-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 4px; background: #e6ece7; color: #446258; font-size: 10px; font-weight: 700; }
.stage-0 { background: #e7e3ef; color: #5b5170; }
.stage-1 { background: #e1e9ef; color: #3f6070; }
.stage-2 { background: #f1e3bd; color: #765b20; }
.stage-3 { background: #f0dfe3; color: #844956; }
.stage-4 { background: #dce9d3; color: #466744; }
.stage-5 { background: #d8e9e2; color: #2f6656; }
.stage-6 { background: #e8e8e5; color: #6d716d; }
.latest-cell time { color: #75817c; font-size: 9px; font-weight: 700; }
.latest-cell p, .next-cell p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: #475c56; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.next-cell span { color: #8b6c30; font-size: 9px; font-weight: 700; }
.next-cell p { color: #3c514b; }
.row-actions { display: grid; gap: 7px; }
.row-actions button, .record-side button, .empty-ledger button { min-height: 32px; border: 1px solid #c7d0ca; border-radius: 5px; background: #fff; color: #365f57; font-size: 10px; font-weight: 700; }
.row-actions button:hover, .record-side button:hover, .empty-ledger button:hover { border-color: #6f978c; background: #f3f7f3; }
.row-actions .record-progress { border-color: var(--prod-green); background: var(--prod-green); color: #fff; }
.row-actions .record-progress:hover { background: #144e4d; }

.record-detail { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, .8fr); gap: 28px; padding: 22px 24px 24px 34px; border-top: 1px solid #e2e5e1; background: #f8f7f2; }
.record-detail[hidden] { display: none; }
.detail-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.detail-title h4, .record-side h4 { margin: 0; color: #314b45; font-size: 11px; }
.detail-title span { color: #85908b; font-size: 9px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 9px; padding-bottom: 17px; }
.timeline li:not(:last-child)::after { position: absolute; top: 12px; bottom: 0; left: 4px; width: 1px; background: #ccd5ce; content: ""; }
.timeline li:last-child { padding-bottom: 0; }
.timeline-dot { z-index: 1; width: 9px; height: 9px; margin-top: 3px; border: 2px solid #f8f7f2; border-radius: 50%; background: #a5b2ac; box-shadow: 0 0 0 1px #a5b2ac; }
.timeline li.latest .timeline-dot { background: var(--prod-green); box-shadow: 0 0 0 1px var(--prod-green); }
.timeline time { color: #78857f; font-size: 9px; font-weight: 700; }
.mini-stage { margin-left: 7px; color: #64736d; font-size: 9px; }
.timeline p { margin: 5px 0 0; color: #40564f; font-size: 11px; line-height: 1.6; }
.record-side { display: grid; align-content: start; gap: 18px; padding-left: 25px; border-left: 1px solid #d9ded9; }
.record-side p { margin: 7px 0 0; color: #52645e; font-size: 10px; line-height: 1.6; }
.record-side code { display: block; margin: 7px 0 9px; overflow-wrap: anywhere; color: #476059; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.55; }
.record-side button { width: 100%; padding: 7px 10px; }
.record-side .edit-record { background: transparent; }
.empty-ledger { display: grid; min-height: 330px; place-content: center; justify-items: center; padding: 34px; text-align: center; }
.empty-ledger[hidden], .record-list[hidden] { display: none; }
.empty-ledger b { color: #385049; font-size: 15px; }
.empty-ledger span { margin-top: 6px; color: #7e8984; font-size: 11px; }
.empty-ledger button { margin-top: 17px; padding: 8px 12px; }

.folder-section { margin-top: 30px; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.section-title h2 { font-size: 20px; line-height: 1.25; }
.text-action { border: 0; background: none; color: #37665e; font-size: 11px; font-weight: 700; }
.text-action:hover { text-decoration: underline; }
.folder-layout { overflow: hidden; border: 1px solid var(--prod-line); border-radius: 7px; background: var(--prod-paper); }
.root-path { display: flex; align-items: center; gap: 18px; padding: 15px 20px; border-bottom: 1px solid #d8ddd8; }
.root-path span { color: #66736d; font-size: 11px; }
.root-path code { min-width: 0; overflow: hidden; color: #294a43; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.folder-flow { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; }
.folder-flow li { min-height: 83px; padding: 15px 18px; border-right: 1px solid #d8ddd8; }
.folder-flow li:last-child { border-right: 0; }
.folder-flow b { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 4px; background: var(--prod-blue); color: #355953; font-size: 9px; }
.folder-flow li:nth-child(2) b { background: #e5e9d9; }
.folder-flow li:nth-child(3) b { background: var(--prod-yellow); }
.folder-flow li:nth-child(4) b { background: var(--prod-lilac); }
.folder-flow span, .folder-flow small { display: block; }
.folder-flow span { margin-top: 7px; color: #29443e; font-size: 12px; font-weight: 700; }
.folder-flow small { margin-top: 2px; color: #7d8983; font-size: 9px; }

dialog { width: min(720px, calc(100% - 28px)); max-height: 90vh; padding: 26px; overflow: auto; border: 1px solid var(--prod-line); border-radius: 8px; background: var(--prod-paper); color: var(--prod-ink); box-shadow: 0 24px 80px #173a3729; }
dialog::backdrop { background: #173a374d; }
.dialog-heading p { margin: 0 0 4px; color: #718079; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.dialog-heading h2 { margin: 0 0 22px; color: #29453f; font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; font-size: 22px; }
.product-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.product-fields label { display: grid; gap: 6px; color: #4e625b; font-size: 11px; font-weight: 700; }
.product-fields label[hidden] { display: none; }
.product-fields .wide { grid-column: 1 / -1; }
.product-fields input, .product-fields select, .product-fields textarea { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #cbd3cd; border-radius: 6px; background: #fff; color: #263e38; outline: none; font-weight: 400; resize: vertical; }
.product-fields input:focus, .product-fields select:focus, .product-fields textarea:focus { border-color: #789a83; box-shadow: 0 0 0 3px #789a8324; }
.form-error { min-height: 19px; margin: 12px 0 0; color: #9c3d4c; font-size: 12px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; margin-top: 14px; }
.dialog-actions button { min-height: 40px; padding: 8px 15px; border: 1px solid #cbd3cd; border-radius: 6px; background: #fff; color: #29443e; }
.dialog-actions .save-product { border-color: var(--prod-green); background: var(--prod-green); color: #fff; }
.dialog-actions .delete-action { border-color: #dec1c5; color: #9c3d4c; }
.production-toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 360px; padding: 11px 15px; border-radius: 6px; background: #1b6261; color: #fff; font-size: 12px; box-shadow: 0 10px 30px #173a3733; }
.production-toast.error { background: #9c3d4c; }

@media (max-width: 1300px) {
  .production-main { padding-right: 26px; padding-left: 26px; }
  .daily-queue-columns, .daily-queue-row { grid-template-columns: minmax(155px, 1fr) minmax(210px, 1.4fr) 108px minmax(180px, 1.15fr) 86px; gap: 12px; }
  .today-production-columns, .today-product-row { grid-template-columns: minmax(185px, 1fr) 105px 125px minmax(190px, 1.1fr) 106px; gap: 12px; }
  .carryover-list { grid-template-columns: 1fr; }
  .carryover-row { border-right: 0; }
  .ledger-columns, .record-main { grid-template-columns: minmax(160px, 1.1fr) 130px minmax(190px, 1.35fr) minmax(175px, 1.2fr) 104px; gap: 12px; }
}

@media (max-width: 1100px) {
  .overview-sidebar { width: 204px; }
  .production-main { margin-left: 204px; }
  .record-workspace { grid-template-columns: 160px minmax(0, 1fr); }
  .daily-queue-columns { display: none; }
  .today-production-columns { display: none; }
  .today-product-row { grid-template-columns: minmax(210px, 1fr) 116px minmax(220px, 1.1fr) 106px; }
  .today-selection-info { display: none; }
  .daily-queue-row { grid-template-columns: minmax(180px, 1fr) 118px minmax(210px, 1.2fr) 88px; }
  .queue-completed { grid-column: 3; grid-row: span 2; }
  .queue-next { grid-column: 1 / 3; }
  .queue-actions { grid-column: 4; grid-row: 1 / span 2; }
  .ledger-columns { display: none; }
  .record-main { grid-template-columns: minmax(180px, 1fr) 135px minmax(210px, 1.35fr) 100px; }
  .next-cell { grid-column: 3; }
  .latest-cell { grid-row: span 2; }
  .row-actions { grid-column: 4; grid-row: 1 / span 2; }
}

@media (max-width: 780px) {
  .production-main { margin: 0; padding: 20px 14px 34px; }
  .production-topbar { padding-bottom: 18px; }
  .production-topbar h1 { font-size: 25px; }
  .production-topbar > div > span { max-width: 260px; font-size: 11px; }
  .production-summary { grid-template-columns: 1fr 1fr; margin: 20px 0; }
  .production-summary > div { min-height: 92px; border-bottom: 1px solid #d7dcd7; }
  .production-summary > div:nth-child(2) { border-right: 0; }
  .production-summary > div:nth-child(n + 3) { border-bottom: 0; }
  .today-production, .daily-queue { margin-bottom: 20px; }
  .today-production-heading, .daily-queue-heading { align-items: flex-start; flex-direction: column; padding: 16px; }
  .daily-date-controls { width: 100%; }
  .daily-date-controls label { flex: 1; }
  .daily-date-controls input { width: 100%; min-width: 0; }
  .today-production-metrics, .daily-queue-metrics { grid-template-columns: 1fr 1fr; }
  .today-production-metrics > div:nth-child(2) { border-right: 0; }
  .today-production-metrics > div:nth-child(-n + 2) { border-bottom: 1px solid #dfe3df; }
  .daily-queue-metrics > div:nth-child(2) { border-right: 0; }
  .daily-queue-metrics > div:nth-child(-n + 2) { border-bottom: 1px solid #dfe3df; }
  .daily-queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 15px 16px; }
  .today-product-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 15px 16px; }
  .today-production-status { justify-items: end; }
  .today-next-action { grid-column: 1 / -1; }
  .today-product-actions { grid-column: 1 / -1; display: flex; }
  .today-product-actions button, .today-product-actions a { flex: 1; }
  .queue-product { grid-column: 1; }
  .queue-stage { grid-column: 2; justify-items: end; }
  .queue-completed, .queue-next, .queue-actions { grid-column: 1 / -1; grid-row: auto; }
  .queue-completed { padding-top: 9px; border-top: 1px solid #e2e5e1; }
  .queue-actions { display: flex; }
  .queue-actions button { flex: 1; }
  .carryover-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .carryover-row { grid-template-columns: minmax(0, 1fr) auto; }
  .carryover-status { justify-items: end; }
  .carryover-row > p { grid-column: 1 / -1; }
  .carryover-row button { grid-column: 1 / -1; }
  .record-workspace { display: block; }
  .group-panel { border-right: 0; border-bottom: 1px solid var(--prod-line); }
  .group-panel-heading { display: none; }
  .group-list { display: flex; gap: 6px; overflow-x: auto; padding: 9px; }
  .group-list { scrollbar-width: none; }
  .group-list::-webkit-scrollbar { display: none; }
  .group-button { flex: 0 0 116px; min-height: 50px; border: 1px solid #d6dbd6; background: #fafaf7; }
  .group-button.active { box-shadow: inset 0 -3px 0 var(--prod-green); }
  .group-button.group-special.special-first { margin-top: 0; margin-left: 6px; }
  .group-button.group-special.special-first::before { top: 7px; bottom: 7px; left: -7px; width: 1px; height: auto; }
  .ledger-heading { align-items: flex-start; flex-direction: column; min-height: 0; padding: 16px; }
  .ledger-filters { width: 100%; }
  .ledger-filters label:first-child { flex: 1; }
  .ledger-filters input { width: 100%; }
  .record-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px; min-height: 0; padding: 16px; }
  .product-identity { grid-column: 1; }
  .product-project { flex-wrap: wrap; }
  .stage-cell { grid-column: 2; justify-items: end; }
  .latest-cell, .next-cell { grid-column: 1 / -1; grid-row: auto; }
  .latest-cell { padding-top: 10px; border-top: 1px solid #e2e5e1; }
  .next-cell { padding: 10px 12px; background: #f8f4e8; }
  .row-actions { display: flex; grid-column: 1 / -1; grid-row: auto; }
  .row-actions button { flex: 1; }
  .record-detail { grid-template-columns: 1fr; gap: 22px; padding: 20px 18px; }
  .record-side { padding: 20px 0 0; border-top: 1px solid #d9ded9; border-left: 0; }
  .folder-flow { grid-template-columns: 1fr 1fr; }
  .folder-flow li { border-bottom: 1px solid #d8ddd8; }
  .folder-flow li:nth-child(2) { border-right: 0; }
  .folder-flow li:nth-child(n + 3) { border-bottom: 0; }
  .product-fields { grid-template-columns: 1fr; }
  .product-fields .wide { grid-column: auto; }
}

@media (max-width: 520px) {
  .production-topbar { gap: 12px; }
  .production-topbar > div > span { display: none; }
  .topbar-actions { grid-template-columns: 40px 40px; gap: 7px; }
  .topbar-actions small { display: none; }
  .topbar-actions button { width: 40px; padding: 0; justify-content: center; }
  .topbar-actions button span, .topbar-actions .primary-action:not(.refresh-action) { font-size: 0; }
  .topbar-actions button svg { width: 17px; }
  .primary-action { white-space: nowrap; }
  .production-summary > div { padding: 17px 15px; }
  .ledger-filters { display: grid; grid-template-columns: 1fr 104px; }
  .root-path { align-items: flex-start; flex-direction: column; gap: 5px; }
  .root-path code { width: 100%; overflow-wrap: anywhere; white-space: normal; }
  .dialog-actions { grid-template-columns: 1fr 1fr; }
  .dialog-actions span { display: none; }
  .dialog-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
