:root {
  --ink: #17231f;
  --ink-soft: #485852;
  --muted: #74817d;
  --canvas: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #f7f9f7;
  --line: #dfe5e1;
  --line-dark: #cbd4cf;
  --green: #174f3c;
  --green-2: #236c53;
  --green-soft: #e7f1ec;
  --gold: #c6a15b;
  --gold-soft: #f7efdf;
  --blue: #3667a6;
  --amber: #9a651a;
  --red: #a23f42;
  --red-soft: #faeaeb;
  --shadow: 0 8px 28px rgba(25, 48, 40, .07);
  --radius: 14px;
  --sidebar: 248px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column;
  color: #e9f0ed; background: linear-gradient(180deg, #153c31 0%, #102e27 72%, #0b241e 100%);
  border-right: 1px solid rgba(255,255,255,.07);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 18px 22px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { display: block; flex: 0 0 42px; width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.28)); }
.brand-logo.large { flex-basis: 68px; width: 68px; height: 68px; }
.brand strong, .login-brand strong { display: block; font-family: Georgia, serif; font-size: 17px; letter-spacing: .02em; }
.brand small, .login-brand small { display: block; margin-top: 1px; color: #aabdb6; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.sidebar nav { flex: 1; padding: 17px 12px; overflow-y: auto; }
.nav-label { margin: 19px 12px 7px; color: #7f9b91; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 42px; margin: 3px 0; padding: 8px 11px; border-radius: 9px; color: #bed0ca; text-decoration: none; font-size: 13px; font-weight: 600; transition: .18s ease; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active { color: #fff; background: rgba(229,203,140,.14); box-shadow: inset 3px 0 var(--gold); }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: #d9c284; font-size: 18px; line-height: 1; }
.sidebar-footer { padding: 14px 16px 17px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; color: #fff; background: #2e6754; font-weight: 700; }
.user-chip strong { display: block; overflow: hidden; max-width: 155px; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: #91aaa1; font-size: 10px; text-transform: capitalize; }
.sidebar-actions { display: flex; gap: 13px; margin: 10px 0 0 44px; }
.sidebar-actions a, .sidebar-actions .link-button { color: #91aaa1; font-size: 10px; text-decoration: none; }
.sidebar-actions a:hover, .sidebar-actions .link-button:hover { color: #fff; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; height: 58px; padding: 0 34px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar-title { color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.environment-pill { margin-left: auto; padding: 4px 9px; border: 1px solid #d7c296; border-radius: 99px; color: #765820; background: var(--gold-soft); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.menu-button { display: none; width: 40px; height: 40px; margin-right: 10px; border: 0; border-radius: 8px; background: transparent; font-size: 19px; }
.content { max-width: 1520px; margin: 0 auto; padding: 30px 34px 56px; }

.page-heading, .order-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading.compact { align-items: center; }
.page-heading h1, .order-hero h1 { margin: 1px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 38px); font-weight: 600; line-height: 1.15; letter-spacing: -.025em; }
.page-heading p, .order-hero p { margin: 0; color: var(--muted); }
.kicker { margin: 0 !important; color: var(--green-2) !important; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.breadcrumb { margin-bottom: 8px !important; font-size: 12px; }
.breadcrumb a { color: var(--green-2); text-decoration: none; }
.title-line { display: flex; align-items: center; gap: 12px; }
.title-line h1 { margin-bottom: 2px; }
.hero-actions { display: flex; gap: 8px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; text-decoration: none; font-size: 12px; font-weight: 700; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--green); box-shadow: 0 5px 14px rgba(23,79,60,.16); }
.button.primary:hover { background: #0e4030; }
.button.secondary { border-color: var(--line-dark); color: var(--ink); background: #fff; }
.button.ghost { color: var(--green); background: transparent; }
.button.success { color: #fff; background: var(--green-2); }
.button.danger { color: #fff; background: var(--red); }
.button.danger-outline { border-color: #dfb5b7; color: var(--red); background: #fff; }
.button.full { width: 100%; }
.button.small { min-height: 34px; padding: 6px 11px; }
.link-button { padding: 0; border: 0; color: var(--green-2); background: none; font-weight: 600; }
.row-link { color: var(--green-2); font-weight: 700; text-decoration: none; white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: var(--surface-soft); font-size: 18px; }
.icon-button.danger { color: var(--red); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.panel-header.standalone { padding: 4px 0 15px; border: 0; }
.panel-header h2 { margin: 0; font-family: Georgia, serif; font-size: 19px; font-weight: 600; }
.panel-header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.panel-header a { color: var(--green-2); font-size: 11px; font-weight: 700; text-decoration: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 137px; padding: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card::after { content: ""; position: absolute; right: -20px; bottom: -35px; width: 95px; height: 95px; border-radius: 50%; background: var(--green-soft); opacity: .55; }
.metric-card.accent { color: #fff; background: linear-gradient(135deg,#1c5c46,#123d31); border-color: transparent; }
.metric-card.accent::after { background: rgba(219,191,126,.2); }
.metric-card.danger { border-color: #e5c2c3; }
.metric-card .metric-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.metric-card.accent .metric-label { color: #bed3ca; }
.metric-card strong { display: block; margin: 10px 0 4px; font-family: Georgia, serif; font-size: 31px; font-weight: 600; line-height: 1; }
.metric-card small { color: var(--muted); font-size: 11px; }
.metric-card.accent small { color: #bdd0c8; }
.module-snapshot-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 0 0 18px; }
.snapshot-card { display: grid; grid-template-columns: 38px 1fr 15px; align-items: center; gap: 11px; min-width: 0; padding: 15px; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); text-decoration: none; transition: .16s ease; }
.snapshot-card:hover { transform: translateY(-2px); border-color: #b9c9c1; }
.snapshot-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 900; }
.snapshot-card small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.snapshot-card strong { display: block; margin-top: 1px; overflow: hidden; font-family: Georgia,serif; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.snapshot-card p { margin: 1px 0 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.snapshot-card b { color: var(--green-2); }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.span-2 { grid-column: span 2; }
.order-queue { padding: 4px 20px 12px; }
.queue-row { display: grid; grid-template-columns: 38px minmax(160px,1fr) 90px 70px; align-items: center; gap: 12px; min-height: 68px; border-bottom: 1px solid var(--line); text-decoration: none; }
.queue-row:last-child { border-bottom: 0; }
.order-monogram { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.queue-main strong { display: block; }
.queue-main small, .queue-qty small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.queue-qty { text-align: right; font-weight: 700; }
.deadline { justify-self: end; padding: 4px 7px; border-radius: 6px; color: var(--green-2); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.deadline.urgent { color: var(--amber); background: #fbf0da; }
.deadline.late { color: var(--red); background: var(--red-soft); }
.status-summary { padding: 12px 20px 18px; }
.status-summary a { display: flex; align-items: center; justify-content: space-between; min-height: 37px; border-bottom: 1px solid var(--line); text-decoration: none; }
.status-summary a:last-child { border: 0; }
.status-summary span { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.draft, .status-dot.planning { background: var(--blue); }
.status-dot.budget_pending, .status-dot.submitted { background: #d08a23; }
.status-dot.approved, .status-dot.in_production, .status-dot.shipped { background: #3a8b67; }
.status-dot.cancelled, .status-dot.rejected { background: var(--red); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: var(--muted); background: #fafbfa; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfb; }
td strong { color: var(--ink); }
.numeric { text-align: right; }
.cell-subtitle { display: block; max-width: 230px; margin-top: 2px; color: var(--muted); font-size: 10px; }
.empty-cell { padding: 48px 20px; color: var(--muted); text-align: center; }
.empty-cell.compact-empty { padding: 20px; }
.inactive-row { opacity: .55; }
.code-tag, .stage-tag { display: inline-block; padding: 3px 7px; border-radius: 5px; color: #315b4c; background: var(--green-soft); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; white-space: nowrap; }
.stage-tag { color: #725419; background: var(--gold-soft); text-transform: capitalize; }
.status-badge { display: inline-block; padding: 4px 8px; border-radius: 99px; color: #46534f; background: #edf0ee; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.status-badge.draft, .status-badge.planning { color: #2f5e97; background: #e9f0f9; }
.status-badge.budget_pending, .status-badge.submitted { color: #875812; background: #fbefd8; }
.status-badge.approved, .status-badge.in_production, .status-badge.shipped { color: #226448; background: #e5f2eb; }
.status-badge.rejected, .status-badge.cancelled { color: #92383b; background: var(--red-soft); }

.filter-bar { display: flex; align-items: center; gap: 8px; padding: 15px; border-bottom: 1px solid var(--line); }
.search-field { position: relative; flex: 1; max-width: 520px; }
.search-field span { position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 19px; }
.search-field input { padding-left: 35px; }
label { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 40px; margin-top: 5px; padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 8px; color: var(--ink); background: #fff; outline: none; transition: .15s ease; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(35,108,83,.1); }
.field-help { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 400; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 18px; }
.form-main { display: grid; gap: 18px; }
.form-section { padding: 22px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 19px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.section-heading > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #75571f; background: var(--gold-soft); font-size: 10px; font-weight: 800; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 19px; }
.section-heading p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.span-3 { grid-column: span 3; }
.form-summary { position: sticky; top: 76px; padding: 20px; }
.form-summary h2, .budget-summary h2 { margin: 3px 0 16px; font-family: Georgia, serif; font-size: 21px; }
.workflow-list { margin: 0; padding: 0; list-style: none; }
.workflow-list li { position: relative; display: flex; gap: 10px; min-height: 54px; }
.workflow-list li::after { content: ""; position: absolute; top: 27px; bottom: -1px; left: 13px; width: 1px; background: var(--line-dark); }
.workflow-list li:last-child::after { display: none; }
.workflow-list li > span { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 27px; height: 27px; border: 1px solid var(--line-dark); border-radius: 50%; color: var(--muted); background: #fff; font-size: 9px; font-weight: 800; }
.workflow-list li.done > span { border-color: var(--green); color: #fff; background: var(--green); }
.workflow-list strong { display: block; font-size: 11px; }
.workflow-list small { color: var(--muted); font-size: 9px; }
.summary-note { margin: 16px 0; padding: 12px; border-radius: 9px; color: #604c27; background: var(--gold-soft); }
.summary-note strong { font-size: 11px; }
.summary-note p { margin: 3px 0 0; font-size: 10px; }
.sticky-actions { display: grid; gap: 8px; }
.form-note { margin: 15px 0 0; padding: 10px 12px; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 10px; }

.order-facts { display: grid; grid-template-columns: repeat(6,1fr); margin-bottom: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.order-facts > div { min-width: 0; padding: 15px 16px; border-right: 1px solid var(--line); }
.order-facts > div:last-child { border: 0; }
.order-facts span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.order-facts strong { display: block; overflow: hidden; margin-top: 3px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.order-facts small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; }
.tab-bar { display: flex; gap: 3px; margin-bottom: 18px; padding: 5px; overflow-x: auto; background: #e7ebe8; border-radius: 11px; }
.tab-bar button, .tab-bar a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; padding: 7px 14px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.tab-bar button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 7px rgba(30,54,46,.09); }
.tab-bar button span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 9px; }
.style-card { margin-bottom: 12px; overflow: hidden; }
.style-card-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.style-card-header > div { display: flex; align-items: center; gap: 10px; }
.style-card h3 { margin: 0; font-size: 13px; }
.style-card p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.color-swatch { display: block; width: 26px; height: 26px; border: 3px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line-dark); }
.size-grid { display: flex; align-items: stretch; overflow-x: auto; }
.size-grid-label, .size-grid > div { min-width: 78px; padding: 11px 13px; border-right: 1px solid var(--line); }
.size-grid-label { display: flex; align-items: center; color: var(--muted); background: #fafbfa; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.size-grid span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.size-grid strong { display: block; margin-top: 2px; font-size: 13px; }
.size-grid .size-total { margin-left: auto; border-left: 1px solid var(--line); border-right: 0; background: var(--green-soft); }
.process-strip { display: flex; align-items: center; margin: 3px 0 18px; padding: 14px 18px; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.process-node { position: relative; display: flex; flex: 1; align-items: center; gap: 8px; min-width: 120px; color: var(--muted); }
.process-node::after { content: ""; flex: 1; height: 1px; margin: 0 10px; background: var(--line-dark); }
.process-node:last-child::after { display: none; }
.process-node > span { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line-dark); border-radius: 50%; font-size: 9px; }
.process-node strong { font-size: 10px; white-space: nowrap; }
.process-node.complete { color: var(--green-2); }
.process-node.complete > span { border-color: var(--green-2); color: #fff; background: var(--green-2); }
.timeline { padding: 20px 24px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 22px; }
.timeline-item::after { content: ""; position: absolute; top: 13px; bottom: 0; left: 5px; width: 1px; background: var(--line-dark); }
.timeline-item:last-child::after { display: none; }
.timeline-item > span { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 3px; border: 3px solid #fff; border-radius: 50%; background: var(--green-2); box-shadow: 0 0 0 1px var(--green-2); }
.timeline-item strong { font-size: 11px; }
.timeline-item p { margin: 2px 0; color: var(--ink-soft); font-size: 11px; }
.timeline-item small { color: var(--muted); font-size: 9px; }

.budget-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; align-items: start; gap: 18px; }
.budget-main { display: grid; gap: 13px; }
.budget-section { overflow: hidden; }
.budget-section-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.budget-section-head > div { display: flex; align-items: center; gap: 10px; }
.budget-section-head h2 { margin: 0; font-family: Georgia, serif; font-size: 17px; }
.budget-section-head p { margin: 1px 0 0; color: var(--muted); font-size: 9px; }
.budget-section-head > strong { font-size: 13px; }
.category-number { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: #78591e; background: var(--gold-soft); font-size: 9px; font-weight: 800; }
.inline-add { width: 100%; padding: 10px 15px; border: 0; border-top: 1px dashed var(--line-dark); color: var(--green-2); background: #fcfdfc; font-size: 10px; font-weight: 800; text-align: left; }
.budget-summary { position: sticky; top: 76px; padding: 20px; }
.cost-breakdown, .profit-breakdown { margin: 0; }
.cost-breakdown > div, .profit-breakdown > div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cost-breakdown dt, .profit-breakdown dt { color: var(--muted); font-size: 10px; }
.cost-breakdown dd, .profit-breakdown dd { margin: 0; font-size: 10px; font-weight: 700; }
.summary-total { margin: 14px -20px; padding: 16px 20px; color: #fff; background: var(--green); }
.summary-total span, .summary-total small { display: block; color: #b9d0c8; font-size: 9px; text-transform: uppercase; }
.summary-total strong { display: block; margin: 4px 0; font-family: Georgia, serif; font-size: 22px; }
.margin-meter { margin: 16px 0; padding: 12px; border-radius: 9px; background: var(--green-soft); }
.margin-meter > div:first-child { display: flex; align-items: center; justify-content: space-between; font-size: 10px; }
.margin-meter strong { color: var(--green); font-size: 14px; }
.meter { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #cbded5; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--green-2); }
.approval-actions { display: grid; gap: 8px; }
.callout { margin: -8px 0 18px; padding: 13px 16px; border: 1px solid; border-radius: 10px; }
.callout strong { font-size: 11px; }
.callout p { margin: 2px 0 0; font-size: 10px; }
.danger-callout { border-color: #e4b9bb; color: #853438; background: var(--red-soft); }
.success-callout { border-color: #b8d7c7; color: #245f47; background: var(--green-soft); }

.modal { width: min(570px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; border: 0; border-radius: 15px; box-shadow: 0 24px 80px rgba(8,31,23,.3); }
.modal.wide { width: min(820px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(10,31,24,.55); backdrop-filter: blur(3px); }
.modal form { padding: 22px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 19px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 23px; }
.modal-header > button { width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 19px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 21px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-subheading { margin: 20px 0 8px; font-size: 11px; }
.size-inputs { display: grid; grid-template-columns: repeat(8,1fr); gap: 7px; }
.size-inputs label { text-align: center; }
.size-inputs input { text-align: center; }
.narrow-panel { max-width: 550px; padding: 22px; }
.stack-form { display: grid; gap: 14px; }
.master-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); align-items: start; gap: 18px; }
.master-nav { padding: 8px; }
.master-nav a { display: flex; align-items: center; justify-content: space-between; min-height: 39px; padding: 8px 10px; border-radius: 8px; color: var(--ink-soft); font-size: 11px; text-decoration: none; }
.master-nav a:hover { background: var(--surface-soft); }
.master-nav a.active { color: var(--green); background: var(--green-soft); font-weight: 800; }
.master-nav strong { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: rgba(255,255,255,.7); font-size: 9px; }
.error-page { max-width: 650px; margin: 8vh auto; padding: 50px; text-align: center; }
.error-page > span { display: inline-block; color: var(--gold); font-family: Georgia,serif; font-size: 68px; line-height: 1; }
.error-page h1 { margin: 8px 0; font-family: Georgia,serif; font-size: 30px; }
.error-page > p:not(.kicker) { max-width: 470px; margin: 0 auto 22px; color: var(--muted); }
.error-page > div { display: flex; justify-content: center; gap: 8px; }

.flash-stack { position: fixed; top: 70px; right: 18px; z-index: 100; display: grid; gap: 8px; width: min(380px,calc(100vw - 36px)); }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; border: 1px solid; border-radius: 10px; background: #fff; box-shadow: 0 12px 34px rgba(16,40,32,.16); font-size: 11px; font-weight: 600; }
.flash.success { border-color: #b7d8c7; color: #245e46; }
.flash.error { border-color: #e0b2b4; color: #8f393d; }
.flash.warning { border-color: #e5d0a3; color: #7d5714; }
.flash button { border: 0; color: currentColor; background: none; font-size: 17px; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 19px; }
.empty-state h3 { margin: 0; color: var(--ink); font-family: Georgia, serif; font-size: 17px; }
.empty-state p { margin: 4px 0 13px; font-size: 11px; }
.muted { color: var(--muted) !important; }
.text-danger { color: var(--red) !important; }
.text-success { color: var(--green-2) !important; }
.sidebar-backdrop { display: none; }
.style-card-body { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 18px; }
.style-card-content { min-width: 0; }
.style-photo-box { display: grid; place-items: center; min-height: 145px; overflow: hidden; color: var(--muted); background: #f3f4ef; border: 1px dashed var(--line); border-radius: 9px; font-size: 10px; }
.style-photo-box img { width: 100%; height: 145px; object-fit: contain; background: #fff; }
.style-photo-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.style-photo-actions form { display: flex; align-items: center; gap: 8px; }
.file-button { display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 700; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.costing-form .cost-input { background: #edf5ff; border-color: #b8cde5; }
.costing-grid { min-width: 1320px; }
.costing-grid input { min-width: 78px; padding: 7px; }
.costing-grid td:first-child input { min-width: 115px; }
.calc-cell { color: var(--green); background: var(--green-soft); font-weight: 700; text-align: right; }
.costing-measurements { margin-top: 18px; }
.formula-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.costing-layout { display: grid; grid-template-columns: 1fr 1fr 300px; gap: 16px; align-items: start; }
.costing-summary { position: sticky; top: 82px; }
.costing-total { display: grid; gap: 3px; margin: 17px 0; padding: 17px; color: #fff; background: linear-gradient(145deg,#174f3c,#0a2921); border-radius: 10px; }
.costing-total small { color: #b7ccc4; text-transform: uppercase; letter-spacing: .1em; }
.costing-total strong { font: 600 28px Georgia,serif; }
.costing-total > span { color: #d7bd7d; }

.auth-page { background: #f4f4ef; }
.login-layout { display: grid; grid-template-columns: minmax(380px, .92fr) minmax(420px, 1.08fr); min-height: 100vh; }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 42px clamp(36px,6vw,86px); overflow: hidden; color: #fff; background: linear-gradient(145deg,#174f3c,#0a2921); }
.login-story::before { content: ""; position: absolute; width: 520px; height: 520px; right: -280px; top: 20%; border: 1px solid rgba(218,188,119,.22); border-radius: 50%; box-shadow: 0 0 0 70px rgba(218,188,119,.035), 0 0 0 150px rgba(218,188,119,.025); }
.login-story::after { content: ""; position: absolute; inset: auto 0 0; height: 36%; background: linear-gradient(180deg,transparent,rgba(0,0,0,.18)); }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.story-copy { position: relative; z-index: 1; max-width: 510px; }
.story-copy .kicker { color: #d7bd7d !important; }
.story-copy h1 { margin: 13px 0 16px; font-family: Georgia, serif; font-size: clamp(35px,4vw,55px); font-weight: 500; line-height: 1.08; letter-spacing: -.035em; }
.story-copy > p:last-child { max-width: 450px; color: #b7ccc4; font-size: 15px; }
.story-foot { position: relative; z-index: 1; margin: 0; color: #829e94; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(390px,100%); padding: 38px; background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 20px 55px rgba(26,51,42,.10); }
.login-card h2 { margin: 4px 0 3px; font-family: Georgia, serif; font-size: 29px; font-weight: 600; }
.login-card > .muted { margin: 0 0 24px; font-size: 11px; }
.login-card label { margin-top: 13px; }
.login-card .button { margin-top: 21px; min-height: 44px; }
.login-help { margin: 18px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.mobile-login-brand { display: none; }

@media (max-width: 1100px) {
  .costing-layout { grid-template-columns: 1fr 1fr; }
  .costing-summary { position: static; grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .module-snapshot-grid { grid-template-columns: repeat(2,1fr); }
  .order-facts { grid-template-columns: repeat(3,1fr); }
  .order-facts > div:nth-child(3) { border-right: 0; }
  .order-facts > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .budget-layout { grid-template-columns: 1fr; }
  .budget-summary { position: static; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .menu-button { display: block; }
  .content { padding: 24px 20px 46px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(8,29,22,.45); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .form-layout { grid-template-columns: 1fr; }
  .form-summary { position: static; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .style-card-body { grid-template-columns: 1fr; }
  .style-photo-box, .style-photo-box img { min-height: 190px; height: 190px; }
  .style-photo-actions { align-items: stretch; flex-direction: column; }
  .costing-layout { grid-template-columns: 1fr; }
  .costing-summary { grid-column: auto; }
  .content { padding: 19px 13px 38px; }
  .page-heading, .order-hero { align-items: stretch; flex-direction: column; gap: 14px; }
  .hero-actions { flex-wrap: wrap; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .module-snapshot-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 122px; padding: 16px; }
  .metric-card strong { font-size: 26px; }
  .queue-row { grid-template-columns: 34px minmax(120px,1fr) 65px; }
  .queue-qty { display: none; }
  .form-grid.two, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .form-section { padding: 17px; }
  .order-facts { grid-template-columns: repeat(2,1fr); }
  .order-facts > div, .order-facts > div:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .order-facts > div:nth-child(2n) { border-right: 0; }
  .order-facts > div:nth-last-child(-n+2) { border-bottom: 0; }
  .size-inputs { grid-template-columns: repeat(4,1fr); }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .search-field { max-width: none; }
  .login-layout { display: block; min-height: 100vh; padding: 24px 14px; }
  .login-story { display: none; }
  .login-panel { min-height: calc(100vh - 48px); padding: 0; }
  .login-card { padding: 28px 22px; }
  .master-layout { grid-template-columns: 1fr; }
  .master-nav { display: flex; overflow-x: auto; }
  .master-nav a { flex: 0 0 auto; gap: 8px; }
  .mobile-login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
  .mobile-login-brand strong { font-family: Georgia, serif; font-size: 17px; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .page-heading h1, .order-hero h1 { font-size: 29px; }
}

@media print {
  .sidebar, .topbar, .page-heading, .order-hero .hero-actions, .tab-bar, .flash-stack, .inline-add, .icon-button, .button, dialog { display: none !important; }
  .app-shell { margin: 0; }
  .content { max-width: none; padding: 0; }
  .budget-layout { display: block; }
  .budget-summary { margin-top: 15px; box-shadow: none; }
  .panel { break-inside: avoid; box-shadow: none; }
}
