:root {
  color-scheme: light;
  --ink-950: #13252f;
  --ink-800: #29414c;
  --ink-600: #5d717b;
  --ink-400: #94a5ad;
  --line: #dbe4e7;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --teal-700: #126c68;
  --teal-600: #19827c;
  --teal-100: #dff1ee;
  --amber-700: #9b5b11;
  --amber-100: #fff0d5;
  --red-700: #a83d35;
  --red-100: #fae5e1;
  --green-700: #32704f;
  --green-100: #e2f1e8;
  --shadow: 0 16px 40px rgba(21, 48, 57, 0.07);
  --radius: 16px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink-950); background: var(--canvas); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; padding: 28px 18px; color: #fff; background: #153a45; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #153a45; background: #b7e2d9; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand, .sidebar-note { flex-shrink: 0; }
.brand strong { font-size: 18px; letter-spacing: .08em; }
.brand small { margin-top: 3px; color: #b9cdd2; font-size: 11px; }
.nav-list { display: grid; flex-shrink: 0; gap: 5px; margin-top: 24px; margin-bottom: 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #c5d4d8; font-size: 14px; }
.nav-item span { width: 20px; text-align: center; color: #8fb7b4; font-size: 17px; }
.nav-item:hover { color: white; background: rgba(183,226,217,.08); }
.nav-item.active { color: white; background: rgba(183,226,217,.18); box-shadow: inset 3px 0 0 #b7e2d9; font-weight: 700; }
.nav-item:focus-visible { outline: 2px solid #b7e2d9; outline-offset: 2px; }
.nav-item .nav-badge { width: auto; min-width: 20px; margin-left: auto; padding: 1px 5px; border-radius: 9px; background: #b7e2d9; color: #153a45; font-size: 11px; }
.sidebar-note { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.05); }
.sidebar-note strong { display: block; margin-top: 6px; font-size: 14px; }
.sidebar-note p { margin: 8px 0 0; color: #b9cdd2; font-size: 12px; line-height: 1.55; }

.workspace { min-width: 0; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); }
.topbar h1 { margin: 3px 0 0; font-size: 24px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--teal-700); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.organization-chip { max-width: 240px; overflow: hidden; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-600); background: var(--canvas); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.role-switch { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.role-switch a { padding: 7px 13px; border-radius: 7px; color: var(--ink-600); font-size: 13px; font-weight: 600; }
.role-switch a.active { color: var(--teal-700); background: #fff; box-shadow: 0 2px 8px rgba(19,37,47,.08); }
.account-chip { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; color: var(--ink-950); background: transparent; text-align: left; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; background: var(--teal-700); font-size: 12px; font-weight: 800; }
.account-chip strong, .account-chip small { display: block; }
.account-chip strong { font-size: 12px; }
.account-chip small { margin-top: 2px; color: var(--ink-600); font-size: 10px; }
.logout-button { padding: 7px 10px; border: 0; color: var(--ink-600); background: transparent; cursor: pointer; }
.logout-button:hover { color: var(--red-700); }

.content { max-width: 1460px; margin: 0 auto; padding: 28px 32px 44px; }
.message-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 11px 14px; border: 1px solid #b7dac7; border-radius: 10px; color: var(--green-700); background: var(--green-100); font-size: 12px; }
.intro-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.lead { margin: 0 0 5px; font-size: 17px; font-weight: 650; }
.muted { margin: 0; color: var(--ink-600); font-size: 12px; }
.button { min-height: 38px; padding: 0 16px; border: 1px solid #bdcbd0; border-radius: 9px; color: var(--ink-800); background: white; font-weight: 650; cursor: pointer; }
.button:hover { border-color: var(--teal-600); color: var(--teal-700); }
.button.primary { border-color: var(--teal-700); color: white; background: var(--teal-700); box-shadow: 0 8px 18px rgba(18,108,104,.16); }
.button.primary:hover { background: #0f5b58; }
.button.compact { min-height: 32px; padding: 0 11px; font-size: 12px; white-space: nowrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { position: relative; min-height: 126px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card::after { content: ""; position: absolute; right: -18px; bottom: -28px; width: 84px; height: 84px; border-radius: 50%; background: var(--teal-100); opacity: .65; }
.metric-card.warning::after { background: var(--amber-100); }
.metric-card.urgent::after { background: var(--red-100); }
.metric-card span, .metric-card small { display: block; position: relative; z-index: 1; }
.metric-card span { color: var(--ink-600); font-size: 12px; font-weight: 650; }
.metric-card strong { display: block; position: relative; z-index: 1; margin: 8px 0 4px; font-size: 30px; line-height: 1; }
.metric-card small { color: var(--ink-400); font-size: 11px; }
.metric-link { display: block; color: var(--ink-950); text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.metric-link:hover { border-color: var(--teal-600); box-shadow: 0 4px 18px rgba(15, 118, 110, .18); }
.metric-link:focus-visible { outline: 3px solid #0f766e; outline-offset: 3px; }
.metric-card .metric-arrow { display: inline; float: right; font-size: 16px; color: #0f766e; }
.dashboard-task-filter { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 18px; margin-bottom: 16px; background: #e7f3f1; border: 1px solid #9dc9c4; border-radius: 12px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel.span-2 { grid-column: span 2; }
.panel.span-3 { grid-column: span 3; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.panel-header h2 { margin: 4px 0 0; font-size: 16px; }
.panel-header > a { color: var(--teal-700); font-size: 12px; font-weight: 700; }
.task-list { display: grid; }
.task-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid #edf1f2; }
.task-row:first-child { border-top: 0; }
.task-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--teal-700); background: var(--teal-100); font-size: 12px; font-weight: 800; }
.task-icon.red { color: var(--red-700); background: var(--red-100); }
.task-icon.amber { color: var(--amber-700); background: var(--amber-100); }
.task-main { min-width: 0; }
.task-main strong, .task-main span { display: block; }
.task-main strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.task-main span { margin-top: 4px; overflow: hidden; color: var(--ink-600); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; color: var(--ink-600); background: #edf1f2; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status.danger { color: var(--red-700); background: var(--red-100); }
.status.warning { color: var(--amber-700); background: var(--amber-100); }
.status.success { color: var(--green-700); background: var(--green-100); }
.quality-score { margin: 22px 0 13px; }
.quality-score strong, .quality-score span { display: block; }
.quality-score strong { font-size: 32px; }
.quality-score span { margin-top: 4px; color: var(--ink-600); font-size: 11px; }
.bar { height: 7px; overflow: hidden; border-radius: 999px; background: #e7eeef; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal-600); }
.amber-bar span { background: #d59034; }
.mini-stats { display: grid; gap: 10px; margin: 22px 0 0; }
.mini-stats div { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid #edf1f2; }
.mini-stats dt { color: var(--ink-600); font-size: 11px; }
.mini-stats dd { margin: 0; font-size: 12px; font-weight: 800; }
.text-warning { color: var(--amber-700); }
.filter-group { display: flex; gap: 5px; padding: 3px; border-radius: 8px; background: var(--canvas); }
.filter { padding: 6px 10px; border: 0; border-radius: 6px; color: var(--ink-600); background: transparent; font-size: 11px; cursor: pointer; }
.filter.active { color: var(--teal-700); background: white; font-weight: 750; box-shadow: 0 1px 4px rgba(19,37,47,.08); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 9px 12px; color: var(--ink-600); background: #f5f8f7; font-size: 10px; text-align: left; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf1f2; vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--ink-400); }
tbody tr:hover { background: #fafcfc; }
.toolbar { display: flex; gap: 9px; }
.section-panel { margin-bottom: 16px; }
.identity-grid { margin-top: 0; }
.record-count { color: var(--ink-600); font-size: 11px; }
.role-tag { display: inline-flex; margin: 2px 4px 2px 0; padding: 4px 7px; border-radius: 6px; color: var(--teal-700); background: var(--teal-100); font-size: 10px; font-weight: 700; }
.empty-cell { padding: 26px; color: var(--ink-400); text-align: center; }
.invite-list { display: grid; }
.invite-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid #edf1f2; }
.invite-list article:first-child { border-top: 0; }
.invite-list strong, .invite-list span { display: block; }
.invite-list strong { max-width: 230px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.invite-list div > span { margin-top: 4px; color: var(--ink-600); font-size: 10px; }
.one-time-link { margin-bottom: 16px; padding: 16px 18px; border: 1px solid #ebc77c; border-radius: 12px; background: var(--amber-100); }
.one-time-link strong { color: var(--amber-700); font-size: 13px; }
.one-time-link p { margin: 5px 0 10px; color: #735226; font-size: 11px; }
.one-time-link div { display: flex; gap: 8px; }
.one-time-link input { min-width: 0; flex: 1; padding: 8px 10px; border: 1px solid #e2bd70; border-radius: 7px; color: var(--ink-800); background: rgba(255,255,255,.8); font-size: 11px; }

.form-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; overflow: visible; border: 0; border-radius: 16px; background: transparent; box-shadow: 0 28px 80px rgba(10, 28, 34, .24); }
.form-dialog[open] { position: fixed; inset: 0; margin: auto; }
.form-dialog::backdrop { background: rgba(12, 31, 38, .48); backdrop-filter: blur(2px); }
.dialog-card { max-height: calc(100vh - 40px); padding: 22px; overflow-y: auto; border-radius: 16px; background: white; }
.dialog-card header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.dialog-card h2 { margin: 4px 0 0; font-size: 19px; }
.dialog-card footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--ink-600); background: var(--canvas); font-size: 20px; cursor: pointer; }
.stack-form { display: grid; gap: 15px; margin-top: 24px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; color: var(--ink-800); font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid #bac9ce; border-radius: 8px; color: var(--ink-950); background: white; outline: none; }
.field input[type="checkbox"] { width: 17px; height: 17px; min-height: 17px; padding: 0; }
.checkbox-field { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.checkbox-field input { justify-self: end; }
.shipment-eligibility-options { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.shipment-eligibility-options legend { padding: 0 6px; font-weight: 800; }
.shipment-eligibility-options > div { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.shipment-eligibility-options label { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfc; line-height: 1.45; }
.shipment-eligibility-options input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; }
.shipment-quantity-options > div { max-height: 430px; }
.shipment-quantity-option { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfc; }
.shipment-choice { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; }
.shipment-choice label { display: block; padding: 0; border: 0; background: transparent; cursor: pointer; }
.shipment-choice strong, .shipment-choice small { display: block; }
.shipment-choice small { margin-top: 3px; color: var(--ink-600); }
.shipment-quantity-field { display: grid !important; grid-template-columns: 1fr !important; gap: 4px !important; padding: 0 !important; border: 0 !important; background: transparent !important; font-size: 10px; font-weight: 750; }
.shipment-quantity-field input { width: 100%; min-height: 38px; padding: 0 9px; border: 1px solid #bac9ce; border-radius: 7px; background: white; font-size: 13px; }
.shipment-quantity-field small { color: var(--ink-600); font-weight: 400; }
@media (max-width: 720px) { .shipment-quantity-option { grid-template-columns: 1fr; } }
.field textarea { min-height: 80px; padding-block: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(25,130,124,.12); }
.field small { color: var(--ink-600); font-size: 10px; font-weight: 400; line-height: 1.5; }
.field-error { color: var(--red-700) !important; }
.form-error { padding: 10px 12px; border: 1px solid #efb5ad; border-radius: 8px; color: var(--red-700); background: var(--red-100); font-size: 11px; }
.choice-field > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }
.choice-field ul { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; margin: 0; padding: 10px 12px; list-style: none; border: 1px solid var(--line); border-radius: 9px; }
.choice-field li label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 500; }
.choice-field li input { width: 15px; height: 15px; min-height: 15px; }
.choice-field label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 500; }
.choice-field input { width: 15px; min-height: auto; height: 15px; }
.supplier-choice-field { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.supplier-choice-field legend { margin-bottom: 7px; font-weight: 650; }
.supplier-choice-field ul { grid-template-columns: 1fr; max-height: 190px; overflow-y: auto; background: #fbfcfc; }
.full { width: 100%; }
.button-link { display: grid; place-items: center; }
.record-filters { display: flex; align-items: end; gap: 10px; }
.filter-field { display: grid; min-width: 180px; gap: 6px; color: var(--ink-600); font-size: 10px; font-weight: 700; }
.filter-field.grow { min-width: 260px; flex: 1; }
.filter-field input, .filter-field select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid #bac9ce; border-radius: 8px; color: var(--ink-950); background: white; outline: none; }
.filter-field input:focus, .filter-field select:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(25,130,124,.12); }
.row-actions { display: flex; gap: 6px; }
.inline-record { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inline-record:last-child { border-bottom: 0; }
.inline-record .row-actions { flex-wrap: wrap; margin-top: 6px; }
.inline-record details { margin-top: 4px; }
.inline-record summary { cursor: pointer; color: var(--ink-600); }
.address-cell { max-width: 260px; color: var(--ink-600); line-height: 1.5; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 14px; color: var(--ink-600); font-size: 11px; }
.immutable-note, .warning-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; color: var(--ink-600); background: var(--canvas); font-size: 11px; line-height: 1.6; }
.warning-note { color: var(--amber-700); background: var(--amber-100); }
.email-evidence-note { line-height: 1.75; }
.quota-panel { display: grid; gap: 14px; }
.quota-row { display: grid; grid-template-columns: minmax(130px, 190px) minmax(180px, 1fr) 64px; align-items: center; gap: 16px; }
.quota-row div, .quota-row small { display: block; }
.quota-row small { margin-top: 3px; color: var(--ink-400); }
.quota-row progress { width: 100%; height: 14px; accent-color: var(--teal-700); }
.small-dialog { width: min(460px, calc(100vw - 32px)); }
.danger-outline { color: var(--red-700); border-color: #efb5ad; }
.danger-button { color: white; border-color: var(--red-700); background: var(--red-700); }
.back-link { display: inline-block; margin-bottom: 9px; color: var(--teal-700); font-size: 11px; font-weight: 750; }
.document-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.document-summary article { padding: 15px 17px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.document-summary span, .document-summary strong { display: block; }
.document-summary span { color: var(--ink-600); font-size: 10px; font-weight: 700; }
.document-summary strong { margin-top: 7px; font-size: 24px; }
.document-summary .warning { border-color: #ebc77c; background: var(--amber-100); }
.document-summary .danger { border-color: #efb5ad; background: var(--red-100); }
.master-data-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 16px; }
.long-copy { margin: 0; color: var(--ink-600); font-size: 12px; line-height: 1.8; }
.inline-form { display: inline; margin: 0; }
.draft-panel { border-color: #ebc77c; }
.photo-chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.photo-chip-list span { padding: 6px 9px; border-radius: 999px; color: var(--teal-700); background: var(--teal-100); font-size: 10px; font-weight: 700; }
.photo-chip-list .missing-chip { color: var(--red-700); background: var(--red-100); }
.criteria-cell { max-width: 320px; white-space: normal; line-height: 1.55; }
.product-image-frame { position: relative; display: grid; width: 76px; height: 76px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-600); background: #edf3f2; font-size: 9px; text-align: center; }
.product-image-frame.large { width: min(260px, 100%); height: 210px; }
.product-image-frame img { width: 100%; height: 100%; object-fit: contain; background: white; }
.product-image-placeholder { padding: 8px; }
.product-master-card { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 20px; align-items: start; }
.product-master-grid { display: grid; gap: 14px; margin-top: 14px; }
.product-master-grid .product-master-card { grid-template-columns: 112px minmax(0, 1fr); padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; }
.product-master-grid .product-image-frame { width: 112px; height: 112px; }
.product-master-grid .product-text-stack { max-width: none; }
.product-master-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.product-master-fields div { min-width: 0; padding-bottom: 10px; border-bottom: 1px solid #edf1f2; }
.product-master-fields dt { color: var(--ink-600); font-size: 10px; font-weight: 750; }
.product-master-fields dd { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 12px; line-height: 1.55; }
.product-text-stack { display: grid; gap: 5px; min-width: 220px; max-width: 330px; }
.product-text-stack span { color: var(--ink-600); white-space: pre-line; line-height: 1.45; }
.supplier-binding-list { display: grid; min-width: 150px; gap: 6px; }
.supplier-binding-list span:not(.status) { display: grid; gap: 2px; }
.supplier-binding-list small { color: var(--ink-600); font-size: 10px; }
.quality-change-list { display: grid; gap: 14px; }
.quality-change-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; }
.quality-change-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.quality-change-card h3 { margin: 3px 0 5px; font-size: 16px; }
.quality-change-card > footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.quality-change-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 15px 0 0; }
.quality-change-meta div { padding: 10px; border-radius: 8px; background: white; }
.quality-change-meta dt { color: var(--ink-600); font-size: 9px; font-weight: 750; }
.quality-change-meta dd { margin: 5px 0 0; font-size: 11px; line-height: 1.45; }
.quality-change-detail { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.quality-change-detail summary { color: var(--teal-700); font-size: 11px; font-weight: 750; cursor: pointer; }
.quality-change-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.quality-change-grid > div { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.quality-change-grid strong { font-size: 10px; }
.quality-change-grid p { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 11px; line-height: 1.55; }
.quality-change-rejection { grid-column: 1 / -1; border-color: #efb5ad !important; background: var(--red-100) !important; }
@media (max-width: 900px) { .quality-change-meta, .quality-change-grid { grid-template-columns: 1fr; } }
.product-image-input-preview { display: none; width: 150px; height: 120px; margin-bottom: 9px; object-fit: contain; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.version-card { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfc; }
.version-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.version-card summary strong, .version-card summary small { display: block; }
.version-card summary small { margin-top: 4px; color: var(--ink-600); font-size: 10px; }
.version-card[open] summary { margin-bottom: 14px; }

.import-preview-summary { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr); gap: 12px; margin-bottom: 16px; }
.import-preview-summary div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.import-preview-summary span, .import-preview-summary strong { display: block; }
.import-preview-summary span { color: var(--ink-600); font-size: 10px; font-weight: 700; }
.import-preview-summary strong { margin-top: 5px; overflow-wrap: anywhere; font-size: 11px; }
.import-preview-table { max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
.import-preview-table thead { position: sticky; top: 0; z-index: 1; }
.confirm-import-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.button:disabled { cursor: not-allowed; opacity: .5; }

.wide-dialog { width: min(1180px, calc(100vw - 32px)); }
.wide-dialog .dialog-card { max-width: none; }
.inspection-review-card { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100vh - 40px); overflow: hidden; }
.inspection-review-card > header { margin-bottom: 12px; }
.inspection-review-card .dialog-scroll-body { min-height: 0; padding-right: 6px; overflow-y: auto; }
.inspection-review-card > footer { flex-wrap: wrap; margin-top: 12px; max-height: 42dvh; overflow-y: auto; background: white; }
.inspection-review-card > footer .decision-form { flex: 1 1 100%; }
.permission-note { margin-top: 0; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.span-two { grid-column: 1 / -1; }
.order-lines-editor { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.order-lines-editor [hidden] { display: none !important; }
.selected-product-count { font-size: 12px; font-weight: normal; color: var(--ink-600); }
.product-catalog-filter { margin-bottom: 12px; max-width: 460px; }
.order-product-catalog { min-width: 800px; }
.order-product-catalog td { vertical-align: top; }
.order-product-catalog .catalog-specifications, .order-product-catalog .catalog-notes { min-width: 170px; max-width: 300px; overflow-wrap: anywhere; }
.selection-column { width: 42px; text-align: center; }
.order-lines-editor .selection-column input[type="checkbox"] { width: 18px; min-width: 18px; height: 18px; accent-color: var(--teal-700); }
.order-product-identity { min-width: 150px; max-width: 220px; overflow-wrap: anywhere; }
.line-fnsku { min-width: 115px; overflow-wrap: anywhere; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.order-line-table select, .order-line-table input, .order-line-table textarea { min-width: 110px; width: 100%; }
.order-line-table td:nth-child(4) input, .order-line-table td:nth-child(6) input { min-width: 70px; }
.order-line-table select { min-width: 230px; }
.order-line-table textarea { min-width: 160px; resize: vertical; }
.line-delete-input { display: none; }
.inspection-item-table input, .inspection-item-table select { width: 100%; min-width: 100px; min-height: 38px; padding: 0 9px; border: 1px solid #bac9ce; border-radius: 8px; background: white; }
.inspection-item-table td:first-child { min-width: 260px; }
.inspection-item-table td:nth-child(3), .inspection-item-table td:nth-child(5) { min-width: 190px; }
.inspection-photo-editor { padding-bottom: 4px; }
.inspection-draft-dialog { width: min(820px, calc(100vw - 24px)); }
.inspection-draft-dialog [hidden] { display: none !important; }
.inspection-draft-dialog .inspection-draft-card { display: flex; flex-direction: column; height: calc(100dvh - 40px); max-height: 980px; padding: 0; overflow: hidden; }
.inspection-draft-card .inspection-dialog-header { flex: none; margin: 0; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.inspection-dialog-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 24px; scrollbar-gutter: stable; }
.inspection-form-section { padding: 22px 0 8px; border-top: 1px solid var(--line); }
.inspection-form-section:first-of-type { border-top: 0; padding-top: 12px; }
.inspection-form-section > h3 { margin: 0 0 12px; font-size: 16px; }
.inspection-form-section > .muted { margin: 0 0 18px; line-height: 1.65; }
.inspection-draft-card .field { margin-bottom: 18px; font-size: 13px; line-height: 1.5; }
.inspection-draft-card .field > small { font-weight: 400; }
.inspection-draft-card .field select { text-overflow: ellipsis; }
.inspection-draft-card .field textarea { min-height: 88px; padding: 10px 12px; }
.field-required { color: #a24326; }
.inspection-draft-card .inspection-photo-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.inspection-draft-card .inspection-photo-category { padding: 18px; }
.inspection-check-item { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.inspection-check-item h4 { margin: 0 0 10px; font-size: 14px; }
.inspection-draft-card .inspection-dialog-footer { flex: none; display: block; margin: 0; padding: 12px 24px 16px; background: white; box-shadow: 0 -5px 15px rgba(10, 28, 34, .04); }
.inspection-dialog-footer > p { margin: 0 0 8px; overflow-wrap: anywhere; }
.inspection-dialog-footer .row-actions { justify-content: flex-end; flex-wrap: wrap; }
.photo-dropzone { position: relative; display: grid; gap: 7px; padding: 22px 12px; border: 1px dashed #4d8e8b; border-radius: 10px; color: var(--teal-700, #126c69); background: #f0f8f7; text-align: center; cursor: pointer; }
.photo-dropzone > span { color: var(--ink-600); font-size: 12px; line-height: 1.5; }
.photo-dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-dropzone:focus-within, .photo-dropzone.is-dragging { outline: 2px solid #128781; outline-offset: 3px; background: #e0f3f0; }
.inspection-draft-card .inspection-photo-editor .inspection-photo-list,
.inspection-draft-card .inspection-photo-editor .local-photo-preview { grid-template-columns: minmax(0, 1fr); }
.inspection-draft-card .inspection-photo-card, .inspection-draft-card .local-photo-card { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: start; }
.inspection-draft-card .inspection-photo-editor .inspection-photo-frame img,
.inspection-draft-card .inspection-photo-editor .local-photo-card > img { height: 180px; }
.inspection-draft-card .inspection-photo-editor .inspection-photo-frame { min-height: 180px; }
.inspection-draft-card .inspection-photo-card figcaption, .inspection-draft-card .local-photo-card figcaption { padding: 12px; gap: 8px; }
.inspection-draft-card .inspection-photo-card figcaption strong, .inspection-draft-card .local-photo-card figcaption strong { font-size: 12px; }
.inspection-draft-card .inspection-photo-card figcaption small { font-size: 11px; }
@media (max-width: 600px) {
  .inspection-draft-dialog .inspection-draft-card { height: calc(100dvh - 24px); }
  .inspection-draft-card .inspection-dialog-header, .inspection-draft-card .inspection-dialog-footer { padding: 12px; }
  .inspection-dialog-body { padding: 0 12px 12px; }
  .inspection-draft-card .inspection-photo-category, .inspection-check-item { padding: 12px; }
  .inspection-draft-card .inspection-photo-card, .inspection-draft-card .local-photo-card { grid-template-columns: minmax(0, 1fr); }
  .inspection-draft-card .section-title-row { align-items: flex-start; flex-direction: column; gap: 8px; }
}
.inspection-photo-editor .inspection-photo-list, .inspection-photo-editor .local-photo-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inspection-photo-editor .inspection-photo-frame img, .inspection-photo-editor .local-photo-card img { height: 140px; object-fit: contain; }
.inspection-photo-editor .inspection-photo-frame { min-height: 140px; }
.inspection-photo-editor textarea { box-sizing: border-box; width: 100%; min-height: 76px; resize: vertical; font-size: 12px; }
.inspection-photo-editor figcaption strong { white-space: normal; overflow-wrap: anywhere; }
.inspection-photo-editor .field { margin: 4px 0; }
.photo-annotation-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.incomplete-count { color: var(--red-700); }
.inspection-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.review-photo [hidden], .review-gallery [hidden] { display: none !important; }
.review-photo-open { display: grid; width: 100%; padding: 10px; gap: 8px; justify-items: center; align-content: center; min-height: 210px; border: 1px solid var(--line); border-radius: 10px; background: #edf3f2; color: var(--ink-900); cursor: zoom-in; }
.review-photo-open:focus-visible { outline: 3px solid var(--teal-600, #117875); outline-offset: 3px; }
.review-photo-open img { display: block; width: 100%; height: 200px; object-fit: contain; }
.review-photo-hint { font-size: 12px; color: var(--ink-600); }
.review-photo [data-photo-status]:empty { display: none; }
.review-photo .photo-annotation-text, .review-gallery .photo-annotation-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-gallery { width: min(1100px, calc(100vw - 32px)); }
.review-gallery-card { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100dvh - 40px); overflow: hidden; }
.review-gallery-card > header { gap: 12px; }
.review-gallery-card > header > div { min-width: 0; overflow-wrap: anywhere; }
.review-gallery-body { overflow: auto; min-height: 0; }
.review-gallery-image { display: grid; place-items: center; min-height: 160px; background: #edf3f2; border-radius: 10px; }
.review-gallery-image img { display: block; max-width: 100%; max-height: 62dvh; object-fit: contain; }
.review-gallery-card > footer { align-items: center; justify-content: center; margin-top: 12px; }
.inspection-photo-category { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; }
.inspection-photo-category > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.inspection-photo-category > header strong, .inspection-photo-category > header small { display: block; }
.inspection-photo-category > header small { margin-top: 4px; color: var(--ink-600); font-size: 10px; }
.inspection-photo-list, .local-photo-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inspection-photo-list { margin-bottom: 12px; }
.inspection-photo-card, .local-photo-card { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: white; }
.inspection-photo-frame { position: relative; display: grid; min-height: 88px; place-items: center; overflow: hidden; color: var(--ink-600); background: #edf3f2; font-size: 10px; text-align: center; }
.inspection-photo-frame img, .local-photo-card img { width: 100%; height: 88px; object-fit: cover; }
.photo-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; background: rgba(237, 243, 242, .92); }
.photo-placeholder { padding: 8px; }
.inspection-photo-card figcaption, .local-photo-card figcaption { display: grid; gap: 5px; padding: 7px; }
.inspection-photo-card figcaption strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.inspection-photo-card figcaption small { color: var(--ink-600); font-size: 9px; }
.local-photo-preview { margin: 8px 0; }
.local-photo-card figcaption { color: var(--ink-600); font-size: 9px; word-break: break-all; }
.local-photo-card figcaption .button { margin-top: 4px; }
.photo-file-field { margin-bottom: 8px; }
.photo-file-field input { padding: 8px; }
.empty-photo-note { grid-column: 1 / -1; margin: 0; padding: 18px; border: 1px dashed #c7d3d6; border-radius: 9px; text-align: center; }

@media (max-width: 900px) {
  .inspection-photo-grid { grid-template-columns: 1fr; }
  .import-preview-summary { grid-template-columns: 1fr; }
  .product-master-card { grid-template-columns: 1fr; }
  .product-master-grid .product-master-card { grid-template-columns: 96px minmax(0, 1fr); }
  .product-master-grid .product-image-frame { width: 96px; height: 96px; }
}

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #e8efee; }
.auth-shell { width: min(980px, 100%); min-height: 590px; display: grid; grid-template-columns: 1.15fr .85fr; overflow: hidden; border-radius: 24px; background: white; box-shadow: 0 28px 80px rgba(17, 45, 53, .16); }
.auth-intro { display: flex; flex-direction: column; justify-content: center; padding: 64px; color: white; background: linear-gradient(145deg, #123743 0%, #155c5c 100%); }
.brand-mark.large { width: 54px; height: 54px; margin-bottom: 46px; font-size: 21px; }
.auth-intro .eyebrow { color: #a6d7ce; }
.auth-intro h1 { margin: 12px 0 20px; font-size: clamp(30px, 4vw, 44px); line-height: 1.22; letter-spacing: -.04em; }
.auth-intro > p:not(.eyebrow) { max-width: 460px; margin: 0; color: #bfd0d3; font-size: 14px; line-height: 1.8; }
.auth-points { display: flex; gap: 10px; margin-top: 34px; }
.auth-points span { padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #d6e4e5; font-size: 10px; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 54px; }
.auth-card h2 { margin: 6px 0 8px; font-size: 26px; }
.auth-help { margin: 20px 0 0; color: var(--ink-600); font-size: 10px; line-height: 1.6; text-align: center; }
.single-auth-card { width: min(440px, 100%); padding: 36px; border-radius: 20px; background: white; box-shadow: 0 24px 70px rgba(17, 45, 53, .14); }
.brand.centered { justify-content: flex-start; padding: 0 0 24px; border-bottom-color: var(--line); color: var(--ink-950); }
.brand.centered small { color: var(--ink-600); }
.single-auth-card > .muted { margin-top: 20px; line-height: 1.7; }
.auth-secret { display: grid; gap: 8px; margin-top: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.auth-secret span { color: var(--ink-600); font-size: 10px; font-weight: 700; }
.auth-secret strong { overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 16px; letter-spacing: .08em; }
.auth-secret .button { justify-self: start; }
.success-card { text-align: center; }
.success-card h1 { margin: 8px 0; }
.success-card p { color: var(--ink-600); font-size: 12px; }
.success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 50%; color: var(--green-700); background: var(--green-100); font-size: 26px; font-weight: 800; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 24px 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > span:last-child, .nav-item:not(.active)::after, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item span { font-size: 18px; }
  .sidebar-note { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; }
  .brand { padding: 0; border: 0; }
  .brand-mark { width: 36px; height: 36px; }
  .nav-list { display: none; }
  .topbar { align-items: flex-start; padding: 16px; }
  .topbar-actions { align-items: flex-end; flex-direction: column-reverse; }
  .account-chip { display: none; }
  .organization-chip { display: none; }
  .content { padding: 20px 16px 36px; }
  .intro-row { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel.span-2, .panel.span-3 { grid-column: span 1; }
  .task-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .task-row .status { display: none; }
  .record-filters { align-items: stretch; flex-direction: column; }
  .filter-field, .filter-field.grow { width: 100%; min-width: 0; }
  .document-summary { grid-template-columns: 1fr 1fr; }
  .master-data-grid { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .product-master-fields { grid-template-columns: 1fr; }
  .product-master-grid .product-master-card { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
}

@media (max-width: 700px) {
  .auth-page { padding: 16px; }
  .auth-shell { min-height: auto; grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-card { padding: 36px 26px; }
  .choice-field > div { grid-template-columns: 1fr; }
}

.inspection-photo-category > .photo-category-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.photo-category-heading > .status { justify-self: end; }
.photo-sample-slot { text-align: center; }
.photo-sample-slot small { color: var(--ink-600); font-size: 11px; }
.photo-sample-link { border: 0; padding: 6px 4px; color: var(--teal-700, #126c6a); background: transparent; text-decoration: underline; text-underline-offset: 3px; font: inherit; font-weight: 700; cursor: pointer; }
.sample-preview-dialog { width: min(900px, calc(100vw - 32px)); }
.sample-editor-dialog { width: min(800px, calc(100vw - 32px)); }
.sample-editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.sample-editor-card { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.sample-editor-card img { width: 100%; height: 120px; object-fit: contain; }
.sample-editor-card figcaption { display: grid; gap: 8px; overflow-wrap: anywhere; }
.sample-remove-choice { display: flex; align-items: center; gap: 8px; }
.sample-editor-card input[type="checkbox"] { width: auto; }
.sample-gallery-controls { display: flex; gap: 16px; align-items: center; justify-content: center; }
.sample-gallery-image { min-height: 180px; }
.sample-preview-dialog img { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; margin: 0 auto; }
@media (max-width: 480px) {
  .inspection-photo-category > .photo-category-heading { grid-template-columns: 1fr auto; }
  .photo-category-heading > .photo-sample-slot { grid-column: 1 / -1; grid-row: 2; }
  .metric-grid { grid-template-columns: 1fr; }
  .role-switch a { padding-inline: 9px; }
  .topbar h1 { font-size: 20px; }
  .task-row { grid-template-columns: 34px minmax(0, 1fr); }
  .task-row .button { grid-column: 2; justify-self: start; }
}
