:root {
  --ink: #14202b;
  --muted: #5a6b78;
  --line: #d5dde4;
  --panel: #ffffff;
  --bg0: #eef3f6;
  --bg1: #f7f5f1;
  --accent: #0f6b63;
  --accent-2: #148f84;
  --accent-dark: #0b524c;
  --sidebar: #10242c;
  --sidebar-2: #16333d;
  --sidebar-text: #c5d5db;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
  --radius: 8px;
  --shadow: 0 6px 18px rgba(16, 36, 44, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 36, 44, 0.05);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Manrope", "Segoe UI", sans-serif;
  /* Compact density */
  --space-1: 0.25rem;
  --space-2: 0.4rem;
  --space-3: 0.55rem;
  --space-4: 0.75rem;
  --space-5: 1rem;
  --ctrl-pad-y: 0.38rem;
  --ctrl-pad-x: 0.55rem;
  --row-pad-y: 0.35rem;
  --row-pad-x: 0.5rem;
  --font-base: 0.84rem;
  --font-sm: 0.72rem;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-base);
  line-height: 1.35;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(20, 143, 132, 0.10), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(180, 140, 70, 0.08), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(90deg, #0d1f26 0%, #14343d 100%);
  color: #fff;
  gap: 0.65rem;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.sidebar-toggle {
  display: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 7px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.68rem;
  background: linear-gradient(145deg, #1aa897, #0f6b63);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand-text {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 0.92rem;
}
.plant-badge {
  background: rgba(26, 168, 151, 0.2);
  border: 1px solid rgba(26, 168, 151, 0.35);
  color: #b8f0e6;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.prod-line-switch {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.55rem;
  padding-left: 0.65rem;
  border-left: 1px solid rgba(255,255,255,0.12);
  flex-wrap: wrap;
}
.prod-line-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #c5d5db;
  text-decoration: none;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.prod-line-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}
.prod-line-btn.is-active {
  color: #0b524c;
  background: #7ee0d2;
  border-color: #7ee0d2;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-right: 0.25rem;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1aa897;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.72rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-meta strong { font-size: 0.74rem; }
.user-meta small { font-size: 0.62rem; opacity: 0.7; text-transform: capitalize; }

/* Layout + Sidebar */
.layout { display: flex; min-height: calc(100vh - 46px); }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0f2229;
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-inner {
  position: sticky;
  top: 46px;
  max-height: calc(100vh - 46px);
  overflow-y: auto;
  padding: 0.65rem 0.5rem 1.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.sidebar-context {
  margin: 0 0.25rem 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.sidebar-context-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7f9aa3;
  margin-bottom: 0.12rem;
}
.sidebar-context-title {
  display: block;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 700;
  color: #e8f0f2;
  line-height: 1.25;
}
.nav-section {
  margin: 0.7rem 0.4rem 0.28rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7a929b;
}
.nav-section:first-of-type,
.sidebar-context + .nav-section,
.nav-link-home + .nav-section {
  margin-top: 0.45rem;
}
.nav-hint {
  margin: 0.35rem 0.4rem 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 7px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  color: #8aa0a8;
  text-transform: none;
  letter-spacing: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #b7c8ce;
  padding: 0.4rem 0.55rem;
  margin: 0.05rem 0;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}
.nav-link-soon,
.nav-link-soon:hover {
  cursor: default;
  background: none;
  color: #7f949c;
}
.nav-soon {
  margin-left: auto;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #f0c27a;
  background: rgba(240, 194, 122, 0.12);
}
.nav-link.active {
  background: rgba(26, 168, 151, 0.16);
  border-color: rgba(26, 168, 151, 0.28);
  color: #fff;
  font-weight: 650;
  box-shadow: inset 3px 0 0 #1aa897;
}
.nav-link-home {
  margin-bottom: 0.2rem;
  font-weight: 600;
  color: #d5e3e7;
}
.nav-link-home.active {
  background: rgba(26, 168, 151, 0.2);
}
.nav-ico {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 800;
  font-family: var(--display);
  letter-spacing: 0.02em;
  color: #9eb4bc;
  background: rgba(255,255,255,0.05);
  opacity: 1;
}
.nav-link:hover .nav-ico {
  color: #d7e6ea;
  background: rgba(255,255,255,0.08);
}
.nav-link.active .nav-ico {
  color: #0b524c;
  background: #7ee0d2;
}
.nav-dot {
  width: 0.35rem;
  height: 0.35rem;
  margin: 0 0.4rem 0 0.4rem;
  border-radius: 50%;
  background: #5f7882;
  flex-shrink: 0;
}
.nav-link:hover .nav-dot { background: #9eb4bc; }
.nav-link.active .nav-dot { background: #7ee0d2; }

.nav-group {
  margin: 0.35rem 0 0.15rem;
}
.nav-group-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #9eb4bc;
  padding: 0.32rem 0.55rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}
.nav-group-title::-webkit-details-marker { display: none; }
.nav-group-title::after {
  content: '▾';
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.7;
}
.nav-group:not([open]) .nav-group-title::after { content: '▸'; }
.nav-group-title:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-sub {
  padding: 0.1rem 0 0.2rem 0.35rem;
  border-left: 2px solid rgba(126, 224, 210, 0.22);
  margin: 0.1rem 0 0.25rem 0.7rem;
}
.nav-sub-link {
  font-size: 0.76rem;
}

.content {
  flex: 1;
  padding: 0.65rem 0.85rem 1.1rem;
  overflow-x: auto;
  min-width: 0;
  position: relative;
  width: 100%;
}

/* —— Main home dashboard (standard software) —— */
.home-dash {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.15rem 0 1.25rem;
}
.home-dash-head {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.home-empty {
  padding: 1rem 1.1rem;
}
.home-section {
  margin-bottom: 1.15rem;
}
.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}
.home-section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.home-section-sub {
  margin: 0;
  font-size: 0.74rem;
}
.home-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}
.home-module-grid-setup {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 520px;
}
.home-module {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 148px;
  padding: 0.85rem 0.9rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-module:hover {
  border-color: rgba(15, 107, 99, 0.45);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.home-module:hover .home-module-cta {
  color: var(--accent-dark);
}
.home-module-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.home-module-ico {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(145deg, #1aa897, #0f6b63);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}
.home-module-ico-setup {
  background: linear-gradient(145deg, #3a5360, #1c2f38);
}
.home-module-badge {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.home-badge-ready {
  color: var(--ok);
  background: #e8f6ef;
  border-color: #b7e0c8;
}
.home-badge-soon {
  color: var(--warn);
  background: #fff7eb;
  border-color: #f0d7a8;
}
.home-badge-setup {
  color: #334955;
  background: #eef3f6;
  border-color: #c9d5dc;
}
.home-module-title {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.home-module-hint {
  margin: 0;
  flex: 1;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}
.home-module-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(213, 221, 228, 0.9);
}
.home-module-meta {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}
.home-module-cta {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.home-module-soon {
  opacity: 0.92;
  cursor: default;
}
.home-module-soon:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.home-module-soon .home-module-cta,
.home-module-soon:hover .home-module-cta {
  color: var(--muted);
}
@media (max-width: 900px) {
  .home-module-grid { grid-template-columns: 1fr 1fr; }
  .home-module-grid-setup { max-width: none; }
}
@media (max-width: 560px) {
  .home-module-grid,
  .home-module-grid-setup { grid-template-columns: 1fr; }
}

/* Legacy module dashboards (Production / nested) */
.dash-shell {
  position: relative;
  min-height: calc(100vh - 7rem);
  display: flex;
  align-items: flex-start;
  justify-content: stretch;
  padding: 0.25rem 0 1.5rem;
  overflow: hidden;
}
.dash-shell-module {
  align-items: flex-start;
  justify-content: stretch;
}
.dash-watermark { display: none; }
.dash-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
}
.dash-welcome {
  text-align: left;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.dash-welcome .page-title { margin: 0.15rem 0; }
.dash-modules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
.dash-module {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-module:hover {
  border-color: rgba(15, 107, 99, 0.45);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.dash-module-title {
  font-family: var(--display);
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.dash-module-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.dash-master-wrap {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(16, 36, 44, 0.12);
}
.dash-module-master {
  background: #f5f8fa;
}
.dash-module.is-active-plant {
  border-color: rgba(15, 107, 99, 0.55);
  box-shadow: inset 3px 0 0 #1aa897, var(--shadow-sm);
}
.dash-module-empty {
  width: 100%;
  max-width: none;
}
@media (min-width: 720px) {
  .dash-modules { grid-template-columns: 1fr 1fr 1fr; }
  .dash-modules[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
  .dash-master-wrap .dash-module { max-width: 280px; }
}

/* Page chrome */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}
.page-head .muted { margin: 0.1rem 0 0 !important; font-size: var(--font-sm) !important; }
.eyebrow {
  margin: 0 0 0.05rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.card {
  background: var(--panel);
  border: 1px solid rgba(213, 221, 228, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.55rem;
}
.form-card { max-width: 680px; }
.mp-plan-form .form-card { max-width: none; }

/* Valve Painting / Jamming — always full content width */
.vp-form,
.va-form {
  width: 100%;
  max-width: none;
}
.vp-full,
.va-full,
.card.vp-full,
.card.va-full,
.form-card.vp-full,
.form-card.va-full {
  max-width: none !important;
  width: 100% !important;
}
.vp-form > .card,
.va-form > .card {
  max-width: none !important;
  width: 100%;
}

.mp-plan-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 0.85rem;
  align-items: start;
}
.mp-plan-side { min-width: 0; }
.mp-req-card { padding: 0.85rem; }
.mp-req-head { margin-bottom: 0.75rem; }
.mp-req-block {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.mp-req-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.mp-req-block-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
}
.mp-req-table { font-size: 0.78rem; }
.mp-req-table td, .mp-req-table th { padding: 0.35rem 0.4rem; }
.mp-req-actions {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.mp-req-modal {
  max-width: 720px !important;
  width: min(720px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.mp-req-modal .modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}
.mp-popup-h {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
}
.mp-req-modal-foot {
  flex-wrap: wrap;
  justify-content: flex-start !important;
}
.mp-req-actions-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
}
.req-slip-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.req-slip-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: 0.35rem 0.85rem;
  font-size: 0.8rem;
}
.req-slip-meta span { display: block; color: var(--muted); font-size: 0.7rem; }
@media (max-width: 960px) {
  .mp-plan-layout { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .sidebar, .no-print, .app-credit { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }

.form-group { margin-bottom: 0.5rem; }
.form-group label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 0.18rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.42rem 0.65rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(16, 36, 44, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #9aa8b3;
}
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6b78' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.1 2.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px;
  padding-right: 1.7rem;
  cursor: pointer;
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #b7c4cd;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.16);
  background: #fff;
}
.form-group textarea { min-height: 54px; resize: vertical; }
.check-label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink) !important;
  font-size: 0.82rem !important;
  cursor: pointer;
}

.duration-box {
  margin-top: 0.25rem;
  padding: 0.55rem;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15,107,99,0.06), rgba(20,143,132,0.03));
  border: 1px dashed rgba(15,107,99,0.28);
}
.duration-box-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
  color: var(--accent-dark);
}

.shift-master-card { max-width: none; }
.shift-master-plant {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.shift-master-plant .form-group { margin: 0; min-width: 220px; flex: 0 1 280px; }
.shift-plant-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  background: #eef3f6;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.shift-plant-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.shift-plant-tab:hover { color: var(--ink); text-decoration: none; }
.shift-plant-tab.is-active {
  background: var(--accent);
  color: #fff;
}
.shift-plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}
.shift-plant-card { margin-bottom: 0; min-height: 180px; }
.shift-plant-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.shift-plant-card-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.shift-plant-card-head .muted { margin: 0.15rem 0 0; }
.shift-plant-empty {
  text-align: center;
  padding: 1.35rem 0.6rem 0.55rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafb;
}
.shift-plant-empty p { margin: 0; font-size: 0.82rem; }
.shift-plant-empty .btn { margin-top: 0.75rem; }
.shift-plant-table th:last-child,
.shift-plant-table td:last-child { text-align: right; }
.shift-rows input,
.shift-rows select {
  width: 100%;
  padding: 0.38rem 0.5rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: #fff;
}
.shift-rows input:focus,
.shift-rows select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,107,99,0.12);
}
.shift-rows .shift-code { text-transform: uppercase; font-weight: 700; max-width: 6rem; }
.shift-rows .shift-active-cell { white-space: nowrap; }
.shift-rows td.shift-act { width: 2.6rem; text-align: center; }
.shift-rows input[type="time"] { min-width: 7.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: none;
  border-radius: 8px;
  padding: 0.42rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 107, 99, 0.22);
}
.btn-primary:hover { color: #fff; background: linear-gradient(135deg, #16a090, var(--accent-dark)); }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid #d0d9e0;
  box-shadow: 0 1px 2px rgba(16, 36, 44, 0.04);
}
.btn-secondary:hover { background: #f5f8f9; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; }
.btn-ghost-dark {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.74rem; border-radius: 7px; }
.btn-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.55rem; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: var(--row-pad-y) var(--row-pad-x);
  text-align: left;
  vertical-align: middle;
}
table.data th {
  background: #f4f7f9;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
table.data tr:hover td { background: #fafcfd; }

.alert {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
}
.alert-success { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.alert-error { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.alert-info { background: #eff8ff; color: #175cd3; border: 1px solid #b2ddff; }
.alert-warn { background: #fffaeb; color: #b54708; border: 1px solid #fedf89; }
.ep-smart-alert { margin-bottom: 0.45rem; }
.ep-smart-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
}
.ep-smart-pill {
  display: inline-block;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.3;
  border: 1px solid transparent;
}
.ep-smart-ok {
  background: #ecfdf3;
  color: #067647;
  border-color: #abefc6;
}
.ep-smart-warn {
  background: #fffaeb;
  color: #b54708;
  border-color: #fedf89;
}
.ep-close-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.ep-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.22rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
}
.ep-chip input { margin: 0; }
.ep-chip:has(input:checked) {
  border-color: #1aa897;
  background: #eef9f6;
}
.ep-close-remark {
  height: 2.1rem;
  min-width: 160px;
  flex: 1;
  max-width: 280px;
  border-radius: 7px;
  border: 1px solid #c5d0d8;
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
}
.ep-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}
.ep-board-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.7rem 0.85rem;
  transition: border-color 0.15s ease;
}
.ep-board-card:hover { border-color: #1aa897; }
.ep-board-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}
.ep-board-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin: 0.4rem 0;
  font-size: 0.8rem;
}
.ep-board-times .muted { display: block; font-size: 0.68rem; }
.ep-board-bar {
  height: 5px;
  border-radius: 99px;
  background: #e8eef1;
  overflow: hidden;
}
.ep-board-bar-fill {
  height: 100%;
  background: #1aa897;
  border-radius: 99px;
}
.ep-board-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.ep-board-closed { opacity: 0.82; }

.auth-wrap {
  max-width: 400px;
  margin: 8vh auto;
  padding: 0.75rem;
}
.auth-card {
  background: var(--panel);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.auth-card h1 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
}
.auth-card p.sub { margin: 0 0 0.85rem; color: var(--muted); font-size: 0.82rem; }

.app-credit {
  position: fixed;
  right: 0.85rem;
  bottom: 0.85rem;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.4rem 0.95rem;
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(16, 36, 44, 0.1);
  font-size: 0.72rem;
  color: #7a8894;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.app-credit-prefix { font-weight: 500; color: #8a97a3; }
.app-credit-name {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--accent);
  margin-left: 0;
}
a.app-credit-name:hover { color: var(--accent-dark); text-decoration: underline; }
.app-body .content,
.auth-wrap {
  padding-bottom: 3rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}
.menu-tile {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}
.menu-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(26,168,151,0.45);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.menu-tile .cat {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.menu-tile .ttl {
  margin-top: 0.2rem;
  font-family: var(--display);
  font-weight: 750;
  font-size: 0.88rem;
}

.fr-home-wrap { margin: 1rem 0 0.4rem; }
.fr-home-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  color: #fff;
  background: linear-gradient(120deg, #0f6b63 0%, #1d4ed8 55%, #7c3aed 100%);
  box-shadow: 0 8px 20px rgba(15, 107, 99, 0.22);
}
.fr-home-toggle-copy { display: flex; flex-direction: column; gap: 0.08rem; }
.fr-home-toggle-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.fr-home-toggle strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
}
.fr-home-toggle-sub { font-size: 0.78rem; opacity: 0.88; }
.fr-home-switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
  position: relative;
  flex-shrink: 0;
}
.fr-home-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.fr-home-toggle.is-on .fr-home-knob { transform: translateX(20px); }
.fr-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.7rem;
  margin: 0.75rem 0 0.2rem;
}
.fr-home-grid[hidden] { display: none !important; }
.fr-home-card {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}
.fr-home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.fr-home-card .sheet {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fr-home-card strong {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
}
.fr-home-card .fmt { font-size: 0.7rem; font-weight: 700; }
.fr-home-card .blurb { font-size: 0.78rem; line-height: 1.35; }
.fr-home-card.tone-teal { background: #ecfdf5; border-color: #99f6e4; color: #064e3b; }
.fr-home-card.tone-teal .sheet { color: #0f766e; }
.fr-home-card.tone-amber { background: #fff7ed; border-color: #fdba74; color: #7c2d12; }
.fr-home-card.tone-amber .sheet { color: #c2410c; }
.fr-home-card.tone-blue { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; }
.fr-home-card.tone-blue .sheet { color: #1d4ed8; }
.fr-home-card.tone-violet { background: #f5f3ff; border-color: #c4b5fd; color: #4c1d95; }
.fr-home-card.tone-violet .sheet { color: #6d28d9; }
.fr-home-card .fmt, .fr-home-card .blurb { color: inherit; opacity: 0.78; }

.dash-inner.fr-home-inner,
.fr-home-inner {
  width: 100%;
  max-width: none;
}
.fr-home-reports { margin-top: 0.35rem; }
.fr-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.fr-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.2;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.fr-chip:hover { transform: translateY(-1px); text-decoration: none; box-shadow: var(--shadow-sm); }
.fr-chip.tone-teal { background: #ecfdf5; border-color: #5eead4; color: #0f766e; }
.fr-chip.tone-amber { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.fr-chip.tone-blue { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.fr-chip.tone-violet { background: #f5f3ff; border-color: #c4b5fd; color: #6d28d9; font-size: 0.78rem; padding: 0.36rem 0.9rem; }
.fr-chip.is-on { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14); color: #fff; }
.fr-chip.tone-teal.is-on { background: #0f766e; border-color: #0f766e; }
.fr-chip.tone-amber.is-on { background: #c2410c; border-color: #c2410c; }
.fr-chip.tone-blue.is-on { background: #1d4ed8; border-color: #1d4ed8; }
.fr-chip.tone-violet.is-on { background: #6d28d9; border-color: #6d28d9; }
.fr-embed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.85rem;
  background: #fff;
}
.fr-embed-bar strong { display: block; font-family: var(--display); font-size: 1.02rem; font-weight: 800; }
.fr-embed-bar span { display: block; font-size: 0.78rem; color: #64748b; margin-top: 0.08rem; }
.fr-embed-bar.tone-violet { background: #f5f3ff; border-color: #ddd6fe; }
.fr-embed-bar.tone-teal { background: #ecfdf5; border-color: #99f6e4; }
.fr-embed-bar.tone-amber { background: #fff7ed; border-color: #fdba74; }
.fr-embed-bar.tone-blue { background: #eff6ff; border-color: #93c5fd; }

.priv-table th, .priv-table td { text-align: center; }
.priv-table td:first-child, .priv-table th:first-child { text-align: left; }
.priv-table input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
}
.badge-ok { background: #ecfdf3; color: var(--ok); }
.badge-warn { background: #fffaeb; color: var(--warn); }
.badge-no { background: #fef3f2; color: var(--danger); }
.badge-view { background: #eff8ff; color: #175cd3; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}
.master-list-search {
  width: 168px;
  max-width: 46vw;
  height: 32px;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  flex: 0 0 auto;
}
.master-list-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.12);
}
.toolbar:has(> .master-list-search),
.page-head:has(> .master-list-search) {
  justify-content: flex-start;
}
.toolbar:has(> .master-list-search) > .btn-primary,
.toolbar:has(> .master-list-search) > a.btn-primary,
.page-head:has(> .master-list-search) > .btn-primary,
.page-head:has(> .master-list-search) > a.btn-primary {
  margin-left: auto;
}
.muted { color: var(--muted); font-size: 0.78rem; }
.empty { padding: 0.85rem; text-align: center; color: var(--muted); }

.multi-select {
  width: 100%;
  min-height: 96px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  background: #fff;
}
.alloc-table td { vertical-align: middle; }
.alloc-table input[type=number] { width: 100%; max-width: 100px; }

/* Mixing manpower refined UI */
.mp-meta-card { margin-bottom: 1.1rem; }
.mp-meta-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 1rem;
  align-items: end;
}
.mp-stat {
  min-width: 120px;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(15,107,99,0.1), rgba(26,168,151,0.05));
  border: 1px solid rgba(15,107,99,0.18);
  text-align: center;
}
.mp-stat-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.mp-stat-value {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.mp-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin: 0.35rem 0 0.9rem;
  flex-wrap: wrap;
}
.mp-section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
}

.mp-alloc-wrap { overflow: visible; }
.mp-alloc-table { margin: 0; }
.mp-alloc-table th:last-child,
.mp-alloc-table td:last-child { width: 66%; }
.em-alloc-table th:last-child,
.em-alloc-table td:last-child { width: auto; }
.em-alloc-table select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  background: #fff;
}
.mp-alloc-row.is-filled td { background: rgba(26,168,151,0.04); }
.mp-station-cell {
  vertical-align: middle !important;
  font-family: var(--display);
  font-size: 0.98rem;
}

/* Searchable multi-select dropdown */
.ms-dropdown { position: relative; width: 100%; }
.ms-dropdown.is-open,
.mp-alloc-row:has(.ms-dropdown.is-open) { z-index: 40; }
.ms-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.ms-trigger:hover { border-color: rgba(26,168,151,0.45); }
.ms-dropdown.is-open .ms-trigger {
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26,168,151,0.15);
}
.ms-trigger-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.ms-dropdown.has-value .ms-trigger-text { color: var(--ink); font-weight: 600; }
.ms-dropdown.is-invalid .ms-trigger {
  border-color: #c45c5c;
  box-shadow: 0 0 0 2px rgba(196, 92, 92, 0.15);
}
.ms-caret { color: var(--muted); font-size: 0.85rem; }
.ms-panel {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(16,36,44,0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ms-panel[hidden] { display: none !important; }
.ms-panel.is-up {
  top: auto;
  bottom: calc(100% + 4px);
}
.ms-search-wrap { padding: 0.65rem; border-bottom: 1px solid var(--line); }
.ms-search {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.ms-search:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26,168,151,0.12);
}
.ms-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.35rem;
}
.ms-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  color: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}
.ms-option:hover { background: #f3f7f8; }
.ms-option.is-on { background: rgba(26,168,151,0.1); font-weight: 600; color: var(--accent-dark); }
.ms-option input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.ms-option.is-hidden { display: none; }
.ms-option.is-taken { display: none !important; }
.ms-group-label.is-hidden { display: none; }
.ms-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #6b7c80);
  padding: 0.45rem 0.5rem 0.15rem;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.ms-move-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0.35rem 0.15rem;
  padding: 0.45rem 0.55rem;
  border: 1px dashed var(--line, #d5dee0);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  background: #f7fafa;
}
.ms-move-toggle input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.ms-move-list { padding-top: 0.15rem; }
.ms-empty-mini {
  font-size: 0.75rem;
  color: var(--muted, #6b7c80);
  padding: 0.2rem 0.5rem 0.45rem;
}
#mxMaterialTable input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
#mxMaterialTable td { vertical-align: middle; }

/* Flap Plant Mixing → Warehouse stepper */
.flap-pipe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.85rem;
}
.flap-pipe a {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.26rem 0.58rem;
  border-radius: 999px;
  text-decoration: none;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.flap-pipe a:hover { background: #e2e8f0; color: #0f172a; }
.flap-pipe a.is-on {
  background: #0f6b63;
  color: #fff;
  border-color: transparent;
}
.flap-pipe-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: -0.4rem 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.flap-pipe-sub a { color: #0f6b63; text-decoration: none; }
.flap-pipe-sub a:hover { text-decoration: underline; }

/* Flap Mixing only — match QC filter/card. Plant A/B Mixing is unchanged. */
body.flap-mix .card,
body.flap-mix .form-card,
body.flap-mix .ep-plan-card,
body.flap-mix .mp-meta-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: none;
}
body.flap-mix .form-group label,
body.flap-mix .ep-plan-meta .form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}
body.flap-mix .form-group input,
body.flap-mix .form-group select,
body.flap-mix .form-group textarea {
  height: 38px;
  padding: 0.4rem 0.65rem;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: none;
}
body.flap-mix .form-group textarea {
  height: auto;
  min-height: 72px;
}
body.flap-mix .form-group input:focus,
body.flap-mix .form-group select:focus,
body.flap-mix .form-group textarea:focus {
  outline: none;
  border-color: #0f6b63;
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.16);
}
body.flap-mix .ep-plan-meta,
body.flap-mix .mp-meta-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
body.flap-mix .mx-prod-form {
  max-width: 860px;
}
body.flap-mix .mx-prod-form .form-card {
  max-width: none;
  padding: 1rem 1.2rem;
}
body.flap-mix .mx-plan-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
body.flap-mix .mx-plan-preview span.muted,
body.flap-mix .mx-plan-preview span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
body.flap-mix .mx-plan-preview strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}
body.flap-mix .prod-loss-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
body.flap-mix .prod-loss-row {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
body.flap-mix .prod-loss-dur {
  background: #f1f5f9;
}
body.flap-mix .prod-loss-foot {
  background: #f1f5f9;
}
body.flap-mix .prod-loss-foot strong {
  color: #0f6b63;
}
body.flap-mix .btn-primary {
  background: #0f6b63;
  border-color: #0f6b63;
}
body.flap-mix .data thead th {
  background: #f8fafc;
  color: #334155;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Mixing Production form */
.mx-prod-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1180px;
}
.mx-start-card {
  max-width: none;
}
.mx-start-row {
  display: grid;
  grid-template-columns: 9rem 7.5rem minmax(12rem, 1.5fr) 7rem minmax(8rem, 1fr) 7rem 7rem 9rem;
  gap: 0.55rem 0.55rem;
  align-items: end;
}
.mx-start-row .form-group {
  margin: 0;
}
.mx-start-row input[readonly] {
  background: color-mix(in srgb, var(--surface, #fff) 88%, var(--line) 12%);
  cursor: default;
}
.mx-start-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
}
.mx-machine-plans {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface, #fff) 92%, var(--accent, #1a5f4a) 8%);
}
.mx-machine-plans-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}
.mx-machine-plans-head strong {
  font-size: 0.98rem;
}
.mx-alloc-readout {
  margin: 0.55rem 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mx-open-on-machine {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
  font-size: 0.88rem;
  line-height: 1.55;
}
.mx-zone-red td { background: #fef2f2; }
.mx-zone-orange td { background: #fff7ed; }
.mx-zone-green td { background: #ecfdf3; }
.mx-zone-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.mx-zone-badge.mx-zone-red { background: #fee2e2; color: #b91c1c; }
.mx-zone-badge.mx-zone-orange { background: #ffedd5; color: #c2410c; }
.mx-zone-badge.mx-zone-green { background: #d1fae5; color: #047857; }
.mx-zone-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.15rem;
}
.mx-zone-swatch.mx-zone-red { background: #ef4444; }
.mx-zone-swatch.mx-zone-orange { background: #f97316; }
.mx-zone-swatch.mx-zone-green { background: #10b981; }

.mx-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 0.85rem;
  align-items: start;
  max-width: 1180px;
}
.mx-edit-main .card { max-width: none; }
.mx-compact-card {
  padding: 0.9rem 1rem 1rem;
}
.mx-meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed var(--line);
}
.mx-meta-strip > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.mx-meta-strip .muted { font-size: 0.72rem; }
.mx-meta-strip strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mx-add-trolley {
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface, #fff) 94%, var(--line) 6%);
}
.mx-add-trolley.is-editing {
  border-color: #0f766e;
  background: color-mix(in srgb, #ecfdf5 70%, var(--surface, #fff));
}
.mx-trolley-actions {
  white-space: nowrap;
}
.mx-trolley-actions .btn { margin-left: 0.15rem; }
.mx-trolley-table tr.is-editing-row td {
  outline: 1px solid #0f766e;
}
.mx-add-trolley-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.55rem;
}
.mx-add-trolley-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.mx-trolley-block { margin-bottom: 0.75rem; }
.mx-trolley-table td, .mx-trolley-table th { padding: 0.4rem 0.5rem; }
.mx-ready-board { margin-bottom: 1rem; }
.mx-ready-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.55rem;
}
.mx-compound-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.mx-chip {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
  border: 1px solid var(--line);
}
.mx-chip-ready {
  background: #ecfdf3;
  border-color: #a7f3d0;
  color: #047857;
}
.mx-chip-aging {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.mx-foot-strip {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}
.mx-batch-side-card {
  position: sticky;
  top: 1rem;
  padding: 0.85rem 0.9rem;
}
.mx-batch-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.mx-batch-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: calc(100vh - 10rem);
  overflow: auto;
}
.mx-batch-side-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}
.mx-batch-side-item.mx-batch-done { background: #ecfdf3; border-color: #a7f3d0; }
.mx-batch-side-item.mx-batch-partial { background: #fff7ed; border-color: #fed7aa; }
.mx-batch-side-item.mx-batch-pending { background: #f8fafc; }
.mx-batch-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.mx-batch-bar {
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.mx-batch-bar > span {
  display: block;
  height: 100%;
  background: #0f766e;
}
.mx-batch-side-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.78rem;
}
@media (max-width: 960px) {
  .mx-edit-layout { grid-template-columns: 1fr; }
  .mx-batch-side-card { position: static; }
  .mx-batch-side-list { max-height: none; }
  .mx-meta-strip { grid-template-columns: 1fr 1fr; }
  .mx-add-trolley-form { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .mx-start-row {
    grid-template-columns: 1fr 1fr;
  }
  .mx-start-plan {
    grid-column: 1 / -1;
  }
}
@media (max-width: 560px) {
  .mx-start-row {
    grid-template-columns: 1fr;
  }
}
.mx-section {
  max-width: none !important;
  padding: 1.15rem 1.25rem 1.25rem;
}
.mx-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed var(--line);
}
.mx-section-head-main {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}
.mx-section-sub {
  margin: 0.2rem 0 0 !important;
  font-size: 0.82rem !important;
}
.mx-step {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, #1aa897, #0f6b63);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.85rem;
}
.mx-batch-code {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #f3f7f8 !important;
}
.mx-readonly {
  background: #f3f7f8 !important;
  font-weight: 650;
}
.mx-close-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbfb 0%, #fff 100%);
}
.mx-close-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mx-close-stat .muted {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mx-close-stat strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
}
.mx-type-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.mx-type-row select {
  flex: 1;
  min-width: 160px;
}
.text-ok { color: #0f7a4a; }
.text-warn { color: #b45309; }
.text-danger { color: #b42318; }
.mx-mat-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.mx-mat-list-head {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(140px, 1.3fr) minmax(120px, 1fr) 120px 44px;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: #f3f7f8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.mx-mat-list-body { display: flex; flex-direction: column; }
.mx-mat-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(140px, 1.3fr) minmax(120px, 1fr) 120px 44px;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-top: 1px solid var(--line);
}
.mx-mat-row:first-child { border-top: none; }
.mx-mat-row.has-code { background: rgba(26,168,151,0.04); }
.mx-mat-name { background: #f7fafb !important; color: var(--ink); }
.mx-mat-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.95rem;
}
.mx-form-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  margin-top: 0.25rem;
}
.mx-batch-inline {
  font-family: var(--display);
  letter-spacing: 0.01em;
}
@media (max-width: 760px) {
  .mx-mat-list-head { display: none; }
  .mx-mat-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  .mx-mat-row .bom-actions { grid-column: 2; justify-self: end; }
  .mx-mat-summary { grid-template-columns: 1fr; }
}
.ms-panel-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}
.ms-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.mp-footer-card { margin-top: 0.25rem; }

.mp-list { display: flex; flex-direction: column; gap: 0.75rem; }
.mp-list-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mp-list-card.is-open {
  border-color: rgba(26,168,151,0.4);
  box-shadow: var(--shadow);
}
.mp-list-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  cursor: pointer;
  flex-wrap: wrap;
  user-select: none;
}
.mp-list-summary:hover { background: #f8fbfb; }
.mp-list-main { display: flex; gap: 0.95rem; align-items: center; min-width: 0; flex: 1; }
.mp-list-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.mp-expand-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef3f5;
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease, background 0.15s;
}
.mp-list-card.is-open .mp-expand-ico {
  transform: rotate(180deg);
  background: rgba(26,168,151,0.15);
  color: var(--accent-dark);
}
.mp-list-details {
  border-top: 1px solid var(--line);
  padding: 0.85rem 1.1rem 1.05rem;
  background: linear-gradient(180deg, #f7fafb 0%, #fff 40%);
  animation: mpExpandIn 0.18s ease;
}
@keyframes mpExpandIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mp-detail-table { margin: 0; background: #fff; border-radius: 10px; overflow: hidden; }
.mp-detail-table th, .mp-detail-table td { vertical-align: middle; }
.mp-name-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mp-name-chip {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(26,168,151,0.1);
  border: 1px solid rgba(26,168,151,0.22);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 600;
}
.mp-date-block {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(160deg, #14343d, #0f6b63);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mp-day { font-family: var(--display); font-weight: 800; font-size: 1.25rem; line-height: 1; }
.mp-mon { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; margin-top: 0.15rem; }
.mp-list-info h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 750;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.mp-list-info h3 small { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.mp-list-info p { margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mp-pill {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #eef3f5;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.mp-remarks {
  margin-top: 0.45rem !important;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.8;
}
.mp-list-actions { display: flex; gap: 0.4rem; }

/* Extruder Plan — clean workspace */
.ep-plan-form,
.ep-plan-card {
  width: 100%;
  max-width: none;
}
.ep-plan-card {
  padding: 0.95rem 1.05rem 1rem;
}
.ep-plan-meta {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.95rem;
  padding: 0.75rem 0.85rem;
  background: #f6f9f8;
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}
.ep-plan-meta-fields {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  flex: 1 1 420px;
  min-width: 0;
  flex-wrap: wrap;
}
.ep-plan-meta .form-group { margin: 0; }
.ep-plan-meta .form-group label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.28rem;
}
.ep-field-date { width: 150px; flex: 0 0 auto; }
.ep-field-remarks { flex: 1 1 220px; min-width: 180px; max-width: 420px; }
.ep-col-shift { width: 12%; }
.ep-line-overlap td { background: #fff5f4 !important; }
.ep-overlap-alert { font-size: 0.84rem; }
.ep-plan-total {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 108px;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c5e0d6;
  box-shadow: var(--shadow-sm);
  line-height: 1.15;
}
.ep-plan-total-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ep-plan-total strong {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-dark, #0d6e5f);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ep-plan-switch {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  margin: 0 0 0.75rem;
  background: #eef3f1;
  border-radius: 10px;
}
.ep-plan-switch-btn {
  border: 0;
  background: transparent;
  color: #3d524c;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.ep-plan-switch-btn.is-on {
  background: #fff;
  color: #0d3d34;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.ep-plan-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.ep-plan-section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 750;
}
.ep-plan-hint {
  margin: 0.12rem 0 0 !important;
  font-size: 0.74rem !important;
}
.ep-plan-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  width: 100%;
  background: #fff;
}
.mp-plan-form .ep-plan-table-wrap { overflow: visible; }
.mp-plan-lines tr:has(.ms-dropdown.is-open) { position: relative; z-index: 6; }
.mp-plan-lines .ms-trigger {
  height: 2.2rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #c9d4db;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 550;
}
.mp-plan-lines .ms-dropdown.has-value .ms-trigger-text { font-weight: 600; }
.ep-size-cell { position: relative; }
.ep-size-cell.is-off .ms-dropdown { visibility: hidden; pointer-events: none; }
.ep-size-cell.is-off::before {
  content: '—';
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.sm-manpower-form .ep-plan-card {
  max-width: 560px;
  margin-inline: auto;
}
.sm-manpower-form .ep-plan-table-wrap {
  overflow: visible;
}
.cm-manpower-form .ep-plan-card {
  max-width: 820px;
  margin-inline: auto;
}
.cm-manpower-form .ep-plan-table-wrap {
  overflow: visible;
}
.cm-machines-cell .ms-dropdown {
  min-width: 0;
}
.cm-mach-picks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cm-mach-slot .ms-trigger {
  height: 2.05rem;
  min-height: 2.05rem;
  font-size: 0.78rem;
}
.cm-manpower-form .ep-plan-card {
  max-width: 880px;
}
.va-prod-form .ep-plan-card {
  max-width: 920px;
  margin-inline: auto;
}
/* Inspection / Second Inspection — full width, polished dropdowns + inputs */
.insp-prod-form,
.si-prod-form {
  width: 100%;
  max-width: none;
}
.insp-prod-form .ep-plan-card,
.insp-prod-form > .card,
.si-prod-form .ep-plan-card,
.si-prod-form > .card {
  max-width: none !important;
  width: 100% !important;
}
.insp-prod-form .ep-plan-meta,
.si-prod-form .ep-plan-meta {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #f4f8f7;
  border: 1px solid #e2ebe8;
  border-radius: 10px;
}
.insp-prod-form .ep-plan-meta-fields,
.si-prod-form .ep-plan-meta-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
  align-items: flex-end;
  flex: 0 1 auto;
}
.insp-prod-form .ep-field-date,
.si-prod-form .ep-field-date {
  width: 10.5rem;
  max-width: 10.5rem;
  flex: 0 0 auto;
}
.insp-prod-form .ep-plan-meta .form-group,
.si-prod-form .ep-plan-meta .form-group {
  margin: 0;
  min-width: 10.5rem;
}
.insp-prod-form .ep-plan-meta label,
.si-prod-form .ep-plan-meta label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.insp-prod-form .ep-plan-section-head,
.si-prod-form .ep-plan-section-head {
  margin-top: 0.35rem;
  margin-bottom: 0.55rem;
  align-items: flex-end;
}
.insp-prod-form .ep-plan-section-title,
.si-prod-form .ep-plan-section-title {
  font-size: 0.95rem;
}
.insp-prod-form .ep-plan-hint,
.si-prod-form .ep-plan-hint {
  font-size: 0.78rem;
  line-height: 1.35;
}
.insp-prod-form .ep-plan-table-wrap,
.si-prod-form .ep-plan-table-wrap {
  /* visible so ms-panel is not clipped (overflow-x:auto forces both axes to clip) */
  overflow: visible;
  width: 100%;
  border: 1px solid #e2ebe8;
  border-radius: 10px;
  background: #fff;
  position: relative;
}
.insp-prod-form .ep-plan-table-wrap:has(.ms-dropdown.is-open),
.si-prod-form .ep-plan-table-wrap:has(.ms-dropdown.is-open) {
  z-index: 30;
}
.insp-prod-form .ep-plan-card,
.si-prod-form .ep-plan-card {
  overflow: visible;
}
.insp-prod-form .ep-plan-lines,
.si-prod-form .ep-plan-lines {
  table-layout: fixed;
  width: 100%;
  border-spacing: 0;
}
.insp-prod-form .ep-plan-lines thead th,
.si-prod-form .ep-plan-lines thead th {
  background: #eef4f2;
  font-size: 0.66rem;
  padding: 0.55rem 0.5rem;
}
.insp-prod-form .ep-plan-lines th,
.insp-prod-form .ep-plan-lines td,
.si-prod-form .ep-plan-lines th,
.si-prod-form .ep-plan-lines td {
  vertical-align: middle;
  padding: 0.4rem 0.45rem;
}
.insp-prod-form .ep-plan-lines .ep-col-num,
.si-prod-form .ep-plan-lines .ep-col-num {
  width: 2.1rem;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}
.insp-prod-form .ep-col-act,
.si-prod-form .ep-col-act {
  width: 5.25rem;
  white-space: nowrap;
  text-align: right;
}
.insp-prod-form .va-remove-btn,
.si-prod-form .va-remove-btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
}

/* Dropdowns inside inspection tables */
.insp-prod-form .ep-plan-lines tr:has(.ms-dropdown.is-open),
.si-prod-form .ep-plan-lines tr:has(.ms-dropdown.is-open) {
  position: relative;
  z-index: 8;
}
.insp-prod-form .ep-plan-lines .ms-dropdown,
.insp-prod-form .ep-plan-meta .ms-dropdown,
.si-prod-form .ep-plan-lines .ms-dropdown,
.si-prod-form .ep-plan-meta .ms-dropdown {
  width: 100%;
  min-width: 0;
}
.insp-prod-form .ep-plan-lines .ms-trigger,
.insp-prod-form .ep-plan-meta .ms-trigger,
.si-prod-form .ep-plan-lines .ms-trigger,
.si-prod-form .ep-plan-meta .ms-trigger {
  height: 2.25rem !important;
  min-height: 2.25rem !important;
  padding: 0.22rem 0.45rem !important;
  border: 1px solid #c5d2d8 !important;
  border-radius: 8px !important;
  font-size: 0.8rem !important;
  font-weight: 550 !important;
  background: #fff !important;
  gap: 0.25rem !important;
  box-sizing: border-box !important;
}
.insp-prod-form .ms-caret,
.si-prod-form .ms-caret {
  font-size: 0.7rem;
  flex-shrink: 0;
}
.insp-prod-form .ep-plan-lines .ms-trigger:hover,
.insp-prod-form .ep-plan-meta .ms-trigger:hover,
.si-prod-form .ep-plan-lines .ms-trigger:hover,
.si-prod-form .ep-plan-meta .ms-trigger:hover {
  border-color: #9eb4bc !important;
}
.insp-prod-form .ms-dropdown.is-open .ms-trigger,
.si-prod-form .ms-dropdown.is-open .ms-trigger {
  border-color: #1aa897 !important;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.14) !important;
}
.insp-prod-form .ms-trigger-text,
.si-prod-form .ms-trigger-text {
  font-size: 0.82rem;
  line-height: 1.25;
}
.insp-prod-form .ms-dropdown.has-value .ms-trigger-text,
.si-prod-form .ms-dropdown.has-value .ms-trigger-text {
  color: var(--ink);
  font-weight: 600;
}
.insp-prod-form .ms-panel,
.si-prod-form .ms-panel {
  min-width: 100%;
  width: max(100%, 16rem);
  max-width: min(24rem, 92vw);
  border-radius: 10px;
  border: 1px solid #d5e0e4;
  box-shadow: 0 12px 32px rgba(16, 36, 44, 0.18);
  z-index: 80;
}
.insp-prod-form .ms-search,
.si-prod-form .ms-search {
  height: 2.1rem;
  padding: 0.35rem 0.6rem !important;
  font-size: 0.82rem !important;
  border-radius: 7px !important;
  border: 1px solid #c5d2d8;
  box-sizing: border-box;
}
.insp-prod-form .ms-options,
.si-prod-form .ms-options {
  max-height: 220px;
}
.insp-prod-form .ms-option,
.si-prod-form .ms-option {
  padding: 0.4rem 0.5rem !important;
  font-size: 0.8rem !important;
  border: none !important;
  border-radius: 7px !important;
  background: transparent !important;
  box-shadow: none !important;
}
.insp-prod-form .ms-option:hover,
.si-prod-form .ms-option:hover {
  background: #f3f7f8 !important;
}
.insp-prod-form .ms-option.is-on,
.si-prod-form .ms-option.is-on {
  background: rgba(26, 168, 151, 0.1) !important;
}

/* Number / auto fields */
.insp-prod-form .ep-plan-lines input[type="number"],
.insp-prod-form .ep-plan-lines input[type="text"],
.insp-prod-form .ep-plan-meta input[type="date"],
.si-prod-form .ep-plan-lines input[type="number"],
.si-prod-form .ep-plan-lines input[type="text"],
.si-prod-form .ep-plan-meta input[type="date"] {
  height: 2.25rem;
  border-radius: 8px;
  border-color: #c5d2d8;
  font-size: 0.84rem;
}
.insp-prod-form .ep-plan-lines input[type="number"],
.si-prod-form .ep-plan-lines input[type="number"] {
  width: 100%;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.insp-prod-form .insp-s-ok,
.si-prod-form .si-s-ok {
  width: 100%;
  background: #f1f5f4 !important;
  color: #3d5a55;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: default;
}

/* Size summary table — compact */
#inspSizeTable,
#siSizeTable {
  table-layout: auto;
  min-width: 0;
  width: 100%;
  max-width: 40rem;
}
#inspSizeTable th:nth-child(2),
#inspSizeTable td:nth-child(2),
#siSizeTable th:nth-child(2),
#siSizeTable td:nth-child(2) {
  min-width: 12rem;
}
#inspSizeTable .insp-s-insp,
#inspSizeTable .insp-s-ok,
#siSizeTable .si-s-insp,
#siSizeTable .si-s-ok {
  max-width: 7.5rem;
  width: 100%;
}

/* Defect table — fit viewport; operator gets most room */
#inspDefTable,
#siDefTable {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
#inspDefTable .ep-col-num,
#siDefTable .ep-col-num {
  width: 1.85rem;
}
#inspDefTable .ep-col-act,
#siDefTable .ep-col-act {
  width: 3.75rem;
}
#inspDefTable th:nth-child(2),
#inspDefTable td:nth-child(2),
#siDefTable th:nth-child(2),
#siDefTable td:nth-child(2) {
  width: 20%;
}
#inspDefTable th:nth-child(3),
#inspDefTable td:nth-child(3),
#siDefTable th:nth-child(3),
#siDefTable td:nth-child(3) {
  width: 16%;
}
#inspDefTable th:nth-child(4),
#inspDefTable td:nth-child(4),
#inspDefTable th:nth-child(5),
#inspDefTable td:nth-child(5),
#siDefTable th:nth-child(4),
#siDefTable td:nth-child(4),
#siDefTable th:nth-child(5),
#siDefTable td:nth-child(5) {
  width: 13.5%;
}
#inspDefTable th:nth-child(6),
#inspDefTable td:nth-child(6),
#siDefTable th:nth-child(6),
#siDefTable td:nth-child(6) {
  width: 15%;
}
#inspDefTable th:nth-child(7),
#inspDefTable td:nth-child(7),
#siDefTable th:nth-child(7),
#siDefTable td:nth-child(7) {
  width: 3.85rem;
}
.insp-prod-form #inspDefTable .va-remove-btn,
.si-prod-form #siDefTable .va-remove-btn,
.insp-prod-form #inspSizeTable .va-remove-btn,
.si-prod-form #siSizeTable .va-remove-btn {
  padding: 0.28rem 0.4rem;
  font-size: 0.68rem;
}
#inspDefTable .insp-d-qty,
#siDefTable .si-d-qty {
  max-width: none;
  width: 100%;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.insp-prod-form .ep-plan-foot,
.si-prod-form .ep-plan-foot {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e6eeeb;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Inflation (over inflation) — compact operator cards */
.oi-prod-form {
  width: 100%;
  max-width: none;
}
.oi-prod-form .ep-plan-card {
  max-width: none !important;
  width: 100% !important;
  overflow: visible;
}
.oi-prod-form .ep-plan-meta {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #f4f8f7;
  border: 1px solid #e2ebe8;
  border-radius: 10px;
}
.oi-prod-form .ep-plan-table-wrap {
  overflow: visible;
  border: 1px solid #e2ebe8;
  border-radius: 10px;
  background: #fff;
}
.oi-prod-form .ep-plan-table-wrap:has(.ms-dropdown.is-open) {
  position: relative;
  z-index: 30;
}
.oi-prod-form .oi-meta-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.oi-prod-form .oi-meta-table th:nth-child(5),
.oi-prod-form .oi-meta-table td:nth-child(5) {
  width: 6.5rem;
}
.oi-prod-form .oi-def-table {
  table-layout: fixed;
  width: 100%;
  max-width: 28rem;
}
.oi-prod-form .oi-def-table .ep-col-num { width: 2rem; }
.oi-prod-form .oi-def-table .ep-col-act { width: 4.5rem; }
.oi-prod-form .oi-def-table th:nth-child(3),
.oi-prod-form .oi-def-table td:nth-child(3) {
  width: 5.5rem;
}
.oi-prod-form .oi-def-head {
  margin-top: 0.65rem;
}
.oi-prod-form .oi-total-ok,
.oi-prod-form .oi-def-qty {
  width: 100%;
  height: 2.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  border-radius: 8px;
  border-color: #c5d2d8;
  font-size: 0.84rem;
}
.oi-prod-form .ep-plan-lines .ms-trigger {
  height: 2.25rem !important;
  min-height: 2.25rem !important;
  padding: 0.22rem 0.45rem !important;
  border: 1px solid #c5d2d8 !important;
  border-radius: 8px !important;
  font-size: 0.8rem !important;
}
.oi-prod-form .ms-panel {
  min-width: 100%;
  width: max(100%, 14rem);
  max-width: min(22rem, 92vw);
  z-index: 80;
}
.oi-prod-form .va-op-body {
  padding: 0.65rem 0.75rem 0.85rem;
}
.oi-prod-form .ep-plan-foot {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

/* Deflation / Repair / Reclass — compact line tables (share oi meta polish) */
.df-prod-form .ep-plan-table-wrap,
.rp-prod-form .ep-plan-table-wrap,
.rr-prod-form .ep-plan-table-wrap {
  overflow: visible;
  width: 100%;
}
.df-prod-form #dfLineTable,
.rp-prod-form #rpLineTable,
.rr-prod-form #rrLineTable,
.df-prod-form #dfBdBody,
.df-prod-form table.ep-plan-lines {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.df-prod-form .df-qty,
.rp-prod-form .rp-qty,
.rr-prod-form .rr-qty {
  width: 100%;
  max-width: 100%;
  height: 2.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  border-radius: 8px;
  border-color: #c5d2d8;
  font-size: 0.84rem;
  box-sizing: border-box;
}
.df-prod-form .ep-col-num,
.rp-prod-form .ep-col-num,
.rr-prod-form .ep-col-num {
  width: 2.25rem;
}
.df-prod-form .ep-col-act,
.rp-prod-form .ep-col-act,
.rr-prod-form .ep-col-act {
  width: 2.75rem;
  min-width: 2.75rem;
  white-space: nowrap;
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.35rem;
}
.df-prod-form .ep-col-act .btn,
.rp-prod-form .ep-col-act .btn,
.rr-prod-form .ep-col-act .btn {
  min-width: 1.85rem;
  padding: 0.2rem 0.4rem;
  line-height: 1.2;
  font-size: 1rem;
  color: #9b2c2c;
}
.df-prod-form .va-remove-btn,
.rp-prod-form .va-remove-btn,
.rr-prod-form .va-remove-btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
}
.df-prod-form #dfLineTable th:nth-child(4),
.df-prod-form #dfLineTable td:nth-child(4) {
  width: 6.5rem;
}
.rp-prod-form #rpLineTable th:nth-child(5),
.rp-prod-form #rpLineTable td:nth-child(5) {
  width: 5.75rem;
}
.df-prod-form #dfLineTable td,
.rp-prod-form #rpLineTable td,
.rr-prod-form #rrLineTable td {
  vertical-align: middle;
}
.df-prod-form #dfLineTable .ms-dropdown,
.rp-prod-form #rpLineTable .ms-dropdown,
.rr-prod-form #rrLineTable .ms-dropdown,
.df-prod-form #dfLineTable td:not(.ep-col-act):not(.ep-col-num),
.rp-prod-form #rpLineTable td:not(.ep-col-act):not(.ep-col-num),
.rr-prod-form #rrLineTable td:not(.ep-col-act):not(.ep-col-num) {
  min-width: 0;
}
.rr-prod-form #rrLineTable th:nth-child(4),
.rr-prod-form #rrLineTable td:nth-child(4) {
  width: 5.5rem;
}
.df-prod-form .ep-col-time,
.df-prod-form .df-bd-from,
.df-prod-form .df-bd-to,
.df-prod-form .df-bd-total {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.df-prod-form .ep-col-time { width: 6.5rem; }

.va-op-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.va-op-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
  overflow: visible;
}
.va-op-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #eef3f2;
  border-bottom: 1px solid var(--line);
}
.va-op-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  padding: 0.15rem 0.35rem;
}
.va-op-title { flex: 1; font-size: 0.9rem; }
.va-op-card:not(.is-open) .va-op-body { display: none; }
.va-op-body { padding: 0.75rem; }
.va-op-meta {
  display: grid;
  grid-template-columns: minmax(14rem, 22rem);
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}
.va-size-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.va-remove-btn {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  color: #9b2c2c;
  border-color: #e8b4b4;
  background: #fff5f5;
}
.va-remove-btn:hover {
  background: #ffe8e8;
  border-color: #d98989;
}
.va-prod-form .ep-col-act {
  width: 5.5rem;
  white-space: nowrap;
}
.ep-plan-lines {
  margin: 0;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.ep-plan-lines thead th {
  background: #eef3f2;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4a5d68;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.ep-plan-lines td,
.ep-plan-lines th {
  padding: 0.45rem 0.4rem;
  vertical-align: middle;
  border-bottom: 1px solid #e8eef0;
}
.ep-plan-lines tbody tr:last-child td { border-bottom: none; }
.ep-plan-meta input,
.ep-plan-meta select,
.ep-plan-lines select,
.ep-plan-lines input[type="number"],
.ep-plan-lines input[type="time"],
.ep-plan-lines input[type="text"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  height: 2.2rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #c9d4db;
  border-radius: 7px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ep-plan-lines input[type="number"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding-right: 0.5rem;
  -moz-appearance: textfield;
}
.ep-plan-lines input[type="number"]::-webkit-outer-spin-button,
.ep-plan-lines input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ep-plan-lines input[type="time"] {
  padding-right: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.ep-plan-meta select,
.ep-plan-lines select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 1.6rem;
  background-color: #fff;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5d68' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.1 2.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 9px;
}
.ep-plan-meta input:hover,
.ep-plan-meta select:hover,
.ep-plan-lines select:hover,
.ep-plan-lines input[type="number"]:hover,
.ep-plan-lines input[type="time"]:hover {
  border-color: #a8b8c2;
}
.ep-plan-meta input:focus,
.ep-plan-meta select:focus,
.ep-plan-lines select:focus,
.ep-plan-lines input[type="number"]:focus,
.ep-plan-lines input[type="time"]:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.14);
}
.ep-plan-lines select:invalid,
.ep-plan-lines select option[value=""] { color: #7a8b96; }
.ep-plan-lines select option { color: var(--ink); }
.ep-plan-lines input::placeholder { color: #9aa8b3; font-weight: 450; }
.ep-col-act .ep-remove {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 7px;
  font-size: 1.05rem;
  line-height: 1;
  color: #8a5a57;
}
.ep-col-act .ep-remove:hover {
  background: #fff1f0;
  color: #b42318;
}
.ep-col-num { width: 36px; text-align: center; }
.ep-line-num { text-align: center; font-size: 0.76rem; }
.ep-col-machine { width: 11%; }
.ep-col-size { width: 10%; }
.ep-col-nos { width: 88px; }
.ep-col-compound { width: 28%; }
.ep-col-est { width: 118px; }
.ep-col-time { width: 104px; }
.ep-col-act { width: 42px; text-align: center; }
.ep-mill-lines .mill-col-shift { width: 12%; }
.ep-mill-lines .mill-col-mill { width: 16%; }
.ep-mill-lines .mill-col-compound { width: 16%; }
.ep-mill-lines .mill-col-from { width: 12%; }
.ep-mill-lines .mill-col-batches { width: 88px; }
.ep-mill-lines .mill-col-kg { width: 148px; }
.ep-mill-lines .mill-col-fromkg { width: 130px; }
.ep-mill-lines .mill-col-qty { width: 120px; }
.ep-mill-lines .mill-col-time { width: 110px; }
.ep-mill-lines .mill-batches { width: 100%; }
.mill-from {
  font-weight: 750;
  color: #1a3c34;
  font-size: 0.86rem;
}
.mill-from.is-missing {
  font-weight: 650;
  color: #9a3412;
}
.ep-est-time {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-size: 0.84rem;
  line-height: 1.2;
}
.ep-est-time strong {
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ep-est-time .ep-est-rate {
  font-size: 0.66rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.ep-compound-cell { vertical-align: middle !important; }
.ep-compound-info {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.35rem 0.5rem;
  border-radius: 7px;
  background: #f4f8f6;
  border: 1px solid #d5e6df;
  font-size: 0.76rem;
  line-height: 1.25;
  min-height: 2.2rem;
  justify-content: center;
}
.ep-compound-info .ep-comp-code {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a3c34;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-comp-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.ep-comp-metrics b { font-weight: 700; color: var(--ink); }
.ep-comp-metrics .text-ok b { color: var(--ok); }
.ep-comp-metrics .text-danger b { color: var(--danger); }
.ep-comp-dot { opacity: 0.45; }
.ep-compound-warn {
  background: #fff8e8;
  border-color: #edd9a3;
}
.ep-compound-short {
  background: #fff1f0;
  border-color: #f0c2bd;
}
.ep-plan-lines tr[data-ep-line]:hover td { background: #f8fbfa; }
.ep-plan-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .ep-plan-meta { align-items: stretch; }
  .ep-plan-total {
    width: 100%;
    align-items: flex-start;
  }
  .ep-field-date { width: calc(50% - 0.4rem); }
  .ep-field-remarks { max-width: none; flex: 1 1 100%; }
  .ep-plan-lines { table-layout: auto; min-width: 980px; }
}

/* Mixing Plan — column widths on Extruder workspace */
.mp-plan-lines .mp-col-shift { width: 13%; }
.mp-plan-lines .mp-col-machine { width: 18%; }
.mp-plan-lines .mp-col-compound { width: 18%; }
.mp-plan-lines .mp-col-batches { width: 76px; }
.mp-plan-lines .mp-col-qty { width: 108px; }
.mp-plan-lines .mp-col-est { width: 132px; }
.mp-plan-lines input.mp-qty {
  width: 100%;
  height: 2.2rem;
  margin: 0;
  padding: 0.3rem 0.6rem;
  border: 1px solid #d5e6df;
  border-radius: 7px;
  background: #f3f8f6;
  color: #14352e;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: default;
}
.mp-plan-lines input.mp-qty:focus,
input.mill-calc:focus {
  outline: none;
  box-shadow: none;
  border-color: #d5e6df;
}
input.mill-calc {
  width: 100%;
  height: 2.2rem;
  margin: 0;
  padding: 0.3rem 0.6rem;
  border: 1px solid #d5e6df;
  border-radius: 7px;
  background: #f3f8f6;
  color: #14352e;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: default;
}
.mp-plan-lines .mp-est {
  flex-direction: row;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
}
.mp-plan-lines .mp-est-pct {
  font-size: 0.72rem;
  font-weight: 650;
  color: #5d726c;
  font-variant-numeric: tabular-nums;
}
.mp-plan-lines .mp-est.mp-cap-warn strong,
.mp-plan-lines .mp-est.mp-cap-warn .mp-est-pct,
.mp-plan-lines .mp-cap-warn { color: var(--warn, #b54708); }
.mp-plan-lines tr[data-mp-line]:hover td { background: #f8fbfa; }
.ep-plan-foot #mpCapHint { margin-right: auto; }
@media (max-width: 980px) {
  .mp-plan-lines { table-layout: auto; min-width: 920px; }
}

/* Extruder Production — compact fit layout */
.ep-page-head { margin-bottom: 0.55rem; }
.ep-prod-form { width: 100%; max-width: none; }
.ep-prod-card {
  width: 100%;
  max-width: none;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.65rem;
}
.ep-prod-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.ep-prod-section-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
}
.ep-prod-hint { margin: 0.1rem 0 0 !important; font-size: 0.74rem !important; }
.ep-prod-total {
  min-width: 68px;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  background: #eef6f3;
  border: 1px solid #c5e0d6;
  text-align: right;
}
.ep-prod-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}
.ep-prod-total-bd { background: #fff8f0; border-color: #edd9a3; }
.ep-prod-total-bd strong { color: #b45309; }
.ep-prod-total .muted { display: block; font-size: 0.65rem; margin: 0; line-height: 1.1; }
.ep-prod-total strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-dark, #0d6e5f);
  line-height: 1.15;
}
.ep-prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.45rem 0.55rem;
}
.ep-prod-grid .form-group { margin: 0; }
.ep-prod-grid .form-group label {
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.ep-prod-remarks { grid-column: span 2; }
.ep-plan-select-wrap { grid-column: 1 / -1; }
.ep-start-top {
  grid-template-columns: minmax(220px, 1.6fr) 140px;
  margin-bottom: 0.5rem;
}
.ep-start-top .ep-plan-select-wrap { grid-column: auto; }
.ep-plan-prefill {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem 0.5rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.55rem;
  border-radius: 8px;
  background: #eef6f3;
  border: 1px solid #c5e0d6;
}
.ep-plan-prefill .muted { display: block; font-size: 0.65rem; margin: 0; }
.ep-plan-prefill strong { font-size: 0.88rem; }
.ep-alloc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.3rem;
}
.ep-alloc-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.ep-alloc-table { margin: 0; }
.ep-alloc-table select,
.ep-alloc-table input {
  width: 100%;
  height: 2.1rem;
  margin: 0;
  border-radius: 7px;
  border: 1px solid #c5d0d8;
  padding: 0.25rem 0.45rem;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
}
.ep-alloc-table tfoot td { background: #f3f7f5; }
@media (max-width: 900px) {
  .ep-plan-prefill { grid-template-columns: 1fr 1fr; }
  .ep-start-top { grid-template-columns: 1fr; }
}
.ep-prod-grid input,
.ep-prod-grid select,
.ep-add-trolley input,
.ep-add-breakdown input,
.ep-add-breakdown select {
  height: 2.15rem;
  width: 100%;
  border-radius: 7px;
  border: 1px solid #c5d0d8;
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
}
.ep-prod-grid select,
.ep-add-breakdown select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.55rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5d68' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.1 2.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 10px;
  cursor: pointer;
}
.ep-prod-grid input:focus,
.ep-prod-grid select:focus,
.ep-add-trolley input:focus,
.ep-add-breakdown input:focus,
.ep-add-breakdown select:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 2px rgba(26, 168, 151, 0.14);
}
.ep-tentative-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  min-height: 2.15rem;
  padding: 0.2rem 0.45rem;
  border-radius: 7px;
  border: 1px dashed #b7c9c2;
  background: #f3faf7;
}
.ep-tentative-box strong { font-size: 0.95rem; }
.ep-tentative-box .muted { font-size: 0.65rem; line-height: 1.15; }
.ep-prod-foot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.ep-close-strip {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.ep-close-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.ep-add-trolley {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #c5e0d6;
  border-radius: 8px;
  background: #f4faf7;
  max-width: 100%;
}
.ep-add-trolley .form-group { margin: 0; width: 120px; }
.ep-add-trolley .form-group label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.12rem;
}
.ep-trolley-no-field { width: 72px !important; }
.ep-trolley-no-badge {
  height: 2.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.45rem;
  border-radius: 7px;
  border: 1px solid #b7d4ca;
  background: #e7f3ee;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0d6e5f;
}
.ep-add-trolley-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 2.15rem;
  padding: 0 0.85rem !important;
  white-space: nowrap;
}
.ep-add-breakdown {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #edd9a3;
  border-radius: 8px;
  background: #fffaf3;
  max-width: 100%;
}
.ep-add-breakdown .form-group { margin: 0; width: 110px; }
.ep-add-breakdown .form-group label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.12rem;
}
.ep-add-breakdown .ep-bd-reason { width: 200px; }
.ep-add-breakdown .ep-bd-remarks { width: 160px; flex: 1; min-width: 140px; }
.ep-loss-cat-row { display: flex; gap: 0.3rem; align-items: center; }
.ep-loss-cat-row select { flex: 1; min-width: 0; }
.ep-loss-cat-row .btn { flex-shrink: 0; white-space: nowrap; }
.ep-bd-duration {
  height: 2.15rem;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  border-radius: 7px;
  border: 1px solid #e0d2b0;
  background: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  color: #9a6700;
  white-space: nowrap;
}
.ep-trolley-own { margin: 0; }
.ep-trolley-own td, .ep-trolley-own th { padding: 0.35rem 0.45rem; }
.ep-trolley-own tfoot td {
  background: #f3f7f5;
  border-top: 1px solid var(--line);
}
@media (max-width: 960px) {
  .ep-prod-grid { grid-template-columns: 1fr 1fr; }
  .ep-prod-remarks { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .ep-prod-grid { grid-template-columns: 1fr; }
  .ep-add-trolley .form-group,
  .ep-trolley-no-field,
  .ep-add-breakdown .form-group,
  .ep-add-breakdown .ep-bd-reason,
  .ep-add-breakdown .ep-bd-remarks { width: 100% !important; }
}

/* Extruder planning — paper form layout (legacy) */
.ep-sheet {
  padding: 1.15rem 1.25rem 1rem;
  background:
    linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
  border: 1px solid var(--line);
}
.ep-sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid #14343d;
}
.ep-sheet-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.ep-sheet-brand strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #14343d;
}
.ep-sheet-brand span {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.ep-sheet-meta {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.75rem;
  min-width: min(100%, 360px);
}
.ep-section { margin-bottom: 1.35rem; }
.ep-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}
.ep-section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 800;
}
.ep-hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.ep-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.ep-paper-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  margin: 0;
}
.ep-paper-table th {
  background: #f0f4f6;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.ep-paper-table td {
  padding: 0.4rem 0.4rem;
  border-bottom: 1px solid #e8eef1;
  vertical-align: middle;
}
.ep-paper-table tr:last-child td { border-bottom: none; }
.ep-paper-table select,
.ep-paper-table input {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: #fff;
  min-width: 0;
}
.ep-paper-table select:focus,
.ep-paper-table input:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26,168,151,0.12);
}
.ep-machine-block {
  margin-bottom: 0.85rem;
  padding: 0.75rem;
  border: 1px dashed rgba(20,52,61,0.22);
  border-radius: 12px;
  background: rgba(15,107,99,0.03);
}
.ep-machine-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.ep-machine-label strong {
  font-family: var(--display);
  font-size: 1.15rem;
  color: #14343d;
  margin-left: 0.2rem;
}
.ep-machine-block .btn { margin-top: 0.55rem; }
.ep-total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  margin-top: 0.35rem;
  background: #14343d;
  color: #fff;
  border-radius: 10px;
  font-size: 0.85rem;
}
.ep-total-bar strong {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
}
.ep-sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.ep-form-code {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
}
.ep-remove {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
}
.ep-remove:hover {
  background: #fef3f2;
  border-color: #fecdca;
  color: var(--danger);
}
.ep-detail-machine-head {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin: 0.45rem 0 0.2rem;
}
.ep-detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ep-detail-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}
.ep-detail-main {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.ep-detail-machine {
  font-family: var(--display);
  font-size: 0.95rem;
}
.ep-detail-size {
  font-size: 0.8rem;
  color: var(--muted);
}
.ep-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 720px) {
  .ep-sheet-meta { grid-template-columns: 1fr; min-width: 0; width: 100%; }
}


.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.empty-ico { font-size: 2rem; margin-bottom: 0.5rem; }
.empty-state h3 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-weight: 750;
}
.empty-state .btn { margin-top: 0.85rem; }

.link-add-uom {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}
.link-add-uom:hover { color: var(--accent-dark); text-decoration: underline; }
.blend-select-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.blend-select-row select { flex: 1; min-width: 0; }
.blend-select-row .link-add-uom {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.78rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 36, 44, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: modalIn 0.16s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
}
.modal-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 750;
}
.modal-close {
  border: none;
  background: #e8eef1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
}
.modal-body { padding: 1.1rem; }
.pm-rpt-bar {
  height: 5px;
  margin-top: 0.25rem;
  border-radius: 3px;
  background: #e8eef1;
  overflow: hidden;
  max-width: 160px;
}
.pm-rpt-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.pm-rpt-bar-danger span { background: #c0392b; }
.pm-wo-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.pm-wo-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.pm-wo-tab.is-on {
  background: var(--accent, #1f6f8b);
  border-color: var(--accent, #1f6f8b);
  color: #fff;
}
.machine-doors .door-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  max-width: 360px;
}
.machine-doors .door-row input[name="door_name[]"] { flex: 1; }
.press-map .door-row { max-width: 420px; }
.press-map .door-row input[name="press_no[]"] { flex: 1; min-width: 0; }
.cred-card { max-width: 480px; }
.cred-table { width: 100%; border-collapse: collapse; }
.cred-table th,
.cred-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.88rem;
  vertical-align: middle;
}
.cred-table th { width: 42%; color: var(--muted); font-weight: 650; }
.cred-pass {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin-right: 0.4rem;
  border-radius: 6px;
  background: #f4f8f9;
  border: 1px solid var(--line);
  font-family: Consolas, monospace;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  user-select: all;
}
.cred-note { margin: 0.75rem 0 0; font-size: 0.8rem; }
.cred-note-ok { color: #1f7a4d; }
.cred-note-warn { color: #9a6700; }
.user-modules-options { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 0.35rem; }
.user-modules-options .check-label { margin: 0; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

/* BOM Master view popup */
.bom-view-card {
  max-width: 780px !important;
  width: min(780px, 96vw);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
}
.bom-view-card .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.bom-view-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #f7fbfb;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.bom-view-meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.bom-view-meta strong {
  font-size: 0.88rem;
  word-break: break-word;
}
.bom-view-block { margin-top: 0.75rem; }
.bom-view-block h4 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--accent-dark);
}
.bom-view-table { font-size: 0.8rem; margin: 0; }
.bom-view-table th,
.bom-view-table td { padding: 0.35rem 0.45rem; }
.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--accent-dark); text-decoration: underline; }
.master-del-form { display: inline; margin: 0; }
.master-del-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.4rem;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}
.master-del-btn:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .bom-view-meta { grid-template-columns: 1fr 1fr; }
}

/* Size / BOM master form — edge-to-edge content width */
.size-form {
  width: 100%;
  max-width: none;
  margin: 0;
}
.size-layout {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  max-width: none;
  width: 100%;
}
.size-info-card,
.size-bom-card {
  max-width: none;
  width: 100%;
  margin-bottom: 0;
  padding: 0.95rem 1.1rem;
}
.size-info-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.bom-parent-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem 1.5rem;
  align-items: stretch;
  width: 100%;
}
.bom-parent-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.bom-parent-left > .form-group { margin: 0; }
.bom-parent-fields {
  display: grid;
  grid-template-columns: minmax(9rem, 1.15fr) minmax(8rem, 1fr) minmax(9rem, 1.1fr) auto auto;
  gap: 0.7rem 0.85rem;
  align-items: start;
  width: 100%;
}
.bom-active-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 2.6rem;
  padding-top: 1.15rem;
}
.bom-extrude-hint {
  margin: -0.25rem 0 0;
  font-size: 0.7rem;
}
.bom-parent-desc { margin: 0; }
.bom-size-press-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(16rem, 1.15fr);
  gap: 0.75rem;
  align-items: start;
}
.press-size-pick select { width: 100%; }
.press-size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  min-height: 0;
}
.press-size-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.35rem 0.18rem 0.55rem;
  border-radius: 999px;
  background: #e8f3f7;
  border: 1px solid #b7d4e0;
  color: #164e63;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}
.press-size-chip button {
  border: 0;
  background: transparent;
  color: #64748b;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}
.press-size-chip button:hover { background: #d7e8ef; color: #0f172a; }

/* Clearer, taller inputs on BOM form */
.size-form .form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.28rem;
}
.size-form .form-group > .muted {
  font-size: 0.72rem !important;
  line-height: 1.35;
  margin-top: 0.3rem !important;
}
.size-form input[type="text"],
.size-form input[type="number"],
.size-form input:not([type]),
.size-form select,
.size-form textarea,
.bom-parent-desc input,
.bom-parent-fields input,
.bom-parent-fields select,
.size-compound-grid input,
.size-compound-grid select {
  width: 100%;
  min-height: 2.55rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #c5d0d8;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 36, 44, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.size-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6b78' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.1 2.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
  padding-right: 1.85rem;
}
.size-form input:hover,
.size-form select:hover,
.bom-parent-fields input:hover,
.bom-parent-fields select:hover {
  border-color: #9eb0bb;
}
.size-form input:focus,
.size-form select:focus,
.bom-parent-fields input:focus,
.bom-parent-fields select:focus,
.size-compound-grid input:focus,
.size-compound-grid select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fcfffe;
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.14);
}
.size-form input:disabled,
.size-form input[readonly],
.size-compound-grid input:disabled,
.size-compound-grid input[readonly] {
  background: #f1f5f7;
  color: var(--muted);
  border-color: #d5dde4;
  box-shadow: none;
}
.size-code-input {
  font-family: var(--display);
  font-weight: 750;
  letter-spacing: 0.03em;
  font-size: 0.98rem !important;
}

/* Checkbox pills */
.size-form .check-label,
.size-form .form-group label.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  min-height: 2.55rem;
  border: 1.5px solid #c5d0d8;
  border-radius: 10px;
  background: #fff;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.size-form .check-label:hover {
  border-color: #9eb0bb;
  background: #f8fbfb;
}
.size-form .check-label:has(input:checked) {
  border-color: var(--accent);
  background: #eef8f6;
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.1);
  color: var(--accent-dark);
}
.size-form .check-label input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.bom-stage-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fbfb 0%, #fff 100%);
  padding: 0.7rem 0.85rem 0.8rem;
  margin: 0;
  min-width: 0;
  height: 100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.bom-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.86rem;
}
.bom-stage-table { display: flex; flex-direction: column; gap: 0.3rem; width: 100%; }
.bom-stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  width: 100%;
}
.bom-stage-head-row {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0 0.05rem 0.28rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.1rem;
}
.bom-stage-name {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ink);
}
.bom-stage-row input[type="number"] {
  width: 100%;
  padding: 0.38rem 0.45rem;
  font-size: 0.84rem;
}
.bom-materials-split {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 0.75rem;
  width: 100%;
  align-items: start;
}
.size-compound-grid {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.65rem;
  max-width: none;
  width: 100%;
  align-items: end;
}
.size-compound-grid .form-group:first-child {
  grid-column: 1 / -1;
}
.cmp-slot {
  border: 1px solid #e3ece8;
  border-radius: 12px;
  padding: 0.85rem 0.95rem 0.95rem;
  background: #fff;
  margin-top: 0.75rem;
}
.cmp-slot + .cmp-slot {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e3ece8;
}
.size-compound-level.cmp-slot + .size-compound-level.cmp-slot {
  border-top: 1px solid #e3ece8;
  padding-top: 0.85rem;
}
.cmp-slot-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.cmp-step {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0d6e5f;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.cmp-slot-title {
  font-weight: 750;
  font-size: 0.92rem;
  color: #14352e;
}
.cmp-slot-hint { font-size: 0.75rem; }
.cmp-slot .cmp-fields {
  margin-top: 0.7rem;
  grid-template-columns: minmax(200px, 1.7fr) minmax(120px, 0.7fr) minmax(100px, 0.55fr) minmax(130px, 0.7fr);
  align-items: end;
}
.cmp-slot .cmp-fields .form-group:first-child { grid-column: auto; }
.cmp-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.cmp-choice label {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin: 0;
  padding: 0.55rem 0.7rem 0.6rem 2rem;
  border: 1.5px solid #d5e0db;
  border-radius: 10px;
  background: #f7faf9;
  cursor: pointer;
  position: relative;
}
.cmp-choice label span { font-weight: 750; font-size: 0.86rem; color: #14352e; }
.cmp-choice label small { color: var(--muted); font-size: 0.74rem; font-weight: 500; line-height: 1.3; }
.cmp-choice input {
  position: absolute;
  left: 0.7rem;
  top: 0.7rem;
}
.cmp-choice label:has(input:checked) {
  border-color: #0d6e5f;
  background: #eef8f4;
  box-shadow: 0 0 0 3px rgba(13, 110, 95, 0.08);
}
.cmp-branch {
  margin-top: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d5e6df;
  border-radius: 10px;
  background: #f6faf8;
}
.cmp-saved {
  margin: 0 0 0.45rem;
  font-weight: 750;
  color: #14352e;
  font-size: 0.84rem;
}
[data-batch-change] { margin: 0 0 0.5rem; }
.cmp-branch-nest {
  border-left: 3px solid #0d6e5f;
}
.cmp-branch-sub {
  margin-top: 0.65rem;
  margin-left: 0.85rem;
  background: #fff;
}
.cmp-branch-label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #3d524c;
  margin-bottom: 0.4rem;
}
.cmp-from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.65rem;
}
.cmp-from label { margin: 0; font-size: 0.84rem; font-weight: 650; }
.cmp-from select { min-width: 10rem; }
.cmp-batch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
}
.cmp-batch {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 9.5rem;
}
.cmp-batch-pair {
  display: flex;
  gap: 0.3rem;
}
.cmp-batch-pair input { width: 4.4rem; }
.cmp-batch-mill .cmp-batch { min-width: 100%; }
.cmp-batch-mill .cmp-batch-pair {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.cmp-batch-field {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.cmp-batch-field span {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.cmp-batch-field input,
.cmp-batch-mill .cmp-batch-pair input { width: 100%; }
.cmp-batch span {
  font-size: 0.72rem;
  color: var(--muted);
}
.cmp-batch input {
  width: 4.6rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid #c5d0d8;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #fff;
}
.cmp-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cmp-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef2f4;
  color: #24343c;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.cmp-chip.is-mix { background: #e7f6ef; color: #0d6e5f; }
.cmp-chip.is-mill { background: #fff4e5; color: #9a5412; }
@media (max-width: 800px) {
  .cmp-slot .cmp-fields,
  .cmp-choice { grid-template-columns: 1fr 1fr; }
  .cmp-slot .cmp-fields .form-group:first-child { grid-column: 1 / -1; }
}
.bom-list {
  width: 100%;
}
.size-form .bom-list-head,
.size-form .bom-row {
  grid-template-columns: minmax(0, 2.2fr) minmax(90px, 0.7fr) minmax(72px, 0.55fr) minmax(90px, 0.7fr) 56px 40px;
}
.size-form-actions {
  width: 100%;
  max-width: none;
}
@media (max-width: 1100px) {
  .bom-materials-split { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .bom-parent-split { grid-template-columns: 1fr; }
  .bom-parent-fields { grid-template-columns: 1fr 1fr; }
  .bom-active-field { grid-column: 1 / -1; }
  .bom-size-press-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .bom-parent-fields { grid-template-columns: 1fr; }
  .size-compound-grid { grid-template-columns: 1fr 1fr; }
  .bom-list-head,
  .bom-row {
    grid-template-columns: minmax(0, 1.4fr) 100px 80px 100px 56px 40px;
  }
}
.size-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1aa897, #0f6b63);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.size-card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 750;
}
.size-code-input {
  font-family: var(--display);
  font-weight: 750;
  letter-spacing: 0.03em;
}
.size-bom-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--line);
}
.size-bom-pill {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(26,168,151,0.12);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bom-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.bom-list-head {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(90px, 0.7fr) minmax(72px, 0.55fr) minmax(90px, 0.7fr) 56px 40px;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #f3f7f8;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.bom-list-head-size,
.bom-row-size {
  grid-template-columns: 120px minmax(0, 1.6fr) 130px 90px 44px;
}
.size-compound-card {
  border-left: 3px solid #1aa897;
}
.size-compound-level + .size-compound-level {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px dashed #d5dde4;
}
.size-compound-level-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
}
.bom-level-lines { display: flex; flex-direction: column; gap: 0.15rem; white-space: nowrap; }
.bom-list-body { display: flex; flex-direction: column; }
.bom-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(90px, 0.7fr) minmax(72px, 0.55fr) minmax(90px, 0.7fr) 56px 40px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--line);
  transition: background 0.12s;
}
.bom-row:first-child { border-top: none; }
.bom-row:hover { background: #fafcfd; }
.bom-row.has-comp { background: rgba(26,168,151,0.04); }
.bom-field select,
.bom-field input {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid #c5d0d8;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 36, 44, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bom-field select:hover,
.bom-field input:hover {
  border-color: #9eb0bb;
}
.bom-field select:focus,
.bom-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.14);
}
.bom-unit-wrap { display: flex; justify-content: center; }
.bom-unit-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #eef3f5;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.bom-row.has-comp .bom-unit-chip {
  background: rgba(26,168,151,0.12);
  color: var(--accent-dark);
}
.bom-actions { display: flex; justify-content: center; }
.bom-remove {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.bom-remove:hover {
  background: #fef3f2;
  border-color: #fecdca;
  color: var(--danger);
}
.size-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.95rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
}

@media (max-width: 820px) {
  .bom-list-head { display: none; }
  .bom-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.85rem;
  }
  .bom-unit-wrap, .bom-actions { justify-content: flex-start; }
}

@media (max-width: 900px) {
  .mp-meta-grid { grid-template-columns: 1fr; }
  .mp-alloc-table th:last-child,
  .mp-alloc-table td:last-child { width: auto; }
  .mp-station-cell, .mp-alloc-table td { display: block; width: 100% !important; }
  .mp-alloc-table thead { display: none; }
  .mp-alloc-row { display: block; border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
}

/* Shift master cards */
.shift-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.shift-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s;
}
.shift-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.shift-card.is-off { opacity: 0.65; }
.shift-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}
.shift-code {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 0.55rem;
  border-radius: 11px;
  background: linear-gradient(145deg, #1aa897, #0f6b63);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
}
.shift-name {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 750;
}
.shift-duration {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #f3f7f8;
  margin-bottom: 0.9rem;
}
.dur-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.dur-value {
  font-family: var(--display);
  font-weight: 750;
  font-size: 1.05rem;
  color: var(--accent-dark);
}
.dur-sep { opacity: 0.45; margin: 0 0.2rem; }
.shift-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

@media (max-width: 980px) {
  .sidebar-toggle { display: inline-grid; place-items: center; }
  .layout { position: relative; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 58px;
    bottom: 0;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .user-meta { display: none; }
}
@media (max-width: 980px) {
  .sidebar { top: 46px !important; }
}

/* ===== Compact density overrides (less scroll) ===== */
.multi-select { min-height: 64px; padding: 0.25rem; border-radius: 7px; }
.mp-meta-card { margin-bottom: 0.55rem !important; }
.mp-meta-grid { gap: 0.55rem !important; }
.mp-stat { min-width: 88px !important; padding: 0.35rem 0.55rem !important; border-radius: 8px !important; }
.mp-stat-label { font-size: 0.58rem !important; margin-bottom: 0.05rem !important; }
.mp-stat-value { font-size: 1.05rem !important; }
.mp-section-head { margin: 0 0 0.45rem !important; gap: 0.55rem !important; }
.mp-section-title { font-size: 0.92rem !important; }
.mp-section-head .muted { margin: 0.05rem 0 0 !important; font-size: 0.7rem !important; }
.mp-alloc-table th, .mp-alloc-table td { padding: 0.28rem 0.4rem !important; }
.mp-station-cell { font-size: 0.82rem !important; }
.ms-trigger { padding: 0.34rem 0.5rem !important; border-radius: 7px !important; font-size: 0.8rem !important; }
.ms-options { max-height: 180px; }
.ms-option { padding: 0.32rem 0.4rem !important; font-size: 0.78rem !important; gap: 0.4rem !important; }
.ms-search-wrap { padding: 0.4rem !important; }
.ms-search { padding: 0.32rem 0.5rem !important; font-size: 0.8rem !important; }
.ms-panel-foot { padding: 0.35rem 0.4rem !important; }
.mp-footer-card textarea { min-height: 44px !important; }
.mp-list { gap: 0.4rem !important; }
.mp-list-card { border-radius: 10px !important; }
.mp-list-summary { padding: 0.5rem 0.7rem !important; gap: 0.65rem !important; }
.mp-list-main { gap: 0.55rem !important; }
.mp-date-block { width: 42px !important; height: 42px !important; border-radius: 8px !important; }
.mp-day { font-size: 0.95rem !important; }
.mp-mon { font-size: 0.52rem !important; }
.mp-list-info h3 { font-size: 0.9rem !important; }
.mp-list-info p { margin: 0.2rem 0 0 !important; }
.mp-pill { padding: 0.08rem 0.38rem !important; font-size: 0.68rem !important; }
.mp-list-details { padding: 0.5rem 0.7rem 0.65rem !important; }
.mp-name-chip { padding: 0.1rem 0.4rem !important; font-size: 0.7rem !important; }
.mp-expand-ico { width: 24px !important; height: 24px !important; }

@media (min-width: 1100px) {
  .mp-alloc-table thead { display: none; }
  .mp-alloc-table, .mp-alloc-table tbody { display: block; width: 100%; }
  .mp-alloc-table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
  .mp-alloc-row {
    display: grid !important;
    grid-template-columns: minmax(8.5rem, 11rem) minmax(0, 1fr);
    gap: 0.4rem;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.3rem 0.45rem;
    background: #fff;
  }
  .mp-alloc-row td {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    display: block;
    width: auto !important;
  }
  .mp-alloc-row.is-filled {
    background: rgba(26,168,151,0.05);
    border-color: rgba(26,168,151,0.28);
    box-shadow: inset 2px 0 0 var(--accent);
  }
}

.ep-sheet { padding: 0.7rem 0.8rem 0.55rem !important; }
.ep-sheet-head { padding-bottom: 0.55rem !important; margin-bottom: 0.5rem !important; gap: 0.75rem !important; }
.ep-sheet-brand strong { font-size: 0.95rem !important; }
.ep-sheet-brand span { font-size: 0.78rem !important; }
.ep-section { margin-bottom: 0.7rem !important; }
.ep-section-head { margin-bottom: 0.35rem !important; }
.ep-section-head h2 { font-size: 0.85rem !important; }
.ep-paper-table th { padding: 0.32rem 0.35rem !important; font-size: 0.62rem !important; }
.ep-paper-table td { padding: 0.22rem 0.28rem !important; }
.ep-paper-table select, .ep-paper-table input { padding: 0.28rem 0.4rem !important; font-size: 0.8rem !important; border-radius: 6px !important; }
.ep-machine-block { margin-bottom: 0.5rem !important; padding: 0.45rem !important; border-radius: 8px !important; }
.ep-machine-label { font-size: 0.72rem !important; margin-bottom: 0.3rem !important; }
.ep-machine-label strong { font-size: 0.95rem !important; }
.ep-total-bar { padding: 0.4rem 0.65rem !important; font-size: 0.78rem !important; }
.ep-total-bar strong { font-size: 1.05rem !important; }
.ep-remove { width: 26px !important; height: 26px !important; }
.ep-hint { margin: 0.25rem 0 0 !important; font-size: 0.68rem !important; }
.ep-form-code { margin: 0.4rem 0 0 !important; font-size: 0.62rem !important; }
.empty-state { padding: 1.4rem 1rem !important; }
.empty-ico { font-size: 1.4rem !important; margin-bottom: 0.25rem !important; }
.empty-state h3 { font-size: 1rem !important; margin: 0 0 0.2rem !important; }
.empty-state .btn { margin-top: 0.5rem !important; }
.size-info-card, .size-bom-card { padding: 0.85rem 1rem !important; }
.size-layout { gap: 0.65rem !important; margin-bottom: 0.65rem !important; }
.bom-materials-split { gap: 0.65rem !important; }
.size-bom-head { margin-bottom: 0.65rem !important; padding-bottom: 0.6rem !important; }
.bom-list-head { padding: 0.45rem 0.65rem !important; font-size: 0.62rem !important; gap: 0.4rem !important; }
.bom-row { padding: 0.5rem 0.65rem !important; gap: 0.45rem !important; }
.bom-field select, .bom-field input { padding: 0.48rem 0.65rem !important; min-height: 2.35rem !important; border-radius: 9px !important; }
.bom-remove { width: 28px !important; height: 28px !important; }
.size-form-actions { padding: 0.6rem 0.85rem !important; border-radius: 10px !important; bottom: 0.4rem !important; }
.size-badge { width: 38px !important; height: 38px !important; border-radius: 10px !important; font-size: 0.72rem !important; }
.size-card-title { font-size: 0.95rem !important; }
.size-form input[type="text"],
.size-form input[type="number"],
.size-form input:not([type]),
.size-form select,
.bom-parent-fields input,
.bom-parent-fields select,
.size-compound-grid input,
.size-compound-grid select {
  min-height: 2.45rem !important;
  padding: 0.5rem 0.7rem !important;
  border-radius: 10px !important;
}
.modal-head { padding: 0.55rem 0.75rem !important; }
.modal-body { padding: 0.7rem !important; }
.modal-foot { padding: 0.5rem 0.75rem !important; }
.modal-card { border-radius: 10px !important; max-width: 380px !important; }
.bom-view-card { max-width: 780px !important; }
.mx-ledger-card { max-width: 920px !important; }

/* PM checklist — compact full-width sheet */
.pm-cl-sheet {
  width: 100%;
  max-width: none;
  background: var(--panel);
  border: 1px solid rgba(213, 221, 228, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pm-cl-form { width: 100%; max-width: none !important; }
.pm-cl-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbfb 0%, #f3f7f8 100%);
}
.pm-cl-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.1rem;
}
.pm-cl-title-block .eyebrow { margin: 0; }
.pm-cl-toolbar .page-title { font-size: 0.98rem; }
.pm-cl-toolbar-fields {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0.45rem;
  min-width: 0;
}
.pm-cl-toolbar-fields .form-group { margin: 0; }
.pm-cl-toolbar-fields label {
  margin-bottom: 0.1rem;
  font-size: 0.62rem;
}
.pm-cl-toolbar-fields input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.84rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(16, 36, 44, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pm-cl-toolbar-fields input:hover { border-color: #b7c4cd; }
.pm-cl-toolbar-fields input:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.16);
}
.pm-cl-toolbar-fields input::placeholder { color: #9aa8b3; }
.pm-cl-active-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  padding: 0.2rem 0.55rem;
  border: 1px solid #d5dde4;
  border-radius: 999px;
  background: #fff;
  font-size: 0.76rem;
  white-space: nowrap;
  cursor: pointer;
}
.pm-cl-active-inline input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}
.pm-cl-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.05rem;
}
.pm-cl-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: start;
}
.pm-cl-pane {
  min-width: 0;
  padding: 0.45rem 0.55rem 0.6rem;
}
.pm-cl-pane-side {
  border-left: 1px solid var(--line);
  background: #fafcfc;
  min-height: 100%;
}
.pm-cl-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.pm-cl-pane-head strong {
  font-family: var(--display);
  font-size: 0.84rem;
  font-weight: 750;
}
.pm-cl-hint {
  margin: 0 0 0.35rem;
  font-size: 0.64rem;
  color: var(--muted);
  line-height: 1.3;
}
.pm-cl-table-scroll {
  overflow: auto;
  max-height: min(52vh, 420px);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.pm-cl-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.pm-cl-table th,
.pm-cl-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #edf1f3;
  vertical-align: middle;
}
.pm-cl-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f7f8;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.pm-cl-table tbody tr:last-child td { border-bottom: none; }
.pm-cl-table tbody tr:hover td { background: #f8fbfb; }
.pm-cl-col-num { width: 34px; text-align: center !important; }
.pm-cl-col-text { width: 34%; max-width: 280px; }
.pm-cl-col-input { width: 110px; }
.pm-cl-col-exp { width: 78px; }
.pm-cl-col-tol { width: 78px; }
.pm-cl-table input:disabled,
.pm-cl-table select:disabled {
  background: #eef2f4;
  color: #8a96a0;
  cursor: not-allowed;
}
.pm-cl-table input:disabled::placeholder {
  color: transparent;
}
.pm-cl-col-req { width: 42px; text-align: center !important; }
.pm-cl-col-x { width: 32px; }
.pm-cl-item-num {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--accent-dark);
}
.pm-cl-table input,
.pm-cl-table select,
.pm-cl-assign select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  border: 1px solid #d0d9e0;
  border-radius: 7px;
  background: #fff;
  box-sizing: border-box;
  box-shadow: inset 0 1px 1px rgba(16, 36, 44, 0.025);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pm-cl-table input::placeholder { color: #9aa8b3; }
.pm-cl-table select,
.pm-cl-assign select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6b78' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.1 2.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 9px;
  padding-right: 1.4rem;
  cursor: pointer;
}
.pm-cl-table input:hover,
.pm-cl-table select:hover,
.pm-cl-assign select:hover {
  border-color: #b7c4cd;
}
.pm-cl-table input:focus,
.pm-cl-table select:focus,
.pm-cl-assign select:focus {
  outline: none;
  border-color: #1aa897;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.15);
}
.pm-cl-req {
  display: grid;
  place-items: center;
  margin: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f3f7f8;
  border: 1px solid #d5dde4;
  cursor: pointer;
}
.pm-cl-req:has(.pm-mand-check:checked) {
  background: rgba(26, 168, 151, 0.12);
  border-color: rgba(26, 168, 151, 0.35);
}
.pm-cl-req input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.pm-cl-x {
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pm-cl-x:hover {
  background: #fef3f2;
  border-color: #fecdca;
  color: var(--danger);
}
.pm-cl-assigns {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pm-cl-assign {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 26px;
  gap: 0.35rem;
  align-items: center;
  padding: 0.4rem;
  border: 1px solid #dfe6eb;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 36, 44, 0.03);
}
.pm-cl-assign[data-scope="machine_type"] .pm-machine { display: none !important; }
.pm-cl-assign[data-scope="machine"] .pm-type { display: none !important; }
.pm-cl-assign .pm-type,
.pm-cl-assign .pm-machine { grid-column: 2; }
@media (max-width: 1100px) {
  .pm-cl-toolbar {
    grid-template-columns: 1fr auto;
  }
  .pm-cl-toolbar-fields {
    grid-column: 1 / -1;
  }
}
@media (max-width: 900px) {
  .pm-cl-split { grid-template-columns: 1fr; }
  .pm-cl-pane-side {
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .pm-cl-table-scroll { max-height: 40vh; }
  .pm-cl-toolbar-fields { grid-template-columns: 1fr; }
}

/* PM breakdown reasons */
.pm-br-sheet {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border: 1px solid rgba(213, 221, 228, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pm-br-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbfb 0%, #f3f7f8 100%);
}
.pm-br-toolbar .page-title { font-size: 1rem; }
.pm-br-toolbar .eyebrow { margin: 0; }
.pm-br-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pm-br-body { padding: 0.75rem; }
.pm-br-note {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
}
.pm-br-filters {
  padding: 0.45rem 0.65rem !important;
  margin-bottom: 0.55rem;
}
.pm-br-filter-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.pm-br-filter-form label {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  margin: 0;
}
.pm-br-filter-form select {
  min-width: 180px;
  padding: 0.32rem 0.55rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
}
.pm-br-cat-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pm-br-cat-row select {
  flex: 1;
  min-width: 0;
}
.pm-br-cat-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
}
.pm-type-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.pm-type-card {
  display: flex !important;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 !important;
  padding: 0.6rem 0.7rem;
  border: 1px solid #cfd8df;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pm-type-card:hover { border-color: #9fb3bf; }
.pm-type-card:has(input:checked) {
  border-color: #1aa897;
  background: #effaf8;
  box-shadow: 0 0 0 3px rgba(26, 168, 151, 0.12);
}
.pm-type-card input[type="radio"],
.pm-type-card input[type="checkbox"],
.form-group .pm-type-card input[type="radio"] {
  width: auto;
  flex: 0 0 auto;
  margin: 0.15rem 0 0;
  padding: 0;
  box-shadow: none;
  accent-color: #1aa897;
}
.pm-type-card-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pm-type-card-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
}
.pm-type-card-who {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e8eef2;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pm-type-card:has(input:checked) .pm-type-card-who { background: #cdeee9; color: #0f6f63; }
.pm-type-card-text { font-size: 0.76rem; font-weight: 500; color: var(--ink); line-height: 1.35; }
.pm-type-card-eg { font-size: 0.72rem; font-weight: 500; color: var(--muted); }
@media (max-width: 640px) {
  .pm-type-cards { grid-template-columns: 1fr; }
}
.pm-sp-sheet { max-width: 820px; }
.pm-sp-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pm-sp-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.28rem 0.55rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}
.pm-sp-type-chip:has(input:checked) {
  border-color: #7aa8b0;
  background: #eef7f8;
}
.pm-sp-type-chip input {
  margin: 0;
}
.pm-sch-sheet { max-width: 820px; }
.pm-sch-dates, .pm-sch-hours { margin-top: 0.55rem; }
.pm-sch-dates .check-label { display: flex !important; font-weight: 500; }
.pm-sch-dates .check-label input[type="checkbox"] { width: 1rem; height: 1rem; min-height: 0; margin: 0; padding: 0; flex-shrink: 0; accent-color: var(--accent); }
.pm-sch-rules {
  margin-top: 0.7rem;
  padding: 0.65rem 0.7rem;
  border: 1px dashed #cfd8df;
  border-radius: 10px;
  background: #fafcfd;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pm-sch-rules-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-size: 0.84rem; }
.pm-sch-rules-head .muted { font-size: 0.74rem; }
.pm-sch-window {
  display: grid;
  grid-template-columns: 140px 140px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: end;
}
.pm-sch-window .form-group { margin: 0; }
.pm-sch-window-preview {
  margin: 0;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  background: #eef7f8;
  color: #0f5f56;
  font-size: 0.76rem;
  line-height: 1.35;
}
.pm-sch-mandatory:has(input:checked) { border-color: #c0392b; background: #fdf1ef; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1); }
.pm-sch-mandatory:has(input:checked) .pm-type-card-who { background: #f6d5d0; color: #9b2c1f; }
@media (max-width: 640px) {
  .pm-sch-window { grid-template-columns: 1fr 1fr; }
  .pm-sch-window-preview { grid-column: 1 / -1; }
}

/* PM Home dashboard */
.pm-home {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.pm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0 1rem;
}
.pm-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.75rem;
  background: linear-gradient(180deg, #f8fbfb 0%, #f1f6f7 100%);
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  min-height: 74px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.pm-kpi:hover {
  border-color: #7aa8b0;
  transform: translateY(-1px);
}
.pm-kpi-val {
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #1c2b33;
}
.pm-kpi-lbl {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.25;
}
.pm-kpi-danger {
  background: linear-gradient(180deg, #fff5f4 0%, #fdeceb 100%);
  border-color: #efc4c0;
}
.pm-kpi-danger .pm-kpi-val { color: #b42318; }
.pm-kpi-warn {
  background: linear-gradient(180deg, #fffaf0 0%, #fff3dc 100%);
  border-color: #ead4a8;
}
.pm-kpi-warn .pm-kpi-val { color: #9a6700; }
.pm-kpi-ok {
  background: linear-gradient(180deg, #f3fbf6 0%, #e3f5ec 100%);
  border-color: #b9e0c9;
}
.pm-kpi-ok .pm-kpi-val { color: #1e7b4f; }
.pm-kpi-muted { cursor: default; }
.pm-kpi-hint {
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
  opacity: 0.85;
}
.pm-home-split {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.pm-home-panel { padding: 0.75rem 0.85rem 0.55rem; margin: 0; }
.pm-home-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.pm-home-panel-head a {
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}
.pm-home-h {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1c2b33;
}
.pm-home-empty {
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem;
  text-align: center;
}
.pm-home-table { margin: 0; }
.pm-home-table th { font-size: 0.7rem; }
.pm-home-table td { font-size: 0.82rem; vertical-align: top; }
.pm-home-table .badge,
.pm-home-table .mp-pill { margin-left: 0.3rem; }
.pm-home-masters { margin-top: 0.25rem; }
.pm-home-masters .pm-home-h { margin-bottom: 0.5rem; }
.pm-home-master-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.pm-wo-top-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.pm-wo-card {
  background: #fff;
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pm-wo-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #f6fafb 0%, #eef4f5 100%);
  border-bottom: 1px solid var(--line);
}
.pm-wo-top-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pm-wo-no {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #1c2b33;
}
.pm-wo-line {
  margin: 0.28rem 0 0;
  font-size: 0.8rem;
  color: #3d5560;
}
.pm-wo-line-soft { color: var(--muted); font-size: 0.74rem; }
.pm-wo-list-head {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #fafcfc;
  border-bottom: 1px solid #e8eef1;
}
.pm-wo-list { display: flex; flex-direction: column; }
.pm-wo-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) minmax(220px, 0.95fr);
  gap: 0.55rem 0.85rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #eef2f4;
  align-items: start;
}
.pm-wo-item:nth-child(even) { background: #fbfcfd; }
.pm-wo-item:last-child { border-bottom: none; }
.pm-wo-item-idx {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #e8f0f2;
  color: #45606a;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.pm-wo-item-name {
  font-size: 0.9rem;
  font-weight: 650;
  color: #1c2b33;
  line-height: 1.3;
}
.pm-wo-star { color: #b42318; font-style: normal; margin-left: 0.15rem; }
.pm-wo-item-meta {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.pm-wo-item-input {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pm-wo-seg { display: flex; gap: 0.28rem; flex-wrap: wrap; }
.pm-wo-seg-opt { margin: 0; cursor: pointer; }
.pm-wo-seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pm-wo-seg-opt span {
  display: inline-block;
  padding: 0.32rem 0.55rem;
  border: 1px solid #cfd8df;
  border-radius: 7px;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 650;
  color: #3d5560;
}
.pm-wo-seg-opt input:checked + span {
  border-color: #2f6f78;
  background: #e7f4f5;
  color: #1c4a52;
}
.pm-wo-seg-opt input[value="not_ok"]:checked + span {
  border-color: #c45c4a;
  background: #fdeceb;
  color: #b42318;
}
.pm-wo-num-auto {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pm-wo-num-auto input,
.pm-wo-text-row input,
.pm-wo-remark,
.pm-wo-bar-note,
.pm-wo-text-row select,
.pm-wo-approve-return input {
  width: 100%;
  padding: 0.38rem 0.55rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
  background: #fff;
}
.pm-wo-auto-badge {
  flex-shrink: 0;
  min-width: 68px;
  text-align: center;
  padding: 0.35rem 0.45rem;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 750;
  background: #eef2f4;
  color: #6a7a84;
  border: 1px solid #d5dde3;
}
.pm-wo-auto-badge.is-ok {
  background: #e8f6ee;
  color: #1b7a3d;
  border-color: #b7e0c5;
}
.pm-wo-auto-badge.is-not-ok {
  background: #fdeceb;
  color: #b42318;
  border-color: #efc4c0;
}
.pm-wo-auto-badge.is-na {
  background: #f3f5f7;
  color: #5a6a74;
}
.pm-wo-na-inline {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.pm-wo-text-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 0.35rem;
}
.pm-wo-remark { font-size: 0.8rem !important; color: #3d5560; }
.pm-wo-photo-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}
.pm-wo-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid #cfd8df;
  vertical-align: middle;
  transition: transform 0.15s ease;
}
.pm-wo-thumb:hover {
  transform: scale(1.15);
}
.pm-wo-thumb-link {
  display: inline-flex;
  align-items: center;
}
.pm-wo-file-btn {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  margin: 0;
}
.pm-wo-file-btn input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.pm-wo-file-btn span {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border: 1px dashed #9cb1bc;
  border-radius: 6px;
  font-size: 0.72rem;
  color: #4b636e;
  background: #f8fafb;
  transition: all 0.15s ease;
}
.pm-wo-file-btn input[type="file"]:focus + span,
.pm-wo-file-btn:hover span {
  border-color: #2f6f78;
  color: #1c4a52;
  background: #edf6f7;
}
.pm-wo-photo-thumb-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pm-wo-photo-remove {
  font-size: 0.7rem;
  color: #b42318;
  cursor: pointer;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.pm-wo-view-block {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.84rem;
}
.pm-wo-bar {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  background: #f4f8f9;
}
.pm-wo-bar-note { flex: 1; min-width: 180px; }
.pm-wo-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.45rem 1rem 0.65rem;
  border-top: 1px solid #eef2f4;
  background: #fcfdfd;
}
.pm-wo-skip-inline summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}
.pm-wo-skip-inline form {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.pm-wo-skip-inline input { min-width: 180px; padding: 0.32rem 0.5rem; border: 1px solid #cfd8df; border-radius: 7px; font: inherit; font-size: 0.8rem; }
.pm-wo-approve {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 12px;
  background: #fff;
}
.pm-wo-approve-return {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.pm-wo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0.85rem;
  align-items: start;
}
.pm-wo-main { min-width: 0; }
.pm-wo-main .pm-panel { max-width: none; }
.pm-wo-side { display: flex; flex-direction: column; gap: 0.85rem; position: sticky; top: 0.75rem; }
.pm-wo-side .pm-panel { max-width: none; margin-top: 0; }
.pm-wo-side .pm-cost-grid { grid-template-columns: 1fr 1fr; }
.pm-wo-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.pm-wo-meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 1rem;
  border-right: 1px solid #eef2f4;
  min-width: 0;
}
.pm-wo-meta > div:last-child { border-right: none; }
.pm-wo-meta span { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.pm-wo-meta strong { font-size: 0.9rem; color: #1c2b33; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-wo-meta small { font-size: 0.72rem; color: var(--muted); }
.pm-wo-meta .is-late strong, .pm-wo-meta .is-late small { color: #b42318; }
.pm-wo-progress { display: inline-flex; align-items: center; gap: 0.5rem; text-transform: none; letter-spacing: 0; }
.pm-wo-progress-bar { width: 90px; height: 6px; border-radius: 99px; background: #e2e9ed; overflow: hidden; }
.pm-wo-progress-bar i { display: block; height: 100%; background: #1aa897; border-radius: 99px; transition: width 0.2s ease; }
.pm-wo-progress.is-complete .pm-wo-progress-text { color: #1b7a3d; }
.pm-wo-section-head { border-top: 1px solid var(--line); }
.pm-wo-item { padding: 0.85rem 1rem; }
.pm-wo-seg-opt { flex: 1 1 0; }
.pm-wo-seg-opt span {
  display: block;
  text-align: center;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pm-wo-seg-opt:hover span { border-color: #9cb1bc; }
.pm-wo-seg-opt input:focus-visible + span { outline: 2px solid #2f6f78; outline-offset: 1px; }
.pm-wo-seg-opt input[value="ok"]:checked + span { border-color: #34a467; background: #e8f6ee; color: #1b7a3d; }
.pm-wo-seg-opt input[value="na"]:checked + span { border-color: #8a9aa4; background: #f0f3f5; color: #4b5b65; }
.pm-wo-item-extra { display: flex; gap: 0.4rem; align-items: center; }
.pm-wo-item-extra .pm-wo-remark { flex: 1; min-width: 0; }
.pm-wo-item-extra .pm-wo-photo-row { margin-top: 0; flex-wrap: nowrap; }
.pm-wo-item-extra .pm-wo-file-btn span { padding: 0.36rem 0.55rem; white-space: nowrap; }
.pm-wo-cost-row { padding: 0.7rem 1rem 0.8rem; }
.pm-wo-cost-row input {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 400;
  color: #1c2b33;
  background: #fff;
}
.pm-wo-cost-row input:focus,
.pm-wo-bar-note:focus,
.pm-wo-remark:focus { outline: none; border-color: #2f6f78; box-shadow: 0 0 0 3px rgba(47, 111, 120, 0.12); }
.pm-wo-bar { justify-content: flex-end; }
.pm-wo-mandatory-note { font-size: 0.76rem; font-weight: 650; color: #b42318; }
@media (max-width: 1100px) {
  .pm-wo-layout { grid-template-columns: 1fr; }
  .pm-wo-side { position: static; }
  .pm-wo-side .pm-cost-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .pm-wo-item { grid-template-columns: 28px 1fr; }
  .pm-wo-item-input { grid-column: 2; }
  .pm-wo-text-row { grid-template-columns: 1fr; }
  .pm-wo-meta { grid-template-columns: 1fr 1fr; }
  .pm-wo-meta > div:nth-child(2) { border-right: none; }
  .pm-wo-meta > div:nth-child(-n+2) { border-bottom: 1px solid #eef2f4; }
  .pm-wo-side .pm-cost-grid { grid-template-columns: 1fr 1fr; }
  .pm-wo-item-extra { flex-wrap: wrap; }
}

/* Breakdown tickets */
.pm-bd-card {
  max-width: 820px;
  background: #fff;
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pm-bd-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #fdf8f6 0%, #f7f1ef 100%);
  border-bottom: 1px solid #eadfdc;
}
.pm-bd-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pm-bd-no {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  color: #1c2b33;
}
.pm-bd-line { margin: 0.25rem 0 0; font-size: 0.8rem; color: #3d5560; }
.pm-bd-soft { color: var(--muted); font-size: 0.74rem; }
.pm-bd-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: flex-start; }
.pm-bd-body { padding: 0.85rem 1rem 1rem; }
.pm-bd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.pm-bd-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  background: #f7fafb;
  border-radius: 8px;
  border: 1px solid #e8eef1;
}
.pm-bd-grid .muted { font-size: 0.68rem; font-weight: 650; }
.pm-bd-block { margin-top: 0.55rem; }
.pm-bd-block .muted { font-size: 0.7rem; font-weight: 650; }
.pm-bd-block p { margin: 0.2rem 0 0; font-size: 0.9rem; line-height: 1.4; }
.pm-bd-foot {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  background: #f4f8f9;
}
@media (max-width: 720px) {
  .pm-bd-grid { grid-template-columns: 1fr 1fr; }
}
.pm-bd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0.85rem;
  align-items: start;
}
.pm-bd-main { min-width: 0; }
.pm-bd-main .pm-bd-card,
.pm-bd-main .pm-panel { max-width: none; }
.pm-bd-side { display: flex; flex-direction: column; gap: 0.85rem; }
.pm-bd-side .pm-panel { max-width: none; margin-top: 0; }
.pm-bd-side .pm-cost-grid { grid-template-columns: 1fr 1fr; }
.pm-chk-summary { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.pm-chk-summary span {
  padding: 0.18rem 0.55rem; border-radius: 99px; font-size: 0.72rem; font-weight: 700;
  background: #f0f3f5; color: #4b5b65;
}
.pm-chk-summary .is-bad { background: #fdeceb; color: #b42318; }
.pm-chk-summary .is-ok { background: #e8f6ee; color: #1b7a3d; }
.pm-chk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.pm-chk-item {
  padding: 0.6rem 0.7rem;
  border: 1px solid #e3e9ed;
  border-left: 4px solid #b7c4cc;
  border-radius: 8px;
  background: #fff;
}
.pm-chk-item.is-bad { border-color: #efc4c0; border-left-color: #d92d20; background: #fff6f5; }
.pm-chk-item.is-ok { border-left-color: #34a467; }
.pm-chk-name { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; font-size: 0.84rem; font-weight: 650; color: #1c2b33; line-height: 1.3; }
.pm-chk-badge {
  flex-shrink: 0; padding: 0.1rem 0.45rem; border-radius: 6px; font-size: 0.68rem; font-weight: 750;
  background: #f0f3f5; color: #4b5b65;
}
.pm-chk-item.is-bad .pm-chk-badge { background: #d92d20; color: #fff; }
.pm-chk-item.is-ok .pm-chk-badge { background: #e8f6ee; color: #1b7a3d; }
.pm-chk-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.45rem; }
.pm-chk-vals > div {
  display: flex; flex-direction: column; gap: 0.05rem;
  padding: 0.35rem 0.5rem; border-radius: 6px; background: #f7fafb; border: 1px solid #edf1f4;
}
.pm-chk-vals small { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.pm-chk-vals strong { font-size: 0.88rem; color: #1c2b33; word-break: break-word; }
.pm-chk-vals em { font-style: normal; font-size: 0.7rem; color: var(--muted); }
.pm-chk-item.is-bad .pm-chk-result { background: #fdeceb; border-color: #f4c7c3; }
.pm-chk-item.is-bad .pm-chk-result strong,
.pm-chk-item.is-bad .pm-chk-result em { color: #b42318; font-weight: 750; }
.pm-chk-note { display: flex; gap: 0.45rem; align-items: center; margin-top: 0.4rem; font-size: 0.76rem; color: #3d5560; }
.pm-imp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 0.85rem; align-items: start; }
.pm-imp-steps ol { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.75rem; }
.pm-imp-steps li { font-size: 0.86rem; color: #3d5560; }
.pm-imp-steps li strong { color: #1c2b33; display: block; margin-bottom: 0.3rem; }
.pm-imp-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.2rem; }
.pm-imp-form input[type="file"] {
  padding: 0.55rem; border: 1px dashed #9cb1bc; border-radius: 8px; background: #f8fafb; font: inherit; font-size: 0.82rem;
}
.pm-imp-table td, .pm-imp-table th { padding: 0.35rem 0.5rem; font-size: 0.8rem; vertical-align: top; }
.pm-imp-table code { font-size: 0.78rem; background: #eef4f5; padding: 0.05rem 0.3rem; border-radius: 4px; }
.pm-imp-result { margin-bottom: 0.85rem; border-left: 4px solid #b7c4cc; }
.pm-imp-result h3 { margin: 0 0 0.5rem; font-size: 0.98rem; }
.pm-imp-result.is-saved { border-left-color: #34a467; background: #f3fbf6; }
.pm-imp-result.is-ok { border-left-color: #1aa897; background: #f2fbfa; }
.pm-imp-result.is-bad { border-left-color: #d92d20; background: #fff8f7; }
.pm-imp-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pm-imp-stats span { padding: 0.25rem 0.6rem; border-radius: 8px; background: #fff; border: 1px solid #e3e9ed; font-size: 0.8rem; }
.pm-imp-label { margin: 0.75rem 0 0.3rem; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
@media (max-width: 900px) { .pm-imp-grid { grid-template-columns: 1fr; } }
@media (max-width: 1100px) {
  .pm-bd-layout { grid-template-columns: 1fr; }
  .pm-bd-side .pm-cost-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .pm-bd-side .pm-cost-grid { grid-template-columns: 1fr 1fr; }
}

/* PM spares / cost / history panels */
.pm-panel { max-width: 820px; margin-top: 0.85rem; padding: 0.8rem 1rem; }
.pm-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.pm-panel-head h3 { margin: 0; font-size: 0.95rem; }
.pm-panel-sub { margin: 0.55rem 0 0.3rem; font-size: 0.74rem; font-weight: 650; color: var(--muted); }
.pm-panel-warn { color: #b54708; }
.pm-panel-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }
.pm-panel-actions form { margin: 0; }
.pm-panel table.data th, .pm-panel table.data td { padding: 0.4rem 0.5rem; font-size: 0.82rem; }
.pm-spare-req {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(70px, 0.8fr) minmax(0, 2fr) auto;
  gap: 0.5rem;
  align-items: end;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
}
.pm-spare-req .form-group { margin: 0; }
.pm-spare-req.pm-spare-req-3 { grid-template-columns: minmax(0, 3fr) minmax(90px, 1fr) auto; }
.pm-sugg-req { display: flex; gap: 0.3rem; align-items: center; justify-content: flex-end; margin: 0; }
.pm-sugg-req input[type="number"] { width: 5.5rem; padding: 0.25rem 0.4rem; }
.modal-card.modal-wide { max-width: 580px; }
.pm-cost-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; }
.pm-cost-grid > div {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.5rem 0.6rem; background: #f7fafb; border: 1px solid #e8eef1; border-radius: 8px;
}
.pm-cost-grid .muted { font-size: 0.68rem; font-weight: 650; }
.pm-cost-total { background: #ecfdf3 !important; border-color: #abefc6 !important; }
.pm-timeline { list-style: none; margin: 0; padding: 0 0 0 0.9rem; border-left: 2px solid #e2e9ed; }
.pm-timeline li { position: relative; display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; padding: 0.3rem 0; font-size: 0.82rem; }
.pm-timeline li::before {
  content: ''; position: absolute; left: -1.27rem; top: 0.62rem;
  width: 9px; height: 9px; border-radius: 50%; background: #5b8fa3;
}
.pm-tl-when { color: var(--muted); font-size: 0.74rem; min-width: 7.5rem; }
.pm-tl-who { color: var(--muted); font-size: 0.74rem; flex-basis: 100%; }
.pm-wo-cost-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem;
  padding: 0.6rem 1rem; border-top: 1px solid var(--line); background: #fafcfd;
}
.pm-wo-cost-row label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; font-weight: 650; color: var(--muted); }
@media (max-width: 720px) { .pm-wo-cost-row { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .pm-spare-req, .pm-cost-grid { grid-template-columns: 1fr 1fr; }
}
.pm-home-master {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid rgba(213, 221, 228, 0.95);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pm-home-master:hover {
  border-color: #7aa8b0;
  background: #f7fbfb;
}
.pm-home-master-ttl {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1c2b33;
}
.pm-home-master .muted { font-size: 0.72rem; }
.pm-home-note {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
}
@media (max-width: 1000px) {
  .pm-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pm-home-split { grid-template-columns: 1fr; }
  .pm-home-master-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .pm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-home-master-grid { grid-template-columns: 1fr; }
}

/* PM reports + spare stock */
.pm-rpt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}
.pm-rpt-tab {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #3d5560;
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
}
.pm-rpt-tab:hover { border-color: #7aa8b0; background: #f7fbfb; }
.pm-rpt-tab.is-on {
  border-color: #2f6f78;
  background: #e7f4f5;
  color: #1c4a52;
}
.pm-rpt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.pm-rpt-panel { padding: 0.75rem 0.85rem; margin: 0; }
.pm-rpt-panel .pm-home-h { margin: 0 0 0.55rem; }
.pm-br-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
  .pm-rpt-grid { grid-template-columns: 1fr; }
}

/* Green Tube Stock */
.gts-head {
  align-items: flex-start;
}
.gts-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.2rem 0 0 !important;
}
.gts-aging-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.gts-day-tabs {
  display: inline-flex;
  padding: 0.18rem;
  gap: 0.15rem;
  border-radius: 10px;
  background: #eef2f1;
  border: 1px solid var(--line, #d7e0dd);
}
.gts-day-tab {
  display: inline-block;
  padding: 0.32rem 0.7rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  text-decoration: none;
  line-height: 1.2;
}
.gts-day-tab:hover { color: var(--accent-dark, #0b524c); background: rgba(255,255,255,0.7); }
.gts-day-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2, #148f84), var(--accent, #0f6b63));
  box-shadow: 0 1px 2px rgba(15, 107, 99, 0.25);
}
.gts-card { padding: 0.85rem 1rem !important; }
.gts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.gts-plant-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.gts-plant-filter label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.gts-plant-filter select {
  min-width: 150px;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  font-size: 0.88rem;
}
.gts-ready-bar {
  position: relative;
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  height: 1.55rem;
  border-radius: 999px;
  background: #f1f5f4;
  border: 1px solid #d7e5e1;
  overflow: hidden;
}
.gts-ready-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #34d399, #0f6b63);
  border-radius: inherit;
  transition: width 0.25s ease;
}
.gts-ready-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-dark, #0b524c);
  letter-spacing: 0.02em;
  pointer-events: none;
}
.gts-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.gts-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f4f8f7;
  border: 1px solid #d7e5e1;
}
.gts-stat-ok {
  background: #ecfdf3;
  border-color: #a7f3d0;
}
.gts-stat-warn {
  background: #fff7ed;
  border-color: #fed7aa;
}
.gts-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.gts-stat-val {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text, #0f172a);
  font-variant-numeric: tabular-nums;
}
.gts-stat-ok .gts-stat-val { color: #047857; }
.gts-stat-warn .gts-stat-val { color: #c2410c; }
.gts-table-wrap { margin: 0; border-radius: 10px; border: 1px solid var(--line, #e2e8f0); overflow: hidden; }
.gts-table { margin: 0; }
.gts-table thead th {
  background: #f8faf9;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.gts-table tbody td,
.gts-table tfoot td {
  padding: 0.55rem 0.7rem;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f1;
}
.gts-table tbody tr:last-child td { border-bottom: none; }
.gts-table tbody tr:hover td { background: #f8fbfb; }
.gts-table tfoot td {
  background: #f4f8f7;
  border-top: 1px solid var(--line, #e2e8f0);
  border-bottom: none;
}
.gts-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gts-plant {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-dark, #0b524c);
  background: #e8f4f1;
  border: 1px solid #c5e0d6;
}
.gts-size {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.gts-aging-note,
.gts-ready-note {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.7rem;
  font-weight: 500;
}
.gts-aging-note { color: #c2410c; }
.gts-ready-note { color: #64748b; }
@media (max-width: 640px) {
  .gts-stats { grid-template-columns: 1fr; }
  .gts-ready-bar { max-width: none; width: 100%; }
}

/* —— Routing Master —— */
.rt-shell { max-width: 760px; }
.rt-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1rem 1.5rem;
  margin-bottom: 0.75rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, #f4faf8 0%, #fff 55%);
}
.rt-hero-main {
  flex: 1 1 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}
.rt-size-pick select {
  font-weight: 600;
  font-size: 1rem;
  min-width: 10rem;
}
.rt-progress-wrap { max-width: 22rem; }
.rt-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.rt-progress-meta strong {
  font-size: 0.88rem;
  color: var(--ink, #1a2e2a);
  font-weight: 700;
}
.rt-progress-bar {
  height: 6px;
  border-radius: 99px;
  background: #e2ebe8;
  overflow: hidden;
}
.rt-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  transition: width 0.2s ease;
}
.rt-hero-totals {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  margin-left: auto;
}
.rt-total {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.rt-total span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rt-total strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-dark, #0b524c);
}
.rt-total em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}
.rt-form { padding: 1.05rem 1.15rem 1.15rem; }
.rt-form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.rt-extra-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-dark, #0b524c);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0;
}
.rt-extra-link:hover { text-decoration: underline; }
.rt-cols-head {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(6.5rem, 1fr) minmax(6.5rem, 1fr);
  gap: 0.55rem 0.75rem;
  padding: 0 0.75rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rt-cols-head em {
  font-style: normal;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.85;
}
.rt-stage-list { display: flex; flex-direction: column; gap: 0.45rem; }
.rt-stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(6.5rem, 1fr) minmax(6.5rem, 1fr);
  gap: 0.55rem 0.75rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  border: 1px solid #dde8e4;
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.rt-stage-row:hover { border-color: #b7d4cb; }
.rt-stage-row.is-filled {
  background: #f3faf7;
  border-color: #b9d9ce;
}
.rt-step-no {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-dark, #0b524c);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.12rem;
}
.rt-stage-name {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.rt-stage-name strong { font-size: 0.95rem; letter-spacing: 0.01em; }
.rt-field { display: flex; flex-direction: column; gap: 0.15rem; margin: 0; }
.rt-field-label {
  display: none;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.rt-input {
  width: 100%;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #d0ddd8;
  background: #fcfdfd;
}
.rt-input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
  background: #fff;
}
.rt-input::placeholder { color: #b0bfb9; }
.rt-input.rt-time {
  text-align: center;
  letter-spacing: 0.06em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.rt-input.rt-time.is-invalid,
.rt-time.is-invalid {
  border-color: #e07a6e;
  background: #fff8f7;
}
.rt-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}
.rt-hint {
  margin: 0;
  max-width: 22rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}
.rt-list-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.rt-pill {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.85rem;
  background: #f7fbfb;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 6.5rem;
}
.rt-pill strong { font-size: 1.05rem; }
.rt-list-card { padding: 0; overflow: hidden; }
.rt-matrix-wrap { overflow: auto; max-height: calc(100vh - 220px); }
.rt-matrix { border-collapse: separate; border-spacing: 0; min-width: max-content; }
.rt-matrix th, .rt-matrix td {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
}
.rt-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f8f7;
}
.rt-matrix thead tr:nth-child(2) th { top: 2.15rem; }
.rt-matrix .rt-act {
  border-bottom: none;
  font-size: 0.75rem;
}
.rt-matrix .rt-sub {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.rt-matrix .rt-size-h,
.rt-matrix .rt-size-c {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  min-width: 11rem;
  box-shadow: 1px 0 0 var(--line);
}
.rt-matrix thead .rt-size-h { z-index: 4; background: #f4f8f7; }
.rt-matrix .rt-size-c a { font-weight: 700; color: inherit; text-decoration: none; }
.rt-matrix .rt-size-c a:hover { color: var(--accent-dark, #0b524c); text-decoration: underline; }
.rt-matrix td.rt-blank { color: var(--muted); }
.rt-matrix tbody tr:hover td { background: #fafcfd; }
.rt-matrix tbody tr:hover .rt-size-c { background: #fafcfd; }
.rt-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}
.rt-size-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fafcfb, #fff);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rt-size-card:hover {
  border-color: #9ec9bc;
  box-shadow: 0 2px 10px rgba(11, 82, 76, 0.06);
}
.rt-size-card.is-done { border-color: #c5e0d6; background: #f3faf7; }
.rt-size-top { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.rt-size-code { font-size: 1rem; letter-spacing: 0.01em; }
.rt-size-desc {
  margin: 0;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rt-bar {
  height: 4px;
  border-radius: 99px;
  background: #e8eeec;
  overflow: hidden;
}
.rt-bar > span {
  display: block;
  height: 100%;
  background: var(--accent, #0d9488);
  border-radius: 99px;
}
.rt-size-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark, #0b524c);
}
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.insp-grid { min-width: 0; max-width: 52rem; width: 100%; }
.insp-grid th, .insp-grid td { text-align: center; }
.insp-grid th:first-child, .insp-grid td:first-child { text-align: left; }
.insp-grid th:nth-child(2), .insp-grid td:nth-child(2) { width: 7rem; }
.insp-grid th:nth-child(3), .insp-grid td:nth-child(3),
.insp-grid th:nth-child(4), .insp-grid td:nth-child(4) { width: 11rem; }
.insp-grid input[type="number"] {
  width: 100%;
  max-width: 6.5rem;
  padding: 0.28rem 0.35rem;
  text-align: right;
}
.insp-grid select { width: 100%; max-width: 12rem; }
.insp-grid .insp-ro { font-variant-numeric: tabular-nums; font-weight: 600; }
.insp-sum td { background: #f6faf8; }

/* Shift-total operator rows + summary beside them */
.prod-work {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(16rem, 22rem);
  gap: 1rem 1.25rem;
  align-items: stretch;
  margin: 1rem 0 1.15rem;
  max-width: 64rem;
}
.prod-work .vp-ops-block,
.prod-work .va-ops-block,
.prod-work .sp-ops-block,
.prod-work .oi-ops-block {
  max-width: none;
  margin: 0;
  height: 100%;
}
.prod-work .vp-op-cols, .prod-work .vp-op-row, .prod-work .vp-op-foot,
.prod-work .oi-op-cols, .prod-work .oi-op-row, .prod-work .oi-op-foot {
  max-width: none;
  width: 100%;
}
.prod-summary {
  background: linear-gradient(180deg, #eef7f4 0%, #f7fbfa 100%);
  border: 1px solid #cfe3dc;
  border-radius: 10px;
  padding: 0.9rem 1rem 1rem;
}
.prod-summary-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0b524c;
}
.prod-summary-note {
  margin: 0 0 0.8rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.prod-summary .vp-totals,
.prod-summary .va-totals,
.prod-summary .sp-totals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin: 0;
}
.prod-summary .mx-ready-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin: 0;
}
.prod-summary .mx-close-stat {
  padding: 0.55rem 0.7rem;
  background: #fff;
  border: 1px solid #d5e6e0;
  border-radius: 8px;
}
.prod-eff {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem 0.85rem;
  background: linear-gradient(180deg, #eef6fb 0%, #f7fbfd 100%);
  border: 1px solid #c9dce8;
  border-radius: 10px;
}
.prod-summary .prod-eff { margin-top: 0.85rem; }
.prod-eff-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}
.prod-eff-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0b3d52;
}
.prod-eff-help-btn {
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border: 1px solid #b7c9d4;
  border-radius: 999px;
  background: #fff;
  color: #0b3d52;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.prod-eff-help-btn:hover { background: #e8f2f8; border-color: #7aa0b4; }
.prod-eff-help {
  position: relative;
  z-index: 20;
  margin-top: 0.55rem;
}
.prod-eff-help-card {
  padding: 0.65rem 0.75rem 0.75rem;
  background: #fff;
  border: 1px solid #c5d6e0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 40, 55, 0.12);
}
.prod-eff-help-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
}
.prod-eff-help-close {
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.prod-eff-help-body { font-size: 0.78rem; line-height: 1.45; color: #1a2b33; }
.prod-eff-help-body p { margin: 0 0 0.4rem; }
.prod-eff-help-list {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.1rem;
}
.prod-eff-help-list li { margin: 0.2rem 0; }
.prod-eff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}
.prod-eff-badge .prod-eff-help {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  width: min(22rem, 85vw);
  margin: 0;
}
.entry-row-actions { white-space: nowrap; font-size: 0.84rem; }
.entry-row-actions .entry-del-btn,
.link-btn.entry-del-btn {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: #9b2c2c;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.prod-eff-note {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  line-height: 1.35;
}
.prod-eff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.prod-eff-stat {
  padding: 0.45rem 0.55rem;
  background: #fff;
  border: 1px solid #d5e3ec;
  border-radius: 8px;
}
.prod-eff-stat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.prod-eff-stat strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: #123;
}
.prod-eff-stat em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 0.2rem;
}
.prod-eff-pct { grid-column: 1 / -1; background: #e8f7f1; border-color: #b7e0d0; }
.prod-eff-pct strong { font-size: 1.25rem; color: #0b524c; }
.prod-eff-formula {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: #4a6572;
  line-height: 1.4;
}
.vp-op-name select, .va-op-name select, .sp-op-name select, .oi-op-name select {
  max-width: 100%;
  text-overflow: ellipsis;
}
@media (max-width: 860px) {
  .prod-work { grid-template-columns: 1fr; max-width: none; }
}
@media (max-width: 640px) {
  .vp-ops-block, .va-ops-block, .sp-ops-block, .oi-ops-block {
    max-width: 100%;
  }
  .vp-op-cols, .vp-op-row, .vp-op-foot,
  .oi-op-cols, .oi-op-row, .oi-op-foot {
    grid-template-columns: minmax(8rem, 1fr) 6.5rem 2.2rem !important;
    max-width: 100% !important;
  }
  .va-op-cols, .va-op-row, .va-op-foot,
  .sp-op-cols, .sp-op-row, .sp-op-foot {
    grid-template-columns: minmax(7.5rem, 1fr) 7.5rem 6.5rem 2.2rem !important;
    max-width: 100% !important;
  }
}
@media (max-width: 720px) {
  .rt-hero-totals { margin-left: 0; width: 100%; }
  .rt-total { flex: 1; }
  .rt-cols-head { display: none; }
  .rt-stage-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "setup run";
  }
  .rt-stage-name { grid-area: name; }
  .rt-field:nth-of-type(1) { grid-area: setup; }
  .rt-field:nth-of-type(2) { grid-area: run; }
  .rt-field-label { display: block; }
  .rt-input { text-align: left; }
}

/* Production entry/efficiency dashboard */
.pdash { max-width: 1100px; margin: 0 auto 2rem; }
.pdash-head-sticky {
  position: sticky;
  top: 0;
  z-index: 45;
  margin: 0 -0.25rem 0.35rem;
  padding: 0.55rem 0.25rem 0.75rem;
  background: linear-gradient(180deg, var(--bg, #f3f6f8) 70%, transparent);
  backdrop-filter: blur(4px);
}
.pdash-head-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}
.pdash-section { margin: 1.25rem 0 1.75rem; }
.pdash-section-title {
  margin: 0 0 0.2rem;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--ink);
}
.pdash-section-note { margin: 0 0 0.85rem; font-size: 0.82rem; }
.pdash-section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.pdash-stage-pick {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
}
.pdash-stage-pick select {
  min-width: 10rem;
  height: 2.2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 0.5rem;
}
.pdash-empty-banner {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #eef3f6;
  border: 1px dashed #c5d3dc;
  border-radius: 10px;
  font-size: 0.88rem;
}
.pdash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
}
.pdash-kpi {
  padding: 0.7rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
a.pdash-kpi-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
a.pdash-kpi-link:hover {
  border-color: #7aa0b4;
  box-shadow: 0 4px 14px rgba(15, 40, 55, 0.08);
  transform: translateY(-1px);
}
a.pdash-kpi-link.is-active {
  border-color: #1f6f54;
  box-shadow: 0 0 0 1px rgba(31, 111, 84, 0.35);
}
.pdash-kpi-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.pdash-kpi-total {
  margin: 0.25rem 0 0.45rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}
.pdash-kpi-unit {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 0.15rem;
}
.pdash-kpi-split { display: grid; gap: 0.15rem; font-size: 0.75rem; color: var(--muted); }
.pdash-kpi-split div { display: flex; justify-content: space-between; gap: 0.35rem; }
.pdash-kpi-split strong { color: var(--ink); font-weight: 700; }

.pdash-eff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.75rem;
}
.pdash-eff-card {
  position: relative;
  padding: 0.75rem;
  background: linear-gradient(180deg, #eef6fb 0%, #f7fbfd 100%);
  border: 1px solid #c9dce8;
  border-radius: 12px;
  overflow: visible;
}
.pdash-eff-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.pdash-eff-card-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #0b3d52;
}
.pdash-eff-chart-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0.25rem auto 0.5rem;
}
.pdash-eff-centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.pdash-eff-centre strong { font-size: 1.05rem; font-weight: 800; }
.pdash-eff-centre span { font-size: 0.65rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.pdash-eff-band-good .pdash-eff-pct { color: #1f6f54; }
.pdash-eff-band-ok .pdash-eff-pct { color: #b45309; }
.pdash-eff-band-low .pdash-eff-pct { color: #9b2c2c; }
.pdash-eff-band-muted .pdash-eff-pct { color: #6b7c86; }
.pdash-eff-band-good { border-color: #9bc4b3; }
.pdash-eff-band-ok { border-color: #e0b57a; }
.pdash-eff-band-low { border-color: #d4a0a0; }
.pdash-eff-empty {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 1rem;
}
.pdash-eff-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  font-size: 0.75rem;
}
.pdash-eff-meta span { display: block; color: var(--muted); font-size: 0.65rem; text-transform: uppercase; }
.pdash-eff-meta strong { font-weight: 700; }
.pdash-eff-card .prod-eff-help {
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  top: 2.1rem;
  z-index: 50;
  margin: 0;
  width: auto;
  min-width: 0;
}
.pdash-eff-card .prod-eff-help-card {
  box-shadow: 0 12px 28px rgba(15, 40, 55, 0.18);
}
.pdash-charts-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.85rem;
}
@media (max-width: 860px) {
  .pdash-charts-row { grid-template-columns: 1fr; }
  .pdash-head-controls { justify-content: flex-start; }
}
.pdash-chart-card { padding: 0.85rem 1rem 1rem; }
.pdash-chart-title {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
}
.pdash-chart-wrap { position: relative; width: 100%; }
.pdash-chart-empty {
  margin: 0.35rem 0 0;
  padding: 1.4rem 0.75rem;
  text-align: center;
  font-size: 0.86rem;
  background: #f4f7f9;
  border-radius: 8px;
}
.pdash-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pdash-detail-card { max-width: min(720px, 94vw) !important; }
.pdash-detail-table th.num,
.pdash-detail-table td.num { text-align: right; white-space: nowrap; }


/* Saved entries — month filter */
.entry-month-bar {
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f7fafb;
  border: 1px solid #d5e0e7;
  border-radius: 12px;
  box-shadow: none;
}
.entry-month-bar-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.35rem;
  margin: 0;
}
.entry-month-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.entry-month-label {
  display: block;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}
.entry-month-optional {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.85;
}
.entry-month-bar-nav,
.entry-month-bar-day {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}
.entry-month-arrow {
  width: 2.15rem;
  min-width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.entry-month-bar-nav input[type="month"],
.entry-month-bar-day input[type="date"] {
  height: 2.15rem;
  min-width: 10.5rem;
  padding: 0 0.55rem;
  border: 1px solid #c5d3dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  box-sizing: border-box;
}
.entry-month-bar-nav input[type="month"]:focus,
.entry-month-bar-day input[type="date"]:focus {
  outline: none;
  border-color: #7aa0b4;
  box-shadow: 0 0 0 3px rgba(122, 160, 180, 0.18);
}
.entry-month-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.1rem;
  margin-left: auto;
}
.entry-month-chip {
  display: inline-flex;
  align-items: center;
  height: 2.15rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: #e5f2ec;
  color: #1f6f54;
  font-size: 0.78rem;
  font-weight: 700;
}
@media (max-width: 640px) {
  .entry-month-bar-form { gap: 0.75rem; }
  .entry-month-actions { margin-left: 0; width: 100%; }
  .entry-month-bar-nav input[type="month"],
  .entry-month-bar-day input[type="date"] {
    min-width: 0;
    flex: 1 1 auto;
  }
}
