:root {
  color-scheme: light;
  --bg: #e9eceb;
  --panel: #f8faf9;
  --panel-strong: #eef2f1;
  --text: #17211f;
  --muted: #5d6a66;
  --line: #c5ceca;
  --line-strong: #8c9a95;
  --brand: #126b78;
  --primary: #126b78;
  --accent: #a84f2b;
  --ok: #247a52;
  --steel: #26322f;
  --steel-2: #3c4743;
  --modern-accent: #34c5dd;
  --caution: #d46b38;
  --shadow: 0 14px 36px rgba(27, 38, 35, 0.12);
}

* {
  box-sizing: border-box;
}

.d-none {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(38, 50, 47, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(38, 50, 47, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--steel), #1e2926);
  border-bottom: 3px solid var(--modern-accent);
  box-shadow: 0 8px 28px rgba(18, 27, 24, 0.22);
}

.topbar h1 {
  color: #f8faf9;
}

.topbar strong {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.topbar span {
  display: block;
  color: #dce7e4;
  font-size: 13px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  padding: 4px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
}

h1 {
  margin: 0;
  font-size: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.compact {
  max-width: 420px;
  margin: 48px auto;
}

form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  background: #fbfcfb;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(18, 107, 120, 0.22);
  border-color: var(--brand);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

select[multiple] {
  min-height: 118px;
}

button {
  padding: 8px 12px;
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

button:disabled,
button.is-busy {
  cursor: wait;
  opacity: 0.72;
}

button.is-busy::after,
.button-link.is-busy::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.button-link {
  display: inline-grid;
  min-height: 40px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  text-decoration: none;
}

button.ghost {
  background: #eef2f1;
  color: var(--brand);
  border-color: #b6c2bd;
}

.error {
  color: var(--accent);
}

.tabs,
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.mobile-menu-button {
  display: none;
}

.tabs {
  padding: 8px;
  background: #dfe5e2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

.tab.active {
  color: #f8faf9;
  background: var(--steel-2);
  border-bottom-color: var(--modern-accent);
}

.tab-link {
  gap: 7px;
}

.nav-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: currentColor;
  opacity: 0.95;
}

.nav-icon::before,
.nav-icon::after {
  position: absolute;
  content: "";
  box-sizing: border-box;
}

.nav-icon-tasks::before {
  inset: 2px 3px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
}

.nav-icon-tasks::after {
  left: 6px;
  top: 0;
  width: 4px;
  height: 4px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
  background: var(--panel);
}

.nav-icon-services::before {
  left: 2px;
  top: 7px;
  width: 12px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(-35deg);
}

.nav-icon-services::after {
  right: 1px;
  top: 1px;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 2px;
  transform: rotate(45deg);
}

.nav-icon-gantt::before {
  inset: 2px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.nav-icon-gantt::after {
  left: 5px;
  top: 3px;
  width: 9px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: skewX(-18deg);
}

.nav-icon-manufacturing::before {
  inset: 3px 1px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-icon-manufacturing::after {
  left: 7px;
  top: 0;
  width: 2px;
  height: 16px;
  background: currentColor;
  box-shadow: -6px 6px 0 -0.5px currentColor, 6px 6px 0 -0.5px currentColor;
}

.nav-icon-bpc::before {
  left: 2px;
  top: 4px;
  width: 12px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.nav-icon-bpc::after {
  left: 5px;
  top: 1px;
  width: 6px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.nav-icon-repairs::before {
  left: 3px;
  top: 7px;
  width: 11px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
}

.nav-icon-repairs::after {
  left: 1px;
  top: 2px;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  transform: rotate(45deg);
}

.nav-icon-test::before {
  left: 6px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.nav-icon-test::after {
  left: 4px;
  bottom: 1px;
  width: 8px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
}

.nav-icon-stock::before {
  left: 2px;
  top: 3px;
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.nav-icon-stock::after {
  left: 5px;
  top: 1px;
  width: 6px;
  height: 4px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.nav-icon-intake::before {
  left: 3px;
  top: 2px;
  width: 10px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.nav-icon-intake::after {
  left: 6px;
  top: 6px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}

.toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.task-list {
  display: grid;
  gap: 8px;
}

.bpc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 12px;
}

.bpc-grid .panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.bpc-grid h2,
.bpc-grid h3 {
  margin: 0;
}

.results {
  display: grid;
  gap: 6px;
}

.result-button {
  background: #f7f9f8;
  color: var(--text);
  border-color: var(--line);
  text-align: left;
}

.result-list {
  display: grid;
  gap: 8px;
}

.stack {
  display: grid;
  gap: 12px;
}

.result {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
  background: #eef4f1;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.result small,
.active-task small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  margin-top: 3px;
}

.active-task {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 6px;
  background: #f2f6f4;
  margin-bottom: 12px;
}

.button-link.primary,
button.primary {
  background: var(--brand);
  color: #ffffff;
}

.button-link.secondary,
button.secondary {
  background: #dce7e4;
  color: #182521;
  border-color: #b7c6c1;
}

.button-link.ghost-light {
  background: #eef2f1;
  color: var(--text);
  border-color: var(--line);
}

.top-link {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 14px;
}

button.danger {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

button.compact {
  min-height: 36px;
  padding: 6px 10px;
}

.testing-main {
  display: grid;
  gap: 12px;
}

.testing-tabs {
  margin-bottom: 0;
  overflow-x: auto;
}

.tab-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.tab-link.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.testing-panel {
  display: grid;
  gap: 12px;
}

.testing-progress {
  border-left: 5px solid var(--brand);
}

.panel-heading,
.toolbar-inline,
.audio-actions,
.transfer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-heading {
  justify-content: space-between;
}

.task-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
}

.services-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 12px;
  align-items: start;
}

.service-detail {
  grid-column: 1 / -1;
  order: -1;
}

.service-form {
  display: grid;
  gap: 12px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.service-subpanels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.intake-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(320px, 1fr);
  gap: 12px;
  align-items: start;
}

.intake-tabs {
  margin: 12px 0;
}

.intake-draft h3 {
  margin: 0;
  font-size: 16px;
}

.intake-private-row {
  align-self: end;
  min-height: 40px;
  padding: 8px 0;
}

.intake-follower-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.intake-follower-row strong,
.intake-follower-row span {
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  color: #164e63;
  background: #e6f7fb;
  border: 1px solid #a8dcea;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.intake-record-wrap {
  display: grid;
  place-items: center;
}

.hold-record-button {
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(220px, 100%);
  aspect-ratio: 1.35 / 1;
  min-height: 128px;
  touch-action: none;
  user-select: none;
  border-radius: 10px;
  font-size: 15px;
  text-align: center;
}

.hold-record-button.recording {
  background: #9f2f2f;
  border-color: #9f2f2f;
}

.hold-record-button.cancel-recording {
  background: #4b5563;
  border-color: #4b5563;
}

.record-mic-icon {
  position: relative;
  width: 30px;
  height: 42px;
  border: 3px solid currentColor;
  border-radius: 18px;
}

.record-mic-icon::before,
.record-mic-icon::after {
  position: absolute;
  content: "";
  left: 50%;
  transform: translateX(-50%);
}

.record-mic-icon::before {
  bottom: -12px;
  width: 42px;
  height: 24px;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 24px 24px;
}

.record-mic-icon::after {
  bottom: -22px;
  width: 4px;
  height: 12px;
  background: currentColor;
  box-shadow: -11px 12px 0 0 currentColor, 11px 12px 0 0 currentColor;
}

.signature-box {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  touch-action: none;
}

.signature-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.delivery-preview {
  padding: 12px;
  color: #10231f;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.delivery-preview dl {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.delivery-preview dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.delivery-preview dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.delivery-note-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  color: #101820;
  background: #fff;
  border: 1.5px solid #10231f;
}

.delivery-note-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  min-height: 58px;
  border: 1px solid #10231f;
}

.delivery-note-header > div:first-child {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
}

.delivery-note-header span {
  font-size: 12px;
}

.delivery-note-box {
  display: grid;
  place-items: center;
  border-left: 1px solid #10231f;
}

.delivery-note-box strong {
  font-size: 24px;
}

.delivery-note-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #10231f;
  border-bottom: 0;
}

.delivery-note-meta div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 34px;
  border-bottom: 1px solid #10231f;
}

.delivery-note-meta b {
  padding: 8px;
  background: #eef3f1;
  border-right: 1px solid #10231f;
  font-size: 12px;
}

.delivery-note-meta span {
  padding: 8px;
  overflow-wrap: anywhere;
}

.delivery-note-items {
  border: 1px solid #10231f;
}

.delivery-note-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  min-height: 76px;
}

.delivery-note-row > span {
  padding: 8px;
  border-left: 1px solid #10231f;
  overflow-wrap: anywhere;
}

.delivery-note-row > span:first-child {
  border-left: 0;
  text-align: center;
}

.delivery-note-head {
  min-height: 0;
  background: #eef3f1;
  font-weight: 700;
}

.delivery-note-head > span {
  padding: 6px 8px;
  border-bottom: 1px solid #10231f;
}

.delivery-note-timesheets {
  display: grid;
  gap: 6px;
}

.delivery-note-timesheets h4 {
  margin: 0;
}

.delivery-note-timesheets table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.delivery-note-timesheets th,
.delivery-note-timesheets td {
  padding: 6px;
  border: 1px solid #10231f;
  text-align: left;
  vertical-align: top;
}

.delivery-note-timesheets th {
  background: #eef3f1;
}

.delivery-note-timesheets td:last-child,
.delivery-note-timesheets th:last-child {
  text-align: right;
}

.delivery-note-total {
  font-weight: 700;
}

.delivery-note-signature-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 48px;
  border: 1px solid #10231f;
}

.delivery-note-signature-preview span {
  display: grid;
  place-items: end center;
  padding: 8px;
  border-left: 1px solid #10231f;
  color: #52615c;
  font-size: 12px;
}

.delivery-note-signature-preview span:first-child {
  border-left: 0;
}

.delivery-success {
  display: grid;
  gap: 12px;
  place-items: start;
  margin-top: 16px;
  padding: 18px;
  background: #e7f7ed;
  border: 1px solid #b7e2c3;
  border-radius: 8px;
}

.delivery-success h2,
.delivery-success p {
  margin: 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.service-audio-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel-2);
  border-radius: 8px;
  background: #f1f5f3;
}

.service-audio-panel h3 {
  margin: 0;
}

.service-audio-panel audio {
  width: 100%;
}

.service-list-button {
  display: grid;
  gap: 4px;
  border-left-width: 5px;
}

.service-list-button span,
.mini-list {
  color: var(--muted);
  font-size: 13px;
}

.mini-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f3;
}

.reference-preview img {
  display: block;
  max-width: min(100%, 520px);
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.step-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.step-type-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
  border: 1px solid var(--line);
  color: transparent;
  font-size: 0;
  overflow: hidden;
}

.step-type-icon.measurement {
  background-image: url("/static/icons/test-measurement.png");
}

.step-type-icon.check {
  background-image: url("/static/icons/test-check.png");
}

.step-type-icon.text {
  background-image: url("/static/icons/test-text.png");
}

.step-type-icon.photo {
  background-image: url("/static/icons/test-photo.png");
}

.manufacturing-layout {
  display: block;
}

.manufacturing-detail,
.manufacturing-detail-header {
  display: grid;
  gap: 12px;
}

.manufacturing-detail-header {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.manufacturing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#manufacturingPicker {
  display: grid;
  gap: 12px;
}

.manufacturing-order-button {
  display: grid;
  gap: 4px;
}

.manufacturing-order-button span {
  color: var(--muted);
  font-size: 12px;
}

.operation-list {
  display: grid;
  gap: 8px;
}

.operation-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f5;
}

.operation-item.operation-done {
  border-color: #9fd4b8;
  background: #e8f6ee;
}

.operation-item.operation-running {
  border-color: #9ccad2;
  background: #e7f3f5;
}

.operation-item.operation-locked {
  opacity: 0.72;
}

.operation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operation-user-select {
  display: grid;
  gap: 4px;
  font-size: 12px;
  min-width: 0;
}

.operation-user-select select {
  width: 100%;
}

.material-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.material-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(90px, 0.8fr) repeat(4, minmax(70px, 0.6fr));
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f3;
  font-size: 13px;
}

.material-row:last-child {
  border-bottom: 0;
}

.material-head {
  background: #dbe3df;
  color: #2f3b37;
  font-weight: 800;
}

.stock-low {
  color: var(--accent);
  font-weight: 800;
}

.status-pill {
  background: #eef2f1;
  border: 1px solid #c2ccc7;
  border-radius: 999px;
  color: var(--brand);
  font-weight: 800;
  padding: 7px 12px;
}

.step-panel {
  background: #f8faf9;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
  padding: 18px;
}

.mode-toggle {
  background: #dfe5e2;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
}

.mode-toggle label {
  align-items: center;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  min-height: 34px;
  padding: 0 6px;
  text-align: center;
}

.mode-toggle input:checked + label {
  background: #f8faf9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  color: var(--brand);
}

.step-chip {
  background: #e7f4f6;
  border: 1px solid #b9dbe2;
  border-radius: 999px;
  color: var(--brand);
  font-weight: 800;
  padding: 6px 12px;
}

.scanner-box {
  align-items: center;
  background: #101923;
  border: 4px solid #172536;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  min-height: clamp(220px, 42vh, 360px);
  overflow: hidden;
  position: relative;
  width: 100%;
}

.scanner-help {
  color: #dcebf0;
  font-weight: 700;
  max-width: 270px;
  padding: 18px;
  text-align: center;
}

.scanner-box video,
.scanner-box canvas {
  background: #101923 !important;
}

.scanner-box > div {
  width: 100% !important;
}

.status-line {
  background: #eaf8f2;
  border: 1px solid #b9e5d0;
  border-left: 5px solid var(--ok);
  border-radius: 8px;
  color: #154734;
  font-weight: 800;
  padding: 12px 14px;
}

.form-label {
  color: #31424c;
  font-weight: 800;
  margin-bottom: 6px;
}

.camera-drop {
  align-items: center;
  background: #f6fafb;
  border: 2px dashed #8fb7c2;
  border-radius: 8px;
  color: var(--brand);
  cursor: pointer;
  display: flex;
  font-size: 1.05rem;
  font-weight: 800;
  justify-content: center;
  min-height: 132px;
  padding: 16px;
  text-align: center;
  width: 100%;
}

.camera-drop input {
  display: none;
}

.photo-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  max-width: 100%;
}

.photo-item {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  max-height: 180px;
  overflow: hidden;
  position: relative;
}

.photo-item img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.photo-item button {
  align-items: center;
  background: rgba(15, 23, 42, 0.86);
  border: 0;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 1.2rem;
  height: 34px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 34px;
}

.summary-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.summary-list > div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 132px 1fr;
  padding: 13px 14px;
}

.summary-list > div:last-child {
  border-bottom: 0;
}

.summary-item {
  align-items: center;
  background: #fbfdfe;
  display: grid !important;
  gap: 7px;
  grid-template-columns: 1fr auto !important;
}

.summary-item span,
.summary-item small {
  color: var(--muted);
  font-weight: 700;
  grid-column: 1 / -1;
}

.summary-item button {
  grid-column: 2;
  grid-row: 1;
  min-height: 34px;
}

.sticky-actions {
  background: linear-gradient(180deg, rgba(246, 247, 248, 0), var(--bg) 25%);
  bottom: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin: 18px -18px -18px;
  padding: 22px 18px 18px;
  position: sticky;
}

.wide-action {
  grid-column: 1 / -1;
}

.loading-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  gap: 12px;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 2000;
}

.alert {
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  font-weight: 700;
}

@media (min-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 180px));
  }
}

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task:hover,
.task:focus {
  border-color: var(--brand);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  outline: none;
}

.task-event {
  background: #eef8f9;
  border-left: 4px solid var(--brand);
  cursor: default;
}

.task-event:hover,
.task-event:focus {
  border-color: var(--line);
  border-left-color: var(--brand);
  box-shadow: none;
}

.task-note {
  background: #f4f7f5;
  border-left: 4px solid #5f7f6f;
}

.task-subtabs {
  margin: 10px 0 12px;
}

.stock-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(320px, 1fr);
  gap: 12px;
  align-items: start;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.stock-lines {
  display: grid;
  gap: 8px;
  min-height: 80px;
}

.stock-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-empty {
  padding: 12px;
  box-shadow: none;
}

.task strong {
  display: block;
  margin-bottom: 4px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f1f4;
  color: var(--brand);
  font-size: 12px;
}

.action-badge {
  min-height: 0;
  border-color: #b9dbe2;
  cursor: pointer;
}

.pickup-layout {
  display: grid;
  gap: 14px;
}

.pickup-scanner {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.pickup-scan-actions,
.pickup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pickup-current {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.pickup-current-card {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid #b9dbe2;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: #edf6f6;
  padding: 12px;
}

.pickup-current-card.complete {
  border-color: #b9e5d0;
  border-left-color: var(--ok);
  background: #e8f6ee;
}

.pickup-current-card.no-stock {
  border-color: #e3b39c;
  border-left-color: var(--caution);
  background: #fbf0eb;
}

.pickup-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pickup-materials {
  display: grid;
  gap: 8px;
}

.pickup-line {
  display: grid;
  grid-template-columns: minmax(180px, 1.7fr) minmax(90px, 0.8fr) repeat(5, minmax(70px, 0.65fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  font-size: 13px;
}

.pickup-line.complete {
  background: #e8f6ee;
  color: #166534;
}

.pickup-line .muted {
  color: var(--muted);
  font-size: 12px;
}

.pickup-qty.no-stock,
.stock-low {
  color: var(--caution);
  font-weight: 800;
}

.pickup-history {
  display: grid;
  gap: 8px;
}

.pickup-history-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--ok);
  border-radius: 8px;
  padding: 8px 10px;
}

.pickup-history-item.error {
  border-left-color: #b91c1c;
}

.gantt-layout {
  display: grid;
  grid-template-columns: minmax(190px, 300px) minmax(0, 1fr);
  align-items: start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.gantt-project-rail {
  border-right: 1px solid var(--line);
  background: #f8fafc;
  color: #0f172a;
  font-size: 13px;
  min-height: 360px;
}

.gantt-project-header {
  display: flex;
  align-items: center;
  height: 85px;
  padding: 0 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 800;
}

.gantt-project-row {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid #eef1f3;
  font-weight: 700;
  line-height: 1.2;
}

.gantt-project-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  padding: 0;
  text-align: left;
}

.gantt-project-toggle:hover {
  color: var(--brand);
}

.gantt-project-row.group-start {
  border-top: 1px solid #cbd5e1;
}

.gantt-project-row.manufacturing-parent-row {
  background: #eef6f8;
}

.gantt-project-row.manufacturing-child-row {
  color: #475569;
  font-size: 12px;
  font-weight: 650;
  padding-left: 28px;
}

.gantt-manufacturing-toggle {
  color: #0f3f4c;
}

.gantt-subtask-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.gantt-chart {
  overflow-x: auto;
  background: #ffffff;
  min-height: 360px;
  padding: 8px;
}

.gantt-chart svg {
  min-width: 900px;
}

.gantt .grid-header {
  fill: #f8fafc;
}

.gantt .bar-wrapper .bar {
  fill: #1f7a8c;
  stroke: #176b87;
}

.gantt .bar-wrapper.stage-pendiente .bar {
  fill: #f59e0b;
  stroke: #b45309;
}

.gantt .bar-wrapper.stage-pendiente .bar-progress {
  fill: #fbbf24;
}

.gantt .bar-wrapper.stage-pendiente-sin-fecha .bar {
  fill: #f59e0b;
  stroke: #b45309;
  stroke-dasharray: 5 3;
}

.gantt .bar-wrapper.stage-pendiente-sin-fecha .bar-progress {
  fill: #fbbf24;
}

.gantt .bar-wrapper.stage-en-ejecucion .bar,
.gantt .bar-wrapper.stage-en-reparacion .bar {
  fill: #2563eb;
  stroke: #1d4ed8;
}

.gantt .bar-wrapper.stage-en-ejecucion .bar-progress,
.gantt .bar-wrapper.stage-en-reparacion .bar-progress {
  fill: #60a5fa;
}

.gantt .bar-wrapper.stage-en-ejecucion-sin-fecha .bar,
.gantt .bar-wrapper.stage-en-reparacion-sin-fecha .bar {
  fill: #2563eb;
  stroke: #1d4ed8;
  stroke-dasharray: 5 3;
}

.gantt .bar-wrapper.stage-en-ejecucion-sin-fecha .bar-progress,
.gantt .bar-wrapper.stage-en-reparacion-sin-fecha .bar-progress {
  fill: #60a5fa;
}

.gantt .bar-wrapper.stage-finalizada .bar {
  fill: #16a34a;
  stroke: #15803d;
}

.gantt .bar-wrapper.stage-finalizada .bar-progress {
  fill: #86efac;
}

.gantt .bar-wrapper.stage-finalizada-sin-fecha .bar {
  fill: #16a34a;
  stroke: #15803d;
  stroke-dasharray: 5 3;
}

.gantt .bar-wrapper.stage-finalizada-sin-fecha .bar-progress {
  fill: #86efac;
}

.gantt .bar-wrapper.project-summary .bar {
  fill: #64748b;
  stroke: #475569;
}

.gantt .bar-wrapper.project-summary .bar-progress {
  fill: #94a3b8;
}

.gantt .bar-wrapper.manufacturing-parent .bar {
  fill: #0f766e;
  stroke: #115e59;
}

.gantt .bar-wrapper.manufacturing-parent .bar-progress {
  fill: #5eead4;
}

.gantt .bar-wrapper.manufacturing-child .bar {
  stroke-width: 1.5px;
}

.gantt .bar-progress {
  fill: #22a06b;
}

.gantt .bar-label {
  fill: #0f172a;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.gantt .lower-text,
.gantt .upper-text {
  fill: #334155;
  font-size: 12px;
}

.gantt-message {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.app-notice {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(720px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 12px 14px;
  color: #16324f;
  background: #e8f4fb;
  border: 1px solid #b9dced;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.app-notice.error {
  color: #721c24;
  background: #fdeaea;
  border-color: #f3b6bd;
}

.app-notice.success {
  color: #14532d;
  background: #e7f7ed;
  border-color: #b7e2c3;
}

.app-notice[hidden] {
  display: none;
}

.app-notice button {
  min-height: 34px;
  padding: 6px 10px;
  border-color: currentColor;
  color: currentColor;
  background: transparent;
  white-space: nowrap;
}

.gantt-popup {
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 10px;
  color: #0f172a;
}

.gantt-fallback-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-width: 720px;
  padding: 10px 6px;
  border-bottom: 1px solid #eef1f3;
}

.task-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 33, 31, 0.58);
}

.task-modal {
  display: grid;
  gap: 12px;
  width: min(680px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 18px;
  background: #f8faf9;
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--modern-accent);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.task-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.task-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.date-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.task-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.task-modal-actions .success {
  background: #178044;
}

@media (max-width: 680px) {
  main {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions button {
    flex: 1;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 36px;
    margin-bottom: 8px;
    border-color: rgba(255, 255, 255, 0.28);
    background: #34423e;
    color: #f8faf9;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0;
  }

  .tabs {
    display: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8faf9;
    padding: 8px;
  }

  .tabs.mobile-open {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tabs .tab {
    width: 100%;
    text-align: left;
  }

  .task {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    width: 100%;
  }

  .panel {
    padding: 12px;
  }

  .manufacturing-detail-header {
    grid-template-columns: 1fr;
  }

  .manufacturing-actions {
    justify-content: stretch;
  }

  .manufacturing-actions button {
    flex: 1;
  }

  .services-layout,
  .intake-layout,
  .stock-layout,
  .service-grid,
  .service-subpanels {
    grid-template-columns: 1fr;
  }

  .stock-line {
    grid-template-columns: 1fr;
  }

  .operation-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .operation-item > .operation-user-select,
  .operation-item > .badge,
  .operation-item > .action-badge,
  .operation-item > .operation-actions {
    grid-column: 1 / -1;
  }

  .operation-item > .action-badge,
  .operation-actions .action-badge {
    width: 100%;
    min-height: 38px;
    border-radius: 6px;
  }

  .material-list {
    border: 0;
    gap: 8px;
  }

  .material-head {
    display: none;
  }

  .material-row {
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
  }

  .material-row strong,
  .material-row span:first-child {
    grid-column: 1 / -1;
  }

  .pickup-current-card {
    grid-template-columns: 1fr;
  }

  .pickup-current-actions button,
  .pickup-scan-actions button,
  .pickup-actions button {
    flex: 1 1 100%;
  }

  .pickup-line {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .pickup-line > div:first-child {
    grid-column: 1 / -1;
  }

  .pickup-line input {
    grid-column: 1 / -1;
  }

  .pickup-line > div:nth-child(2)::before {
    content: "Codigo";
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .pickup-line > div:nth-child(3)::before {
    content: "Necesaria";
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .pickup-line > div:nth-child(4)::before {
    content: "Descontado";
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .pickup-line > div:nth-child(5)::before {
    content: "Stock";
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .pickup-line > div:nth-child(7)::before {
    content: "Faltante";
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .bpc-grid {
    grid-template-columns: 1fr;
  }

  .testing-tabs {
    padding-bottom: 2px;
  }

  .tab-link {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .gantt-layout {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .gantt-project-header,
  .gantt-project-row {
    padding: 0 8px;
    font-size: 12px;
  }

  .task-modal-grid {
    grid-template-columns: 1fr;
  }

}
