:root {
  --ink: #14212b;
  --muted: #5c6b78;
  --line: #d5dde5;
  --paper: #f4f7fa;
  --card: #ffffff;
  --accent: #0b6e4f;
  --accent-2: #0a4d68;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(20, 33, 43, 0.08);
  --radius: 14px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9ebe3 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #d6e6ef 0%, transparent 50%),
    var(--paper);
}

body { line-height: 1.45; }

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.appbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(90deg, #102033 0%, #163049 100%);
  color: #e8eef4;
  box-shadow: 0 4px 18px rgba(16, 32, 51, 0.25);
  z-index: 30;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
}

.appbar .brand { padding: 0; flex-shrink: 0; }
.appbar .brand-logo { width: 40px; height: 40px; }

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  color: #9db0c3;
  font-size: 0.75rem;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  padding: 4px;
}

.bi-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(120deg, #102033 0%, #0a4d68 55%, #0b6e4f 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bi-hero img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 6px;
}

.bi-hero h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.bi-hero p {
  margin: 0.25rem 0 0;
  opacity: 0.85;
  font-size: 0.9rem;
}

.bi-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bi-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.bi-tab:hover { color: var(--ink); border-color: #b7c7d6; }
.bi-tab.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: white;
}

.bi-period {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.bi-period select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  background: white;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.85rem;
}

.charts-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem 1rem;
  min-height: 280px;
}

.chart-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 0.95rem;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap.tall { height: 280px; }

@media (max-width: 1100px) {
  .charts-grid,
  .charts-grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .bi-hero { flex-direction: column; text-align: center; }
}


.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c7d5e3;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(31, 157, 110, 0.28); color: #fff; }

.nav-home {
  display: inline-grid;
  place-items: center;
  padding: 0.5rem 0.6rem;
}

.nav-home-label { display: none; }

.nav-group { position: relative; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-toggle::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.nav-group.open > .nav-toggle::after { transform: translateY(1px) rotate(-135deg); }

.nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 0.4rem;
  margin-top: 0.35rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(16, 32, 51, 0.18);
  z-index: 40;
}

/* Faixa invisível que mantém o submenu aberto enquanto o mouse desce até ele */
.nav-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.45rem;
  height: 0.45rem;
}

.nav-group.open > .nav-menu { display: grid; gap: 0.15rem; }

@media (hover: hover) and (min-width: 961px) {
  .nav-group:hover > .nav-menu { display: grid; gap: 0.15rem; }
}

.nav-menu .nav-item {
  width: 100%;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

.nav-menu .nav-item:hover { background: #eef3f7; color: var(--ink); }
.nav-menu .nav-item.active { background: rgba(11, 110, 79, 0.12); color: var(--accent); font-weight: 600; }

.appbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.user-chip {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  color: #b7c7d6;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
}

.user-chip:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.appbar .menu-toggle {
  background: transparent;
  border-color: rgba(255,255,255,0.18);
  color: #e8eef4;
  margin-left: auto;
}

.main-wrap { min-width: 0; flex: 1; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  background: rgba(244, 247, 250, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  flex: 1;
}

.topbar-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.period-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.period-filter select,
#globalPeriod {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: white;
  cursor: pointer;
  max-width: 11.5rem;
}

.bi-period-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  align-self: center;
}

.bi-period-hint strong {
  color: var(--ink);
  font-weight: 600;
}

#globalSearch {
  width: min(360px, 42vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  background: white;
}

.view {
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.stat strong {
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
}

.panel-body { padding: 1rem 1.1rem; }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fafc;
  position: sticky;
  top: 0;
}

tr:hover td { background: #f7fbf9; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: #f3f6f9; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.18);
  color: #d7e3ef;
}
.btn.block { width: 100%; }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.btn.danger { background: #fef3f2; border-color: #fecdca; color: var(--danger); }

.icon-btn {
  display: none;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filters select,
.filters input,
form label input,
form label select,
form label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: white;
}

form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }

.senha-panel { max-width: 520px; }
.senha-panel .form-grid { grid-template-columns: 1fr; }

.section-title {
  grid-column: 1 / -1;
  margin: 0.4rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--accent-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.ok { background: #ecfdf3; color: var(--ok); }
.badge.warn { background: #fff7ed; color: var(--warn); }
.badge.info { background: #eff8ff; color: var(--accent-2); }
.badge.danger { background: #fef3f2; color: var(--danger); }
.badge.muted { background: #f2f4f7; color: var(--muted); }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(800px 400px at 20% 0%, #cfe8dc, transparent),
    radial-gradient(700px 400px at 90% 20%, #c9dce8, transparent),
    #0f1c2a;
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  gap: 0.9rem;
  box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 0.4rem; color: var(--ink); }
.login-brand small { color: var(--muted); }

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  background: var(--ink);
  color: white;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 2rem));
}

.hidden { display: none !important; }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.detail-grid dt {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-grid dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-2, .form-grid .span-3 { grid-column: span 2; }
}

@media (max-width: 1280px) {
  .appbar .brand-text { display: none; }
}

@media (max-width: 1100px) {
  .appbar .user-chip { display: none; }
}

@media (max-width: 960px) {
  .appbar { flex-wrap: wrap; }
  .appbar .brand-text { display: block; }
  .appbar .menu-toggle { display: inline-grid; place-items: center; }
  .appbar .nav,
  .appbar .appbar-user { display: none; width: 100%; }
  .appbar.open .nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .appbar.open .appbar-user {
    display: flex;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .appbar.open .user-chip { display: inline; }
  .nav-home { display: flex; justify-content: flex-start; gap: 0.6rem; padding: 0.6rem 0.8rem; }
  .nav-home-label { display: inline; }
  .nav-toggle { width: 100%; justify-content: space-between; }
  .nav-menu {
    position: static;
    min-width: 0;
    margin: 0.15rem 0 0.35rem 0.75rem;
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255,255,255,0.15);
    border-radius: 0;
    box-shadow: none;
  }
  .nav-menu::before { display: none; }
  .nav-menu .nav-item { color: #c7d5e3; }
  .nav-menu .nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
  .nav-menu .nav-item.active { background: rgba(31, 157, 110, 0.28); color: #fff; }
}

@media (max-width: 860px) {
  #globalSearch { width: min(160px, 36vw); }
  .period-filter span { display: none; }
  .period-filter select,
  #globalPeriod { max-width: 9.5rem; font-size: 0.85rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
  .detail-grid { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  .appbar { padding: 0.5rem 0.75rem; padding-top: max(0.5rem, env(safe-area-inset-top)); }
  .appbar .brand-text small { display: none; }

  .topbar { flex-wrap: wrap; padding: 0.7rem 0.75rem; gap: 0.5rem; }
  .topbar h1 { font-size: 1.1rem; flex-basis: 100%; }
  .topbar-actions { width: 100%; flex-wrap: nowrap; }
  .period-filter { flex-shrink: 0; }
  #globalSearch { width: auto; flex: 1; min-width: 0; }

  .view { padding: 0.75rem; gap: 0.75rem; padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
  .panel-head { padding: 0.8rem 0.85rem; }
  .panel-head h2 { font-size: 0.98rem; }
  .panel-body { padding: 0.85rem; }
  .panel-head .filters { width: 100%; }
  .panel-head .filters > * { flex: 1 1 auto; }
  .panel-head .filters select { flex-basis: 100%; }

  .stat { padding: 0.8rem 0.85rem; }
  .stat strong { font-size: 1.35rem; }
  .grid-stats { gap: 0.6rem; }

  .chart-card { min-height: 0; padding: 0.8rem; }
  .chart-wrap.tall { height: 240px; }
  .bi-hero { padding: 0.85rem; }
  .bi-hero img { width: 56px; height: 56px; }
  .bi-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .bi-tab { flex-shrink: 0; }

  /* Evita o zoom automático do iPhone ao tocar nos campos */
  input, select, textarea { font-size: 16px !important; }
  .btn { padding: 0.65rem 0.9rem; }
  .btn.sm { padding: 0.45rem 0.7rem; }

  /* Tabelas de listagem viram cartões */
  table.responsive thead { display: none; }
  table.responsive,
  table.responsive tbody { display: block; }
  table.responsive tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid var(--line);
  }
  table.responsive tr:hover td { background: transparent; }
  table.responsive td {
    display: block;
    padding: 0;
    border: 0;
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
  }
  table.responsive td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }
  table.responsive td.cell-title { grid-column: 1 / -1; font-size: 1rem; }
  table.responsive td.cell-title::before { display: none; }
  table.responsive td.cell-wide { grid-column: 1 / -1; }
  table.responsive td.row-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    gap: 0.4rem;
    padding-top: 0.35rem;
  }
  table.responsive td.row-actions .btn { flex: 1 1 auto; margin: 0; }

  .toast { left: 0.75rem; right: 0.75rem; bottom: max(0.75rem, env(safe-area-inset-bottom)); max-width: none; }
  .login-card { padding: 1.25rem; }

  .import-form .btn { justify-self: stretch; }
}

/* ---------- Login, senha e administração ---------- */
.hint-erro { color: var(--danger); font-weight: 600; }

.aviso {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #eff8ff;
  border: 1px solid #b2ddff;
  color: var(--accent-2);
  font-size: 0.9rem;
}

.senha-panel { margin-inline: auto; width: 100%; }
.senha-panel a { color: var(--accent); }

/* Na troca obrigatória de senha só fica disponível o botão Sair */
.appbar.bloqueado .nav,
.appbar.bloqueado .menu-toggle,
.appbar.bloqueado .user-chip { display: none !important; }
.appbar.bloqueado .appbar-user { display: flex !important; width: auto; margin-left: auto; border: 0; padding: 0; }
.appbar.bloqueado + .main-wrap .topbar-actions { display: none; }

.nav-menu-end { left: auto; right: 0; }

form label.check-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  align-self: end;
  padding: 0.55rem 0;
  color: var(--ink);
}
form label.check-line input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}

.row-muted td { color: #98a2b3; }
td.row-actions { text-align: right; }
td.row-actions .btn + .btn { margin-left: 0.25rem; }

.semana-tabela input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.semana-tabela select { max-width: 8rem; }
.semana-total { margin: 0.75rem 0 0; font-weight: 700; color: var(--accent-2); }

.import-form { display: grid; gap: 0.85rem; max-width: 720px; }
.import-form .btn { justify-self: start; }
.import-form input[type="file"] { padding: 0.45rem; background: #f8fafc; }
.import-ok { margin: 0; color: var(--ok); font-weight: 600; }
.import-result ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }

input.calc-field,
.calc-field {
  background: #f0f5f8;
  color: var(--accent-2);
  font-weight: 600;
}

/* ---------- Cadastro de OS - Flexografia ---------- */
.flexo-form .filters input[type="number"] { width: 7.5rem; }
.flexo-tabs-wrap { border-top: 1px solid var(--line); display: grid; gap: 0.9rem; }

.flexo-form label input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.flexo-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink) !important;
  font-weight: 500 !important;
  cursor: pointer;
}
.flexo-check:has(input:checked) { border-color: var(--accent); background: rgba(11, 110, 79, 0.07); }
.flexo-check.compact { padding: 0.35rem; border: 0; background: transparent; justify-content: center; }
.flexo-check.compact span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.flexo-check.compact:has(input:checked) { background: transparent; }

.flexo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 1rem;
  align-items: start;
}

.flexo-box {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.85rem 0.85rem;
  min-width: 0;
}
.flexo-box legend {
  padding: 0 0.35rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-2);
}

.sentidos-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}
.sentido-card {
  display: grid !important;
  gap: 0.35rem;
  padding: 0.4rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}
.sentido-card img { width: 100%; height: auto; display: block; border-radius: 6px; }
.sentido-card:has(input:checked) { border-color: var(--accent); background: rgba(11, 110, 79, 0.07); }
.sentido-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--ink);
  font-size: 0.8rem;
}

.cores-table th, .cores-table td { padding: 0.3rem 0.4rem; text-align: center; }
.cores-table tbody th { text-align: left; color: var(--accent-2); background: transparent; position: static; }
.cores-table tr:hover td { background: transparent; }
.cores-table .cor-nome {
  width: 100%;
  min-width: 9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
}

.seguranca-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.flexo-obs textarea { min-height: 12rem; }

@media (max-width: 1100px) {
  .flexo-layout { grid-template-columns: 1fr; }
  .seguranca-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .sentidos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seguranca-grid { grid-template-columns: 1fr; }
}

/* ---------- Ficha de impressão da OS ---------- */
.os-sheet-wrap { overflow-x: auto; }

.os-sheet {
  --os-navy: #0d3f7a;
  --os-magenta: #d4145a;
  --os-box: #c9d2dc;
  width: 100%;
  max-width: 1120px;
  min-width: 900px;
  margin: 0 auto;
  background: #fff;
  color: var(--os-navy);
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 12px;
  padding: 22px 26px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.os-head {
  display: grid;
  grid-template-columns: 220px 1fr 270px;
  align-items: center;
  gap: 16px;
}

.os-logo { width: 100%; max-width: 220px; height: auto; display: block; }

.os-title { text-align: center; }
.os-title h1 {
  margin: 0;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--os-navy);
}
.os-number {
  display: inline-block;
  margin-top: 2px;
  font-weight: 700;
  font-size: 13px;
  color: var(--os-magenta);
  letter-spacing: 0.08em;
}

.os-head-side { display: grid; gap: 8px; }

.os-colorbar {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    #e6007e 0 12.5%, #00a0e3 12.5% 25%, #9d9d9c 25% 37.5%, #1d1d1b 37.5% 50%,
    #95c11f 50% 62.5%, #ffed00 62.5% 75%, #0d3f7a 75% 87.5%, #e6007e 87.5% 100%);
  margin: 2px 0 4px;
}

.os-grid { display: grid; gap: 10px 14px; }
.os-grid-5 { grid-template-columns: 0.8fr 1.4fr 1.3fr 1fr 1fr; }
.os-grid-5 .osf-box { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.osf { display: grid; gap: 3px; min-width: 0; }
.osf.inline { grid-template-columns: auto minmax(64px, 1fr); align-items: center; gap: 8px; }
.osf.inline:not(.wide) .osf-box { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.osf.wide { grid-column: 1 / -1; }

.osf-label {
  font-size: 11.5px;
  color: var(--os-navy);
  white-space: nowrap;
  line-height: 1.15;
}
.osf-label small { display: block; font-size: 9.5px; opacity: 0.85; }

.osf-box {
  display: block;
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid var(--os-box);
  border-radius: 3px;
  background: #fff;
  box-shadow: 1px 2px 3px rgba(13, 63, 122, 0.12);
  color: #14212b;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.os-body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
  margin-top: 6px;
}
.os-left { display: grid; gap: 12px; }

.os-group {
  margin: 0;
  border: 1.5px solid var(--os-navy);
  border-radius: 4px;
  padding: 10px 14px 14px;
  min-width: 0;
}
.os-group legend {
  padding: 0 8px;
  color: var(--os-magenta);
  font-weight: 700;
  font-size: 12.5px;
}

.os-pages {
  display: grid;
  grid-template-columns: 1fr 1fr 170px;
  gap: 16px;
  align-items: start;
}
.os-col { display: grid; gap: 8px; align-content: start; }
.os-col h4 {
  margin: 0 0 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--os-navy);
}
.os-pages .osf.inline { grid-template-columns: 100px minmax(50px, 80px); }

.os-note {
  border: 1px solid var(--os-box);
  border-radius: 3px;
  box-shadow: 1px 2px 3px rgba(13, 63, 122, 0.12);
  padding: 8px 10px;
  min-height: 110px;
  color: #14212b;
  font-size: 11.5px;
  line-height: 1.45;
}
.os-note.alert { border-color: var(--os-magenta); color: var(--os-magenta); font-weight: 600; }
.os-note-title {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--os-navy);
  margin-bottom: 4px;
}
.os-multiplos { display: grid; gap: 6px; }
.os-multiplos div { display: grid; line-height: 1.3; }
.os-multiplos strong { color: var(--os-navy); font-weight: 700; font-size: 11px; }
.os-multiplos span { white-space: nowrap; }

.os-format {
  display: grid;
  grid-template-columns: 150px 1fr 125px;
  gap: 16px;
  align-items: start;
}
.os-format .osf-label { white-space: normal; }
.os-warn {
  margin: 6px 0 0;
  color: var(--os-magenta);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.3;
}
.os-dims { display: grid; gap: 8px; }
.os-dim {
  display: grid;
  grid-template-columns: minmax(105px, 1fr) 56px auto 56px;
  align-items: center;
  gap: 6px;
}
.os-dim b { color: var(--os-magenta); font-size: 13px; }
.os-dim .osf-box { text-align: center; }

.os-obs { display: flex; flex-direction: column; }
.os-obs-text {
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--os-box);
  border-radius: 3px;
  box-shadow: 1px 2px 3px rgba(13, 63, 122, 0.12);
  padding: 10px;
  color: #14212b;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.os-foot {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 28px;
  align-items: end;
  margin-top: 18px;
  font-size: 10.5px;
}
.os-sign { text-align: center; color: var(--os-navy); }
.os-sign span {
  display: block;
  border-top: 1px solid var(--os-navy);
  margin: 0 12px 4px;
}
.os-emit { text-align: right; color: #7a8794; line-height: 1.4; }

/* Ficha de flexografia */
.fx-subtitle {
  margin: 0;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--os-navy);
}
.fx-grid-titulo { grid-template-columns: 1fr 170px; }
.fx-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.fx-body {
  display: grid;
  grid-template-columns: 1fr 1.45fr 0.9fr;
  gap: 14px;
  margin-top: 6px;
  align-items: stretch;
}

.fx-cores { width: 100%; border-collapse: collapse; font-size: 11px; }
.fx-cores th, .fx-cores td {
  padding: 3px 5px;
  border-bottom: 1px solid var(--os-box);
  white-space: normal;
  color: #14212b;
}
.fx-cores th {
  position: static;
  background: transparent;
  color: var(--os-navy);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.fx-cores tr:hover td { background: transparent; }
.fx-cores .fx-n { width: 22px; color: var(--os-navy); font-weight: 700; }
.fx-cores .fx-lado { width: 36px; font-weight: 700; }

.fx-seguranca {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  grid-template-rows: repeat(15, auto);
  gap: 3px 14px;
  font-size: 11px;
  color: #14212b;
}
.fx-item { display: flex; align-items: center; gap: 6px; line-height: 1.2; }
.fx-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 14px;
  border: 1px solid var(--os-box);
  border-radius: 2px;
  font-weight: 800;
  font-size: 10px;
  color: var(--os-magenta);
  flex-shrink: 0;
}

.fx-sentidos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fx-sentidos figure { margin: 0; text-align: center; font-size: 10.5px; color: var(--os-navy); font-weight: 600; }
.fx-sentidos img { width: 100%; max-width: 110px; height: auto; display: block; margin: 0 auto 2px; }
.fx-sentidos.single { grid-template-columns: 1fr; padding-top: 6px; }
.fx-sentidos.single figure { font-size: 12px; }
.fx-sentidos.single img { max-width: 190px; margin-bottom: 4px; }
.fx-vazio { margin: 0; color: #7a8794; font-size: 11px; }

.fx-obs { min-height: 120px; }

@page { size: A4 landscape; margin: 8mm; }

@media print {
  .appbar, .topbar, .filters, .btn, #toast, .no-print { display: none !important; }
  html, body { background: #fff !important; }
  #app { display: block; }
  .main-wrap { display: block; }
  .view { padding: 0; display: block; }
  .panel { box-shadow: none; border: 0; }
  .os-sheet-wrap { overflow: visible; }
  .os-sheet {
    max-width: none;
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    font-size: 11px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }
  .os-obs-text { min-height: 220px; }
  .fx-sheet { gap: 7px; }
  .fx-sheet .os-obs-text { min-height: 90px; }
}
