:root {
  --navy: #17365d;
  --blue: #2f75b5;
  --teal: #0f6b78;
  --green: #3f8f58;
  --ink: #172033;
  --muted: #657086;
  --line: #dbe3ef;
  --panel: #ffffff;
  --surface: #f4f7fb;
  --warning: #fff3cd;
  --danger: #b42318;
  --shadow: 0 12px 34px rgba(26, 47, 75, .08);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--surface); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(47,117,181,.24), transparent 32%),
    radial-gradient(circle at 84% 80%, rgba(15,107,120,.2), transparent 34%),
    linear-gradient(135deg, #102640, #17365d 55%, #0f5967);
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255,255,255,.97);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(0,0,0,.25);
  padding: 38px;
}

.brand-mark, .sidebar-brand > img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: block;
  object-fit: cover;
  object-position: center 42%;
  background: #d8d1c7;
  box-shadow: 0 8px 20px rgba(47,117,181,.28);
}

.login-card h1 { margin: 8px 0 4px; font-size: 30px; letter-spacing: -.5px; }
.eyebrow { margin: 18px 0 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; }
.subtle, .hint { color: var(--muted); }
.demo-box { margin-top: 22px; padding: 14px 16px; border-radius: 14px; background: #eef5fb; display: grid; gap: 5px; color: #3b4a62; font-size: 13px; }

.stack-form { display: grid; gap: 15px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #33405a; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd6e5;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,117,181,.12); }
textarea { resize: vertical; }

button, .button-link {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.primary { color: white; background: linear-gradient(135deg, var(--blue), #245c98); box-shadow: 0 7px 16px rgba(47,117,181,.18); }
.primary:hover { filter: brightness(1.05); }
.ghost { color: #33405a; background: #edf2f8; }
.ghost:hover { background: #e3eaf4; }
.success { color: white; background: var(--green); }
.success:hover { filter: brightness(1.05); }
.danger { color: white; background: var(--danger); }
.small { padding: 7px 11px; font-size: 12px; }
.wide { width: 100%; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; color: white; background: linear-gradient(180deg, #132e50, #17365d 62%, #0d4c58); display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 25px; }
.sidebar-brand > img { width: 42px; height: 42px; border-radius: 13px; flex: 0 0 42px; }
.sidebar-brand strong { display: block; font-size: 20px; line-height: 1.2; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav button { text-align: left; justify-content: flex-start; color: #d9e5f3; background: transparent; border-radius: 11px; padding: 11px 14px; }
.sidebar nav button:hover, .sidebar nav button.active { color: white; background: rgba(255,255,255,.12); }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.12); color: #b9cbe1; font-size: 12px; }

.workspace { min-width: 0; }
.topbar { height: 84px; padding: 15px 30px; display: flex; align-items: center; justify-content: space-between; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .eyebrow { margin: 0; }
.topbar h2 { margin: 4px 0 0; font-size: 22px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip span { font-weight: 750; }
.user-chip em { padding: 4px 8px; border-radius: 999px; color: #1c5f38; background: #e4f4ea; font-style: normal; font-size: 11px; font-weight: 800; }
.content { padding: 26px 30px 60px; }
.page-section { display: none; }
.page-section.active { display: block; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.metric-card { padding: 21px; border-radius: 18px; color: white; box-shadow: var(--shadow); background: linear-gradient(145deg, var(--blue), #245d9b); }
.metric-card:nth-child(2) { background: linear-gradient(145deg, var(--teal), #0b525e); }
.metric-card:nth-child(3) { background: linear-gradient(145deg, #536aa6, #3f4f87); }
.metric-card:nth-child(4) { background: linear-gradient(145deg, #bf7d25, #a45d18); }
.metric-card span { opacity: .82; font-size: 13px; }
.metric-card strong { display: block; margin-top: 8px; font-size: 34px; }

.panel { background: var(--panel); border: 1px solid #e2e8f1; border-radius: 18px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 22px; }
.panel-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.panel-heading .eyebrow { margin: 0; }
.panel-heading h3 { margin: 3px 0 0; font-size: 19px; }
.section-return { margin-bottom: 12px; }
.system-setting-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.system-setting-card { min-height: 132px; padding: 20px; border: 1px solid #d8e2ef; border-radius: 16px; text-align: left; justify-items: start; align-content: center; background: linear-gradient(145deg, #f8fbff, #edf4fb); box-shadow: 0 8px 22px rgba(26,47,75,.06); }
.system-setting-card:hover { border-color: #9fc2e1; transform: translateY(-1px); }
.system-setting-card strong { color: var(--navy); font-size: 19px; }
.system-setting-card span { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.55; }
.finance-gate { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.finance-gate .eyebrow { margin-top: 15px; }
.finance-gate h3 { margin: 7px 0; color: var(--navy); font-size: 24px; }
.finance-gate p:not(.eyebrow) { margin: 0 0 22px; color: var(--muted); }
.finance-lock-icon { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, #526a8f, var(--navy)); box-shadow: 0 12px 28px rgba(23,54,93,.2); font-size: 24px; font-weight: 850; }
.finance-placeholder { min-height: 380px; }
.finance-empty { min-height: 260px; border: 1px dashed #b8c8dc; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: var(--muted); background: #f8fafc; text-align: center; }
.finance-empty strong { color: var(--navy); font-size: 20px; }
.finance-workspace { display: grid; gap: 22px; }
.finance-costing-layout { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 22px; align-items: start; }
.costing-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.costing-summary > div { padding: 15px; border: 1px solid #d7e4f1; border-radius: 14px; background: linear-gradient(145deg, #f8fbff, #edf4fb); }
.costing-summary span, .costing-summary strong { display: block; }
.costing-summary span { color: var(--muted); font-size: 12px; }
.costing-summary strong { margin-top: 6px; color: var(--navy); font-size: 21px; }
.costing-order-info { display: grid; gap: 5px; padding: 14px; border-radius: 12px; color: var(--muted); background: #eef5fb; font-size: 12px; }
.costing-order-info strong { color: var(--navy); font-size: 17px; }
.costing-live-result { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 12px; border: 1px solid #d6e2ef; border-radius: 13px; background: #f8fafc; }
.costing-live-result span, .costing-live-result strong { display: block; }
.costing-live-result span { color: var(--muted); font-size: 11px; }
.costing-live-result strong { margin-top: 4px; color: var(--navy); font-size: 16px; }
.positive-value { color: #167044 !important; font-weight: 800; }
.negative-value { color: #b42b3d !important; font-weight: 800; }
.profit-chart { display: grid; gap: 11px; margin-bottom: 20px; }
.profit-chart-row { display: grid; grid-template-columns: 150px minmax(120px, 1fr) 180px; gap: 12px; align-items: center; }
.profit-chart-label, .profit-chart-value { min-width: 0; display: grid; gap: 2px; }
.profit-chart-label strong, .profit-chart-label span, .profit-chart-value strong, .profit-chart-value span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profit-chart-label strong { color: var(--navy); font-size: 12px; }
.profit-chart-label span, .profit-chart-value span { color: var(--muted); font-size: 10px; }
.profit-chart-value { text-align: right; }
.profit-chart-value strong { color: var(--navy); font-size: 12px; }
.profit-track { height: 14px; overflow: hidden; border-radius: 999px; background: #e7edf5; }
.profit-track i { display: block; height: 100%; border-radius: inherit; }
.profit-track i.profit { background: linear-gradient(90deg, #2f75b5, #16845a); }
.profit-track i.loss { background: linear-gradient(90deg, #dc7a49, #b42b3d); }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(10,24,42,.62); backdrop-filter: blur(4px); }
.modal-card { width: min(430px, 100%); padding: 28px; border-radius: 20px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal-card .eyebrow { margin: 0; }
.modal-card h3 { margin: 7px 0; color: var(--navy); font-size: 23px; }
.modal-card > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.split-layout { display: flex; gap: 22px; align-items: flex-start; }
.split-layout > .panel:first-child { flex: 0 0 360px; }
.grow { flex: 1; min-width: 0; }
.narrow-panel { max-width: 580px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 13px; }
.size-fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 14px; padding: 13px; display: grid; grid-template-columns: repeat(7, minmax(72px, 1fr)); gap: 10px; }
.size-fieldset legend { padding: 0 8px; color: var(--navy); font-weight: 800; }
.size-total { align-self: end; min-height: 40px; border-radius: 10px; padding: 10px; color: var(--navy); background: #e8f1fb; display: flex; justify-content: space-between; }
.size-total strong { font-size: 17px; }

.inline-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.inline-tools input, .inline-tools select { width: auto; min-width: 190px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8edf4; text-align: left; vertical-align: middle; font-size: 13px; }
th { color: white; background: var(--blue); white-space: nowrap; }
tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: #eef5fb; }
.cell-main { display: block; color: var(--ink); font-weight: 700; }
.cell-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { padding: 6px 9px; font-size: 11px; }
.tag { display: inline-block; border-radius: 999px; padding: 4px 8px; background: #e7edf6; color: #46566d; font-size: 11px; font-weight: 800; }
.tag.confirmed { color: #1c5f38; background: #e4f4ea; }
.tag.completed { color: #235487; background: #e1effc; }
.tag.viewer { color: #6a4a00; background: #fff0c2; }
.tag.editor { color: #1c5f38; background: #e4f4ea; }
.tag.admin { color: #7a1d3e; background: #fbe5ee; }
.pill { display: inline-block; border-radius: 999px; padding: 4px 8px; color: #46566d; background: #e7edf6; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill.active, .pill.status-confirmed { color: #1c5f38; background: #e4f4ea; }
.pill.inactive { color: #7b2635; background: #f8e2e6; }
.pill.status-completed { color: #235487; background: #e1effc; }
.pill.status-draft { color: #6a4a00; background: #fff0c2; }
.pill.material-missing { color: #8b2635; background: #fde3e8; }
.pill.material-pending { color: #7a4c00; background: #fff0c2; }
.pill.material-ready { color: #1c5f38; background: #e4f4ea; }
.status-stack { display: grid; justify-items: start; gap: 6px; margin-top: 7px; }
.material-status-action { margin-top: 5px; }
.material-ready-check { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid #dbe5f0; border-radius: 12px; background: #f7fafc; }
.material-ready-check input { width: 18px; height: 18px; margin: 0; }
.readonly-status { min-height: 41px; padding: 10px 12px; border: 1px solid #bcd4e9; border-radius: 10px; color: #235487; background: #e1effc; }
.pill.sample-development { color: #235487; background: #e1effc; }
.pill.sample-revision { color: #7a4c00; background: #fff0c2; }
.pill.sample-bulk { color: #1c5f38; background: #e4f4ea; }
.pill.sample-inspection { color: #71336f; background: #f4e5f4; }

.notice { border-radius: 12px; padding: 13px 15px; margin-bottom: 18px; }
.notice.warning { color: #6a4a00; background: var(--warning); border: 1px solid #f1d27c; }
.notice.info { color: #234d73; background: #e9f3fc; border: 1px solid #c9e0f3; margin-top: 20px; }
.summary-strip { min-height: 48px; padding: 12px 14px; margin-bottom: 15px; border-radius: 12px; background: #eaf3fb; color: var(--navy); display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.summary-strip strong { margin-right: 5px; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

.sample-image-preview { display: flex; align-items: center; gap: 13px; min-height: 96px; padding: 10px; border: 1px dashed #b9c8dc; border-radius: 12px; color: var(--muted); background: #f7fafe; font-size: 12px; }
.sample-image-preview:empty { display: none; }
.sample-image-preview img { width: 110px; height: 86px; border-radius: 9px; object-fit: cover; background: #e8edf4; }
.sample-thumb { display: block; width: 68px; height: 56px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: #e8edf4; }
.sample-requirement-cell { min-width: 210px; max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }

.sample-sheet { width: min(210mm, 100%); min-height: 297mm; margin: 0 auto; padding: 10mm; border: 1px solid #cad5e4; border-radius: 3px; color: #172033; background: #fff; box-shadow: var(--shadow); }
.sample-sheet > .empty-state { padding-top: 120px; }
.sample-sheet-header { min-height: 34mm; display: grid; grid-template-columns: minmax(0, 1fr) 34mm; gap: 8mm; align-items: center; padding-bottom: 5mm; border-bottom: 2px solid var(--navy); }
.sample-sheet-header p { margin: 0 0 2mm; color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: 1.5px; }
.sample-sheet-header h2 { margin: 0 0 2mm; color: var(--navy); font-size: 24px; }
.sample-sheet-header strong { color: #3d4c62; font-size: 14px; letter-spacing: .5px; }
.sample-sheet-qr { display: grid; justify-items: center; gap: 1mm; color: var(--muted); font-size: 9px; text-align: center; }
.sample-sheet-qr img { width: 31mm; height: 31mm; image-rendering: pixelated; }
.sample-sheet-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 5mm; border: 1px solid #bfcbd9; }
.sample-sheet-info > div { min-width: 0; padding: 3mm; border-right: 1px solid #d4dce7; }
.sample-sheet-info > div:last-child { border-right: 0; }
.sample-sheet-info span, .sample-sheet-info strong { display: block; overflow-wrap: anywhere; }
.sample-sheet-info span { margin-bottom: 1.5mm; color: var(--muted); font-size: 9px; }
.sample-sheet-info strong { color: var(--navy); font-size: 12px; }
.sample-sheet-main { min-height: 100mm; display: grid; grid-template-columns: 56% 44%; margin-top: 5mm; border: 1px solid #bfcbd9; }
.sample-sheet-photo { min-width: 0; display: grid; place-items: center; padding: 4mm; border-right: 1px solid #bfcbd9; background: #f7f9fc; }
.sample-sheet-photo img { display: block; width: 100%; height: 92mm; object-fit: contain; }
.sample-sheet-requirements { min-width: 0; padding: 5mm; }
.sample-sheet h3 { margin: 0 0 3mm; color: var(--navy); font-size: 14px; }
.sample-sheet-requirements p { margin: 0; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.sample-sheet-links { margin-top: 5mm; padding: 4mm; border: 1px solid #bfcbd9; background: #f8fafc; }
.sample-sheet-links h3 { margin-bottom: 2mm; }
.sample-sheet-links p { margin: 1mm 0; font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.sample-handwrite { margin-top: 5mm; padding: 4mm 4mm 2mm; border: 1px solid #bfcbd9; }
.sample-handwrite h3 { margin-bottom: 1mm; }
.write-lines { display: grid; }
.write-lines i { display: block; height: 8mm; border-bottom: 1px solid #b9c5d4; }
.sample-sheet footer { margin-top: 4mm; padding-top: 3mm; border-top: 1px solid #9fadc0; color: #45536a; font-size: 10px; text-align: center; }

.production-sheet { background: white; border: 1px solid #d6e0ed; border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.production-title { text-align: center; padding: 12px; color: white; background: var(--navy); font-size: 25px; font-weight: 850; }
.production-note { text-align: center; padding: 8px; background: #fff3cd; color: #6a4a00; font-weight: 750; }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-bottom: 0; }
.info-grid > div { display: flex; flex-direction: column; gap: 4px; padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info-grid > div span { color: var(--muted); font-size: 11px; }
.info-grid > div strong { color: var(--navy); }
.info-item { display: grid; grid-template-columns: 92px 1fr; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info-item:nth-child(4n) { border-right: 0; }
.info-item strong { padding: 9px; color: var(--navy); background: #dceaf7; }
.info-item span { padding: 9px; }
.production-section-title { margin-top: 16px; padding: 8px; text-align: center; color: white; background: var(--teal); font-weight: 800; }
.production-sheet table { min-width: 0; }
.production-sheet th, .production-sheet td { padding: 8px; border: 1px solid #d8e2ef; }
.production-sheet .size-table td { text-align: right; }
.production-sheet .size-table td:first-child { text-align: left; color: var(--navy); font-weight: 800; background: #e9f2fa; }
.production-sheet .size-table tr:nth-child(2) { background: #fff6d8; }
.production-footer { margin-top: 16px; height: 90px; padding: 10px; border: 1px solid #cbd6e5; color: var(--navy); font-weight: 750; }
.production-assets { display: grid; grid-template-columns: minmax(0, 1fr) 156px; margin-top: 14px; border: 1px solid #cbd6e5; page-break-inside: avoid; }
.production-assets h3 { margin: 0; padding: 7px 10px; color: var(--navy); background: #e9f2fa; font-size: 13px; text-align: center; }
.production-style-panel { min-width: 0; border-right: 1px solid #cbd6e5; }
.production-photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; min-height: 126px; padding: 8px; align-items: center; }
.production-photo-grid img { display: block; width: 100%; height: 108px; object-fit: contain; border: 1px solid #dbe3ed; background: #f6f8fb; }
.production-photo-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; }
.production-qr-panel { display: flex; flex-direction: column; align-items: center; }
.production-qr-panel h3 { align-self: stretch; }
.production-qr-panel img { display: block; width: 106px; height: 106px; margin: 5px auto 1px; }
.production-qr-panel span { padding: 2px 6px 6px; color: var(--muted); font-size: 10px; text-align: center; }

.photo-editor, .photo-list, .material-photo-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.photo-editor:empty { display: none; }
.photo-item { position: relative; width: 104px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.photo-item img, .material-thumb { display: block; width: 92px; height: 76px; border-radius: 7px; object-fit: cover; background: #e8edf4; }
.photo-item button { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; padding: 0; border-radius: 50%; color: white; background: var(--danger); }
.pending-photo span { display: block; padding-top: 4px; color: var(--teal); font-size: 11px; text-align: center; }
.photo-count { color: var(--muted); font-size: 11px; }
.material-thumb { width: 54px; height: 46px; display: inline-block; margin-right: 4px; }
.order-photo-summary { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.order-photo-summary img { width: 42px; height: 36px; border-radius: 5px; object-fit: cover; background: #e8edf4; }

.qr-sheet { background: white; border: 1px solid #d6e0ed; border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.qr-header { text-align: center; margin-bottom: 20px; }
.qr-header h2 { margin: 0 0 6px; color: var(--navy); }
.qr-header p { margin: 0; color: var(--muted); }
.qr-grid { display: grid; grid-template-columns: minmax(320px, 760px); justify-content: center; gap: 24px; }
.qr-card { border: 2px solid var(--line); border-radius: 18px; padding: 22px; text-align: center; page-break-inside: avoid; }
.qr-card.bulk { border-color: #9dc4e5; }
.qr-card.garment { border-color: #99c7b2; }
.qr-card h3 { margin: 0 0 4px; color: var(--navy); font-size: 23px; }
.qr-card p { margin: 5px 0 14px; color: var(--muted); }
.qr-card img { width: min(280px, 100%); height: auto; image-rendering: pixelated; }
.qr-scan-tip { margin-top: 12px; padding: 9px; border-radius: 9px; color: #234d73; background: #e9f3fc; font-weight: 700; }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; max-width: min(520px, 90vw); padding: 12px 18px; border-radius: 12px; color: white; background: #253653; box-shadow: 0 12px 34px rgba(0,0,0,.24); font-weight: 700; }
.toast.error { background: var(--danger); }
.toast.success { background: #28734a; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .system-setting-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { flex-direction: column; }
  .finance-costing-layout { grid-template-columns: 1fr; }
  .costing-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout > .panel:first-child { width: 100%; flex-basis: auto; }
  .size-fieldset { grid-template-columns: repeat(4, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .info-item:nth-child(4n) { border-right: 1px solid var(--line); }
  .info-item:nth-child(2n) { border-right: 0; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-foot { display: none; }
  .topbar { position: static; height: auto; padding: 14px 18px; align-items: flex-start; }
  .content { padding: 18px; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .system-setting-grid { grid-template-columns: 1fr; }
  .costing-summary { grid-template-columns: 1fr 1fr; }
  .profit-chart-row { grid-template-columns: 105px minmax(90px, 1fr); }
  .profit-chart-value { grid-column: 1 / -1; text-align: left; }
  .span-2 { grid-column: auto; }
  .size-fieldset { grid-template-columns: repeat(2, 1fr); }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .inline-tools { width: 100%; }
  .inline-tools input, .inline-tools select { flex: 1; min-width: 0; }
  .info-grid { grid-template-columns: 1fr; }
  .production-assets { grid-template-columns: 1fr; }
  .production-style-panel { border-right: 0; border-bottom: 1px solid #cbd6e5; }
  .production-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-grid { grid-template-columns: 1fr; }
  .info-item, .info-item:nth-child(2n), .info-item:nth-child(4n) { border-right: 0; }
  .sample-sheet { min-height: 0; padding: 18px; }
  .sample-sheet-header { grid-template-columns: minmax(0, 1fr) 92px; gap: 18px; }
  .sample-sheet-header h2 { font-size: 19px; }
  .sample-sheet-qr img { width: 84px; height: 84px; }
  .sample-sheet-info { grid-template-columns: repeat(2, 1fr); }
  .sample-sheet-info > div { border-bottom: 1px solid #d4dce7; }
  .sample-sheet-info > div:nth-child(2n) { border-right: 0; }
  .sample-sheet-info > div:nth-last-child(-n+2) { border-bottom: 0; }
  .sample-sheet-main { min-height: 0; grid-template-columns: 1fr; }
  .sample-sheet-photo { border-right: 0; border-bottom: 1px solid #bfcbd9; }
  .sample-sheet-photo img { height: min(92mm, 70vh); }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: white; }
  body * { visibility: hidden !important; }
  body:not(.print-sample) #productionPrint, body:not(.print-sample) #productionPrint *, body:not(.print-sample) #qrPrint, body:not(.print-sample) #qrPrint * { visibility: visible !important; }
  body:not(.print-sample) #productionPrint, body:not(.print-sample) #qrPrint { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; box-shadow: none; }
  #productionPrint .production-title { font-size: 20px; }
  #productionPrint th, #productionPrint td { padding: 5px; font-size: 10px; }
  #productionPrint .production-assets { grid-template-columns: minmax(0, 1fr) 34mm; margin-top: 3mm; }
  #productionPrint .production-style-panel { border-right: 1px solid #cbd6e5; border-bottom: 0; }
  #productionPrint .production-photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); min-height: 32mm; padding: 2mm; gap: 1.5mm; }
  #productionPrint .production-photo-grid img { height: 28mm; }
  #productionPrint .production-qr-panel img { width: 27mm; height: 27mm; margin-top: 1mm; }
  #qrPrint .qr-grid { grid-template-columns: 1fr; gap: 12mm; }
  #qrPrint .qr-card { padding: 8mm; }
  #qrPrint .qr-card img { width: 70mm; }
  body.print-sample #samplePrint, body.print-sample #samplePrint * { visibility: visible !important; }
  body.print-sample #samplePrint { position: absolute; inset: 0; width: 100%; min-height: 279mm; margin: 0; padding: 5mm; border: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.print-sample #samplePrint .sample-sheet-header { min-height: 30mm; padding-bottom: 3mm; }
  body.print-sample #samplePrint .sample-sheet-info { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 3mm; }
  body.print-sample #samplePrint .sample-sheet-info > div { border-right: 1px solid #d4dce7; border-bottom: 0; }
  body.print-sample #samplePrint .sample-sheet-info > div:last-child { border-right: 0; }
  body.print-sample #samplePrint .sample-sheet-main { min-height: 92mm; grid-template-columns: 56% 44%; margin-top: 3mm; }
  body.print-sample #samplePrint .sample-sheet-photo { border-right: 1px solid #bfcbd9; border-bottom: 0; }
  body.print-sample #samplePrint .sample-sheet-photo img { height: 84mm; }
  body.print-sample #samplePrint .sample-sheet-links { margin-top: 3mm; padding: 3mm; }
  body.print-sample #samplePrint .sample-handwrite { margin-top: 3mm; padding: 3mm 3mm 1mm; }
  body.print-sample #samplePrint .write-lines i { height: 6mm; }
  body.print-sample #samplePrint footer { margin-top: 3mm; padding-top: 2mm; }
  .no-print { display: none !important; }
}
