:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --border: #d0d7de;
  --accent: #1f6feb;
  --text: #1f2328;
  --muted: #57606a;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.brand { color: var(--accent); font-size: 18px; font-weight: 700; text-decoration: none; }
.brand-dot { color: #FFB7C5; font-size: 14px; margin-left: 0; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.nav a.active, .nav a:hover { background: #e0e9ff; color: var(--accent); }
.toolbar-spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.assembly-page { padding: 14px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr); gap: 14px; align-items: start; }
.card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.card h1, .card h2 { margin: 0 0 8px; font-size: 20px; }
.card h3 { margin: 22px 0 10px; font-size: 16px; }
.detail-card { margin-top: 14px; }
.detail-card[hidden] { display: none; }
.page-status { min-height: 20px; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.page-status.error { color: #d1242f; }
.inline-form, .shipment-form, .item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.inline-form { margin: 12px 0; }
input, select { max-width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font: inherit; }
.inline-form input { flex: 1; min-width: 220px; }
.shipment-form { margin: 12px 0 16px; }
.shipment-form select:first-child { flex: 1; min-width: 180px; }
.shipment-form input { width: 100px; }
.btn { padding: 7px 11px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; font: inherit; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn.small { padding: 4px 7px; font-size: 12px; }
.btn.danger { color: #d1242f; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.item-actions input, .item-actions select { padding: 4px 6px; font-size: 12px; }
.item-actions input { width: 76px; }
.product-tree { margin-top: 12px; overflow-x: auto; }
.mind-tree { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: max-content; padding: 12px 8px 20px; }
.mind-connections { position: absolute; z-index: 0; inset: 0; overflow: visible; pointer-events: none; }
.mind-connections path { fill: none; stroke: #9db4d2; stroke-width: 2.5; stroke-linecap: round; }
.mind-node { position: relative; display: flex; align-items: center; margin: 8px 0; }
.mind-children { display: flex; flex-direction: column; justify-content: center; margin-left: 70px; }
.mind-card { position: relative; z-index: 1; width: 220px; min-height: 88px; padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: #fff; box-shadow: 0 3px 10px rgba(31, 35, 40, 0.06); }
.mind-card.product { border-color: #8ab4f8; background: #f0f6ff; }
.mind-card.assembly { border-color: #9bd8b5; background: #f2fbf5; }
.mind-card.component { border-color: #efd28a; background: #fffaf0; }
.mind-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mind-card-header strong { font-size: 14px; }
.mind-card-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.mind-card .add-child { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(31, 35, 40, 0.35); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(420px, calc(100vw - 32px)); padding: 20px; border-radius: 12px; background: #fff; box-shadow: 0 16px 50px rgba(31, 35, 40, 0.25); }
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal-form { display: grid; gap: 12px; margin-top: 16px; }
.modal-form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.badge { padding: 2px 6px; border-radius: 9px; background: #eef1f4; color: var(--muted); font-size: 11px; }
.badge.product { background: #e0e9ff; color: var(--accent); }
.badge.assembly { background: #e7f5ee; color: #1a7f37; }
.badge.component { background: #fff3d8; color: #8a5a00; }
.shipment-list { display: grid; gap: 8px; }
.shipment-card { padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; text-align: left; cursor: pointer; }
.shipment-card.active { border-color: var(--accent); background: #f0f6ff; }
.shipment-card.completed { background: #f0f9f3; }
.shipment-card strong, .shipment-card span { display: block; }
.shipment-card span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.progress { height: 7px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: #e5e9ee; }
.progress span { display: block; height: 100%; margin: 0; background: var(--accent); }
.detail-header { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.detail-header h2 { margin: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1150px; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid #e8edf2; text-align: left; vertical-align: top; font-size: 12px; }
th { background: #f3f5f7; color: var(--muted); white-space: nowrap; }
.item-name { min-width: 210px; }
.inventory { min-width: 160px; line-height: 1.55; color: var(--muted); }
.item-actions { min-width: 350px; }
.moves-table { min-width: 800px; }
.empty { padding: 16px 0; color: var(--muted); }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
}
