/* ═══════════════════════════════════════════════
   calc.css — LaColmeia 3D Calculator Styles
   Light-mode professional design inspired by calc.md
   PC-first (12-col grid: 4 left + 8 right)
═══════════════════════════════════════════════ */
*,*::before,*::after{box-sizing:border-box;}

/* ═══ MAIN WRAPPER ═══ */
#calc-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  min-height: 100vh;
  padding: 1rem 1.5rem 6rem;
  margin-top: 72px;
  color: #1e293b;
}

.ca-container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ═══ TOOLBAR ═══ */
.ca-toolbar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: .85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ca-toolbar-brand { display: flex; align-items: center; gap: .6rem; }
.ca-brand-icon {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ca-brand-title { font-size: 1.2rem; font-weight: 800; color: #1e293b; line-height: 1.1; }
.ca-brand-sub { font-size: .7rem; font-weight: 600; color: #94a3b8; letter-spacing: .08em; display: flex; align-items: center; gap: .35rem; }
.ca-dot { color: #cbd5e1; }
.ca-clock { color: #3b82f6; font-weight: 700; }
.ca-toolbar-toggle { display: none; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: .4rem .7rem; font-size: .85rem; color: #64748b; cursor: pointer; margin-left: auto; font-family: inherit; }
.ca-toolbar-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; align-items: center; }
.ca-input-product-wrap { position: relative; }
.ca-input-product-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
#inp-product {
  font-weight: 700; color: #1e293b; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: .5rem .8rem .5rem 2rem; font-size: .88rem; width: 220px; outline: none; font-family: inherit;
  transition: border-color .2s;
}
#inp-product:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

/* ═══ BUTTONS ═══ */
.ca-btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .85rem; border-radius: 10px;
  font-weight: 600; font-size: .82rem; cursor: pointer; border: 1px solid #e2e8f0; transition: all .2s;
  font-family: inherit; background: #fff; color: #64748b; white-space: nowrap;
}
.ca-btn:hover { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.ca-btn-ghost { color: #94a3b8; } .ca-btn-ghost:hover { color: #ef4444; border-color: #fecaca; background: #fef2f2; }
.ca-btn-primary { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; } .ca-btn-primary:hover { background: #dbeafe; }
.ca-btn-dark { background: #1e293b; color: #fff; border-color: #1e293b; } .ca-btn-dark:hover { background: #334155; }
.ca-btn-green { background: #16a34a; color: #fff; border-color: #16a34a; } .ca-btn-green:hover { background: #15803d; }
.ca-btn-indigo { background: #4f46e5; color: #fff; border-color: #4f46e5; } .ca-btn-indigo:hover { background: #4338ca; }

/* ═══ DROPDOWNS ═══ */
.ca-dd-wrap { position: relative; }
.ca-dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px; min-width: 240px; z-index: 500; box-shadow: 0 12px 40px rgba(0,0,0,.12);
  overflow: hidden; display: none;
}
.ca-dd-menu.open { display: block; animation: caFadeIn .2s ease; }
.ca-dd-header { padding: .5rem .8rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.ca-dd-item { display: flex; align-items: center; gap: .65rem; padding: .6rem .8rem; cursor: pointer; transition: background .15s; border-bottom: 1px solid #f1f5f9; }
.ca-dd-item:last-child { border-bottom: none; }
.ca-dd-item:hover { background: #f8fafc; }
.ca-dd-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.ca-dd-icon.blue { background: #eff6ff; } .ca-dd-icon.green { background: #f0fdf4; } .ca-dd-icon.indigo { background: #eef2ff; }
.ca-dd-item strong { display: block; font-size: .82rem; font-weight: 700; color: #1e293b; }
.ca-dd-item span { font-size: .7rem; color: #94a3b8; }
@keyframes caFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ CATALOG MODAL ═══ */
.ca-catalog-modal { display: none; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.2rem; margin-bottom: 1.25rem; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.ca-catalog-modal.open { display: block; animation: caFadeIn .2s ease; }
.ca-catalog-tabs { display: flex; gap: 1rem; border-bottom: 1px solid #e2e8f0; margin-bottom: 1rem; align-items: center; }
.ca-tab { padding: .5rem 0; font-size: .82rem; font-weight: 700; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; color: #94a3b8; font-family: inherit; transition: all .2s; }
.ca-tab.active { border-bottom-color: #3b82f6; color: #2563eb; }
.ca-catalog-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #94a3b8; padding: .2rem .4rem; }
.ca-catalog-close:hover { color: #ef4444; }
.ca-saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.saved-item { border: 1px solid #e2e8f0; border-radius: 12px; padding: .75rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: all .2s; background: #fff; }
.saved-item:hover { background: #f8fafc; border-color: #cbd5e1; }
.saved-name { font-weight: 700; font-size: .82rem; color: #1e293b; }
.saved-sub { font-size: .72rem; color: #94a3b8; }
.del-btn { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; border-radius: 8px; padding: .3rem .5rem; cursor: pointer; font-family: inherit; font-size: .78rem; }
.del-btn:hover { background: #fee2e2; }

/* ═══ MAIN GRID ═══ */
.ca-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
.ca-left { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ca-right { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

/* ═══ CARDS ═══ */
.ca-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04); transition: border-color .3s; }
.ca-card:hover { border-color: #cbd5e1; }
.ca-card-bordered-green { border-color: #bbf7d0; } .ca-card-bordered-green:hover { border-color: #86efac; }
.ca-card-bordered-orange { border-color: #fed7aa; } .ca-card-bordered-orange:hover { border-color: #fdba74; }
.ca-card-bordered-yellow { border-color: #fde68a; } .ca-card-bordered-yellow:hover { border-color: #fcd34d; }
.ca-card-bordered-indigo { border-color: #c7d2fe; } .ca-card-bordered-indigo:hover { border-color: #a5b4fc; }
.ca-card-bordered-tiktok { border-color: #e9d5ff; } .ca-card-bordered-tiktok:hover { border-color: #c084fc; }

.ca-card-head {
  padding: .7rem 1.1rem; font-weight: 700; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .07em; display: flex; align-items: center; gap: .45rem;
  border-bottom: 1px solid #e2e8f0;
}
.ca-card-head-dark { background: #1e293b; color: #fff; border-bottom-color: #1e293b; }
.ca-card-head-green { background: #059669; color: #fff; border-bottom-color: #059669; }
.ca-card-head-orange { background: #ea580c; color: #fff; border-bottom-color: #ea580c; justify-content: space-between; }
.ca-card-head-yellow { background: #fde047; color: #1e293b; border-bottom-color: #fde047; justify-content: space-between; font-weight: 900; }
.ca-card-head-indigo { background: #4f46e5; color: #fff; border-bottom-color: #4f46e5; }
.ca-card-head-tiktok { background: linear-gradient(135deg, #000, #25f4ee); color: #fff; border-bottom-color: #000; }
.ca-card-head-hint { font-weight: 500; opacity: .7; font-size: .7rem; text-transform: none; letter-spacing: 0; }
.ca-card-head select {
  background: rgba(255,255,255,.15); color: inherit; border: none; border-radius: 6px;
  font-size: .72rem; font-weight: 700; padding: .2rem .5rem; cursor: pointer; font-family: inherit;
}
.ca-card-body { padding: 1.25rem; }

/* ═══ FORMS ═══ */
.ca-form-group { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .7rem; }
.ca-label { font-size: .75rem; font-weight: 600; color: #64748b; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-label-row { display: flex; justify-content: space-between; align-items: center; }
.ca-hint { font-weight: 500; color: #94a3b8; font-size: .72rem; }
.ca-input-wrap {
  display: flex; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc;
  transition: border-color .2s, box-shadow .2s;
}
.ca-input-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.08); }
.ca-input-big input { font-size: 1.05rem !important; font-weight: 900 !important; }
.ca-addon {
  background: #f1f5f9; padding: .4rem .6rem; font-size: .82rem; font-weight: 700;
  color: #64748b; border-right: 1px solid #e2e8f0; display: flex; align-items: center; flex-shrink: 0;
}
.ca-addon.right { border-right: none; border-left: 1px solid #e2e8f0; }
.ca-input-wrap input, .ca-select {
  flex: 1; background: transparent; border: none; outline: none; padding: .4rem .6rem;
  font-size: .82rem; color: #1e293b; font-family: inherit; min-width: 0;
}
.ca-select { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: .5rem .6rem; width: 100%; cursor: pointer; }
.ca-select option { background: #fff; color: #1e293b; }
.ca-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .75rem; }
.ca-static-value {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: .45rem .65rem;
  font-size: .88rem; font-weight: 800; color: #1e293b;
}
.ca-static-indigo { color: #4f46e5; font-size: 1.15rem; background: #eef2ff; border-color: #c7d2fe; padding: .6rem .75rem; }
.ca-section-divider {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8;
  margin: .6rem 0 .4rem; display: flex; align-items: center; gap: .35rem;
  border-top: 1px solid #f1f5f9; padding-top: .6rem;
}
.ca-btn-apply-suggestion {
  background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; border-radius: 20px;
  padding: .2rem .6rem; font-size: .68rem; font-weight: 700; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: .3rem; transition: all .2s;
}
.ca-btn-apply-suggestion:hover { background: #d1fae5; }

/* ═══ COST CARD ═══ */
.ca-cost-card {
  background: #1e293b; border-radius: 16px; padding: 1.2rem; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.ca-cost-glow { position: absolute; top: -30px; right: -30px; width: 100px; height: 100px; border-radius: 50%; background: rgba(59,130,246,.12); filter: blur(20px); }
.ca-cost-label { font-size: .72rem; font-weight: 700; color: #94a3b8; display: flex; align-items: center; gap: .35rem; text-transform: uppercase; letter-spacing: .05em; position: relative; z-index: 1; }
.ca-cost-value { font-size: 2rem; font-weight: 900; color: #34d399; margin: .2rem 0 .8rem; position: relative; z-index: 1; }
.ca-bar-wrap { width: 100%; height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; display: flex; margin-bottom: .6rem; position: relative; z-index: 1; }
.ca-bar-seg { height: 100%; transition: width .4s ease; }
.ca-bar-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .6rem; font-size: .68rem; color: #94a3b8; position: relative; z-index: 1; }
.ca-leg { display: flex; align-items: center; gap: .3rem; }
.ca-leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ═══ META BOX ═══ */
.ca-meta-box {
  background: linear-gradient(135deg, #3b82f6, #4f46e5); border-radius: 16px; padding: 1.25rem;
  color: #fff; box-shadow: 0 4px 16px rgba(59,130,246,.2);
}
.ca-meta-top { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.ca-meta-icon { background: rgba(255,255,255,.2); border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.ca-meta-title { font-weight: 800; font-size: 1rem; line-height: 1.2; }
.ca-meta-sub { font-size: .72rem; color: rgba(255,255,255,.75); margin-top: .15rem; }
.ca-meta-input-wrap {
  display: flex; background: #fff; border-radius: 10px; overflow: hidden; margin-left: auto; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.ca-meta-addon { padding: .5rem .7rem; background: #eff6ff; color: #1e40af; font-weight: 800; font-size: .9rem; border-right: 1px solid #dbeafe; display: flex; align-items: center; }
.ca-meta-input-wrap input { width: 90px; border: none; outline: none; padding: .5rem .6rem; font-size: 1.1rem; font-weight: 900; color: #1e40af; text-align: center; font-family: inherit; }
.ca-meta-results { background: rgba(255,255,255,.12); border-radius: 12px; padding: .8rem; margin-top: .8rem; }
.ca-meta-results-label { text-align: center; font-size: .62rem; text-transform: uppercase; font-weight: 800; letter-spacing: .1em; color: rgba(255,255,255,.6); margin-bottom: .5rem; }
.ca-meta-channels { display: flex; justify-content: space-around; align-items: center; text-align: center; }
.ca-meta-ch { flex: 1; }
.ca-meta-ch-label { font-size: .65rem; font-weight: 700; color: rgba(255,255,255,.6); margin-bottom: .2rem; }
.ca-meta-ch-value { font-size: 1.05rem; font-weight: 800; color: #fff; }
.ca-meta-ch-divider { width: 1px; height: 30px; background: rgba(255,255,255,.2); flex-shrink: 0; margin: 0 .3rem; }
.ca-meta-apply {
  width: 100%; margin-top: .6rem; background: #fff; color: #1e40af; border: none; border-radius: 10px;
  padding: .55rem; font-weight: 800; font-size: .78rem; cursor: pointer; font-family: inherit;
  text-transform: uppercase; letter-spacing: .05em; transition: all .2s;
}
.ca-meta-apply:hover { background: #eff6ff; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* ═══ VENDA DIRETA LAYOUT ═══ */
.ca-direct-layout { display: flex; gap: 1.5rem; }
.ca-direct-inputs { flex: 1.2; min-width: 0; }
.ca-direct-result {
  flex: 1; min-width: 200px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 16px;
  padding: 1.2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.ca-result-label-green { font-size: .7rem; font-weight: 800; color: #059669; text-transform: uppercase; letter-spacing: .04em; }
.ca-result-big { font-size: 2.2rem; font-weight: 900; color: #059669; margin: .3rem 0; line-height: 1.1; }
.ca-result-big.neg { color: #ef4444; }
.ca-result-badge {
  display: inline-block; padding: .25rem .8rem; border-radius: 999px; font-size: .75rem; font-weight: 800;
  background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; margin: .3rem 0;
}
.ca-result-badge.neg { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.ca-result-bolso-section {
  width: 100%; border-top: 1px solid rgba(5,150,105,.15); padding-top: .6rem; margin-top: .5rem;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
.ca-result-bolso-label { font-size: .65rem; font-weight: 700; color: #059669; text-transform: uppercase; }
.ca-result-bolso-value { font-size: 1.15rem; font-weight: 900; color: #1e293b; }

/* ═══ CHANNEL ROW (side by side) ═══ */
.ca-channel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.ca-channel-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.ca-channel-row > .ca-card { display: flex; flex-direction: column; }
.ca-channel-body { display: flex; flex-direction: column; flex: 1; }
.ca-channel-info {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: .6rem .8rem;
  margin-bottom: .8rem;
}
.ca-info-line { display: flex; justify-content: space-between; font-size: .78rem; padding: .2rem 0; }
.ca-info-line span:first-child { color: #64748b; font-weight: 600; }
.ca-info-line span:last-child { color: #1e293b; font-weight: 800; }
.ca-channel-profit {
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px; padding: .8rem;
  text-align: center; margin-top: auto;
}
.ca-result-medium { font-size: 1.4rem; font-weight: 900; color: #059669; margin: .2rem 0; }
.ca-result-medium.neg { color: #ef4444; }
.ca-result-bolso-inline { font-size: .78rem; font-weight: 700; color: #059669; display: flex; align-items: center; justify-content: center; gap: .3rem; margin-top: .3rem; }
.ca-result-bolso-inline span:last-child { color: #1e293b; font-weight: 900; }

/* ═══ ATACADO LAYOUT ═══ */
.ca-atacado-layout { display: flex; gap: 1.5rem; }
.ca-atacado-inputs { flex: 1; min-width: 0; }
.ca-atacado-results { flex: 1.3; min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
.ca-atacado-total-box {
  background: linear-gradient(135deg, rgba(79,70,229,.08), #fff); border: 1px solid #c7d2fe;
  border-radius: 16px; padding: 1.2rem; text-align: center;
}
.ca-atacado-total-label { font-size: .78rem; font-weight: 800; color: #4f46e5; text-transform: uppercase; letter-spacing: .05em; }
.ca-atacado-total-value { font-size: 2rem; font-weight: 900; color: #4f46e5; margin-top: .3rem; }
.ca-atacado-halves { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.ca-atacado-half { border-radius: 12px; padding: .75rem; text-align: center; }
.ca-atacado-half.blue { background: #eff6ff; border: 1px solid #bfdbfe; }
.ca-atacado-half.amber { background: #fffbeb; border: 1px solid #fde68a; }
.ca-atacado-half-label { font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.ca-atacado-half.blue .ca-atacado-half-label { color: #1e40af; }
.ca-atacado-half.amber .ca-atacado-half-label { color: #92400e; }
.ca-atacado-half-value { font-size: 1.15rem; font-weight: 900; margin-top: .15rem; }
.ca-atacado-half.blue .ca-atacado-half-value { color: #1e3a8a; }
.ca-atacado-half.amber .ca-atacado-half-value { color: #78350f; }

/* ═══ HEALTH BADGE ═══ */
.health-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .7rem; border-radius: 999px; font-size: .7rem; font-weight: 800; margin-top: .3rem; }
.health-otimo { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.health-bom { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.health-baixo { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.health-prejuizo { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ═══ TOAST ═══ */
#toast {
  position: fixed; top: 5rem; right: 1rem; background: #1e293b; color: #fff;
  padding: .6rem 1rem; border-radius: 12px; font-size: .82rem; font-weight: 600;
  display: none; z-index: 9999; align-items: center; gap: .4rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
#toast.show { display: flex; animation: caFadeIn .3s ease; }

/* ═══ VALUE PULSE ═══ */
@keyframes valuePulse { 0%{opacity:.5;transform:scale(.97)} 50%{opacity:1;transform:scale(1.02)} 100%{opacity:1;transform:scale(1)} }
.value-updated { animation: valuePulse .35s ease; }

/* ═══ RESPONSIVE — Tablet ═══ */
@media (max-width: 1100px) {
  .ca-grid { grid-template-columns: minmax(300px, 360px) 1fr; }
}

/* ═══ RESPONSIVE — Mobile ═══ */
@media (max-width: 900px) {
  .ca-grid { grid-template-columns: 1fr; }
  .ca-left { position: static !important; }
  .ca-channel-row, .ca-channel-row-3 { grid-template-columns: 1fr; }
  .ca-direct-layout { flex-direction: column; }
  .ca-atacado-layout { flex-direction: column; }
  .ca-meta-top { flex-direction: column; align-items: flex-start; }
  .ca-meta-input-wrap { margin-left: 0; width: 100%; }
  .ca-meta-input-wrap input { width: 100%; flex: 1; }
}

@media (max-width: 640px) {
  #calc-app { padding: .75rem .75rem 7rem; margin-top: 64px; }
  .ca-toolbar-toggle { display: flex !important; }
  .ca-toolbar-actions { display: none; width: 100%; flex-direction: column; }
  .ca-toolbar.toolbar-open .ca-toolbar-actions { display: flex; }
  #inp-product { width: 100%; }
  .ca-row-2 { grid-template-columns: 1fr 1fr; gap: .3rem .5rem; }
  .ca-meta-channels { flex-direction: column; gap: .4rem; }
  .ca-meta-ch-divider { width: 100%; height: 1px; margin: 0; }
  .ca-atacado-halves { grid-template-columns: 1fr; }
}
