:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  color: #ecf8f2;
  background: #080f0e;
  --surface: #101d1a;
  --surface-raised: #142520;
  --border: #29483b;
  --muted: #b0c7bb;
  --neon: #78ffad;
  --cyan: #72e7ef;
}
* { box-sizing: border-box; }
body { margin: 0; background: #080f0e; }
button, input, select { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid #78ffad;
  border-radius: 8px;
  min-height: 48px;
  padding: 10px 18px;
  font-weight: 750;
  background: #78ffad;
  color: #082216;
}
button:hover { background: #a2ffc5; border-color: #a2ffc5; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #a0faff;
  outline-offset: 3px;
}
button.secondary { background: #152821; border-color: #375849; color: #d7f8e2; }
button.secondary:hover { background: #203e30; border-color: #78ffad; }
button.danger { background: #ff8885; border-color: #ff8885; color: #2c0a09; }
.shell { max-width: 1600px; margin: auto; padding: 26px clamp(16px, 3vw, 48px); }
header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 28px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); letter-spacing: -.03em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; width: 64px; height: 64px; object-fit: contain; border-radius: 9px; flex: none; }
.login-logo { width: 108px; height: 108px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.top-actions, .row, .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 28px 0 24px; }
.hero p { margin-top: 7px; }
.badge { display: inline-block; padding: 5px 9px; border: 1px solid #376c4d; border-radius: 5px; background: #153527; color: #a4ffc6; font-size: .8rem; font-weight: 800; }
.badge.warn { background: #453217; border-color: #9d7431; color: #ffe09a; }
.badge.stop { background: #48201f; border-color: #a84c45; color: #ffc1b9; }
.badge.done { background: #28352e; border-color: #526a5c; color: #d2ded5; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.sector { background: #101d18; border: 1px solid #29483b; border-top: 3px solid #78ffad; border-radius: 14px; padding: 20px; min-height: 300px; }
.sector.treat { background: #101d20; border-color: #29474a; border-top-color: var(--cyan); }
.sector.treat .badge { background: #12363a; border-color: #39757b; color: #b2faff; }
.sector.treat .order-card .badge.warn { background: #453217; border-color: #9d7431; color: #ffe09a; }
.sector.treat .order-card .badge.stop { background: #48201f; border-color: #a84c45; color: #ffc1b9; }
.sector-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.stack { display: grid; gap: 10px; }
.card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card h3 { margin: 6px 0; }
.card p { margin-top: 5px; }
.order-card { width: 100%; text-align: left; background: #172a22; color: #f0fbf4; border: 1px solid #365646; }
.order-card:hover { background: #203c2d; border-color: #78ffad; }
.order-card .line { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.order-card .line + .line { margin-top: 10px; }
.empty { padding: 25px 5px; color: #a6bdb0; }
.panel { max-width: 760px; margin: 0 auto; }
.panel.wide { max-width: 1000px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: clamp(20px, 4vw, 36px); }
.box h2 { margin-bottom: 8px; }
.field { display: grid; gap: 7px; margin: 18px 0; }
label { font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid #597b68; border-radius: 8px; background: #0a1712; color: #f0fbf4; }
input::placeholder { color: #a6b9ad; opacity: 1; }
input[type=checkbox] { width: 22px; min-height: 22px; accent-color: var(--neon); }
.checks label { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.steps { font-weight: 700; color: #a4ffc6; margin-bottom: 16px; }
.divider { height: 1px; background: #355345; margin: 20px 0; }
.alert { padding: 12px 14px; background: #453217; color: #ffe09a; border: 1px solid #9d7431; border-radius: 8px; margin: 14px 0; }
.error { background: #48201f; color: #ffc1b9; border-color: #a84c45; }
.ok { background: #153527; color: #b7ffd1; border-color: #438f61; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(100%, 420px); border-top: 3px solid var(--neon); box-shadow: 0 0 36px #39ff8b12; }
.login h1 { margin: 20px 0 8px; }
.item { border-top: 1px solid var(--border); padding: 18px 0; }
.item:first-child { border: 0; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.stat { background: #20372b; color: #e0f7e7; padding: 8px 10px; border-radius: 7px; font-size: .9rem; }
.formbox { border: 1px solid #375849; border-radius: 10px; padding: 15px; margin: 12px 0; }
.formbox h3 { margin-bottom: 8px; }
summary { cursor: pointer; min-height: 44px; padding-top: 10px; font-weight: 700; color: #b7ffd1; }
.history { padding-left: 20px; }
.history li { margin: 9px 0; }
.results { max-height: 260px; overflow: auto; display: grid; gap: 5px; }
.result { background: #1b3529; border-color: #426d54; color: #e4ffed; text-align: left; }
.result:hover { background: #28523a; color: #fff; }
.offline { background: #48201f; color: #ffd8d2; text-align: center; padding: 8px; font-weight: 700; }
.progress { height: 5px; background: #284435; border-radius: 9px; margin-bottom: 26px; }
.progress span { display: block; height: 100%; background: var(--neon); box-shadow: 0 0 12px #78ffad88; border-radius: 9px; }
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
  .shell { padding: 18px 15px; }
  .hero { align-items: start; flex-direction: column; }
  .hero button { width: 100%; }
  .top-actions .user { display: none; }
  .sector { min-height: 0; }
  .box { padding: 20px; }
  .actions button { flex: 1; }
  .actions { align-items: stretch; }
  .order-card { min-height: 90px; }
}

/* Criação de OS: um pedido por vez, com ações legíveis no celular. */
.wizard { max-width: 680px; }
.wizard-top { display:flex; justify-content:space-between; align-items:center; gap:12px; color:var(--muted); font-weight:700; margin-bottom:12px; }
.wizard-top strong { color:var(--neon); font-size:.88rem; white-space:nowrap; }
.wizard .progress { margin-bottom:20px; }
.wizard-box { padding:clamp(22px, 5vw, 38px); }
.wizard-kicker { color:var(--neon); font-size:.75rem; font-weight:800; letter-spacing:.1em; margin-bottom:12px; }
.wizard h1 { font-size:clamp(1.7rem,5vw,2.2rem); line-height:1.12; }
.wizard-intro { color:var(--muted); line-height:1.5; margin-top:10px; }
.wizard .field { margin:24px 0; }
.wizard input:not([type=checkbox]) { min-height:56px; }
.optional-field { border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.optional-field summary { display:flex; justify-content:space-between; align-items:center; padding:12px 0; color:#e6f8ec; }
.optional-field summary span { color:var(--muted); font-size:.85rem; font-weight:500; }
.wizard-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:26px; }
.wizard-actions button { flex:1 1 180px; min-height:54px; }
.wizard-actions button:not(.secondary) { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.result-heading { color:var(--muted); font-size:.82rem; font-weight:800; margin:22px 0 10px; }
.wizard .results { max-height:340px; gap:8px; }
.wizard .result { min-height:56px; line-height:1.35; }
.chosen-product { display:grid; gap:6px; padding:16px; margin:20px 0 0; background:#162a22; border:1px solid #355c46; border-radius:10px; }
.chosen-product span, .review-origin span { color:var(--muted); font-size:.72rem; letter-spacing:.08em; font-weight:800; }
.chosen-product strong { line-height:1.4; overflow-wrap:anywhere; }
.service-options { border:0; padding:0; margin:26px 0 0; }
.service-options legend { font-weight:800; font-size:1.1rem; margin-bottom:7px; }
.service-option { display:flex; gap:14px; align-items:center; border:1px solid #395b49; background:#142820; border-radius:10px; padding:15px; margin-top:10px; min-height:74px; cursor:pointer; }
.service-option:has(input:checked) { border-color:var(--neon); background:#1c3b2b; }
.service-option input { flex:none; }
.service-option span { display:grid; gap:4px; }
.service-option small { color:var(--muted); font-weight:400; }
.service-hint { margin-top:12px; font-size:.85rem; color:var(--muted); line-height:1.4; }
.review-origin { display:flex; flex-wrap:wrap; align-items:center; gap:18px; padding:16px; margin:22px 0; background:#162a22; border-radius:10px; }
.review-origin div { display:grid; gap:5px; flex:1; min-width:100px; overflow-wrap:anywhere; }
.review-origin button { min-height:44px; }
.review-heading { display:flex; align-items:center; justify-content:space-between; margin:26px 0 8px; }
.review-heading h2 { margin:0; }
.review-heading span { color:var(--muted); font-size:.9rem; }
.review-item { border-top:1px solid var(--border); padding:16px 0; overflow-wrap:anywhere; }
.review-item p { margin-top:7px; color:var(--muted); }
.review-item-actions { display:flex; gap:8px; margin-top:12px; }
.review-item-actions button { min-height:44px; padding:8px 14px; }
.draft-note { color:var(--muted); font-size:.85rem; margin:15px 2px; }
@media (max-width: 500px) { .wizard-actions { flex-direction:column-reverse; } .wizard-actions button { flex:auto; width:100%; } .review-origin button { width:100%; } }

[hidden] { display: none !important; }

.sector.cutting { margin-top:20px; min-height:0; border-top-color:#ffc86a; }
.formbox > p + button { margin-top:12px; }

/* Controles discretos da ordem, com área de toque para celular. */
.item-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.item-heading h3 { padding-top:11px; line-height:1.35; overflow-wrap:anywhere; }
.icon-button { display:inline-flex; align-items:center; justify-content:center; flex:none; width:48px; height:48px; min-height:48px; padding:11px; border-radius:10px; color:#c7e9d4; background:#172b22; border:1px solid #3b5e4b; }
.icon-button:hover, .icon-button[aria-expanded=true] { color:#eafff1; background:#244637; border-color:var(--neon); }
.icon-button svg { display:block; width:22px; height:22px; }
.order-heading-actions { display:flex; align-items:center; gap:12px; }
.pause-button { color:#ffdc9a; border-color:#886e3e; background:#292719; }
.pause-button:hover, .pause-button[aria-expanded=true] { color:#ffe8bc; background:#41351f; border-color:#f1bf6b; }
.pause-panel { margin:0 0 18px; padding:18px; border-color:#896d39; background:#231f15; }
.pause-panel p { margin:4px 0 0; }
.edit-panel { background:#10241a; }
.order-finish { display:flex; justify-content:flex-end; margin-top:24px; }
@media(max-width:700px) { .order-heading-actions { align-self:stretch; justify-content:space-between; } .order-finish button { width:100%; } }
@media (max-width:700px) { .hero .icon-button { width:48px; } }
.output-results { display:grid; gap:8px; max-height:300px; overflow:auto; margin-top:12px; }
.output-results .result { min-height:48px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.suggested { font-size:.72rem; color:#b0f6c8; white-space:nowrap; }
.chosen-outputs { display:grid; gap:8px; margin-top:12px; }
.chosen-output { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px 8px 14px; background:#1b3529; border:1px solid #426d54; border-radius:8px; }
.chosen-output button { min-width:44px; padding:6px; font-size:1.3rem; }
.service-option:has(input:disabled) { opacity:.65; }
.item-path { margin-top:10px; color:#d4f5df; line-height:1.5; overflow-wrap:anywhere; }
.item-path span { color:var(--neon); padding:0 3px; }
.next-action { margin:12px 0; color:var(--neon); font-weight:750; }
.return-start { margin-top:12px; }
.return-panel h3 { margin-top:10px; }
.return-actions { display:flex; gap:10px; flex-wrap:wrap; }
.return-actions button { flex:1 1 130px; }
.plan-toggle { margin-top:12px; }
.plan-editor .return-actions { margin-top:16px; }

/* O painel dá prioridade às ordens que precisam de atenção. */
.card-status { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; }
.order-card.is-late { border-left:4px solid #f4bd64; }
.order-card.is-paused { border-left:4px solid #ef8a80; }
.order-card.is-late.is-paused { border-left-color:#ef8a80; }
.order-card .line > strong { white-space:nowrap; }
