/* The client deliberately uses a small, reusable token set instead of a UI
   framework. It keeps the web edition fast and straightforward to customise. */
:root {
  --ink: #15213b;
  --muted: #667085;
  --surface: #fff;
  --canvas: #f5f7fb;
  --line: #e5e9f2;
  --brand: #4259d7;
  --brand-dark: #243b8d;
  --accent: #d4f06c;
  --danger: #d92d20;
  --success: #079669;
  --shadow: 0 14px 45px rgba(30, 45, 80, .1);
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.login-shell[hidden], .app-shell[hidden] { display: none !important; }

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 1.15fr) minmax(360px, .85fr);
  background: var(--surface);
}

.brand-panel {
  position: relative;
  min-height: 100%;
  padding: clamp(3rem, 8vw, 9rem);
  overflow: hidden;
  color: white;
  background: radial-gradient(circle at 80% 10%, #6379f0 0, transparent 26%), linear-gradient(145deg, #101b3b, #2c3f98);
}

.brand-panel::after {
  position: absolute;
  right: -12vw;
  bottom: -15vw;
  width: 40vw;
  height: 40vw;
  content: "";
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}

.brand-panel h1 {
  max-width: 700px;
  margin: 1.6rem 0;
  font-size: clamp(2.9rem, 5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -.055em;
}

.brand-panel p { max-width: 500px; color: #dbe4ff; font-size: 1.05rem; line-height: 1.7; }
.eyebrow { color: #8295ff; font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.brand-panel .eyebrow { color: var(--accent); }

.brand-orbit { position: absolute; top: 23%; right: 15%; width: 150px; height: 150px; border: 2px solid rgba(212, 240, 108, .75); border-radius: 50%; }
.brand-orbit i { position: absolute; display: block; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.brand-orbit i:nth-child(1) { top: 4px; left: 15px; }
.brand-orbit i:nth-child(2) { top: 66px; right: -5px; background: #9bb0ff; }
.brand-orbit i:nth-child(3) { bottom: -7px; left: 55px; }

.login-card { width: 100%; max-width: 600px; padding: clamp(3rem, 8vw, 8rem); margin: auto; align-self: center; }
.mark, .brand-mark { display: grid; color: white; font-weight: 850; place-items: center; background: linear-gradient(145deg, #5270ee, #293d9f); box-shadow: 0 8px 22px rgba(59, 80, 190, .3); }
.mark { width: 48px; height: 48px; margin-bottom: 2rem; border-radius: 15px; font-size: 1.7rem; }
.login-card h2 { margin: 1rem 0 .35rem; font-size: 2rem; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.stack-form { display: grid; gap: 1rem; margin-top: 2rem; }
.stack-form label, .field label, .form-grid label { display: grid; gap: .45rem; color: #344054; font-size: .86rem; font-weight: 700; }
.password-field { display: flex; gap: .5rem; align-items: center; }
.password-field input { flex: 1 1 auto; }
.password-toggle { flex: 0 0 auto; white-space: nowrap; }

input, select, textarea {
  width: 100%; padding: .68rem .76rem; color: var(--ink); outline: none;
  border: 1px solid #d7ddea; border-radius: 9px; background: white;
  transition: border .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus { border-color: #7184e5; box-shadow: 0 0 0 3px rgba(66, 89, 215, .13); }
textarea { min-height: 88px; resize: vertical; }
.primary, .secondary, .danger, .text-button, .icon-button { border: 0; border-radius: 9px; font-weight: 750; }
.primary { padding: .72rem 1rem; color: white; background: var(--brand); }
.primary:hover { background: var(--brand-dark); }
.primary span { margin-left: .35rem; font-size: 1.1rem; }
.compact-button { padding: .45rem .68rem; border-radius: 8px; font-size: .8rem; }
.wide { width: 100%; margin-top: .4rem; }
.secondary { padding: .64rem .9rem; color: #31459f; background: #e9edff; }
.danger { padding: .64rem .9rem; color: #b42318; background: #fee4e2; }
.text-button { padding: .45rem .6rem; color: #344054; background: transparent; }
.text-button:hover { background: #f0f2f7; }
.form-error { min-height: 1.3em; color: var(--danger); font-size: .9rem; }
.login-foot { margin-top: 2.5rem; color: #98a2b3; font-size: .78rem; line-height: 1.5; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 254px 1fr; }
.workspace-only-window .app-shell { grid-template-columns: minmax(0, 1fr); }
.workspace-only-window .sidebar { display: none; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 1.2rem .85rem; color: var(--ink); border-right: 1px solid #dbe3f6; background: #eef2ff; }
.brand { display: flex; gap: .7rem; align-items: center; padding: .35rem .45rem 1.65rem; color: var(--brand-dark); font-size: 1.07rem; font-weight: 800; text-decoration: none; }
.brand small { color: var(--brand); font-size: .66rem; letter-spacing: .1em; }
.brand-mark { width: 31px; height: 31px; border-radius: 9px; }
.navigation { display: flex; flex: 1; flex-direction: column; gap: .55rem; min-height: 0; padding: .1rem .15rem; overflow: auto; }
.nav-group { display: block; }
.nav-group summary { display: flex; align-items: center; justify-content: space-between; padding: .56rem .65rem; color: white; border-radius: 8px; background: var(--brand); cursor: pointer; font-size: .65rem; font-weight: 800; letter-spacing: .12em; list-style: none; text-transform: uppercase; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '⌄'; color: white; font-size: .95rem; line-height: 1; transition: transform .16s ease; }
.nav-group[open] summary::after { transform: rotate(180deg); }
.nav-group summary:hover { background: var(--brand-dark); }
.nav-links { display: grid; gap: .3rem; padding-top: .12rem; }
.nav-link { width: 100%; padding: .57rem .65rem; color: #344054; border: 1px solid #dbe3f6; border-radius: 8px; background: white; font-size: .89rem; text-align: left; }
.nav-link:hover { color: var(--brand-dark); border-color: #aebbf2; background: #f7f8ff; }
.nav-link.active { color: var(--brand-dark); border-color: #9eaff0; background: #dfe6ff; box-shadow: inset 4px 0 0 var(--brand); font-weight: 850; }
.nav-empty { display: block; padding: .5rem .65rem; color: #667085; border: 1px dashed #b8c4e8; border-radius: 8px; background: #f7f9ff; font-size: .75rem; }
.sidebar-context-menu { position: fixed; z-index: 30; display: grid; min-width: 218px; padding: .38rem; border: 1px solid #cbd5ee; border-radius: 10px; background: white; box-shadow: 0 12px 28px rgba(31, 48, 103, .2); }
.context-menu-label { padding: .38rem .48rem .44rem; overflow: hidden; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .7rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.context-menu-action { width: 100%; padding: .58rem .55rem; margin-top: .28rem; color: var(--brand-dark); border: 0; border-radius: 7px; background: white; text-align: left; }
.context-menu-action:hover, .context-menu-action:focus { background: #eef2ff; }
.sidebar-foot { display: flex; gap: .45rem; align-items: center; padding: .8rem .55rem .2rem; margin-top: auto; color: #52627f; font-size: .75rem; }
.favorite-selected { color: var(--brand-dark); border: 1px solid #aebbf2; background: #eef2ff; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f79009; }
.status-dot.ok { background: #12b76a; }
.status-dot.bad { background: #f04438; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; height: 66px; padding: 0 clamp(1rem, 3vw, 2.4rem); align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px); }
.breadcrumb { display: grid; gap: .08rem; color: #98a2b3; font-size: .72rem; }
.breadcrumb strong { color: var(--ink); font-size: .98rem; }
.topbar-actions { display: flex; gap: .6rem; align-items: center; font-size: .83rem; }
.topbar-menu { position: relative; }
.topbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 190px;
  padding: .4rem;
  border: 1px solid #d7def8;
  border-radius: 12px;
  background: white;
  box-shadow: 0 16px 34px rgba(31, 46, 85, .18);
}
.topbar-menu-panel.hidden { display: none; }
.menu-link {
  width: 100%;
  padding: .62rem .7rem;
  color: var(--brand-dark);
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-weight: 800;
}
.menu-link:hover, .menu-link:focus { background: #eef2ff; outline: 0; }
.content { max-width: 1700px; padding: clamp(1.1rem, 3.2vw, 2.4rem); margin: auto; }
.page-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.4rem; }
.page-head h1 { margin: .15rem 0 .35rem; font-size: clamp(1.6rem, 2.4vw, 2.2rem); letter-spacing: -.045em; }
.page-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.action-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
button:disabled { cursor: not-allowed; opacity: .48; }

.card { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 2px 4px rgba(27, 40, 70, .02); }
.card-pad { padding: 1.1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric { padding: 1.1rem; }
.metric span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.metric strong { display: block; margin-top: .35rem; font-size: 1.8rem; letter-spacing: -.05em; }
.metric small { color: var(--success); font-size: .78rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; margin-top: 1rem; }
.four-col { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; margin-top: 1rem; }
.hse-hazard-editor,
.hse-hazard-row { display: grid; gap: 0.85rem; }
.hse-hazard-editor-head,
.hse-row-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.hse-hazard-row { padding: 1rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.hse-hazard-row textarea { min-height: 92px; }
.hse-select { min-width: 100%; }
.callout { padding: .75rem .85rem; color: #475467; border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; font-size: .84rem; line-height: 1.45; }
.callout strong { color: var(--brand-dark); }
.tooling-inventory-layout { display: grid; gap: 1rem; }
.tooling-component-form { padding: .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.work-order-tooling-card { margin-top: 1rem; }

.table-card { overflow: hidden; }
.table-tools { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; padding: .85rem; border-bottom: 1px solid var(--line); }
.table-tools input { max-width: 310px; }
.table-scroll { max-height: calc(100vh - 240px); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #667085; background: #f8f9fc; font-size: .68rem; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
th, td { padding: .76rem .85rem; border-bottom: 1px solid #edf0f5; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f4f6ff; }
tr.selected { background: #eaf0ff !important; }
td.empty { padding: 3rem; color: var(--muted); text-align: center; white-space: normal; }
.table-icon-link { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: .25rem .42rem; border-radius: 999px; font-size: .72rem; font-weight: 900; text-decoration: none; }
.whatsapp-link { color: #067647; background: #dcfae6; }
.linkedin-link { color: #0b4a6f; background: #e0f2fe; }
.table-icon-link:hover { filter: brightness(.96); }
.copyable-cell { position: relative; padding-right: 4.15rem; }

.invoice-summary-card { margin-bottom: 1rem; overflow: hidden; }
.invoice-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfcff); }
.invoice-toolbar label { display: grid; flex: 1 1 170px; min-width: 150px; gap: .3rem; color: #344054; font-size: .74rem; font-weight: 800; }
.invoice-toolbar .invoice-search-field { flex-basis: 300px; }
.invoice-filter-actions { display: flex; flex: 0 0 auto; gap: .45rem; align-items: end; }
.invoice-filter-count { flex: 1 1 100%; padding-top: .15rem; }
.invoice-kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.invoice-kpi { display: grid; gap: .22rem; min-width: 0; padding: .9rem 1rem; border-right: 1px solid var(--line); background: #fbfcff; }
.invoice-kpi:last-child { border-right: 0; }
.invoice-kpi span { color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; }
.invoice-kpi strong { overflow: hidden; color: var(--ink); font-size: 1.28rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.invoice-kpi small { min-height: .8rem; color: var(--success); font-size: .7rem; }
.invoice-workspace { display: grid; grid-template-columns: minmax(620px, 1.35fr) minmax(440px, .65fr); gap: 1rem; align-items: start; }
.invoice-list-card .table-scroll { max-height: calc(100vh - 350px); }
.invoice-preview-card { position: sticky; top: 82px; display: grid; gap: .95rem; padding: 1rem; overflow: hidden; }
.invoice-preview-head { display: flex; gap: .85rem; align-items: flex-start; justify-content: space-between; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.invoice-preview-head h2 { margin: .25rem 0 .15rem; font-size: 1.35rem; letter-spacing: 0; }
.invoice-preview-head p { margin: 0; }
.invoice-status-pill { display: inline-flex; max-width: 180px; padding: .38rem .58rem; overflow: hidden; color: #243b8d; border: 1px solid #c8d2ff; border-radius: 999px; background: #eef2ff; font-size: .78rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.invoice-total-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.invoice-total-strip .invoice-kpi { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.invoice-total-strip .invoice-kpi:nth-child(2n) { border-right: 0; }
.invoice-total-strip .invoice-kpi:nth-last-child(-n + 2) { border-bottom: 0; }
.invoice-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.invoice-detail { display: grid; gap: .2rem; min-width: 0; padding: .68rem .75rem; border: 1px solid var(--line); border-radius: 9px; background: #fbfcff; }
.invoice-detail span { color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.invoice-detail strong { overflow-wrap: anywhere; font-size: .86rem; }
.invoice-detail small { overflow-wrap: anywhere; font-size: .72rem; }
.invoice-line-table { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.invoice-line-head, .invoice-line-row { display: grid; grid-template-columns: minmax(0, 1.7fr) .45fr .7fr .8fr; gap: .55rem; align-items: center; }
.invoice-line-head { padding: .62rem .75rem; color: #667085; background: #f8f9fc; font-size: .66rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.invoice-line-row { padding: .75rem; font-size: .82rem; }
.invoice-line-row strong:first-child { overflow-wrap: anywhere; }
.invoice-actions, .invoice-update-panel { display: flex; flex-wrap: wrap; gap: .55rem; align-items: end; }
.invoice-update-panel { padding: .8rem; border: 1px solid #d9e0fb; border-radius: 10px; background: #f7f8ff; }
.invoice-update-panel label { flex: 1 1 210px; margin: 0; }
.invoice-update-panel button { flex: 0 0 auto; }
.invoice-section-title { display: grid; gap: .15rem; padding-top: .25rem; }
.invoice-section-title strong { color: var(--ink); font-size: .9rem; }
.cell-copy-button { position: absolute; top: 50%; right: .42rem; z-index: 2; padding: .25rem .42rem; color: var(--brand-dark); border: 1px solid #b8c4e8; border-radius: 6px; background: white; font-size: .66rem; font-weight: 800; line-height: 1; opacity: 0; transform: translateY(-50%); transition: opacity .14s ease, background .14s ease; }
.copyable-cell:hover .cell-copy-button, .copyable-cell:focus-within .cell-copy-button { opacity: 1; }
.cell-copy-button:hover { background: #eef2ff; }
.chip { display: inline-block; padding: .22rem .5rem; color: #4657a7; border-radius: 99px; background: #eef2ff; font-size: .71rem; font-weight: 700; }

/* Routing is maintained in-place: computed figures remain readable while the
   editable values stay on the same line with explicit save/reset controls. */
.routing-editor-note { padding: .7rem .9rem; margin: 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .78rem; }
.routing-table-scroll {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: .35rem;
}
.routing-editor-table {
  min-width: 1180px;
  white-space: normal;
  overflow: visible;
}
.routing-editor-table th { white-space: nowrap; }
.routing-editor-table td { position: relative; min-width: 112px; vertical-align: middle; overflow: visible; }
.routing-editor-table .routing-input-cell { min-width: 142px; }
.routing-editor-table .routing-lookup-cell { min-width: 200px; overflow: visible; }
.routing-editor-table input, .routing-editor-table textarea { min-width: 100%; padding: .52rem .58rem; font-size: .8rem; }
.routing-editor-table textarea { min-width: 210px; min-height: 58px; }
.routing-edit-row:hover { background: #fbfcff; }
.routing-draft-row { background: #f4f6ff; }
.routing-lookup { min-width: 0; }
.routing-lookup .lookup-field { min-width: 0; overflow: visible; }
.routing-lookup .lookup-menu {
  z-index: 40;
  max-height: 280px;
  border-color: #b7c5ff;
  box-shadow: 0 14px 30px rgba(31, 46, 85, .22);
}
.routing-cell-detail { display: block; max-width: 220px; margin-top: .32rem; overflow: hidden; color: var(--muted); font-size: .72rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.routing-actions { min-width: 214px !important; }
.routing-row-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.routing-row-actions .primary, .routing-row-actions .secondary, .routing-row-actions .danger { padding: .47rem .6rem; font-size: .76rem; }
.routing-documents-manager { margin-top: 0; }
.routing-documents-note { padding: .75rem .85rem; margin: 0; color: #475467; border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; font-size: .84rem; line-height: 1.45; }
.routing-documents-section { display: grid; gap: .55rem; }
.routing-documents-section h3 { margin: 0; font-size: .98rem; }
.routing-documents-heading { display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.routing-documents-heading input { max-width: 350px; }
.routing-documents-table { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.routing-documents-table .table-scroll { max-height: 235px; }
.routing-documents-form { margin-top: -.1rem; }

.details-list { display: grid; gap: .65rem; }
.details-list div { display: flex; gap: 1rem; justify-content: space-between; padding-bottom: .55rem; border-bottom: 1px solid var(--line); font-size: .86rem; }
.details-list span { color: var(--muted); }

/* WO workflow context is intentionally compact, leaving the page for routing
   and BOM work rather than repeating a tall database-record details list. */
.workflow-context-card, .wo-routing-context-card { margin-top: 1rem; }
.workflow-summary-card, .wo-routing-heading { padding: .95rem 1.1rem; }
.workflow-summary-heading { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.workflow-summary-heading h2, .wo-routing-heading h2 { margin: 0; font-size: 1.35rem; }
.workflow-summary-details { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem .9rem; margin-top: .75rem; }
.workflow-summary-details div { min-width: 0; padding: .42rem 0; font-size: .8rem; }
.workflow-summary-details strong { overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.workflow-data-grid { margin-top: .75rem; }
.work-order-documents-card { margin-top: .75rem; }
.work-order-documents { padding: .95rem 1.1rem; }
.work-order-documents .workflow-summary-heading { margin-bottom: .7rem; }
.work-order-documents .workflow-summary-heading > .muted { font-size: .78rem; text-align: right; }
.work-order-documents > .muted { margin: .1rem 0; }
.work-order-documents-table { max-height: 310px; border: 1px solid var(--line); border-radius: 9px; }
.work-order-documents-table td { vertical-align: middle; }
.document-actions { display: flex; gap: .45rem; align-items: center; white-space: nowrap; }
.document-actions .primary, .document-actions .secondary { padding: .48rem .62rem; font-size: .76rem; }
.wo-routing-table-card, .wo-operation-card { margin-top: .85rem; }
.wo-operation-card h2 { margin: 0 0 .9rem; font-size: 1.1rem; }
.wo-routing-actions { justify-content: flex-start; }
.issue-lot-area { max-height: 270px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.issue-lot-area .table-scroll { max-height: 260px; }
.issue-empty { padding: 1rem; margin: 0; text-align: left; }
.issue-total { display: flex; align-items: center; justify-content: space-between; padding: .75rem .85rem; border: 1px solid #cfd7ef; border-radius: 9px; background: #f6f8ff; }
.issue-total span { color: var(--muted); font-size: .84rem; }
.issue-total strong { color: var(--brand-dark); font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .wide-field { grid-column: 1 / -1; }
.scheduling-editor-card { display: grid; gap: 1rem; margin-bottom: 1rem; }
.scheduling-actions { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.scheduling-actions input[hidden] { display: none; }
.scheduling-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scheduling-form .lookup-field { min-width: 0; }
.scheduling-selection-note { padding: .75rem .85rem; margin: 0; color: var(--muted); border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; font-size: .84rem; }
.scheduling-table-card { margin-top: 0; }
.ncr-context-note { padding: .75rem .85rem; margin: 0; color: #475467; border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; font-size: .82rem; line-height: 1.45; }

/* People and Purchasing keep information dense without turning operational
   approval work into a spreadsheet-only experience. */
.employee-document-status { padding: .75rem .85rem; margin: 0; color: #475467; border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; font-size: .84rem; line-height: 1.45; }
.employee-photo-form { align-items: stretch; }
.employee-photo-preview-holder { display: flex; justify-content: center; }
.employee-photo-preview { width: 150px; height: 190px; object-fit: cover; border: 2px solid #d9e0fb; border-radius: 14px; background: #eef2ff; box-shadow: 0 8px 18px rgba(42, 62, 130, .12); }
.employee-photo-preview-fallback { display: grid; place-items: center; color: var(--brand-dark); font-size: 2rem; font-weight: 900; }
.org-chart { --org-connector: #7187dc; overflow: auto; padding: .4rem; }
/* A conventional top-down organization chart: direct reports fan out across
   the page beneath their manager, matching a controlled organization chart. */
.org-roots, .org-children, .org-summary-list, .org-direct-report-list { display: flex; align-items: flex-start; justify-content: center; padding: 0; margin: 0; gap: 1rem; list-style: none; }
/* Explicitly win over the flex declarations above in every supported browser. */
.org-children[hidden], .org-summary-list[hidden] { display: none !important; }
.org-roots { min-width: max-content; }
.org-person, .org-role-group, .org-direct-report-branch { position: relative; display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; min-width: 270px; }
.org-person > .org-card { box-sizing: border-box; width: 270px; }
.org-role-group > .org-role-card { box-sizing: border-box; width: auto; }
.org-person > .org-children, .org-person > .org-summary-list { width: 100%; }
.org-children, .org-summary-list { position: relative; padding: 1.8rem .7rem 0; margin-top: .5rem; }
/* Connectors use borders, not background fills. Print drivers commonly omit
   background graphics, while borders remain visible on screen and on paper. */
.org-children::before, .org-summary-list::before { position: absolute; top: -.5rem; left: 50%; width: 0; height: 1.85rem; border-left: 2px solid var(--org-connector); content: ''; }
.org-children::after, .org-summary-list::after { position: absolute; top: 1.35rem; right: calc(.7rem + 135px); left: calc(.7rem + 135px); height: 0; border-top: 2px solid var(--org-connector); content: ''; }
.org-children > .org-person::before, .org-summary-list > .org-role-group::before, .org-children > .org-direct-report-branch::before { position: absolute; top: -.45rem; left: 50%; width: 0; height: .45rem; border-left: 2px solid var(--org-connector); content: ''; }
.org-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: .28rem .62rem; padding: .82rem .9rem; border: 1px solid #cfd8f7; border-radius: 10px; background: var(--org-card-bg, linear-gradient(135deg, #fff, #f5f7ff)); box-shadow: 0 3px 8px rgba(42, 62, 130, .06); }
.org-level-1 { --org-card-bg: linear-gradient(135deg, #fff, #eef2ff); border-color: #b8c7ff; }
.org-level-2 { --org-card-bg: linear-gradient(135deg, #fff, #f1f7ff); border-color: #c5d8fb; }
.org-level-3 { --org-card-bg: linear-gradient(135deg, #fff, #f1fbf6); border-color: #bee6d0; }
.org-level-4 { --org-card-bg: linear-gradient(135deg, #fff, #fff7ed); border-color: #fed7aa; }
.org-level-5 { --org-card-bg: linear-gradient(135deg, #fff, #fdf2f8); border-color: #fbcfe8; }
.org-level-6 { --org-card-bg: linear-gradient(135deg, #fff, #f5f3ff); border-color: #ddd6fe; }
.org-card-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: .45rem; }
.org-card strong { min-width: 0; color: var(--brand-dark); font-size: .88rem; line-height: 1.15; overflow-wrap: anywhere; word-break: break-word; }
.org-card span { min-width: 0; color: #475467; font-size: .8rem; overflow-wrap: anywhere; }
.org-card small { min-width: 0; color: var(--muted); font-size: .71rem; overflow-wrap: anywhere; }
.org-photo { grid-row: 1 / span 3; width: 48px; height: 58px; object-fit: cover; border: 1px solid #cfd8f7; border-radius: 10px; background: #eef2ff; }
.org-card .org-photo-fallback { display: grid; place-items: center; color: #31459f; font-size: .88rem; font-weight: 900; }
.org-children-vertical { flex-direction: column; align-items: center; min-width: 260px; gap: .8rem; }
.org-children-vertical::after { display: none; }
.org-children-vertical > .org-person::before { top: -.8rem; height: .8rem; }
.org-children-branch-split { align-items: flex-start; gap: 1.25rem; }
.org-direct-report-branch { min-width: 290px; padding-top: .05rem; }
.org-branch-label { display: inline-flex; align-items: center; justify-content: center; min-width: 190px; padding: .28rem .6rem; color: #31459f; border: 1px dashed #b8c7ff; border-radius: 999px; background: #f6f8ff; font-size: .78rem; font-weight: 900; }
.org-direct-report-list { position: relative; flex-direction: column; align-items: center; gap: .8rem; padding-top: 1.35rem; margin-top: .15rem; }
.org-direct-report-list::before { position: absolute; top: 0; left: 50%; width: 0; height: 1.35rem; border-left: 2px solid var(--org-connector); content: ''; }
.org-direct-report-list > .org-person { min-width: 270px; }
.org-direct-report-list > .org-person::before { position: absolute; top: -.8rem; left: 50%; width: 0; height: .8rem; border-left: 2px solid var(--org-connector); content: ''; }
.org-role-card { padding: .08rem .35rem; color: var(--brand-dark); background: transparent; }
.org-role-card strong { color: var(--brand-dark); font-size: .88rem; }
.org-chart-action, .org-toggle { display: grid; width: 30px; height: 30px; padding: 0; place-items: center; color: #31459f; border: 1px solid #c6d0f5; border-radius: 7px; background: white; font-size: 1rem; font-weight: 800; line-height: 1; }
.org-person-toggle { flex: 0 0 auto; width: 25px; height: 25px; margin-top: -.16rem; font-size: .9rem; }
.org-toggle:hover { background: #eef2ff; }

@media (max-width: 760px) {
  .org-chart { padding: .2rem; }
  .org-roots, .org-children, .org-summary-list { justify-content: flex-start; }
  .org-person, .org-role-group { min-width: 210px; }
  .org-person > .org-card { width: 210px; }
  .org-children::after, .org-summary-list::after { right: calc(.7rem + 105px); left: calc(.7rem + 105px); }
}

@page organization-chart { size: landscape; margin: 10mm; }

@media print {
  body.print-organization-chart #erp-app > .sidebar,
  body.print-organization-chart .topbar,
  body.print-organization-chart .page-head { display: none !important; }
  body.print-organization-chart .app-shell { display: block; }
  body.print-organization-chart .workspace,
  body.print-organization-chart .content { display: block; max-width: none; padding: 0; margin: 0; }
  body.print-organization-chart .organization-chart-card { border: 0; box-shadow: none; }
  body.print-organization-chart .organization-chart-print { page: organization-chart; }
  body.print-organization-chart .org-chart { overflow: visible; padding: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.print-organization-chart .org-toggle { display: none; }
  body.print-organization-chart .org-card, body.print-organization-chart .org-role-card { break-inside: avoid; box-shadow: none; }
}
.purchase-request-form { max-width: 900px; }
.purchase-lines { display: grid; gap: .65rem; padding: .85rem; border: 1px solid #d9e0fb; border-radius: 10px; background: #fafbff; }
.purchase-lines-heading { display: flex; align-items: center; justify-content: space-between; color: var(--brand-dark); font-size: .88rem; }
.purchase-line-list { display: grid; gap: .6rem; }
.purchase-line { display: grid; grid-template-columns: 1.1fr 2.2fr .75fr .75fr 1fr auto; gap: .55rem; align-items: end; padding: .72rem; border: 1px solid var(--line); border-radius: 9px; background: white; }
.purchase-line label { display: grid; gap: .3rem; min-width: 0; color: #475467; font-size: .7rem; font-weight: 800; }
.purchase-line input { min-width: 0; }
.purchase-line .danger { padding: .6rem .7rem; }
.purchase-detail-summary { display: grid; gap: .25rem; padding: .8rem .9rem; border: 1px solid #d9e0fb; border-radius: 9px; background: #f7f8ff; }
.purchase-detail-summary strong { color: var(--brand-dark); }
.purchase-detail-summary span { color: var(--muted); font-size: .82rem; }

/* The matrix intentionally keeps real controls in every editable cell. This
   makes bulk planning changes quick while the Save matrix action remains the
   single, deliberate database write. */
.loss-matrix-actions { margin-bottom: 1rem; }
.loss-matrix-card { overflow: hidden; }
.loss-matrix-scroll { max-height: calc(100vh - 290px); }
.loss-matrix-table { min-width: 1450px; white-space: normal; }
.loss-matrix-table th, .loss-matrix-table td { vertical-align: middle; }
.loss-matrix-table th { white-space: nowrap; }
.loss-matrix-table td:first-child, .loss-matrix-table td:nth-child(2) { white-space: nowrap; }
.loss-matrix-table .matrix-number-cell { min-width: 132px; padding: .42rem .5rem; }
.matrix-input { min-width: 94px; padding: .48rem .55rem; text-align: right; }
.matrix-active { min-width: 82px; padding: .48rem .5rem; }
.matrix-notes { min-width: 210px; padding: .48rem .55rem; }
.item-cost-form-note { padding: .85rem 1rem; border: 1px solid #d9e0fb; border-radius: 10px; background: #f6f8ff; }
.item-cost-form-note strong { color: #31459f; font-size: .88rem; }
.item-cost-form-note p { margin: .35rem 0 0; line-height: 1.45; }
.drawing-pdf-field { display: grid; gap: .45rem; }
.drawing-pdf-field > span { color: #344054; font-size: .86rem; font-weight: 700; }
.drawing-pdf-actions { display: flex; gap: .7rem; align-items: center; justify-content: space-between; min-height: 42px; padding: .45rem .55rem .45rem .75rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fafcff; }
.drawing-pdf-actions .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lookup-field { position: relative; }
.lookup-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 8; width: 100%; max-height: 220px; overflow-x: hidden; overflow-y: scroll; scrollbar-gutter: stable both-edges; border: 1px solid #cdd5df; border-radius: 9px; background: white; box-shadow: 0 10px 24px rgba(31, 46, 85, .16); }
.lookup-option { display: grid; width: 100%; gap: .12rem; padding: .62rem .72rem; color: var(--ink); border: 0; border-bottom: 1px solid #eef1f5; background: white; text-align: left; }
.lookup-option:last-child { border-bottom: 0; }
.lookup-option:hover, .lookup-option:focus { background: #eef2ff; }
.lookup-option strong { font-size: .83rem; }
.lookup-option span, .lookup-empty, .lookup-hint { color: var(--muted); font-size: .75rem; font-weight: 500; }
.lookup-empty { display: block; padding: .72rem; }
.lookup-hint { margin-top: -.1rem; }
.checkbox-list-field { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .7rem; border: 1px solid #d9e0fb; border-radius: 10px; background: #fafbff; }
.checkbox-list-option { display: flex; gap: .45rem; align-items: center; min-width: 0; padding: .45rem .5rem; border: 1px solid #e6eaf8; border-radius: 8px; background: white; color: #344054; font-size: .82rem; font-weight: 750; }
.checkbox-list-option input { width: 16px; height: 16px; min-height: auto; padding: 0; accent-color: var(--brand); }

.modal { width: 100%; max-width: min(880px, 100%); padding: 1rem; border: 0; background: transparent; }
.modal::backdrop { background: rgba(14, 24, 48, .46); backdrop-filter: blur(2px); }
.modal-content { max-height: calc(100vh - 2rem); overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; border-radius: 15px; background: white; box-shadow: var(--shadow); }
.modal-content > header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-content h2 { margin: 0; font-size: 1.2rem; }
.modal-content > #modal-body { padding: 1.25rem; }
.icon-button { width: 34px; height: 34px; color: #344054; background: #f2f4f7; font-size: 1.35rem; line-height: 1; }
.icon-button:hover { background: #e4e7ec; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
.toast { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 5; max-width: 420px; padding: .78rem 1rem; color: white; border-radius: 10px; background: #15213b; box-shadow: var(--shadow); opacity: 0; transform: translateY(140%); transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a91c18; }

.chat { display: grid; min-height: 400px; gap: .8rem; }
.chat-log { display: grid; max-height: 480px; padding: 1rem; gap: .7rem; overflow: auto; align-content: start; border: 1px solid var(--line); border-radius: 11px; background: #fbfcff; }
.bubble { max-width: min(680px, 90%); padding: .72rem .85rem; border-radius: 10px; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }
.bubble.user { margin-left: auto; color: white; background: #4259d7; }
.bubble.assistant { border: 1px solid var(--line); background: white; }
.sumi-answer-text { white-space: pre-wrap; }
.sumi-link-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; }
.sumi-answer-meta { display: block; margin-top: .55rem; color: var(--muted); font-size: .72rem; white-space: normal; }
.chat-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; justify-content: space-between; }
.chat-toolbar label { display: grid; min-width: 190px; gap: .3rem; color: #344054; font-size: .76rem; font-weight: 750; }
.chat-toolbar select { min-height: 38px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: .65rem; }
.workflow-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding: 1rem; }
.workflow-controls label { display: grid; min-width: 140px; gap: .3rem; font-size: .76rem; font-weight: 700; }
.workflow-controls input, .workflow-controls select { min-width: 140px; }
.optimizer-card { margin-bottom: 1rem; }
.optimizer-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.optimizer-toggles { display: flex; flex-wrap: wrap; gap: .85rem 1.2rem; align-items: center; padding: .75rem .85rem; border: 1px solid #d9e0fb; border-radius: 10px; background: #f7f8ff; }
.toggle-field { display: flex !important; gap: .5rem; align-items: center; color: #344054; font-size: .82rem !important; font-weight: 700; }
.toggle-field input { width: auto; accent-color: var(--brand); }
.optimizer-hint { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .77rem; line-height: 1.4; }
.optimizer-actions { padding-top: .1rem; }
.optimizer-summary { display: grid; gap: .35rem; padding: 1rem 1.15rem; margin-bottom: 1rem; border-color: #d9e0fb; background: linear-gradient(110deg, #f7f8ff, #fff); }
.optimizer-summary strong { color: var(--brand-dark); font-size: 1.04rem; }
.optimizer-summary p { margin: 0; line-height: 1.45; }
.optimizer-results, .optimizer-unscheduled { margin-top: 1rem; }
.optimizer-unscheduled:empty { display: none; }
.machine-schedule-filter-card { margin-bottom: 1rem; }
.machine-schedule-summary { margin-bottom: 1rem; overflow: hidden; border-color: #d9e0fb; }
.machine-schedule-summary .metric-grid { gap: 0; }
.machine-schedule-summary .metric { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.machine-schedule-summary .metric:last-child { border-right: 0; }
.machine-schedule-summary .metric strong { font-size: 1.05rem; letter-spacing: -.025em; }
.gantt-card { margin-bottom: 1rem; overflow: hidden; }
.gantt-tools { border-bottom: 1px solid var(--line); }
.gantt-scroll { overflow-x: auto; }
.gantt-board { min-width: 860px; overflow: hidden; }
.gantt-grid-row { display: grid; grid-template-columns: 178px minmax(680px, 1fr); min-height: 54px; border-bottom: 1px solid #edf0f5; }
.gantt-grid-row:last-child { border-bottom: 0; }
.gantt-machine-label { display: flex; align-items: center; padding: .7rem .8rem; overflow: hidden; color: #344054; border-right: 1px solid var(--line); background: #fafbff; font-size: .79rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; min-width: 0; overflow: hidden; }
.gantt-axis { min-height: 38px; background: #f8f9fc; }
.gantt-axis-track { min-height: 38px; }
.gantt-day-label { position: absolute; top: .7rem; padding-left: .42rem; color: #667085; font-size: .67rem; font-weight: 700; white-space: nowrap; }
.gantt-lane { min-height: 54px; background: repeating-linear-gradient(0deg, #fff, #fff 26px, #fbfcff 27px); }
.gantt-day-line { position: absolute; top: 0; bottom: 0; width: 1px; background: #e5eaf4; }
.gantt-bar { position: absolute; top: 11px; z-index: 1; height: 31px; min-width: 5px; padding: .48rem .5rem; overflow: hidden; color: #fff; border: 1px solid rgba(0, 0, 0, .08); border-radius: 6px; background: #4b60d8; box-shadow: 0 2px 5px rgba(50, 70, 160, .22); font-size: .67rem; font-weight: 800; line-height: 1; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.gantt-bar:focus, .gantt-bar:hover { z-index: 3; overflow: visible; outline: 3px solid rgba(75, 96, 216, .22); }
.gantt-top-priority, .gantt-critical { background: #b42318; }
.gantt-high { background: #d97706; }
.gantt-low { background: #64748b; }
.gantt-empty { padding: 2.2rem 1.25rem; color: var(--muted); line-height: 1.5; text-align: center; }
.machine-schedule-table { margin-top: 0; }
.wip-layout-card { overflow: hidden; }
.wip-designer-tools { padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: #f8f9ff; }
.wip-designer-tools[hidden] { display: none; }
.wip-designer-tools p { margin: .6rem 0 0; font-size: .78rem; line-height: 1.45; }
.wip-legend { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: white; }
.wip-legend > span { display: grid; grid-template-columns: auto auto; gap: .05rem .45rem; align-items: center; }
.wip-legend small { grid-column: 2; color: var(--muted); font-size: .69rem; }
.wip-legend-dot { display: block; grid-row: 1 / span 2; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .75); border-radius: 50%; box-shadow: 0 0 0 1px rgba(21, 33, 59, .16); }
.wip-legend-dot.productive { background: #15803d; }
.wip-legend-dot.housekeeping { background: #2563eb; }
.wip-legend-dot.waiting { background: #d97706; }
.wip-legend-dot.meal { background: #7c3aed; }
.wip-legend-dot.stopped { background: #b42318; }
.wip-legend-dot.area { background: #d7dce8; }
.wip-layout-scroll { max-width: 100%; overflow: auto; background: #e9edf3; }
.wip-layout-board {
  position: relative;
  width: 100%;
  min-width: 900px;
  min-height: 560px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(rgba(72, 90, 135, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 90, 135, .07) 1px, transparent 1px),
    #f8fafc;
  background-size: 28px 28px;
}
.wip-layout-board.design-mode { background-color: #f3f6ff; }
.wip-layout-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: .35rem; color: var(--muted); text-align: center; }
.wip-layout-empty strong { color: var(--ink); font-size: 1.1rem; }
.wip-layout-box {
  position: absolute;
  display: flex;
  min-width: 90px;
  min-height: 62px;
  flex-direction: column;
  gap: .4rem;
  padding: .72rem;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(25, 39, 68, .14);
  transition: box-shadow .15s, transform .15s;
  touch-action: none;
  user-select: none;
}
.wip-layout-box.machine { color: white; cursor: pointer; }
.wip-layout-box.machine.running { border-color: #0d6b31; background: #15803d; }
.wip-layout-box.machine.not-running { border-color: #8f1b13; background: #b42318; }
.wip-layout-box.machine.status-green { border-color: #0d6b31; background: #15803d; }
.wip-layout-box.machine.status-red { border-color: #8f1b13; background: #b42318; }
.wip-layout-box.machine.status-blue { border-color: #1d4ed8; background: #2563eb; }
.wip-layout-box.machine.status-amber { border-color: #a45309; background: #d97706; }
.wip-layout-box.machine.status-purple { border-color: #5b21b6; background: #7c3aed; }
.wip-layout-box.area { color: #344054; border-color: #7d899b; background: rgba(231, 235, 242, .72); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .62), 0 5px 14px rgba(25, 39, 68, .1); }
.wip-layout-box:hover, .wip-layout-box:focus-visible { z-index: 999 !important; box-shadow: 0 9px 22px rgba(20, 32, 58, .24); outline: 3px solid rgba(66, 89, 215, .22); }
.wip-layout-board.design-mode .wip-layout-box { cursor: move; }
.wip-layout-box.selected { z-index: 998 !important; outline: 4px solid #fbbf24; outline-offset: 2px; }
.wip-layout-box.moving { opacity: .9; box-shadow: 0 13px 28px rgba(20, 32, 58, .3); }
.wip-box-heading { display: flex; min-width: 0; gap: .55rem; align-items: center; }
.wip-box-heading > div { display: grid; min-width: 0; }
.wip-box-heading strong, .wip-box-heading small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wip-box-heading strong { font-size: clamp(.75rem, .9vw, .93rem); }
.wip-box-heading small { opacity: .86; font-size: .68rem; }
.wip-box-icon { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border: 1px solid currentColor; border-radius: 8px; font-size: .72rem; font-weight: 900; opacity: .9; }
.wip-live-state { display: flex; gap: .38rem; align-items: center; padding-top: .1rem; font-size: .75rem; }
.wip-state-icon { font-size: .64rem; }
.wip-operation { overflow: hidden; font-size: .68rem; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.wip-since { overflow: hidden; margin-top: auto; opacity: .82; font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.wip-layout-box.area p { margin: 0; overflow: hidden; font-size: .7rem; line-height: 1.35; }
.wip-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 1px;
  display: none;
  width: 24px;
  height: 24px;
  color: #15213b;
  border-radius: 7px;
  background: #fbbf24;
  font-size: .83rem;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
  cursor: nwse-resize;
}
.wip-layout-board.design-mode .wip-resize-handle { display: block; }
.wip-machine-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; min-width: min(680px, 76vw); }
.wip-machine-details > div:not(.modal-actions) { display: grid; gap: .25rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 9px; background: #fafbff; }
.wip-machine-details span { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.wip-machine-details strong { overflow-wrap: anywhere; }
.shop-entry-card { overflow: hidden; }
.shop-entry-selection { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 1rem; padding: 1rem; }
.shop-entry-fields { display: grid; grid-template-columns: minmax(240px, .65fr) minmax(360px, 1.35fr); gap: .85rem; align-content: start; }
.shop-entry-fields label { display: grid; gap: .35rem; color: var(--ink); font-size: .73rem; font-weight: 800; }
.shop-entry-fields .wide-field { grid-column: 1 / -1; }
.shop-entry-fields textarea { min-height: 78px; resize: vertical; }
.shop-wo-load { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.shop-wo-load button { white-space: nowrap; }
.shop-current-state { display: grid; min-height: 156px; gap: .9rem; align-content: center; padding: 1rem 1.1rem; color: white; border-radius: 14px; box-shadow: 0 8px 24px rgba(21, 33, 59, .14); }
.shop-current-state.state-green { background: linear-gradient(145deg, #15803d, #0f6b34); }
.shop-current-state.state-red { background: linear-gradient(145deg, #b42318, #901b14); }
.shop-current-state.state-blue { background: linear-gradient(145deg, #2563eb, #1d4ed8); }
.shop-current-state.state-amber { background: linear-gradient(145deg, #d97706, #b45309); }
.shop-current-state.state-purple { background: linear-gradient(145deg, #7c3aed, #5b21b6); }
.shop-state-heading { display: flex; gap: .7rem; align-items: center; }
.shop-state-heading > div { display: grid; gap: .15rem; }
.shop-state-heading small { opacity: .82; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.shop-state-heading strong { font-size: 1.28rem; }
.shop-state-dot { width: 16px; height: 16px; flex: 0 0 16px; border: 3px solid rgba(255, 255, 255, .78); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255, 255, 255, .15); }
.shop-state-details { display: flex; flex-wrap: wrap; gap: .4rem .8rem; font-size: .73rem; font-weight: 700; opacity: .9; }
.shop-operation-context { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fbfcff; }
.shop-operation-context > div { display: grid; min-width: 0; gap: .25rem; padding: .7rem .8rem; border-right: 1px solid var(--line); }
.shop-operation-context > div:last-child { border-right: 0; }
.shop-operation-context span { color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.shop-operation-context strong { overflow: hidden; color: var(--ink); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.shop-operation-context > p { grid-column: 1 / -1; margin: 0; padding: .85rem; }
.shop-actions-panel { display: grid; gap: .85rem; }
.shop-actions-panel h2, .table-tools h2 { margin: 0; font-size: 1rem; }
.shop-actions-panel p { margin: .2rem 0 0; font-size: .74rem; }
.shop-action-grid { display: grid; gap: .65rem; }
.productive-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.support-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shop-action { min-height: 54px; padding: .72rem .65rem; color: white; border: 1px solid transparent; border-radius: 10px; font-size: .76rem; font-weight: 850; line-height: 1.2; box-shadow: 0 3px 8px rgba(21, 33, 59, .12); }
.shop-action.compact { min-height: 44px; padding: .42rem .5rem; display: flex; align-items: center; gap: .45rem; justify-content: flex-start; font-size: .69rem; border-radius: 8px; }
.shop-action-icon { min-width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .16); font-size: .68rem; font-weight: 900; letter-spacing: .02em; }
.shop-action-label { display: inline-block; text-align: left; line-height: 1.1; }
.shop-action:hover { filter: brightness(.96); transform: translateY(-1px); }
.shop-action.start, .shop-action.complete { background: #15803d; }
.shop-action.stop { background: #b42318; }
.shop-action.waiting { background: #d97706; }
.shop-action.housekeeping { background: #2563eb; }
.shop-action.meal { background: #7c3aed; }
.shop-action.end-activity { color: #344054; border-color: #c8cfdf; background: #eef1f7; }
.shop-action.end-activity .shop-action-icon { background: rgba(52, 64, 84, .08); color: #344054; }
.shop-util-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; align-items: end; }
.shop-util-grid { display: grid; gap: .8rem; margin-top: 1rem; }
.shop-util-card { padding: .9rem; }
.shop-util-card-head { display: grid; grid-template-columns: 1.1fr 1.5fr auto; gap: .75rem; align-items: center; margin-bottom: .55rem; }
.shop-util-bar { height: 12px; display: flex; overflow: hidden; border-radius: 999px; background: #e6ebf4; box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .08); }
.shop-util-segment { height: 100%; }
.shop-util-segment.productive { background: #15803d; }
.shop-util-segment.waiting { background: #d97706; }
.shop-util-segment.maintenance { background: #0f766e; }
.shop-util-segment.housekeeping { background: #2563eb; }
.shop-util-segment.meal { background: #7c3aed; }
.shop-util-segment.meeting { background: #9333ea; }
.shop-util-meta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .55rem; font-size: .72rem; color: var(--muted); }
.status-panel { display: grid; gap: .55rem; padding: 1rem; }
.status-panel strong { font-size: 1.1rem; }
.task-workspace { display: grid; gap: 1rem; }
.task-filter-tools { align-items: center; }
.task-filter-tools input[type="search"] { min-width: 280px; }
.task-filter-tools select { max-width: 210px; }
.task-priority-preview { border-left: 4px solid var(--brand); }
.task-detail { display: grid; gap: 1rem; min-width: min(900px, 78vw); }
.task-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; border: 1px solid var(--line); border-radius: 12px; }
.task-detail-grid > div { display: grid; gap: .25rem; min-width: 0; padding: .72rem .8rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fbfcff; }
.task-detail-grid > div:nth-child(3n) { border-right: 0; }
.task-detail-grid span { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.task-detail-grid strong { overflow-wrap: anywhere; color: #15213b; font-size: .83rem; }
.task-text-block, .task-resolution-block { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.task-text-block h3, .task-resolution-block h3 { margin: 0 0 .65rem; }
.task-text-block p, .task-resolution-block p { margin: .35rem 0; line-height: 1.55; white-space: pre-wrap; }
.task-resolution-block { border-color: #a7e4ce; background: #f3fcf8; }
.task-attachments { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .65rem; }
.task-attachment-link { display: inline-flex; padding: .55rem .7rem; border-radius: 8px; text-decoration: none; }
.task-upload-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.task-timeline { position: relative; display: grid; gap: .7rem; padding-left: 1.4rem; }
.task-timeline::before { position: absolute; top: .3rem; bottom: .3rem; left: .38rem; width: 2px; content: ''; background: #d8def2; }
.task-event { position: relative; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.task-event::before { position: absolute; top: 1rem; left: -1.45rem; width: .7rem; height: .7rem; content: ''; border: 2px solid white; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 1px #b9c4ec; }
.task-event-resolution::before, .task-event-verification::before { background: #079669; }
.task-event-assignment::before { background: #d97706; }
.task-event-head { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; }
.task-event-head span { color: var(--muted); font-size: .72rem; }
.task-event p { margin: .45rem 0 0; line-height: 1.45; white-space: pre-wrap; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 300px; padding: 3rem; }
  .brand-orbit { top: 30%; right: 10%; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 6; display: none; width: 254px; box-shadow: var(--shadow); }
  .app-shell.nav-open .sidebar { display: flex; }
  .mobile-only { display: block; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .invoice-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-kpi-row .invoice-kpi:nth-child(2n) { border-right: 0; }
  .invoice-workspace { grid-template-columns: 1fr; }
  .invoice-preview-card { position: static; }
  .workflow-summary-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scheduling-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .optimizer-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .machine-schedule-summary .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .machine-schedule-summary .metric:nth-child(2) { border-right: 0; }
  .wip-layout-board { width: 900px; }
  .shop-entry-selection { grid-template-columns: 1fr; }
  .shop-operation-context { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shop-operation-context > div:nth-child(3n) { border-right: 0; }
  .productive-actions, .support-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .issue-lot-area { max-height: 220px; }
  .purchase-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-detail { min-width: 0; }
  .task-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-detail-grid > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .task-detail-grid > div:nth-child(2n) { border-right: 0; }
  .table-scroll { max-height: none; }
  .content { padding: 1rem; }
  .topbar-actions .muted { display: none; }
}

@media (max-width: 680px) {
  .invoice-kpi-row, .invoice-total-strip, .invoice-detail-grid { grid-template-columns: 1fr; }
  .invoice-kpi, .invoice-total-strip .invoice-kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .invoice-kpi:last-child, .invoice-total-strip .invoice-kpi:last-child { border-bottom: 0; }
  .invoice-line-head, .invoice-line-row { grid-template-columns: minmax(0, 1fr); }
  .invoice-line-head span:not(:first-child) { display: none; }
  .invoice-actions, .invoice-update-panel { align-items: stretch; }
  .invoice-actions button, .invoice-update-panel button { width: 100%; }
}

@media (max-width: 560px) {
  .brand-panel { display: none; }
  .login-card { padding: 3rem 1.5rem; }
  .metric-grid { gap: .6rem; grid-template-columns: 1fr 1fr; }
  .metric { padding: .85rem; }
  .metric strong { font-size: 1.4rem; }
  .page-head, .form-grid, .scheduling-form, .optimizer-form, .chat-form { display: grid; grid-template-columns: 1fr; }
  .machine-schedule-summary .metric-grid { grid-template-columns: 1fr; }
  .machine-schedule-summary .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .machine-schedule-summary .metric:last-child { border-bottom: 0; }
  .wip-machine-details { grid-template-columns: 1fr; min-width: 0; }
  .shop-entry-fields, .shop-operation-context { grid-template-columns: 1fr; }
  .shop-operation-context > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .shop-operation-context > div:last-child { border-bottom: 0; }
  .productive-actions, .support-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-summary-heading { display: grid; }
  .workflow-summary-details { grid-template-columns: 1fr; }
  .org-roots { flex-direction: column; }
  .four-col { grid-template-columns: 1fr; }
  .purchase-line { grid-template-columns: 1fr; }
  .task-detail-grid { grid-template-columns: 1fr; }
  .task-detail-grid > div { border-right: 0 !important; }
  .issue-total { display: grid; gap: .25rem; }
  .topbar { padding: 0 .75rem; }
  .cell-copy-button { opacity: 1; }
}
