/* Identidade PRELUX: navegação e telas de operação. */
:root {
  --navy: #081d30;
  --blue: #256da9;
  --blue2: #e9f2f9;
  --ink: #172f44;
  --muted: #627688;
  --line: #d7e0e7;
  --bg: #f3f5f7;
  --green: #0b805e;
  --shadow: none;
}

body {
  background: var(--bg);
  color: var(--ink);
}

.shell {
  grid-template-columns: 226px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  gap: 18px;
  padding: 18px 12px;
  background: var(--navy);
  border-right: 1px solid #17364e;
}

.brand {
  display: block;
  padding: 5px 9px 18px;
  border-bottom: 1px solid #294357;
}

.brand-logo {
  display: block;
  width: min(100%, 188px);
  height: auto;
  object-fit: contain;
}

.nav {
  gap: 5px;
}

.nav-divider {
  display: block;
  height: 1px;
  margin: 8px 2px;
  background: #294357;
}

.nav button {
  min-height: 52px;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c6d5e1;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
}

.nav button:hover {
  background: #12334c;
}

.nav button.active {
  border-color: #5e9dca;
  background: #163c5b;
  color: #fff;
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
}

.nav-icon img {
  width: 33px;
  height: 33px;
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(166, 215, 245, .7));
}

#operationsHero[hidden],
#operationsMetricsToolbar[hidden],
#operationsMetrics[hidden] {
  display: none !important;
}

.side-note,
.topbar-kicker,
.section-kicker {
  display: none;
}

main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  height: 74px;
  min-height: 74px;
  padding: 0 clamp(18px, 2.7vw, 32px);
  background: #fff;
}

.topbar h1 {
  color: #152f46;
  font-size: 22px;
  font-weight: 750;
}

.pill {
  border-color: #cfe5db;
  background: #f0f8f4;
  color: #0c7858;
  font-size: 11px;
}

.content,
.operations-view,
.labels-section {
  width: 100%;
  max-width: 1580px;
  min-width: 0;
  margin: 0 auto;
  padding: 22px clamp(18px, 2.7vw, 32px) 40px;
}

.card,
.operations-panel {
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: none;
}

.btn {
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
}

.btn.primary {
  border-color: #1a659f;
  background: #1a659f;
}

.btn.primary:hover {
  background: #12517f;
}

.operations-hero {
  position: relative;
  display: flex;
  min-height: 164px;
  align-items: center;
  overflow: hidden;
  margin-bottom: 17px;
  padding: 20px 26px;
  border-radius: 10px;
  background: #0b2b46;
  color: #fff;
}

.operations-hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0b2b46 0%, #0b2b46 52%, rgba(11, 43, 70, .18) 100%);
  content: "";
}

.operations-hero-art {
  position: absolute;
  top: 0;
  right: 0;
  width: 46%;
  height: 100%;
  object-fit: cover;
  object-position: 53% center;
  opacity: .86;
}

.operations-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.operations-hero h2 {
  margin: 0 0 5px;
  color: #fff;
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 730;
  letter-spacing: -.025em;
}

.operations-hero p {
  max-width: 600px;
  margin: 0;
  color: #d3e1eb;
  font-size: 12px;
  line-height: 1.5;
}

.operations-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.operations-hero .btn {
  min-height: 36px;
  padding: 7px 12px;
}

.operations-hero .btn.primary {
  border-color: #fff;
  background: #fff;
  color: #13598e;
}

.operations-hero .btn.primary:hover {
  background: #e8f3fb;
}

.hero-catalog-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-color: #88a6bd;
  background: transparent;
  color: #fff;
}

.hero-catalog-button:hover {
  background: #214961;
}

.hero-catalog-button img {
  width: 25px;
  height: 25px;
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(166, 215, 245, .7));
}

.operations-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 9px;
}

.operations-toolbar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
}

.operations-view .metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.operations-view .metric-card {
  min-width: 0;
  min-height: 72px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.operations-view .metric-card small {
  color: #536a7d;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.operations-view .metric-card strong {
  margin-top: 5px;
  color: #173b58;
  font-size: 23px;
  line-height: 1;
}

.operations-status {
  margin-bottom: 12px;
  border-radius: 7px;
}

.operations-status[hidden] {
  display: none !important;
}

.operations-panel {
  overflow: hidden;
}

.operations-list-head h3 {
  font-size: 16px;
}

.labels-section .toolbar h2,
.planning-view .toolbar h2 {
  color: var(--ink);
  font-size: 21px;
}

.labels-section .records-card,
.labels-section .card,
.planning-view .card {
  border-radius: 9px;
  box-shadow: none;
}

.planning-view .metric-card {
  border-radius: 8px;
}

.search,
.input,
.select,
.textarea {
  border-radius: 7px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #4b9bce;
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: auto;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
  }

  .brand {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
  }

  .brand-logo {
    width: 111px;
  }

  .nav {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-divider {
    grid-column: 1 / -1;
    width: 100%;
    margin: 1px 0;
  }

  .nav button {
    min-height: 40px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .nav-icon {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }

  .nav-icon img {
    width: 29px;
    height: 29px;
  }

  .topbar {
    position: relative;
    height: 64px;
    min-height: 64px;
  }

  .content,
  .operations-view,
  .labels-section {
    padding: 17px 18px 32px;
  }
}

@media (max-width: 700px) {
  .operations-hero {
    min-height: 180px;
  }

  .operations-hero::after {
    background: linear-gradient(90deg, #0b2b46 0%, rgba(11, 43, 70, .92) 62%, rgba(11, 43, 70, .45) 100%);
  }

  .operations-hero-art {
    width: 65%;
  }

  .planning-grid,
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .sidebar {
    display: block;
  }

  .brand {
    margin-bottom: 6px;
  }

  .brand-logo {
    width: 104px;
  }

  .nav {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav button {
    flex: none;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 4px 2px;
    font-size: 9px;
  }

  .nav-divider {
    grid-column: 1 / -1;
    width: 100%;
    margin: 1px 0;
  }

  .nav-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .nav-icon img {
    width: 27px;
    height: 27px;
  }

  .pill {
    display: none;
  }

  .content,
  .operations-view,
  .labels-section {
    padding: 14px 12px 28px;
  }

  .operations-hero {
    min-height: 200px;
    padding: 18px;
  }

  .operations-hero h2 {
    font-size: 21px;
  }

  .operations-hero-copy {
    max-width: 100%;
  }

  .operations-hero p {
    max-width: 270px;
  }

  .operations-view .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

/* Relatório de planejamento: o navegador gera o PDF via impressão nativa. */
.planning-print-header {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    background: #fff !important;
    color: #172f44 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .shell {
    display: block !important;
    min-height: 0 !important;
  }

  .sidebar,
  .topbar,
  #etiquetasView,
  #operationsView,
  .planning-view > .toolbar,
  .calendar-controls,
  .planning-scenario-actions,
  .toast,
  .modal-backdrop {
    display: none !important;
  }

  main {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  #planningView,
  #planningView[hidden] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .planning-print-header {
    display: block !important;
    margin: 0 0 8mm;
    padding-bottom: 4mm;
    border-bottom: 1px solid #9aafbf;
  }

  .planning-print-header h1 {
    margin: 0 0 2mm;
    color: #0b2b46;
    font-size: 20pt;
  }

  .planning-print-header p {
    margin: 0;
    color: #526778;
    font-size: 9pt;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 3mm !important;
    margin-bottom: 5mm !important;
  }

  #planningView .card {
    border: 1px solid #cbd8e1 !important;
    border-radius: 2mm !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  #planningView .planning-scenario,
  #planningView .planning-backlog,
  #planningView .planning-grid {
    margin-bottom: 5mm;
  }

  .planning-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .calendar-card {
    overflow: visible !important;
  }

  .calendar-toolbar {
    padding: 3mm 4mm !important;
  }

  .calendar-grid {
    gap: 1mm !important;
    padding: 3mm !important;
  }

  .calendar-day {
    min-height: 19mm !important;
    padding: 1.5mm !important;
    border-radius: 1mm !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: default !important;
  }

  .calendar-week-view .calendar-day {
    min-height: 35mm !important;
  }

  .calendar-events {
    gap: 1mm !important;
  }

  .calendar-event,
  .calendar-window-event {
    padding: 1mm !important;
    font-size: 6.5pt !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .calendar-legend {
    gap: 2mm 4mm !important;
    padding: 0 3mm 3mm !important;
    font-size: 7pt !important;
  }

  .gantt-wrap {
    overflow: visible !important;
    margin: 0 3mm 3mm !important;
    border: 0 !important;
  }

  .gantt-group,
  .gantt-timeline {
    min-width: 0 !important;
  }

  .gantt-timeline {
    grid-template-columns: 34mm repeat(var(--gantt-days), minmax(0, 1fr)) !important;
  }

  .gantt-label {
    position: static !important;
    min-height: 8mm !important;
    padding: 1mm !important;
    font-size: 6.5pt !important;
  }

  .gantt-cell {
    min-width: 0 !important;
    min-height: 8mm !important;
    padding: .5mm !important;
  }

  .gantt-head .gantt-cell small,
  .gantt-work {
    font-size: 5.5pt !important;
    overflow-wrap: anywhere;
  }

  .planning-view input {
    display: none !important;
  }

  #planningView .planning-scenario,
  #planningView .planning-backlog,
  #planningView .calendar-card {
    break-inside: auto;
  }
}

/* Etiquetas: mantenha formulário, lista e prévia dentro de seus cartões. */
.labels-section #generatedLabelsCard .card-head {
  padding: 18px 20px 14px;
}

.labels-section .label-print-actor {
  max-width: 820px;
  margin: 18px 20px 20px;
}

.labels-section .label-print-actor .input {
  display: block;
  max-width: 100%;
}

.labels-section .label-print-actor .form-help {
  display: block;
  margin: 8px 0 0;
  line-height: 1.5;
}

.labels-section #generatedLabelsCard .table-wrap {
  border-top: 1px solid var(--line);
}

.labels-section .table th,
.labels-section .table td {
  padding: 12px 18px;
  vertical-align: middle;
  line-height: 1.4;
}

.labels-section .table .row-actions {
  flex-wrap: wrap;
}

.labels-section .table .empty {
  padding: 21px 20px !important;
  text-align: left;
  font-weight: 500;
  background: #f8fafc;
}

.labels-section #generatedLabelsCard .table:has(.empty) {
  min-width: 0;
}

.labels-section > .toolbar {
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.labels-section > .grid {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.labels-section > .grid > .card {
  min-width: 0;
}

.labels-section #editorCard .card-head {
  gap: 10px;
  flex-wrap: wrap;
}

.labels-section #editorCard .form {
  padding: 20px;
}

.labels-section #editorCard .form-footer,
.labels-section .preview-actions {
  flex-wrap: wrap;
}

.labels-section .preview-top {
  gap: 10px;
  flex-wrap: wrap;
}

.labels-section .preview-top span {
  max-width: 100%;
}

.labels-section .canvas-wrap {
  min-width: 0;
  overflow: hidden;
}

.labels-section #labelCanvas {
  max-width: 100%;
}

@media (max-width: 1050px) {
  .labels-section > .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 800px) {
  .labels-section > .toolbar {
    display: block;
  }

  .labels-section > .toolbar .actions {
    margin-top: 14px;
  }
}

@media (max-width: 620px) {
  .labels-section #generatedLabelsCard .card-head {
    padding: 16px;
  }

  .labels-section .label-print-actor {
    margin: 16px;
  }

  .labels-section > .toolbar .actions {
    display: flex;
    margin-top: 14px;
  }

  .labels-section > .toolbar .actions .btn {
    flex: 1 1 145px;
  }

  .labels-section #editorCard .form {
    padding: 16px;
  }

  .labels-section .preview-top {
    padding: 16px;
  }

  .labels-section .preview-top span {
    text-align: left;
  }
}
