/* Visual pastel moderno */
:root {
  --board-bg: radial-gradient(at 0% 0%, #ffd6e8 0, transparent 55%), radial-gradient(at 100% 0%, #d6e4ff 0, transparent 55%), radial-gradient(at 100% 100%, #d4f7e9 0, transparent 55%), radial-gradient(at 0% 100%, #fff1c9 0, transparent 55%), #f3f0ff;
  --ink: #2a2540;
  --muted: #6e6a86;
  --surface: #ffffff;
  --surface-2: #f5f3fb;
  --border: #e8e5f2;
  --primary: #7c5cff;
  --primary-hover: #6a48f5;
  --primary-soft: #efeaff;
  --accent-gradient: linear-gradient(135deg, #ff9ebb 0%, #a79bff 55%, #7ab8ff 100%);
  --danger: #e0466f;
  --danger-soft: #ffe8ee;
  --ok: #1f9d6b;
  --ok-soft: #dcf7ea;
  --warn: #b26b00;
  --warn-soft: #fff1cc;
  --radius: 14px;
  --column-width: 288px;
  --shadow-sm: 0 1px 2px rgba(42, 37, 64, .06), 0 2px 8px rgba(42, 37, 64, .05);
  --shadow-md: 0 4px 10px rgba(42, 37, 64, .08), 0 12px 24px -8px rgba(42, 37, 64, .14);
  --shadow-lg: 0 24px 60px -12px rgba(42, 37, 64, .28);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--board-bg); display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; background: #fff; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #d6d1ea; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
textarea { resize: vertical; width: 100%; }
a { color: var(--primary); }
code { background: var(--surface-2); padding: 3px 7px; border-radius: 6px; font-size: 12px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.icon { flex-shrink: 0; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); }
.ok-text { color: var(--ok); }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Botões ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 8px 14px; background: var(--surface-2); cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; color: var(--ink); white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: #ebe7f7; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, #8b6cff 0%, #6f8cff 100%); color: #fff; box-shadow: 0 4px 12px -2px rgba(124, 92, 255, .45); }
.btn.primary:hover { background: linear-gradient(135deg, #7a58ff 0%, #5d7cff 100%); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.subtle { background: transparent; color: var(--muted); }
.btn.subtle:hover { background: var(--surface-2); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { display: flex; width: 100%; justify-content: flex-start; margin-bottom: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; border-radius: 8px; padding: 4px; color: inherit; line-height: 1;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(42, 37, 64, .08); }
.icon-btn.square { background: var(--surface-2); width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
.icon-btn:disabled { opacity: .3; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(255, 255, 255, .55); color: var(--ink);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, .8); flex-shrink: 0; flex-wrap: wrap; position: relative; z-index: 5;
}
.logo {
  width: 36px; height: 36px; border-radius: 11px; background: var(--accent-gradient); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px -2px rgba(167, 155, 255, .6);
}
.board-name {
  background: transparent; border: 0; color: var(--ink); font-size: 18px; font-weight: 800; padding: 5px 9px; width: auto; max-width: 360px;
  field-sizing: content; min-width: 120px; letter-spacing: -.01em;
}
.board-name:hover { background: rgba(255, 255, 255, .7); }
.board-name:focus { background: #fff; }
.board-select { background: rgba(255, 255, 255, .7); border: 0; border-radius: 999px; font-weight: 600; }
.search {
  flex: 1; max-width: 380px; display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .7); border-radius: 999px;
  padding: 0 14px; color: var(--muted); border: 1px solid rgba(255, 255, 255, .9); transition: background .15s, box-shadow .15s;
}
.search:focus-within { background: #fff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
.search input { border: 0; background: transparent; flex: 1; padding: 8px 0; color: var(--ink); }
.search input:focus { box-shadow: none; }
.top-actions { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.top-btn {
  background: rgba(255, 255, 255, .65); border: 1px solid rgba(255, 255, 255, .9); color: var(--ink); border-radius: 999px; padding: 7px 13px;
  cursor: pointer; position: relative; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; font-weight: 600;
  transition: background .15s, box-shadow .15s;
}
.top-btn:hover { background: #fff; box-shadow: var(--shadow-sm); }
.top-btn.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.top-btn.bell { padding: 8px; }
.top-btn.user { padding: 0; background: transparent; border: 0; border-radius: 50%; }
.badge-count {
  position: absolute; top: -5px; right: -5px; background: #ff5c8a; color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px;
  font-weight: 800; border: 2px solid #fff;
}

/* ---------- Quadro (rolagem horizontal infinita) ---------- */
.board { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 16px; cursor: default; }
.board.grabbing { cursor: grabbing; user-select: none; }
.board-columns { display: flex; align-items: flex-start; gap: 14px; height: 100%; min-width: min-content; padding-right: 24px; }
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: rgba(42, 37, 64, .18); border-radius: 8px; }
.board::-webkit-scrollbar-track { background: rgba(255, 255, 255, .35); border-radius: 8px; }

.column {
  --col: #eef1f8; --col-fg: #2a2540;
  width: var(--column-width); flex-shrink: 0; color: var(--col-fg); border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--col) 92%, white) 0%, color-mix(in srgb, var(--col) 72%, white) 100%);
  border: 1px solid rgba(255, 255, 255, .75); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; max-height: 100%;
}
.column-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 6px 12px; cursor: grab; }
.column-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--col);
  filter: saturate(3) brightness(.82); box-shadow: 0 0 0 3px rgba(255, 255, 255, .7);
}
.column-title {
  flex: 1; font-weight: 700; background: transparent; border: 0; color: inherit; padding: 5px 6px; cursor: pointer; letter-spacing: -.01em;
}
.column-title:focus { background: #fff; color: var(--ink); cursor: text; }
.column .count { font-size: 12px; background: rgba(255, 255, 255, .75); color: var(--ink); border-radius: 999px; padding: 2px 9px; font-weight: 700; }
.cycle-tag {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(255, 255, 255, .75); color: var(--primary); border-radius: 999px; padding: 3px 7px;
}
.column .icon-btn { opacity: .7; }
.column .icon-btn:hover { opacity: 1; background: rgba(255, 255, 255, .6); }
.cards {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 6px; display: flex; flex-direction: column; gap: 10px; min-height: 24px;
}
.cards::-webkit-scrollbar { width: 8px; }
.cards::-webkit-scrollbar-thumb { background: rgba(42, 37, 64, .15); border-radius: 8px; }
.sentinel { text-align: center; font-size: 12px; opacity: .6; padding: 8px; }

.column.collapsed {
  width: 48px; padding: 12px 0; align-items: center; gap: 12px; cursor: pointer; min-height: 180px; max-height: 100%;
  transition: transform .15s, box-shadow .15s;
}
.column.collapsed:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.collapsed-name { writing-mode: vertical-rl; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collapsed-count { font-size: 12px; background: rgba(255, 255, 255, .75); color: var(--ink); border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.collapsed-icon { opacity: .6; }

.add-card { padding: 4px 10px 10px; }
.add-card-btn, .add-column-btn {
  width: 100%; text-align: left; border: 0; background: transparent; color: inherit; padding: 9px 10px; border-radius: 12px; cursor: pointer;
  opacity: .75; display: flex; align-items: center; gap: 6px; font-weight: 600; transition: background .15s, opacity .15s;
}
.add-card-btn:hover { background: rgba(255, 255, 255, .6); opacity: 1; }
.add-card textarea { margin-bottom: 8px; border: 0; box-shadow: var(--shadow-sm); border-radius: 12px; }
.add-column {
  width: var(--column-width); flex-shrink: 0; background: rgba(255, 255, 255, .4); border: 1.5px dashed rgba(42, 37, 64, .18);
  border-radius: 18px; padding: 6px; color: var(--ink);
}
.add-column:has(input) { background: rgba(255, 255, 255, .9); border-style: solid; border-color: transparent; padding: 10px; box-shadow: var(--shadow-sm); }
.add-column input { width: 100%; margin-bottom: 8px; }
.add-column-btn:hover { background: rgba(255, 255, 255, .6); opacity: 1; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-sm); cursor: pointer; overflow: hidden;
  flex-shrink: 0; position: relative; border: 1px solid rgba(42, 37, 64, .04); transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Destaque das automações: borda colorida desenhada por cima da capa e do conteúdo */
.card.highlighted::after, .cal-chip.highlighted::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--hl-ring); pointer-events: none; z-index: 1;
}
.cal-chip.highlighted { position: relative; }
.card-alerts { display: flex; flex-wrap: wrap; gap: 4px; }
.card-alert {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--hl) 18%, white); color: var(--ink);
}
.card-alert::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--hl); }
.card.colored .badge { background: rgba(255, 255, 255, .55); color: inherit; }
.card-cover { display: block; width: 100%; max-height: 220px; object-fit: cover; background: var(--surface-2); }
.card-body { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 7px; }
.card-title { font-weight: 600; word-break: break-word; line-height: 1.4; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label {
  display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; min-width: 36px; min-height: 18px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; line-height: 14px;
}
.label.big { font-size: 13px; padding: 6px 12px; min-height: 30px; line-height: 18px; }
.label.toggle { cursor: pointer; opacity: .45; }
.label.toggle.on, .label.on { opacity: 1; box-shadow: 0 0 0 2px var(--ink) inset; }
.card-fields { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12px; }
.card-fields dt { opacity: .6; }
.card-fields dd { margin: 0; font-weight: 600; word-break: break-word; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600;
}
.badge.due.soon { background: var(--warn-soft); color: var(--warn) !important; }
.badge.due.overdue { background: var(--danger-soft); color: var(--danger) !important; }
.badge.done { background: var(--ok-soft); color: var(--ok) !important; }
.badge.shopify { background: #dcf7ea; color: #13865a; }
.card-members { margin-left: auto; display: flex; }
.card-members .avatar + .avatar { margin-left: -7px; }
.card-ghost { opacity: .35; outline: 2px dashed var(--primary); outline-offset: -2px; }
.card-chosen { box-shadow: 0 0 0 2px var(--primary); }
.card-drag { rotate: 2deg; box-shadow: var(--shadow-lg); }
body.dragging .card:hover { transform: none; box-shadow: var(--shadow-sm); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 3px 10px; font-size: 12px;
  margin-left: 6px; border: 0; font-weight: 600; vertical-align: middle;
}
.chip.toggle { cursor: pointer; margin: 0; }
.chip.toggle:hover { background: #ebe7f7; }
.chip.toggle.on { box-shadow: 0 0 0 2px var(--ink) inset; }
.chip.shopify { background: #dcf7ea; color: #13865a; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.late { background: var(--danger-soft); color: var(--danger); margin: 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); margin: 0; }
.card-fields .chip { margin: 0; padding: 1px 8px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700;
  flex-shrink: 0; border: 2px solid #fff; box-sizing: content-box;
}
.avatar.system { background: var(--primary-soft); color: var(--primary); width: 28px; height: 28px; }

/* ---------- Modais ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(42, 37, 64, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 50; overflow-y: auto;
  animation: fade .15s ease-out;
}
.modal {
  background: var(--surface); border-radius: 22px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 96px); animation: pop .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 24px; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.modal-body { padding: 8px 24px 24px; overflow-y: auto; }
.modal-body h3 { font-size: 15px; font-weight: 800; margin: 24px 0 10px; }
.modal-body h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
.card-modal .modal-head { position: absolute; right: 10px; top: 10px; z-index: 2; padding: 0; }
.card-modal .modal-head .icon-btn { background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); width: 34px; height: 34px; border-radius: 50%; }
.card-modal { position: relative; overflow: hidden; }
.card-modal .modal-body { padding-top: 0; }
.modal-cover {
  height: 240px; background-size: contain; background-position: center; background-repeat: no-repeat;
  background-color: #f1eefb; margin: 0 -24px; display: flex; align-items: flex-end; justify-content: flex-end; padding: 12px;
}
.modal-cover .btn { background: rgba(255, 255, 255, .92); box-shadow: var(--shadow-sm); }
.color-strip { height: 8px; margin: 0 -24px; }
.card-detail-head { padding-top: 18px; padding-right: 40px; }
.card-title-input { font-size: 22px; font-weight: 800; border: 0; padding: 4px 8px; margin-left: -8px; resize: none; overflow: hidden; letter-spacing: -.01em; }
.card-title-input:hover { background: var(--surface-2); }
.card-detail-head .muted select { padding: 4px 8px; border-radius: 999px; background: var(--surface-2); border: 0; font-weight: 600; }
.card-detail-grid { display: grid; grid-template-columns: 1fr 220px; gap: 28px; }
.card-main { min-width: 0; }
.card-side { padding-top: 16px; }
.side-info { font-size: 12px; margin-top: 16px; line-height: 1.7; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.meta h4 { margin-top: 12px; }
.swatch.big { width: 46px; height: 34px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
.fields-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px;
  background: var(--surface-2); border-radius: 16px; padding: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-textarea, .field-multiselect { grid-column: 1 / -1; }
.field-name { font-size: 12px; font-weight: 700; color: var(--muted); }
.field input:not([type=checkbox]), .field select { width: 100%; }
.field-checkbox input { width: 20px; height: 20px; accent-color: var(--primary); }
.field .row input { flex: 1; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.input-prefix span { padding: 0 10px; color: var(--muted); background: var(--surface-2); align-self: stretch; display: flex; align-items: center; font-weight: 600; }
.input-prefix input { border: 0; border-radius: 0; }
.description { min-height: 90px; }
.dropzone {
  border: 2px dashed #d9d3f0; border-radius: 14px; padding: 16px; color: var(--muted); cursor: pointer; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s;
}
.dropzone.over, .dropzone:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.attachments { display: flex; flex-direction: column; gap: 12px; }
.attachment { display: flex; gap: 14px; align-items: flex-start; }
.attachment.is-cover .thumb { box-shadow: 0 0 0 3px var(--primary); }
.thumb {
  width: 116px; height: 84px; border-radius: 12px; background: var(--surface-2) center/cover no-repeat; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); text-decoration: none;
}
.attachment-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.attachment-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-info .chip { margin: 0; align-self: flex-start; background: var(--primary-soft); color: var(--primary); }

.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat small { color: var(--muted); font-weight: 600; }
.stat strong { font-size: 15px; }
.stats-row.big .stat { background: linear-gradient(160deg, #f6f3ff 0%, #fdf2f8 100%); }
.stats-row.big .stat strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat.ok strong { color: var(--ok); }
.stat.late strong { color: var(--danger); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 80px; gap: 12px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar { background: var(--surface-2); border-radius: 999px; height: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; min-width: 4px; filter: saturate(2.2) brightness(.92); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.timeline { padding-left: 20px; font-size: 13px; line-height: 1.8; }
details summary { cursor: pointer; color: var(--muted); margin: 10px 0; font-weight: 600; }

.activity { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.activity-item { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; padding: 4px; }
.activity-item time { font-size: 12px; color: var(--muted); }
.activity-item.clickable { cursor: pointer; border-radius: 10px; }
.activity-item.clickable:hover { background: var(--surface-2); }

/* ---------- Menus suspensos ---------- */
.popover {
  position: fixed; z-index: 100; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); padding: 12px; overflow-y: auto; color: var(--ink); animation: pop .12s ease-out;
}
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-title { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0; }
.menu-item {
  border: 0; background: transparent; text-align: left; padding: 8px 9px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.on { background: var(--primary-soft); }
.menu-item.indent { padding-left: 18px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.label-option { display: flex; gap: 4px; align-items: center; }
.label-option .label { flex: 1; text-align: left; cursor: pointer; }
.menu input { width: 100%; }
.color-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.swatch {
  width: 28px; height: 28px; border-radius: 9px; border: 1px solid rgba(42, 37, 64, .08); cursor: pointer; padding: 0; transition: transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swatch.custom { display: inline-flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: conic-gradient(#ff9ebb, #ffd95e, #7ee0a1, #5fd4d0, #7ab8ff, #a79bff, #ff9ebb); color: #fff; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.notifications { max-height: 440px; }
.notif { border: 0; background: transparent; text-align: left; padding: 9px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }

/* ---------- Configurações ---------- */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 24px; min-height: 440px; }
.tabs { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 14px; }
.tabs button { border: 0; background: transparent; text-align: left; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button:hover { background: var(--surface-2); color: var(--ink); }
.tabs button.active { background: var(--primary-soft); color: var(--primary); }
.tab-panel { min-width: 0; }
.tab-panel h3:first-child { margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 220px 1fr; gap: 10px; align-items: center; margin: 10px 0; font-weight: 600; }
.form-row > input, .form-row > select { width: 100%; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
fieldset { border: 1px solid var(--border); border-radius: 16px; margin: 16px 0; padding: 8px 16px 12px; }
legend { font-weight: 800; padding: 0 6px; }
.callout { background: var(--primary-soft); border-radius: 12px; padding: 12px 14px; }
.bg-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bg-option {
  width: 96px; height: 60px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; display: flex; align-items: flex-end;
  padding: 6px; font-size: 11px; font-weight: 700; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .1s;
}
.bg-option:hover { transform: translateY(-2px); }
.bg-option.active { border-color: var(--primary); }
.bg-option span { background: rgba(255, 255, 255, .8); border-radius: 6px; padding: 1px 6px; }
.bg-picker .muted { flex-basis: 100%; margin-top: 4px; }
.field-def { border: 1px solid var(--border); border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.field-def > .row > input { flex: 1; }
.field-def .options { margin: 8px 0 0 46px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.reorder { display: flex; flex-direction: column; }
.reorder .icon-btn { min-height: 18px; padding: 0 6px; }
.add-field input { flex: 1; }
.label-row { margin: 6px 0 14px; }
.label-row input { flex: 1; }
.map-table { width: 100%; border-collapse: collapse; }
.map-table td { padding: 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.map-table td:first-child { width: 35%; font-weight: 600; }
.map-table select, .map-table input { width: 100%; margin-bottom: 4px; }
.sheet-columns ol { padding-left: 22px; }
.sheet-columns li { padding: 2px 0; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.users-table tr.inactive { opacity: .5; }
.simple-list { padding-left: 18px; }
.simple-list li { padding: 4px 0; display: flex; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border); padding: 8px; font-size: 12px; }
table.data td { border-bottom: 1px solid var(--border); padding: 8px; }
table.data td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }

/* ---------- Login ---------- */
.auth-screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-box {
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(16px); border: 1px solid #fff; border-radius: 26px; padding: 36px;
  width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-lg);
}
.auth-box h1 { margin: 0; font-size: 24px; text-align: center; font-weight: 800; letter-spacing: -.02em; }
.auth-box .logo {
  width: 64px; height: 64px; border-radius: 20px; background: var(--accent-gradient); color: #fff; margin: 0 auto 4px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px -6px rgba(167, 155, 255, .7);
}

/* ---------- Avisos ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); transition: opacity .4s;
  max-width: 90vw; white-space: pre-line; font-weight: 600; animation: pop .18s ease-out;
}
.toast.ok { background: #1f9d6b; }
.toast.error { background: var(--danger); }
.toast.warn { background: #d4860b; }
.toast.hide { opacity: 0; }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  :root { --column-width: 84vw; }
  .card-detail-grid, .settings { grid-template-columns: 1fr; }
  .tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; }
  .tabs button { white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; gap: 4px; }
  .modal-overlay { padding: 0; }
  .modal { max-height: 100vh; border-radius: 0; min-height: 100vh; }
  .bar-row { grid-template-columns: 100px 1fr 64px; }
  .board { scroll-snap-type: x mandatory; }
  .column, .add-column { scroll-snap-align: center; }
}
.auth-box .btn.block { justify-content: center; padding: 11px; }

/* ---------- Alternar quadro / calendário ---------- */
.view-switch, .segmented {
  display: inline-flex; background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .9); border-radius: 999px; padding: 3px; gap: 2px;
}
.view-switch button, .segmented button {
  border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
.view-switch button:hover, .segmented button:hover { color: var(--ink); }
.view-switch button.active, .segmented button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.segmented { background: var(--surface-2); border-color: transparent; }

/* ---------- Calendário ---------- */
.calendar { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-nav, .cal-options { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav .icon-btn.square { background: rgba(255, 255, 255, .75); }
.cal-nav .btn { background: rgba(255, 255, 255, .75); }
.cal-title { margin: 0 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.cal-options .btn { background: rgba(255, 255, 255, .75); }
.cal-options .segmented { background: rgba(255, 255, 255, .6); }
.cal-source { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .75); border-radius: 10px; padding: 0 4px 0 10px; color: var(--muted); }
.cal-source select { border: 0; background: transparent; font-weight: 600; color: var(--ink); padding: 6px 4px; }
.cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: start; flex-shrink: 0; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: rgba(42, 37, 64, .08);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid rgba(255, 255, 255, .8);
}
.cal-weekday {
  background: rgba(255, 255, 255, .85); padding: 8px 10px; font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.cal-day { background: rgba(255, 255, 255, .72); min-height: 128px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.weekend { background: rgba(250, 248, 255, .72); }
.cal-day.outside { background: rgba(255, 255, 255, .4); }
.cal-day.outside .cal-day-num { opacity: .4; }
.cal-grid.week .cal-weekday { display: none; }
.cal-grid.week .cal-day { min-height: 60vh; }
.cal-day-head { display: flex; align-items: center; gap: 6px; padding: 2px 2px 4px; }
.cal-weekday-inline { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal-day-num {
  font-weight: 700; font-size: 13px; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.cal-day.today .cal-day-num { background: var(--accent-gradient); color: #fff; box-shadow: 0 4px 10px -2px rgba(167, 155, 255, .6); }
.cal-day-count {
  margin-left: auto; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 7px;
}
.cal-side h3 .cal-day-count { margin-left: 8px; }
.cal-day-cards { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 20px; }
.cal-more { white-space: nowrap;
  border: 0; background: transparent; color: var(--primary); font-weight: 700; font-size: 12px; text-align: left; padding: 2px 6px;
  border-radius: 8px; cursor: pointer;
}
.cal-more:hover { background: var(--primary-soft); }
.cal-chip {
  border-radius: 10px; padding: 5px 8px; font-size: 12px; line-height: 1.35; cursor: pointer; overflow: hidden;
  box-shadow: 0 1px 2px rgba(42, 37, 64, .08); border: 1px solid rgba(255, 255, 255, .6); transition: transform .12s, box-shadow .12s;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.cal-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cal-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-chip.done { opacity: .6; }
.cal-chip.overdue { box-shadow: inset 3px 0 0 var(--danger), 0 1px 2px rgba(42, 37, 64, .08); }
.cal-chip-cover { width: calc(100% + 16px); margin: -5px -8px 2px; height: 64px; object-fit: cover; display: block; }
.cal-chip-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cal-chip-time { font-weight: 800; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-chip-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cal-grid.week .cal-chip-title { white-space: normal; }
.cal-chip-flag { font-weight: 800; }
.cal-chip-sub { font-size: 11px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; filter: saturate(3) brightness(.8); }
.cal-chip-labels { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-label { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip-members { display: flex; }
.cal-chip-members .avatar { border-width: 1px; }
.cal-chip-members .avatar + .avatar { margin-left: -5px; }
.cal-side {
  background: rgba(255, 255, 255, .72); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-sm); border: 1px solid rgba(255, 255, 255, .8);
  max-height: calc(100vh - 170px); overflow-y: auto;
}
.cal-side h3 { margin: 2px 0 6px; font-size: 14px; font-weight: 800; display: flex; align-items: center; }
.cal-side .cal-day-cards { min-height: 60px; }
.cal-day-pop .cal-chip { margin-bottom: 4px; }
.menu-check { margin: 2px 0; padding: 4px 6px; border-radius: 8px; }
.menu-check:hover { background: var(--surface-2); }
.muted-inherit { opacity: .75; }

@media (max-width: 760px) {
  .view-switch .lbl { display: none; }
  .cal-body { grid-template-columns: 1fr; }
  .cal-side { max-height: none; }
  .cal-grid.week { grid-template-columns: 1fr; }
  .cal-grid.week .cal-day { min-height: 0; }
  .cal-grid.month .cal-day { min-height: 74px; padding: 3px; }
  .cal-grid.month .cal-chip { padding: 2px 4px; font-size: 10px; }
  .cal-grid.month .cal-chip > :not(.cal-chip-line) { display: none; }
  .cal-grid.month .cal-chip-time { display: none; }
  .cal-weekday { padding: 6px 4px; text-align: center; }
  .cal-title { font-size: 18px; }
}


/* ---------- Arrastar e soltar (fluidez em tablet e celular) ---------- */
/* Impede o menu de "copiar/selecionar" do iPad/Android ao segurar o card */
.card, .cal-chip, .column-head { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.column-title:focus { -webkit-user-select: text; user-select: text; }
/* Card "pego": leve aumento para mostrar que já pode arrastar */
.card-chosen, .cal-chip.card-chosen { transform: scale(1.03); box-shadow: 0 0 0 2px var(--primary), var(--shadow-md); transition: transform .12s ease-out; }
/* Cópia que segue o dedo/mouse, desenhada pelo Sortable */
.sortable-fallback {
  opacity: 1 !important; transform-origin: 50% 50%; box-shadow: var(--shadow-lg) !important; border-radius: 14px;
  will-change: transform; pointer-events: none; z-index: 1000;
}

/* Durante o arraste: sem animações de hover/sombra que pesam no tablet */
body.dragging .card, body.dragging .cal-chip, body.dragging .column, body.dragging .cal-day { transition: none !important; }
body.dragging .card:hover, body.dragging .cal-chip:hover, body.dragging .column.collapsed:hover { transform: none; box-shadow: var(--shadow-sm); }
body.dragging { cursor: grabbing; }
/* Durante o arraste as colunas não "encaixam" na tela (o encaixe desfazia a rolagem automática no celular) */
body.dragging .board { scroll-snap-type: none; }
body.dragging .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 255, 255, .9); }
/* Listas que rolam: rolagem suave e isolada (não "puxa" a página toda no iPad) */
.cards, .cal-side, .board, .calendar { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Envio pelos Correios (no card) ---------- */
.shipping-form { margin-top: 10px; align-items: flex-end; }
.shipping-form .field { min-width: 160px; }

/* ---------- Lightbox (imagens em tela cheia) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(20, 16, 34, .97); display: flex; flex-direction: column;
  animation: fade .15s ease-out; color: #fff;
}
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.lb-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; opacity: .9; }
.lb-caption span { opacity: .65; margin-left: 6px; }
.lb-actions { display: flex; gap: 6px; }
.lb-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 64px; overflow: hidden; }
.lb-img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; cursor: zoom-in;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: pop .18s ease-out; user-select: none;
}
.lb-stage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.lb-stage.zoomed .lb-img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lb-nav:hover { background: rgba(255, 255, 255, .28); }
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-strip { display: flex; gap: 8px; justify-content: center; padding: 10px 16px 16px; overflow-x: auto; }
.lb-thumb {
  width: 64px; height: 48px; flex-shrink: 0; border-radius: 8px; border: 2px solid transparent; background: #333 center/cover no-repeat;
  cursor: pointer; opacity: .55; transition: opacity .15s;
}
.lb-thumb:hover { opacity: .85; }
.lb-thumb.active { opacity: 1; border-color: #fff; }
.modal-cover { cursor: zoom-in; }
.thumb:not(.file) { cursor: zoom-in; }
@media (max-width: 760px) {
  .lb-stage { padding: 4px 8px; }
  .lb-nav { display: none; }
}

/* ---------- Automações ---------- */
.templates { gap: 6px; margin: 4px 0 14px; }
.rule-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.rule-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.rule-item.off { opacity: .55; }
.rule-item .grow { min-width: 0; }
.rule-ring { width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 3px var(--c); flex-shrink: 0; }
.rule-icon { width: 22px; height: 22px; display: grid; place-items: center; color: var(--primary); flex-shrink: 0; }
.rule-editor:not(:empty) { border: 1.5px solid var(--primary); border-radius: 16px; padding: 14px 16px; margin: 6px 0 16px; background: var(--primary-soft); display: flex; flex-direction: column; gap: 12px; }
.rule-block { background: var(--surface); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.rule-step { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.rule-line { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--border); }
.rule-line:first-of-type { border-top: 0; }
.rule-line > select:first-child { max-width: 260px; }
.rule-line .grow { flex: 1 1 260px; }
.rule-line > .rule-unit { align-self: center; }
.rule-tag { font-weight: 600; padding: 6px 0; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.chip-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.chip-toggle::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--chip, var(--border)); }
.chip-toggle.on { border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.ring-colors { gap: 6px; margin-bottom: 6px; align-items: center; }
.ring-swatch { width: 26px; height: 26px; border-radius: 8px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 4px var(--c); cursor: pointer; }
.ring-swatch.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.ring-colors input[type=color] { width: 30px; height: 28px; padding: 0; border: 0; background: none; }
.swatch.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d5d1e4; border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Painel (dashboard) ---------- */
.dashboard { flex: 1; overflow: auto; padding: 16px; }
.dash { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 32px; }
.dash-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.dash-head p { margin: 2px 0 0; }
.dash-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0; }
.dash-card > header h3 { margin: 0; font-size: 15px; }
.dash-card > header p { margin: 2px 0 10px; }
.dash-top { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tiny { font-size: 11px; }
.dash-loading { padding: 24px; }

.gauge-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.gauge-card > header { align-self: stretch; text-align: left; }
.gauge { width: 100%; max-width: 300px; display: block; }
.gauge-tick { font-size: 10px; fill: var(--muted); }
.gauge-needle { transition: all .6s cubic-bezier(.2, .8, .2, 1); }
.gauge-value { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: -6px; }
.gauge-value strong { font-size: 40px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge-facts { list-style: none; padding: 0; margin: 12px 0 6px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.gauge-facts b { color: var(--ink); }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  color: var(--ink); background: color-mix(in srgb, var(--st) 16%, white); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st) 45%, white);
}
.status-pill .icon { color: color-mix(in srgb, var(--st) 80%, black); }

.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
  text-align: left; border: 0; font: inherit; color: var(--ink); position: relative; overflow: hidden; min-width: 0;
}
.kpi { justify-content: center; }
.kpi::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--st, transparent); }
.kpi.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 30px; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; }
.delta { font-weight: 700; color: var(--ink); }

.viz { display: block; overflow: visible; }
.viz-label { font-size: 12px; fill: var(--ink); }
.viz-value { font-size: 12px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.viz-note { font-size: 11px; font-weight: 600; fill: var(--muted); }
.viz-tick { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz-grid { stroke: var(--border); stroke-width: 1; }
.viz-axis { stroke: #cfcbdc; stroke-width: 1; }
.viz-band { fill: var(--surface-2); }
.viz-cross { stroke: #b9b4cc; stroke-width: 1; }
.viz .hit.clickable { cursor: pointer; }
.viz-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: -4px 0 8px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; }
.viz-tip {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; background: var(--ink); color: #fff; border-radius: 10px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow-md); max-width: 260px;
}
.viz-tip strong { display: block; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.tip-key { width: 9px; height: 9px; border-radius: 3px; }
.empty-chart { padding: 24px 0; text-align: center; }

.orders-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.period-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 12px; overflow-x: auto; }
.period-tabs button {
  border: 0; background: none; padding: 8px 12px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.period-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.period-tabs .count { background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.period-tabs button.late .count { background: color-mix(in srgb, #d03b3b 16%, white); }
.status-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
.orders-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.orders-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.orders-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.orders-table tr.clickable { cursor: pointer; }
.orders-table tr.clickable:hover td, .orders-table tr.clickable:focus-visible td { background: var(--surface-2); }
.orders-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.order-title { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 220px; }
.order-title img, .thumb-empty { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.thumb-empty { display: grid; place-items: center; color: var(--muted); }
.stage { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stage i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(42, 37, 64, .2); }
.empty-orders { padding: 18px 0; text-align: center; }

@media (max-width: 980px) {
  .dash-top { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dashboard { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 24px; }
}
.rule-block > .btn.small { align-self: flex-start; }
.card-alerts.detail { margin-top: 8px; }

/* ---------- Seleção de vários cards ---------- */
.top-btn.active { background: var(--primary); color: #fff; }
/* "Selecionar" sempre com o nome (em telas médias os outros botões ficam só com ícone) */
.top-actions #select-btn .lbl { display: inline !important; }
.top-actions #select-btn { padding: 8px 12px; }
.card-check {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 24px; height: 24px; border-radius: 7px; display: none; place-items: center;
  border: 0; padding: 0; cursor: pointer; background: rgba(255, 255, 255, .95); box-shadow: inset 0 0 0 2px #b9b4cc, 0 1px 3px rgba(42, 37, 64, .15);
  color: transparent; transition: background .12s, box-shadow .12s;
}
.card-check:hover { box-shadow: inset 0 0 0 2px var(--primary), 0 1px 3px rgba(42, 37, 64, .15); color: #c9c2ff; }
body.selecting .card-check { display: grid; }
@media (hover: hover) { .card:hover .card-check { display: grid; } }
body.dragging .card-check { display: none !important; }
body.selecting .card { cursor: pointer; }
body.selecting .card .card-body { padding-right: 40px; }
body.selecting .card .card-cover + .card-body { padding-right: 12px; }
.card.selected { box-shadow: 0 0 0 2.5px var(--primary), var(--shadow-sm); }
.card.selected .card-check { background: var(--primary); box-shadow: none; color: #fff; }
.col-select {
  width: 24px; height: 24px; border-radius: 7px; border: 0; display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  background: rgba(255, 255, 255, .9); box-shadow: inset 0 0 0 2px #b9b4cc; color: transparent;
}
.col-select.partial { box-shadow: inset 0 0 0 2px var(--primary); color: var(--primary); }
.col-select.on { background: var(--primary); box-shadow: none; color: #fff; }
.col-select:disabled { opacity: .4; cursor: default; }
.select-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: #fff; padding: 10px 12px 10px 18px; border-radius: 18px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px);
}
.select-bar .select-count { white-space: nowrap; font-size: 13px; }
.select-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.select-bar .btn { background: rgba(255, 255, 255, .12); color: #fff; border: 0; }
.select-bar .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.select-bar .btn.primary { background: var(--primary); }
.select-bar .btn:disabled { opacity: .45; }
.select-bar .icon-btn { color: #fff; }
.menu .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; box-shadow: inset 0 0 0 1px rgba(42, 37, 64, .2); }
.menu .menu-item .avatar { margin-right: 8px; }
.segmented.small button { padding: 4px 10px; font-size: 12px; }
.menu .segmented { margin: 2px 0 6px; }
body.selecting .board { padding-bottom: 90px; }
@media (max-width: 760px) {
  .select-bar { bottom: 10px; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; width: calc(100vw - 20px); }
  .select-bar .lbl { display: none; }
  .select-bar .btn.primary .lbl { display: inline; }
  .select-actions { justify-content: space-between; }
}

/* ---------- Etiquetas de impressão ---------- */
.plabel {
  background: #fff; color: #000; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 1.2mm 3mm; overflow: hidden;
  box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; line-height: 1.2; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lbl-item { min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .3em; }
.lbl-item.full { flex: 0 0 100%; }
.lbl-item.half { flex: 0 0 calc(50% - 1.5mm); }
.lbl-item.bold { font-weight: 800; }
.lbl-name { font-weight: 400; }
.lbl-item.key-qr, .lbl-item.key-photo, .lbl-item.key-barcode { align-items: flex-start; }
.lbl-qr svg { display: block; width: 100%; height: 100%; }
.lbl-photo { display: block; width: 100%; object-fit: contain; filter: grayscale(1) contrast(1.15); }
.lbl-photo.empty { border: .3mm dashed #888; display: grid; place-items: center; font-size: 9pt; color: #555; }
.lbl-barcode { display: block; width: 100%; max-width: 100%; }
.lbl-hr { width: 100%; border: 0; border-top: .4mm solid #000; margin: .4mm 0; }
.lbl-chip { border: .3mm solid #000; border-radius: 1mm; padding: 0 1mm; margin-right: 1mm; }
.lbl-desc { white-space: pre-line; }
.lbl-warn { font-size: 9pt; color: #b00; }
.print-thumb { background: #fff; box-shadow: var(--shadow-md); border-radius: 4px; flex-shrink: 0; }
.print-thumb .plabel.overflow { box-shadow: inset 0 -6px 0 #d03b3b; }
.print-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.print-toolbar .grow { flex: 1; }
.print-preview { display: flex; flex-wrap: wrap; gap: 18px; padding: 16px; background: var(--surface-2); border-radius: 16px; max-height: 62vh; overflow: auto; align-items: flex-start; }
.print-help { margin-top: 14px; }
.print-help code { word-break: break-all; }
.print-editor-form .form-row { grid-template-columns: 150px minmax(0, 1fr); }
.print-editor-form input[type=number] { width: 90px !important; }
.print-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 20px; align-items: start; margin-top: 12px; }
.print-editor-preview { background: var(--surface-2); border-radius: 16px; padding: 16px; position: sticky; top: 0; }
.print-items { list-style: none; padding: 0; margin: 6px 0 10px; display: flex; flex-direction: column; gap: 6px; }
.print-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; background: var(--surface); }
.print-item .grow { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.print-item-opts { gap: 6px; }
.print-item-opts select { padding: 3px 6px; font-size: 12px; }
.drag-handle { cursor: grab; color: var(--muted); padding: 2px 2px; user-select: none; letter-spacing: -2px; }
@media (max-width: 900px) { .print-editor { grid-template-columns: 1fr; } .print-editor-preview { position: static; } }

#print-root { display: none; }
@media print {
  html, body.printing { height: auto !important; overflow: visible !important; background: #fff !important; display: block !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  .print-page { overflow: hidden; position: relative; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page.landscape .print-rot { transform-origin: top left; transform: translateX(var(--rot-h)) rotate(90deg); }
}

.log-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.log-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.log-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table td:nth-child(4) { width: 55%; }
.log-table .chip { white-space: nowrap; }

/* ---------- Checklist ---------- */
.checklist { display: flex; flex-direction: column; gap: 6px; }
.checklist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 8px; }
.checklist li:hover { background: var(--surface-2); }
.checklist li .check { flex: 1; font-weight: 500; }
.checklist li.done .check { color: var(--muted); text-decoration: line-through; }
.checklist input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }
.checklist-progress { display: flex; align-items: center; gap: 8px; }
.checklist-progress .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.checklist-progress .bar span { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .2s; }
.checklist-progress.complete .bar span { background: var(--ok); }
.field.field-checklist { grid-column: 1 / -1; }
.checklist-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); }
.checklist-chip.complete { background: var(--ok-soft); color: var(--ok); }
.checklist-options .check-mark { width: 24px; text-align: center; color: var(--muted); }
.lbl-check { list-style: none; margin: 0; padding: 0; width: 100%; }
.lbl-block { flex: 0 0 100%; }
.field-def .drag-handle { font-size: 16px; padding: 4px; }

/* ---------- Ordenar coluna ---------- */
.sort-menu .stack { margin: 6px 0; }
.sort-menu select { width: 100%; }

/* ---------- Comentários e conversa ---------- */
.mention-box { position: relative; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface); padding: 6px 8px; }
.mention-box:focus-within { border-color: var(--primary); }
.mention-input { width: 100%; border: 0 !important; resize: none; outline: none; padding: 4px 2px; background: transparent; box-shadow: none !important; min-height: 38px; }
.mention-actions { display: flex; align-items: center; gap: 8px; }
.mention-actions small { flex: 1; font-size: 11px; }
.mention-actions .icon-btn { font-weight: 800; color: var(--primary); }
.mention-list {
  position: absolute; left: 8px; bottom: calc(100% + 4px); z-index: 30; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 4px; min-width: 220px; max-height: 260px; overflow: auto;
}
.mention-option { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-align: left; }
.mention-option.active, .mention-option:hover { background: var(--primary-soft); }
.comments { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment-main { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; }
.comment.mentions-me .comment-main { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.comment-head time { font-size: 12px; color: var(--muted); }
.comment-head .grow { flex: 1; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; line-height: 1.45; }
.mention { color: var(--primary); font-weight: 700; background: var(--primary-soft); border-radius: 6px; padding: 0 3px; }
.mention.me { background: var(--primary); color: #fff; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.comments .empty { padding: 6px 0; }
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 70; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: chat-in .18s ease-out;
}
@keyframes chat-in { from { transform: translateX(30px); opacity: 0; } }
.chat-panel header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-panel header .grow { flex: 1; }
.chat-scroll { flex: 1; overflow: auto; padding: 12px 16px; }
.chat-more { display: block; margin: 0 auto 8px; }
.chat-panel footer { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.chat-list { margin: 0; }

/* ---------- Tags de produto (filtro do Shopify) ---------- */
.tag-editor { display: flex; flex-direction: column; gap: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: var(--ink); border-radius: 999px; padding: 3px 4px 3px 10px; font-weight: 600; font-size: 13px; }
.tag-chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); padding: 0 4px; border-radius: 50%; }
.tag-chip button:hover { color: var(--danger); }
.tag-editor .row input { flex: 1; }
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; padding: 8px; background: var(--surface-2); border-radius: 12px; }
.tag-suggestion { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.tag-suggestion:hover { border-color: var(--primary); color: var(--primary); }
.tag-list:empty { display: none; }
.color-preview { display: inline-grid; place-items: center; min-width: 34px; height: 24px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border); font-size: 11px; color: var(--muted); padding: 0 6px; }
.field-def .field-type { max-width: 210px; font-size: 12px; padding: 4px 8px; }

/* ---------- Cards novos ---------- */
.new-pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--accent-gradient); letter-spacing: .02em; }
.card.is-new { box-shadow: 0 0 0 2px #a79bff, 0 6px 18px -6px rgba(124, 92, 255, .45); }
.card.is-new.highlighted { box-shadow: 0 6px 18px -6px rgba(124, 92, 255, .45); }
.new-count { font-size: 11px; font-weight: 800; color: #fff; background: var(--accent-gradient); padding: 2px 8px; border-radius: 999px; white-space: nowrap; animation: new-pulse 2.4s ease-in-out infinite; }
@keyframes new-pulse { 50% { box-shadow: 0 0 0 4px rgba(167, 155, 255, .25); } }
@media (prefers-reduced-motion: reduce) { .new-count { animation: none; } }

/* ---------- Celular: alinhamento das telas ---------- */
.callout, .modal-body li, .modal-body p { overflow-wrap: anywhere; }
input[type=file] { max-width: 100%; }
fieldset { min-width: 0; }
@media (max-width: 760px) {
  .board { padding: 12px 10px; }

  /* Avisos: faixa embaixo, ocupando a largura */
  #toasts { left: 10px; right: 10px; bottom: 12px; transform: none; align-items: stretch; }
  .toast { max-width: none; padding: 9px 14px; font-size: 13px; border-radius: 12px; text-align: center; }

  /* Janelas */
  .modal-head { padding: 12px 10px 0 16px; }
  .modal-body { padding: 6px 16px 20px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; }
  .tabs { align-items: center; margin: 0 -16px; padding: 0 16px 8px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex-shrink: 0; height: 36px; padding: 0 12px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .form-row > * { min-width: 0; }
  .print-editor-form .form-row { grid-template-columns: minmax(0, 1fr); }
  .print-editor { grid-template-columns: minmax(0, 1fr); }
  .print-editor-form .segmented { flex-wrap: wrap; }
  fieldset { padding: 6px 12px 10px; }
  .row.wrap > input, .row.wrap > select { flex: 1 1 100%; min-width: 0; }

  /* Campos do card: nome em cima, tipo embaixo, ações por último */
  .field-def > .row { flex-wrap: wrap; }
  .field-def > .row > input { flex: 1 1 0; min-width: 0; }
  .field-def .field-type { flex: 1 1 100%; max-width: none; font-size: 14px; padding: 7px 10px; }
  .field-def > .row > .check { margin: 0 auto 0 0; }
  .field-def .options { margin-left: 0; align-items: stretch; }
  .field-def .options > .row > input:not([type=color]) { flex: 1; min-width: 0; }

  /* Usuários: cada pessoa vira um bloco */
  .users-table, .users-table tbody { display: block; }
  .users-table tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .users-table td { padding: 0; border: 0; min-width: 0; }
  .users-table td:nth-child(2), .users-table td:nth-child(3) { grid-column: 2 / -1; }
  .users-table td:nth-child(3) select { width: 100%; }
  .users-table td:nth-child(4) { grid-column: 2; }

  /* Automações: textos em cima, botões embaixo */
  .rule-item { flex-wrap: wrap; align-items: flex-start; }
  .rule-item .grow { flex: 1 1 calc(100% - 90px); }
  .rule-item > .icon-btn:first-of-type { margin-left: auto; }

  /* Tabelas largas rolam de lado dentro da janela */
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .table-wrap table { min-width: 560px; }
  .table-wrap td { white-space: nowrap; }
  .table-wrap td:first-child { white-space: normal; min-width: 150px; }

  .rule-line > select:first-child { flex: 1 1 100%; max-width: none; }
  .print-item-opts select { flex: 1 1 100%; }

  /* Card aberto */
  .card-detail-grid input[type=date], .card-detail-grid input[type=datetime-local] { width: 100%; }
}

/* ---------- Estoque de pedras ---------- */
.stock-tabs { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.stock-tabs button { white-space: nowrap; }
.stock-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.stock-search { flex: 1 1 240px; max-width: none; background: var(--surface-2); border-color: transparent; }
.stock-shapes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.stock-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 12px; }
.stock-empty { text-align: center; padding: 28px 12px; }
.stone-list, .melee-list { display: flex; flex-direction: column; gap: 6px; }
.stone-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; text-align: left; width: 100%;
  border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 8px 12px 8px 8px; cursor: pointer;
}
.stone-row:hover { border-color: #cfc6f5; box-shadow: var(--shadow-sm); }
.stone-row.used { background: var(--surface-2); }
.stone-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.stone-thumb.empty { display: grid; place-items: center; color: var(--muted); }
.stone-main { display: flex; flex-direction: column; min-width: 0; }
.stone-main strong { font-size: 15px; letter-spacing: .01em; }
.stone-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stone-grades { display: flex; gap: 4px; }
.grade { font-weight: 800; font-size: 12px; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 3px 8px; }
.stone-status { margin: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.chip.kind-lab { background: #e3f0ff; color: #2b6cb0; margin: 0 0 0 6px; }
.chip.kind-moissanite { background: #fbe7ff; color: #9b3fb5; margin: 0 0 0 6px; }

.melee-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 8px 10px 8px 14px;
}
.melee-row.low { border-color: #ffc2d1; background: #fff7f9; }
.melee-row.empty .melee-qty { color: var(--muted); }
.melee-main { border: 0; background: none; text-align: left; padding: 4px 0; cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.melee-main strong { font-size: 15px; }
.melee-qty { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.melee-qty strong { font-size: 20px; }
.melee-actions { display: flex; gap: 6px; }
.melee-summary { font-size: 18px; margin-bottom: 6px; }
.melee-move .form-row { grid-template-columns: 1fr; gap: 4px; margin: 8px 0; }
.melee-move input, .melee-move select { width: 100%; }

/* Cadastro / detalhe */
.stone-form-modal, .stone-detail-modal { max-width: 560px; }
.stone-photo-box { margin-bottom: 10px; }
.stone-photo-empty {
  width: 100%; border: 2px dashed #cfc6f5; background: var(--primary-soft); color: var(--primary); border-radius: 16px; padding: 22px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center;
}
.stone-photo-empty small { color: var(--muted); font-weight: 500; }
.stone-photo { display: flex; align-items: flex-end; gap: 10px; }
.stone-photo img { max-height: 180px; max-width: 70%; border-radius: 12px; box-shadow: var(--shadow-sm); cursor: zoom-in; object-fit: contain; background: var(--surface-2); }
.stone-read-status { white-space: pre-line; border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; background: var(--surface-2); font-size: 13px; }
.stone-read-status.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.stone-read-status.warn { background: var(--warn-soft); color: var(--warn); }
.stone-read-status.error { background: var(--danger-soft); color: var(--danger); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.stone-form-modal .form-row { grid-template-columns: 150px minmax(0, 1fr); margin: 8px 0; }
.stone-form-modal .form-row > textarea { width: 100%; font-weight: 400; }
.stone-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.stone-grid .form-row { grid-template-columns: 1fr; gap: 4px; }
.stone-more { margin: 6px 0 10px; }
.stone-more summary { cursor: pointer; color: var(--primary); font-weight: 700; padding: 4px 0; }
.stone-detail-photo { width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; background: var(--surface-2); cursor: zoom-in; margin-bottom: 10px; }
.stone-used, .stone-available { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.stone-available { background: var(--ok-soft); }
.stone-used { background: #fff1f4; }
.stone-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 10px; }
.stone-facts dt { color: var(--muted); font-weight: 600; }
.stone-facts dd { margin: 0; font-weight: 700; }
.stone-notes { white-space: pre-line; background: var(--surface-2); border-radius: 12px; padding: 8px 12px; }
.stone-history { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.stone-history li { border-left: 3px solid var(--border); padding-left: 10px; }
.ok-text { color: var(--ok); }

/* Campos do card */
.field.field-stone, .field.field-melee { grid-column: 1 / -1; }
.stock-field { position: relative; }
.stock-field .row input { flex: 1; min-width: 0; }
.stock-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 4px; max-height: 260px; overflow: auto;
}
.stock-suggest-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.stock-suggest-item:hover { background: var(--primary-soft); }
.stock-suggest-empty { padding: 8px 10px; }
.stock-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px 8px 12px; background: var(--surface); flex-wrap: wrap; }
.stock-pick-main { min-width: 0; }
.stock-pick-list { max-height: 320px; overflow: auto; margin-top: 6px; }
.melee-field { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.melee-lines { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 4px; }
.melee-lines li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 4px 6px 4px 10px; background: var(--surface); }
.melee-line-qty { font-weight: 800; min-width: 34px; font-variant-numeric: tabular-nums; }
.melee-line-name { flex: 1; min-width: 0; }
.melee-line-actions { display: flex; }

/* Leitor de código de barras */
.scan-overlay { position: fixed; inset: 0; z-index: 400; background: #0d0b16; color: #fff; display: flex; flex-direction: column; }
.scan-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.scan-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: min(80vw, 420px); height: 120px; border: 3px solid rgba(255, 255, 255, .9); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.scan-tip { text-align: center; padding: 12px 16px 22px; margin: 0; opacity: .85; font-size: 13px; }

@media (max-width: 760px) {
  .stock-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stock-tabs button { white-space: normal; line-height: 1.25; padding: 6px 4px; font-size: 13px; }
  .stone-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: 'thumb main grades' 'thumb status status'; row-gap: 6px; }
  .stone-thumb { grid-area: thumb; width: 40px; height: 40px; }
  .stone-main { grid-area: main; }
  .stone-grades { grid-area: grades; }
  .stone-status { grid-area: status; justify-self: start; max-width: 100%; }
  .stone-form-modal .form-row { grid-template-columns: minmax(0, 1fr); }
  .stone-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Página de Estoque ---------- */
.stock-page { max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 32px; }
.stock-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stock-page-actions { justify-content: flex-end; }
.stock-page-actions .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.stock-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stock-kpis .kpi.active { box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm); }
.stock-tabs-line .segmented { background: rgba(255, 255, 255, .7); }
.stock-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.stock-body.with-panel { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
.stock-main { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 14px 16px; min-width: 0; }
.stock-panel { display: none; }
.stock-body.with-panel .stock-panel {
  display: block; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 14px 16px; position: sticky; top: 0;
  max-height: calc(100vh - 120px); overflow: auto; animation: fade .15s ease-out;
}
.stock-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stock-panel-head h3 { flex: 1; margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.panel-back { display: none; }
.stock-filters .segmented { flex-shrink: 0; }
.stock-more-filters { position: relative; }
.stock-more-filters > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.stock-more-filters > summary::-webkit-details-marker { display: none; }
.stock-more-filters[open] > summary { background: var(--primary-soft); color: var(--primary); }
.stock-filter-grid { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 10px 0 0; }
.stock-filter-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.stock-filter-grid input { width: 100px; }
.stock-more-filters[open] { flex-basis: 100%; order: 5; }
.stock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-table th {
  text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
.stock-table th.sortable { cursor: pointer; }
.stock-table th.sortable:hover, .stock-table th.sorted { color: var(--primary); }
.stock-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stock-table tr.clickable { cursor: pointer; }
.stock-table tr.clickable:hover td { background: var(--surface-2); }
.stock-table tr.selected td { background: var(--primary-soft) !important; }
.stock-table tr.used td:not(.col-photo) { color: var(--muted); }
.stock-table tr.used strong { color: var(--ink); }
.stock-table tr.empty .melee-qty-cell { color: var(--muted); }
.stock-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-table .col-photo { width: 52px; padding-right: 0; }
.stock-table .stone-thumb { width: 40px; height: 40px; }
.stock-table .col-order { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-table .chip { margin: 0; }
.melee-qty-cell { font-size: 16px; }
.low-chip { margin-left: 6px !important; }
.melee-actions-cell { width: 1%; white-space: nowrap; }
.stock-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.melee-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.melee-summary.low { background: #fff1f4; }
.melee-summary-qty { font-size: 22px; }
.stone-detail-actions { margin: 4px 0 6px; }
.stock-panel .stone-detail-photo { max-height: 220px; }
@media (max-width: 1100px) {
  .stock-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .stock-view { padding: 12px 10px; }
  .stock-page-actions { width: 100%; justify-content: stretch; }
  .stock-page-actions > * { flex: 1; justify-content: center; }
  .stock-page-actions .lbl { display: none; }
  .stock-page-actions .btn.primary { flex: 2; }
  .stock-main { padding: 10px; border-radius: 16px; }
  .stock-tabs-line .stock-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stock-tabs-line .stock-tabs button { font-size: 12px; }
  .stock-body.with-panel { grid-template-columns: minmax(0, 1fr); }
  .stock-body.with-panel .stock-panel { position: fixed; inset: 0; z-index: 90; border-radius: 0; max-height: none; padding: 12px 16px 24px; }
  .panel-back { display: inline-flex; }
  .stock-panel-head .icon-btn { display: none; }
  .hide-mobile { display: none; }
  .stock-table td, .stock-table th { padding: 8px 5px; }
  .stock-table .table-wrap, .stock-list > .table-wrap { margin: 0; padding: 0; }
  .stock-list > .table-wrap table { min-width: 0; }
  .stock-list > .table-wrap td { white-space: normal; }
  .stock-kpis { gap: 8px; }
  .stock-kpis .kpi { padding: 10px 12px; gap: 3px; border-radius: 14px; }
  .stock-kpis .kpi-label { font-size: 11px; }
  .stock-kpis .kpi-value { font-size: 22px; }
  .stock-kpis .kpi-sub { font-size: 11px; }
  .stock-page { gap: 10px; }
  .stock-page-head h2 { font-size: 19px; }
}
.move-list { display: flex; flex-direction: column; gap: 6px; }
.move-row { border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; background: var(--surface); }
.move-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.move-line .chip { margin: 0; }
.move-qty { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Bling ---------- */
.bling-json { background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: 12px; max-height: 50vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.bling-desc { white-space: pre-wrap; font-family: inherit; margin: 6px 0 0; font-size: 13px; }
.bling-preview { margin-bottom: 8px; }
.bling-fields { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 8px 0; font-size: 13px; }
.bling-fields dt { color: var(--muted); font-weight: 600; }
.bling-fields dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Promoções ---------- */
.promo-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.promo-check { margin: 6px 0 4px; font-size: 14px; }
.promo-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.promo-sub { font-size: 15px; margin: 18px 0 8px; }
.promo-rules { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.promo-rule { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.promo-rule .chip { margin: 0; }
.promo-rule-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo-rule select { width: auto; }
.promo-pct { width: 80px; }
.promo-rules-view { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.promo-down { color: var(--ok); }
.promo-up { color: var(--warn); }
.promo-facts { gap: 16px; }
.promo-scroll { max-height: 55vh; overflow: auto; }
.promo-skipped { margin-top: 12px; }
.promo-skipped ul { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.promo-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 60vh; overflow: auto; }
.promo-result { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.promo-result.product { flex-direction: column; align-items: stretch; }
.promo-result .grow { flex: 1; min-width: 0; }
.promo-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.promo-variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (max-width: 760px) {
  .promo-form { grid-template-columns: 1fr; }
  .promo-rule { flex-wrap: wrap; }
  .promo-rule-title { flex-basis: 100%; order: -1; white-space: normal; }
}
.promo-type { margin-bottom: 12px; gap: 12px; }
.promo-form-2 { grid-template-columns: 2fr 1fr; max-width: 640px; }
.promo-unit { width: auto; }
.promo-match { flex: 1 1 200px; min-width: 160px; font-size: 13px; }
.promo-rule { flex-wrap: wrap; }

/* ---------- Estoque: por corte e tamanho ---------- */
.stock-view-line { margin-bottom: 10px; }
.stock-group-hint { margin: -2px 0 10px; }
.grouped-table td { padding-top: 6px; padding-bottom: 6px; }
.grouped-table .col-shape-icon { width: 34px; padding-right: 0; }
.shape-icon { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; opacity: .8; display: block; }
.grouped-table tr.first td { border-top: 2px solid var(--border); }
.grouped-table tr.empty td:not(.col-shape-icon) { color: var(--muted); }
.grouped-table tr.open td { background: var(--primary-soft); }
.grouped-table .group-qty { font-size: 15px; }
.grouped-table .group-subtotal td { background: var(--surface-2); border-bottom: 0; padding-top: 4px; padding-bottom: 4px; }
.group-detail td { background: var(--surface-2); }
.group-stones { display: flex; flex-wrap: wrap; gap: 6px; }
.group-stone { margin: 0; font-weight: 500; }
.group-stone.used { opacity: .55; text-decoration: line-through; }
@media (max-width: 760px) {
  .grouped-table { table-layout: fixed; width: 100%; }
  .grouped-table td, .grouped-table th { padding-left: 4px; padding-right: 4px; }
  .grouped-table .col-shape-icon { width: 30px; }
  .grouped-table th.col-order-check { width: 30px; }
  .grouped-table th:nth-child(3) { width: 30%; }
  .grouped-table th:nth-child(5) { width: 112px; }
  .group-stone { white-space: normal; text-align: left; }
}
.stock-level { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 8px; margin-right: 8px; vertical-align: 1px; letter-spacing: .02em; }
.stock-level.low { background: #fff1cc; color: #a15c00; }
.stock-level.zero { background: var(--danger-soft); color: var(--danger); }
.grouped-table tr.empty .stock-level.zero { opacity: .85; }
.low-at { display: inline-flex; align-items: center; gap: 6px; }
.low-at input { width: 56px; padding: 4px 6px; }

/* ---------- Encomenda ao fornecedor ---------- */
.col-order-check { width: 34px; padding-right: 0 !important; text-align: center; }
.order-check { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.stock-table tr.ordered td { background: #f3fbf6; }
.group-order td { background: #f3fbf6; border-top: 0; padding-top: 2px !important; }
.order-editor { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.order-editor .icon-btn.square { width: 30px; height: 30px; }
.order-qty { width: 64px; text-align: center; padding: 5px 6px; }
.order-note { flex: 1 1 160px; min-width: 120px; padding: 5px 8px; font-size: 13px; }
.order-bar {
  position: sticky; bottom: 12px; z-index: 40; margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 12px 10px 16px; box-shadow: var(--shadow-lg);
}
.order-bar[hidden] { display: none; }
.order-bar-text { flex: 1; font-weight: 700; }
.order-bar .btn.subtle { color: #fff; }
.order-bar .btn.subtle:hover { background: rgba(255, 255, 255, .14); }
.order-count { background: var(--primary); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; margin-left: 4px; }
.order-modal { max-width: 640px; }
.order-group h4 { margin-top: 12px; }
.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.order-list li { border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.order-name { display: flex; align-items: center; gap: 6px; }
.order-name .shape-icon { width: 20px; height: 20px; }
.order-add { margin: 12px 0; }
.order-add summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.order-add .row { margin-top: 8px; }
.order-add input:not(.order-qty) { flex: 1 1 180px; }
.order-text { background: var(--surface-2); border-radius: 12px; padding: 12px; white-space: pre-wrap; font: inherit; font-size: 13px; }
.order-history { margin-top: 14px; }
.order-history summary { cursor: pointer; font-weight: 700; }
.melee-row.with-check { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.melee-row.ordered { background: #f3fbf6; }
.melee-order { grid-column: 1 / -1; }

/* Obrigatoriedades */
.req-columns { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.req-column { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) 220px; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border, #dfe1e6); border-radius: 8px; }
.req-column-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.req-column-head .small { white-space: nowrap; }
.req-rules { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.req-rule { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.req-column select { width: 100%; }
.chip-x { display: inline-flex; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; opacity: .7; }
.chip-x:hover { opacity: 1; }
.req-notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.4; }
.req-notice[hidden] { display: none; }
.req-notice svg { flex: none; margin-top: 1px; }
.blocked-list { list-style: none; margin: 8px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow: auto; }
.blocked-list a { font-weight: 600; }
@media (max-width: 640px) {
  .req-column { grid-template-columns: 1fr; }
  .req-rules:empty { display: none; }
}

/* Modelos de card */
.card-model {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; width: fit-content; align-self: flex-start; margin-bottom: 4px;
  padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.6;
  background: color-mix(in srgb, var(--model) 55%, white); color: var(--ink, #1f1d2b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-model::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--model); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: none; }
.card-model.small { margin: 0 0 0 6px; font-size: 10px; vertical-align: middle; }
.model-select { margin-left: 2px; border-radius: 999px; padding: 2px 8px; box-shadow: inset 4px 0 0 var(--model); }
.add-card-model { width: 100%; margin: 6px 0; }
.template-box { margin: 12px 0; }
.template-box legend { padding: 0 4px; }
.template-box legend .card-model { margin: 0; font-size: 12px; }
.model-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.model-matrix th, .model-matrix td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.model-matrix th:first-child, .model-matrix td:first-child { text-align: left; }
.model-matrix th .card-model { margin: 0; }
.model-matrix input { width: 18px; height: 18px; }

/* ---------- Menu lateral (áreas, equipe, configurações) ---------- */
body { flex-direction: row; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-main > main { flex: 1; min-height: 0; }
.sidenav {
  width: 232px; flex: none; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; overflow-y: auto; overflow-x: hidden;
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-right: 1px solid rgba(255, 255, 255, .9); z-index: 6; transition: width .18s ease;
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px; }
.nav-brand .logo { flex: none; }
.nav-brand .nav-lbl { flex: 1; min-width: 0; }
.nav-brand b, .nav-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-brand small, .nav-user small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.nav-collapse { flex: none; color: var(--muted); }
.nav-section { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 6px; white-space: nowrap; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.nav-item:hover { background: rgba(124, 92, 255, .08); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .icon { flex: none; }
.nav-ico { position: relative; display: inline-flex; flex: none; }
.nav-ico .badge-count { top: -8px; right: -10px; }
.nav-lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-spacer { flex: 1; min-height: 12px; }
.nav-user { border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; margin-top: 4px; padding-top: 12px; }
.nav-user .avatar { flex: none; }
.nav-scrim, .menu-btn, .m-only { display: none; }

/* Recolhida: só os ícones (o nome aparece ao passar o mouse) */
body.nav-collapsed .sidenav { width: 64px; padding-left: 8px; padding-right: 8px; }
body.nav-collapsed .sidenav .nav-lbl, body.nav-collapsed .nav-section { display: none; }
body.nav-collapsed .nav-brand { flex-direction: column; gap: 8px; padding: 2px 0 8px; }
body.nav-collapsed .nav-item { justify-content: center; padding: 9px 0; }
body.nav-collapsed .nav-collapse .icon { transform: scaleX(-1); }
body.nav-collapsed .nav-list { padding-top: 6px; border-top: 1px solid var(--border); }

/* Barra de cima: só as ferramentas do quadro */
.topbar { flex-wrap: nowrap; gap: 10px; }
.board-switch { display: flex; align-items: center; min-width: 0; }
.board-select { font-size: 17px; font-weight: 800; padding: 6px 30px 6px 12px; max-width: 320px; }
.top-actions { flex-wrap: nowrap; }
body[data-view="dashboard"] .topbar .search, body[data-view="stock"] .topbar .search,
body[data-view="dashboard"] .top-actions, body[data-view="stock"] .top-actions { display: none; }
@media (max-width: 1180px) and (min-width: 761px) {
  .top-actions .top-btn .lbl { display: none; }
  .top-actions .top-btn { padding: 8px; }
}

/* ---------- Celular: barra do app + menu de gaveta ---------- */
@media (max-width: 760px) {
  .sidenav {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px) !important; transform: translateX(-102%); transition: transform .22s ease;
    background: rgba(255, 255, 255, .97); z-index: 60; box-shadow: 0 0 40px rgba(42, 37, 64, .25);
    padding: calc(12px + env(safe-area-inset-top, 0px)) 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  body.nav-open .sidenav { transform: none; }
  /* No celular a gaveta mostra sempre os nomes, mesmo com a lateral recolhida no computador */
  body.nav-collapsed .sidenav .nav-lbl, body.nav-collapsed .nav-section { display: revert; }
  body.nav-collapsed .nav-brand { flex-direction: row; }
  body.nav-collapsed .nav-item { justify-content: flex-start; padding: 9px 10px; }
  body.nav-collapsed .nav-list { border-top: 0; padding-top: 0; }
  .nav-collapse { display: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(30, 26, 50, .35); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; row-gap: 8px; }
  .menu-btn, .m-only { display: inline-flex; }
  .menu-btn { width: 40px; height: 40px; align-items: center; justify-content: center; color: var(--ink); }
  .board-switch { flex: 1; }
  .board-select { font-size: 16px; max-width: 100%; }
  .board-name { flex: 1 1 0; min-width: 0; max-width: none; font-size: 16px; padding: 4px 6px; text-overflow: ellipsis; }
  .topbar .search { display: none; }
  .topbar .search.open { display: flex; order: 5; flex: 1 0 100%; max-width: none; }
  .search input { padding: 7px 0; }
  .m-only.top-btn { padding: 8px; }
  .top-actions { order: 6; flex: 1 0 100%; margin: 0; overflow-x: auto; gap: 6px; scrollbar-width: none; justify-content: flex-start; }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions .top-btn { flex: none; padding: 6px 12px; font-size: 13px; }
  .top-actions .top-btn .lbl { display: inline; }
}
.sort-tag { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 999px; background: var(--primary-soft); color: var(--primary); cursor: pointer; flex: none; }
.menu-note { padding: 2px 10px 4px; }

/* Varal de Ideias: ocupa a área toda (ele tem as próprias ferramentas) */
.varal-view { position: relative; padding: 0; overflow: hidden; background: #eceee9; }
.varal-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
body[data-view="varal"] .top-actions, body[data-view="varal"] .board-switch { display: none; }
@media (min-width: 761px) { body[data-view="varal"] .topbar { display: none; } }
body[data-view="varal"] .m-only.top-btn:not(.bell) { display: none; }
.promo-moved { margin: 0 0 16px; } .promo-moved p { margin: 6px 0 10px; }
