/* TecnoClock CSS — MSG Design System */

.tc-hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #334155 100%);
  padding: 60px 20px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-top: var(--header-h, 140px);
}
.tc-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.tc-hero-content h1 {
  font-family: 'Oswald', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.tc-hero-content h1 span { color: #60A5FA; }
.tc-hero-sub { color: rgba(255,255,255,0.8); font-size: 1.1rem; margin: 0 0 20px; }
.tc-hero-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}
.tc-hero-stats span {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px 16px;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  font-weight: 500;
}
.tc-hero-stats span i { color: #60A5FA; margin-right: 6px; }

/* Produto selector */
.tc-produto-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.tc-produto-bar label {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.tc-produto-bar select {
  flex: 1 1 auto;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: Roboto, sans-serif;
  background: #fff;
  max-width: 520px;
  min-width: 0;
}

/* Dynamic form */
.tc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}
.tc-field {
  display: flex;
  flex-direction: column;
}
.tc-field label {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tc-req { color: #dc2626; }
.tc-field input, .tc-field select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  font-family: Roboto, sans-serif;
  background: #fff;
}
.tc-field input:focus, .tc-field select:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.tc-field input[readonly] {
  background: #f1f5f9;
  cursor: default;
}

/* Collapsible Drawer for Advanced / Engineering Options */
.tc-drawer {
  grid-column: 1 / -1;
  margin-top: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tc-drawer[open] {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}
.tc-drawer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #062F87;
  cursor: pointer;
  user-select: none;
  background: #f1f5f9;
  transition: background 0.15s ease;
}
.tc-drawer-summary:hover {
  background: #e2e8f0;
}
.tc-drawer[open] .tc-drawer-summary {
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  color: #1d4ed8;
}
.tc-drawer-summary::-webkit-details-marker {
  display: none;
}
.tc-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tc-drawer-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  text-transform: uppercase;
}
.tc-drawer-icon {
  transition: transform 0.2s ease;
  font-size: 12px;
  color: #64748b;
}
.tc-drawer[open] .tc-drawer-icon {
  transform: rotate(180deg);
  color: #1d4ed8;
}
.tc-drawer-content {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 640px) {
  .tc-drawer-content {
    grid-template-columns: 1fr;
  }
}

/* Results */
#tc-results { margin-top: 20px; }

.tc-kpi-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.tc-kpi-item {
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(135deg, #062F87, #1E40AF);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  color: #fff;
  border-bottom: 3px solid #FFD700;
}
.tc-kpi-lbl { display: block; font-size: 9px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.3px; color: #fff; }
.tc-kpi-val { display: block; font-size: 18px; font-weight: 700; font-family: Oswald, sans-serif; color: #fff; margin-top: 1px; }
.tc-kpi-sub { display: block; font-size: 10px; opacity: 0.7; color: #fff; }

.tc-part-number {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #062F87;
  text-align: center;
  padding: 12px 16px;
  margin: 0 0 12px 0;
  background: #f8faff;
  border: 1px solid #d0d9e8;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.tc-report-pn {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #062F87;
  text-align: center;
  padding: 10px 14px;
  margin: 8px 0;
  background: #f8faff;
  border: 1px solid #d0d9e8;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

/* Sections */
.tc-section { margin-bottom: 16px; }
.tc-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #062F87;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tc-param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}
.tc-param-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 10px;
}
.tc-param-label {
  display: block;
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.tc-param-val {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  font-family: Oswald, sans-serif;
  margin-top: 1px;
}

/* Regra construtiva */
.tc-regra {
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 13px;
}

/* Ops table */
.tc-ops-header {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.tc-ops-header:hover { background: #f1f5f9; }
.tc-ops-summary { font-weight: 400; font-size: 11px; color: #64748b; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.tc-ops-toggle-icon { float: right; font-size: 10px; opacity: 0.5; margin-top: 2px; }
.tc-ops-body { transition: all 0.2s ease; }

.tc-ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.tc-ops-table th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tc-ops-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
}
.tc-ops-table tr:hover { background: rgba(6,47,135,0.03); }
.tc-ops-group td { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: #004481; padding: 4px 8px; border-bottom: 1px solid #004481; }
.tc-ops-total td { background: #f1f5f9; font-size: 13px; }
.tc-tempo-min { text-align: right; font-weight: 700; font-family: Oswald, sans-serif; font-size: 1rem; }

/* Custo table */
.tc-custo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.tc-custo-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.tc-custo-val { text-align: right; font-weight: 700; font-family: Oswald, sans-serif; font-size: 1rem; }
.tc-custo-total td { background: #f1f5f9; font-weight: 700; font-size: 1rem; }
.tc-custo-preco td { background: #fefce8; font-weight: 800; font-size: 1.1rem; color: #92400e; }
.tc-custo-preco .tc-custo-val { color: #92400e; font-size: 1.3rem; }

.tc-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ============================================================
   TECNOCLOCK REPORT DESIGN SYSTEM — Premium A4
   Padronizado para todas as 10 Famílias de Produtos
   ============================================================ */

/* --- Container --- */
.tc-report-wrap, .report-wrap {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* --- HEADER PREMIUM --- */
.tc-rh, .report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 2px solid #004481;
}
.tc-rh-left { flex: 1; }
.tc-rh-brand {
  font-family: 'Oswald', 'Segoe UI', sans-serif;
  font-size: 11pt;
  font-weight: 800;
  color: #004481;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.tc-rh-sub {
  font-size: 5.5pt;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}
.tc-rh-right { text-align: right; }
.tc-rh-date { font-size: 5.5pt; color: #1e293b; font-weight: 600; }
.tc-rh-url { font-size: 5pt; color: #64748b; }
.tc-rh-prod-line {
  font-size: 6pt;
  color: #475569;
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 0.5px dotted #cbd5e1;
  letter-spacing: 0.3px;
}

/* --- KPI GRID PREMIUM --- */
.tc-kpi-grid, .report-kpi-grid, .sync-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
  gap: 3px;
  margin-bottom: 6px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.tc-kpi-grid .tc-kpi-item, .report-kpi-grid .report-kpi-item, .sync-kpi-grid .sync-kpi-item {
  padding: 3px 5px;
  border-radius: 3px;
  text-align: center;
  background: #f1f5f9;
  border-bottom: 1.5px solid #004481;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.tc-kpi-grid .tc-kpi-item.report-kpi-primary, .sync-kpi-grid .sync-kpi-primary {
  background: linear-gradient(135deg, #004481, #0a5ca4);
  color: #fff;
  border-bottom: none;
}
.report-kpi-label, .sync-kpi-lbl {
  display: block;
  font-size: 5.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 1px;
  color: #64748b;
}
.report-kpi-primary .report-kpi-label, .sync-kpi-primary .sync-kpi-lbl {
  color: rgba(255, 255, 255, 0.85);
}
.report-kpi-val, .sync-kpi-val-lg, .sync-kpi-val-md {
  display: block;
  font-family: 'Oswald', 'Segoe UI', sans-serif;
  font-size: 9pt;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-unit, .sync-kpi-sub {
  font-size: 5.5pt;
  font-weight: 400;
  opacity: 0.85;
}

/* --- PART NUMBER --- */
.tc-report-pn, .sync-pn-display {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 13pt;
  font-weight: 700;
  color: #062F87;
  text-align: center;
  padding: 4px 8px;
  margin: 4px 0 6px 0;
  background: #f8faff;
  border: 1px solid #d0d9e8;
  border-radius: 4px;
  letter-spacing: 0.5px;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* --- DATASHEET TABLE (Ficha Técnica) --- */
.tc-ds-table, .sync-ds-table {
  font-size: 5.5pt;
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 5px;
}
.tc-ds-table td, .sync-ds-table td {
  padding: 1.5px 4px;
  border: 0.5px solid #e2e8f0;
}
.tc-ds-table .ds-l, .sync-ds-label {
  font-weight: 600;
  color: #004481;
  white-space: nowrap;
  width: 22%;
  font-size: 5pt;
  letter-spacing: 0.2px;
  background: #f8fafc;
}
.tc-ds-table .ds-v {
  font-weight: 400;
  color: #1e293b;
  width: 28%;
}
.tc-ds-table .ds-g, .tc-ds-table th, .report-table th {
  font-weight: 700;
  color: #1e293b;
  font-size: 5.5pt;
  background: #f8fafc;
  padding: 2px 4px !important;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

/* --- OPERATIONS LIST & TABLES --- */
.tc-ops-list { }
.tc-op-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4px 4px;
  font-size: 5.5pt;
  border-bottom: 0.5px solid #f1f5f9;
}
.tc-op-name { flex: 1; }
.tc-op-time {
  font-weight: 600;
  text-align: right;
  font-family: 'Oswald', 'Segoe UI', sans-serif;
  min-width: 30px;
}
.tc-op-row.tc-op-l2 { padding-left: 10px; color: #64748b; font-size: 5pt; }
.tc-op-row.tc-op-sub { font-weight: 700; background: #f0f9ff; border-bottom: 0.5px solid #004481; }
.tc-op-row.tc-op-sub-l2 { background: #f8fafc; }
.tc-op-row.tc-op-total { font-weight: 800; background: #fefce8; border-bottom: 1.5px solid #004481; font-size: 6pt; }
.tc-op-row.tc-op-total-peca { background: #fef3c7; }
.tc-op-row.tc-op-usinagem { background: #e0f2fe; border-bottom: 1.5px solid #0284c7; font-weight: 800; font-size: 6pt; }
.tc-op-row.tc-op-ci-note { font-size: 5.5pt; color: #555; background: #f8fafc; border-bottom: 0.5px dashed #94a3b8; }
.tc-op-row.tc-op-rateio { font-size: 5pt; color: #64748b; }
.tc-op-group-header {
  font-weight: 700;
  font-size: 5.5pt;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 0.8px solid #004481;
  background: #f8fafc;
  padding: 1px 4px;
}

/* --- WARNINGS & ALERTS --- */
.tc-warn-bar, .sync-warn-bar {
  margin: 3px 0;
  padding: 4px 6px;
  background: #fffbeb;
  border: 1px solid #fef08a;
  border-radius: 3px;
  font-size: 6pt;
  color: #854d0e;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tc-warn-bar i, .sync-warn-bar i { color: #d97706; }
.tc-saw-cutoff, .sync-ops-cutoff {
  margin-top: 2px;
  padding: 2px 4px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 2px;
  font-size: 5.5pt;
  color: #991b1b;
}

/* Sectioned operations */
.tc-ops-section, .sync-ops-section { font-weight: 700; font-size: 6pt; text-transform: uppercase; }
.tc-ops-section.turn, .sync-ops-section.turn { background: #eff6ff; color: #1e40af; }
.tc-ops-section.other, .sync-ops-section.other { background: #fef3c7; color: #92400e; }
.tc-ops-subturn, .sync-ops-subtotal.turn { background: #f0f9ff; font-weight: 700; font-size: 6pt; }
.tc-ops-subother, .sync-ops-subtotal.other { background: #fffbeb; font-weight: 700; font-size: 6pt; }
.tc-ops-total, .sync-ops-total { background: #fefce8; font-weight: 800; font-size: 6.5pt; }
.tc-tempo-right { text-align: right; }
.tc-tempo-center { text-align: center; }

/* Engineering notes block */
.tc-eng-notes {
  font-size: 6pt;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
  padding-top: 3px;
  margin-top: 4px;
}
.tc-eng-line { margin: 1px 0; }
.tc-eng-label { font-weight: 700; color: #334155; }
.tc-eng-muted { color: #94a3b8; }
.tc-eng-blue { color: #2563eb; }
.tc-eng-bush { margin: 2px 0; font-size: 5.5pt; color: #0f766e; font-style: italic; }
.tc-eng-disclaimer { margin: 2px 0; font-size: 5pt; color: #94a3b8; }

/* --- FOOTER FIXO (posicionado no fim da pagina) --- */
.tc-rf-spacer { height: 14px; }
.tc-report-footer, .sync-report-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #004481;
  padding: 2px 6mm;
}
.tc-rf-row { display: flex; justify-content: space-between; align-items: center; font-size: 5pt; color: #475569; }
.tc-rf-left { font-weight: 700; color: #004481; }
.tc-rf-center { color: #64748b; }
.tc-rf-right { color: #1e293b; font-weight: 600; }
.tc-rf-note { font-size: 4.5pt; color: #94a3b8; text-align: center; margin-top: 1px; }

/* Oculta terminantemente o relatorio de impressao na tela */
#print-report {
  display: none !important;
}

@media print {
  @page {
    margin: 6mm 8mm;
    size: A4 portrait;
  }
  body * { visibility: hidden; }
  #print-report, #print-report * { visibility: visible; }
  #print-report {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: block !important;
    font-size: 7.5pt;
    line-height: 1.25;
    color: #1e293b;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  #print-report .tc-report-wrap, #print-report .report-wrap {
    padding: 0;
    max-width: 100%;
    margin: 0;
  }

  /* Secoes: evita corte interno em blocos de dados */
  #print-report .report-section {
    margin-bottom: 4px;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  #print-report .report-section-title {
    font-size: 7pt;
    font-weight: 700;
    margin-bottom: 2px;
    padding-bottom: 1px;
    color: #004481;
    text-transform: uppercase;
    border-bottom: 1px solid #cbd5e1;
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Cabecalho e KPI ficam sempre juntos na mesma pagina */
  #print-report .report-header, #print-report .tc-rh, #print-report .sync-report-header {
    break-after: avoid;
    page-break-after: avoid;
  }
  #print-report .tc-kpi-bar, #print-report .tc-kpi-grid, #print-report .report-kpi-grid, #print-report .sync-kpi-grid {
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Tabelas: cabecalho se repete; linhas nao quebram */
  #print-report table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 4px;
  }
  #print-report thead { display: table-header-group; }
  #print-report tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  #print-report td, #print-report th {
    padding: 1.5px 4px;
    font-size: 6pt;
  }

  /* Corpo de operacoes: permite quebra entre linhas se necessario */
  #print-report .tc-ops-body { break-inside: auto; page-break-inside: auto; }
  #print-report .tc-op-row { break-inside: avoid; page-break-inside: avoid; }

  /* Orphans/widows: minimo 3 linhas por bloco */
  #print-report p, #print-report li { orphans: 3; widows: 3; }

  /* Footer fixo na impressao */
  #print-report .tc-report-footer, #print-report .sync-report-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid #004481;
    padding: 2px 6mm;
    display: flex;
    justify-content: space-between;
    font-size: 5pt;
    color: #64748b;
    background: #fff;
  }

  /* Elementos ocultos na impressao */
  #print-report .spk-3d-wrap,
  #print-report .step-section,
  [id$="-master"],
  .tc-actions,
  .no-print {
    display: none !important;
  }
}

/* Action buttons usado pelo TecnoClock */
.dc-action-btn { padding:8px 20px; font-size:13px; font-weight:700; border:none; border-radius:6px; cursor:pointer; transition:all 0.15s; font-family:Roboto,sans-serif }
.dc-action-btn.dc-primary { background:#062F87; color:#fff }
.dc-action-btn.dc-primary:hover { background:#001a4d }
.dc-action-btn.dc-outline { background:#f1f5f9; color:#1e293b; border:1px solid #cbd5e1 }
.dc-action-btn.dc-outline:hover { background:#e2e8f0 }
.dc-action-btn.dc-danger { background:#dc2626; color:#fff }
.dc-action-btn.dc-danger:hover { background:#b91c1c }
.dc-action-btn.dc-green { background:#16a34a; color:#fff }
.dc-action-btn.dc-green:hover { background:#15803d }
.dc-action-btn.dc-yellow { background:#d97706; color:#fff }
.dc-action-btn.dc-yellow:hover { background:#b45309 }
.dc-action-btn.dc-blue { background:#0284c7; color:#fff }
.dc-action-btn.dc-blue:hover { background:#0369a1 }
.dc-action-btn.dc-indigo { background:#4f46e5; color:#fff }
.dc-action-btn.dc-indigo:hover { background:#4338ca }
.dc-action-btn.dc-dark { background:#334155; color:#fff }
.dc-action-btn.dc-dark:hover { background:#1e293b }
.btn-warning { background:#d97706; color:#fff; border:1px solid #b45309 }
.tc-3d-btn {
  font-family: inherit;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.tc-3d-btn:hover {
  background: #475569 !important;
  border-color: #94a3b8 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
.tc-3d-btn:active {
  transform: translateY(0);
}

/* ============================================================
   TECNOCLOCK ROUTING DRAWER (GAVETA DE ROTEIRO FABRIL / PCP)
   ============================================================ */
.tc-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.tc-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.tc-drawer {
  position: fixed;
  top: 0;
  right: -950px;
  width: 950px;
  max-width: 95vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tc-drawer.active {
  right: 0;
}

.tc-drawer-header {
  padding: 16px 24px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0284c7;
}
.tc-drawer-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #38bdf8;
}
.tc-drawer-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}
.tc-drawer-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.tc-drawer-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  background: #f8fafc;
}

/* Routing UI Components */
.tc-routing-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tc-routing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  flex-wrap: wrap;
  gap: 12px;
}
.tc-routing-pn {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.tc-routing-sub {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tc-badge-process {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.tc-badge-process.badge-barra {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.tc-badge-process.badge-casting {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.tc-routing-batch-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tc-routing-batch-selector label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.tc-batch-pills {
  display: flex;
  gap: 4px;
}
.tc-batch-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.tc-batch-pill:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.tc-batch-pill.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.tc-routing-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.tc-routing-card {
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tc-routing-card.highlight {
  border-color: #10b981;
  background: #f0fdf4;
}
.tc-rc-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tc-rc-val {
  font-size: 17px;
  font-weight: 800;
  margin: 4px 0 2px 0;
}
.tc-rc-sub {
  font-size: 10px;
  color: #94a3b8;
}
.text-cyan { color: #0284c7; }
.text-amber { color: #d97706; }
.text-green { color: #059669; }
.text-indigo { color: #4f46e5; }

.tc-routing-table-wrap {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tc-routing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.tc-routing-table th {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.tc-routing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  vertical-align: top;
}
.tc-routing-table tr.row-even {
  background: #ffffff;
}
.tc-routing-table tr.row-odd {
  background: #f8fafc;
}
.tc-routing-table tr:hover {
  background: #f0f9ff;
}
.tc-seq-tag {
  display: inline-block;
  padding: 2px 6px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}
.tc-ws-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-ws-code {
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tc-ws-name {
  font-size: 10px;
  color: #64748b;
  line-height: 1.2;
}
.tc-op-name {
  font-size: 12px;
  color: #0f172a;
}
.tc-op-desc {
  font-size: 11px;
  color: #475569;
  line-height: 1.35;
}
.tc-pokayoke-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #d97706;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #92400e;
  line-height: 1.3;
}
.tc-pokayoke-box i {
  color: #d97706;
  margin-right: 4px;
}
.tc-routing-total-row {
  background: #f1f5f9;
  border-top: 2px solid #cbd5e1;
}
.tc-routing-total-row td {
  padding: 12px;
  font-size: 12px;
}

.tc-routing-footer-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #0284c7;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #1e40af;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .tc-hero-content h1 { font-size: 2rem; }
  .tc-form-grid { grid-template-columns: 1fr; }
  .tc-kpi-bar { flex-wrap: wrap; }
  .tc-kpi-item { flex: 1 1 45%; padding: 8px 4px; }
  .tc-kpi-val { font-size: 15px; }
  .tc-kpi-lbl { font-size: 8px; }
  .tc-kpi-sub { font-size: 9px; }
  .tc-param-grid { grid-template-columns: repeat(2, 1fr); }
  .tc-produto-bar { flex-direction: column; align-items: flex-start; }
  .tc-produto-bar select { max-width: 100%; width: 100%; }
  .tc-routing-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .tc-routing-table { font-size: 10px; }
}

