:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --primary: #3156d3;
  --primary-hover: #2848b6;
  --danger: #c73838;
  --danger-hover: #ab2f2f;
  --text: #1f2937;
  --muted: #667085;
  --border: #dbe2f3;
  --shadow: 0 12px 28px rgba(20, 31, 69, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fd 100%);
  color: var(--text);
}

h1, h2, h3, p { margin-top: 0; }

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.header nav {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.header a {
  text-decoration: none;
  color: #2645bb;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}

.header a:hover { background: #eaf0ff; }
.header a.active { background: #3156d3; color: #fff; box-shadow: 0 8px 18px rgba(49,86,211,.25); }

.container { max-width: 1260px; margin: 1.1rem auto; padding: 0 1rem 2.8rem; }

.card {
  background: var(--surface);
  border: 1px solid #e4e9f6;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.card h2 { margin-bottom: 0.95rem; font-size: 1.15rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.9rem;
}

.cards .card {
  margin-bottom: 0;
  padding: 1rem;
  background: linear-gradient(145deg, #fff 0%, #f8faff 100%);
}

.cards strong { font-size: 1.3rem; color: #1a3fae; }

.grid.form-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label { display: grid; gap: 0.35rem; font-weight: 600; }

input,
select,
button,
textarea {
  border: 1px solid #ccd5eb;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #d8e2ff;
  border-color: #9ab2ff;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, transform .06s ease;
}

button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }

.btn-secondary {
  background: #ecf1ff;
  color: #2747bc;
}

.btn-secondary:hover { background: #dde8ff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

th,
td {
  padding: 0.72rem;
  border-bottom: 1px solid #ecf0fa;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f9ff;
  color: #44506b;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody tr:hover { background: #fbfcff; }

.alerts { list-style: none; padding: 0; margin-top: 0; }
.alert { padding: .8rem .9rem; border-radius: 10px; margin-bottom: .65rem; }
.alert.success { background: #d9fbe0; color: #195f2e; }
.alert.danger { background: #ffe5e5; color: #7d2222; }

.full-width { grid-column: 1 / -1; }
.hidden { display: none !important; }

.inline-form {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.action-stack { display: grid; gap: 0.5rem; }

.stock-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #e4e8f4;
}

.class-menu {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: .85rem;
}

.class-menu button { background: #eef2ff; color: #334; }
.class-menu button.active { background: var(--primary); color: white; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.success { background: #d3f9d8; color: #205d2e; }
.badge.danger { background: #ffe3e3; color: #8f1b1b; }

.sale-summary { display: flex; align-items: center; color: #475467; }

/* Montagem */
.assembly-summary,
.pc-header {
  background: var(--surface-soft);
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  padding: .8rem;
}

.pc-header {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.slots-top,
.slots-bottom {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.slots-bottom {
  margin-top: .25rem;
  padding-top: .25rem;
  border-top: 1px dashed #dbe4ff;
}

.slot-box {
  border: 1px solid #e4e9f8;
  border-radius: 10px;
  padding: 0.75rem;
  background: #fcfdff;
  border-top: 4px solid #d9e2ff;
}

.slot-help { margin: 0 0 .5rem; font-size: .82rem; color: var(--muted); }
.slot-multiple { display: grid; gap: 0.65rem; }
.multi-list { display: grid; gap: 0.5rem; }

.multi-header,
.multi-row {
  display: grid;
  grid-template-columns: 1fr 1fr 130px 150px 34px;
  gap: .5rem;
  align-items: center;
}

.multi-header {
  font-size: .78rem;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  border: 1px solid #cfd6ea;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.qty-control input {
  width: 100%;
  border: none;
  border-left: 1px solid #e2e8f5;
  border-right: 1px solid #e2e8f5;
  text-align: center;
  border-radius: 0;
  padding: .45rem .2rem;
}

.qty-btn { background: #f1f4ff; color: #2f4cc9; border-radius: 0; }
.row-remove { background: #ffe3e3; color: #9f1d1d; border-radius: 8px; padding: .45rem 0; font-weight: 700; }
.add-item { margin-top: 0.5rem; background: #edf2ff; color: #2f4cc9; }

/* Modal de edição de estoque */
.modal {
  border: none;
  border-radius: 12px;
  width: min(680px, 95vw);
  padding: 0;
  box-shadow: 0 30px 70px rgba(17, 30, 77, 0.35);
}

.modal::backdrop {
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  padding: 1rem;
  background: #fff;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  margin-bottom: .7rem;
}

.modal-header h3 { margin: 0; font-size: 1.08rem; }

.modal-close {
  background: #eef2ff;
  color: #3149aa;
  min-width: 38px;
  padding: .45rem;
}

.modal-close:hover { background: #dfe7ff; }

.product-gallery {
  display: grid;
  gap: .5rem;
  margin-bottom: .5rem;
}

.gallery-image {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #dbe4ff;
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.gallery-counter {
  min-width: 72px;
  text-align: center;
  color: #5b647c;
  font-weight: 600;
}

@media (max-width: 860px) {
  .pc-header { grid-template-columns: 1fr; }
  .multi-header { display: none; }
  .multi-row { grid-template-columns: 1fr; }
  .row-remove { width: 34px; justify-self: end; }
}

@media (max-width: 640px) {
  .header { position: static; }
  .card { padding: .9rem; }
  table { display: block; overflow-x: auto; }
}


.montaje-card {
  background: #fff;
}

.montage-subtitle {
  color: var(--muted);
  margin: -0.35rem 0 0.9rem;
}

.montaje-card .form-grid {
  align-items: start;
}

.slots-top {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.slot-box {
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.06);
  border-top: 0;
}

.slot-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .55rem;
}

.slot-heading h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.slot-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ecf2ff;
}

.piece-mode {
  display: inline-flex;
  gap: .35rem;
  padding: .2rem;
  background: #f2f5ff;
  border: 1px solid #dbe4ff;
  border-radius: 999px;
  margin-bottom: .55rem;
}

.piece-mode label {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin: 0;
  padding: .28rem .6rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
  color: #3f4b72;
  cursor: pointer;
}

.piece-mode label:has(input:checked) {
  background: #3156d3;
  color: #fff;
}

.piece-mode.compact {
  margin-bottom: 0;
}

.piece-mode.compact label {
  padding: .22rem .45rem;
  min-width: 32px;
  justify-content: center;
}

.piece-mode input[type="radio"] {
  margin: 0;
  width: 0;
  height: 0;
  opacity: 0;
}

.stock-fields,
.custom-fields {
  display: grid;
  gap: .4rem;
}

.multi-header,
.multi-row {
  grid-template-columns: 86px 1.3fr 120px 130px 34px;
}

.multi-item {
  display: grid;
}

.summary-highlight {
  position: sticky;
  bottom: .7rem;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  border: 1px solid #c7d6ff;
  box-shadow: 0 12px 32px rgba(49, 86, 211, .16);
}

.summary-title {
  margin: 0 0 .2rem;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: #3156d3;
  text-transform: uppercase;
}

.summary-highlight #total-custo,
.summary-highlight #preco-sugerido {
  font-weight: 800;
  color: #132f8f;
}

.summary-submit {
  min-width: 220px;
  align-self: stretch;
  border-radius: 12px;
  font-size: 1rem;
}

@media (max-width: 860px) {
  .summary-highlight {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .summary-submit {
    min-width: 0;
  }

  .multi-header,
  .multi-row {
    grid-template-columns: 1fr;
  }
}


.service-cards {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.service-card {
  display: grid;
  gap: .45rem;
  border: 1px solid #dbe4ff;
}

.service-card h3 {
  margin: 0;
  font-size: 1.03rem;
  color: #1b2d6b;
}

.service-card p {
  margin: 0;
  color: #5e6a84;
}

.service-price {
  font-size: 1.18rem;
  font-weight: 800;
  color: #2448c4 !important;
}

input[type="number"]::placeholder {
  color: #9aa6c5;
}
