:root {
  --nufarm: #00aa4e;
  --nufarm-dark: #007a38;
  --ink: #0a0a0a;
  --muted: #5b635e;
  --line: #e4ebe6;
  --paper: #f5f7f5;
  --card: #ffffff;
  --wakeup: #00a3ff;
  --ok: #00d294;
  --wa-teal: #008069;
  --wa-head: #008069;
  --wa-out: #d9fdd3;
  --wa-in: #ffffff;
  --wa-bg: #efeae2;
  --radius: 18px;
  font-family: Inter, "Noto Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: var(--paper); color: var(--ink); }
body { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand h1 { font-size: 18px; letter-spacing: -0.02em; line-height: 1.15; }
.brand p { font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 2px; max-width: 680px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.btn {
  appearance: none;
  border: 0;
  background: var(--nufarm);
  color: #fff;
  font: 600 14px/1 Inter, sans-serif;
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--nufarm-dark); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: #eef3ef; color: var(--ink); }
.btn.ghost:hover { background: #e1eae4; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.active { box-shadow: 0 0 0 3px rgba(0,170,78,.28); }

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 28px;
  padding: 24px 28px 36px;
  align-items: start;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.phone-col { display: flex; flex-direction: column; align-items: center; }
.phone-caption, .board-foot {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.board-foot { text-align: right; padding-right: 4px; }

.device {
  position: relative;
  width: 360px;
  height: 740px;
  padding: 11px;
  border-radius: 54px;
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e 40%, #0e0e10);
  box-shadow:
    0 30px 60px rgba(0,0,0,.28),
    0 0 0 1px #000,
    inset 0 0 0 1px rgba(255,255,255,.12);
}
.device-side {
  position: absolute;
  width: 4px;
  background: #2a2a2c;
  border-radius: 2px;
}
.device-side.left { left: -3px; top: 120px; height: 36px; box-shadow: 0 52px 0 0 #2a2a2c, 0 100px 0 0 #2a2a2c; }
.device-side.right { right: -3px; top: 180px; height: 86px; }
.device-screen {
  position: relative;
  height: 100%;
  border-radius: 44px;
  overflow: hidden;
  background: #000;
}
.island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 112px;
  height: 30px;
  background: #000;
  border-radius: 20px;
  z-index: 8;
}

.wa { display: flex; flex-direction: column; height: 100%; background: var(--wa-bg); color: #111; }
.wa-status {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 12px 22px 0 28px;
  height: 44px;
  background: var(--wa-head);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.wa-status-icons { display: flex; gap: 6px; align-items: center; opacity: 0.95; }
.wa-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--wa-head);
  color: #fff;
  padding: 8px 12px 10px;
}
.wa-back { background: none; border: 0; padding: 4px 4px 0 0; cursor: default; }
.wa-avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: contain; padding: 3px; }
.wa-who { display: flex; flex-direction: column; }
.wa-who strong { font-size: 16px; font-weight: 600; }
.wa-who span { font-size: 12px; opacity: 0.9; }

.wa-thread {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
  background-color: #efeae2;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(0,0,0,.03) 1.2px, transparent 1.4px),
    radial-gradient(circle at 68% 42%, rgba(80,60,20,.035) 1px, transparent 1.3px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-thread::-webkit-scrollbar { width: 0; }

.msg { display: flex; flex-direction: column; max-width: 82%; animation: pop .22s ease; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; }
.bubble {
  border-radius: 8px;
  padding: 6px 8px 4px 8px;
  font-size: 14.5px;
  line-height: 1.35;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(0,0,0,.08);
  word-wrap: break-word;
}
.msg.in .bubble { background: var(--wa-in); border-top-left-radius: 0; }
.msg.out .bubble { background: var(--wa-out); border-top-right-radius: 0; }
.bubble .meta {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: #667781;
  margin-top: 2px;
  padding-left: 16px;
}
.checks { color: #53bdeb; font-size: 13px; letter-spacing: -1px; }
.bubble p { white-space: pre-wrap; }
.bubble img.photo {
  width: 210px;
  height: auto;
  border-radius: 6px;
  display: block;
  margin-bottom: 4px;
}

.voice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
  padding: 4px 2px 2px;
}
.voice-play {
  width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: #008069; color: #fff;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.wave { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1; }
.wave i {
  display: block; width: 3px; background: #0b7c66; border-radius: 2px;
  transform-origin: center;
}
.wave.playing i { animation: bar 0.9s ease-in-out infinite; }
.wave.playing i:nth-child(2n) { animation-delay: .12s; }
.wave.playing i:nth-child(3n) { animation-delay: .24s; }
.voice-dur { font-size: 12px; color: #667781; width: 28px; }

.typing { display: flex; gap: 4px; padding: 10px 14px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa3a0;
  animation: typ 1s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

.wa-record[hidden] { display: none !important; }
.wa-record {
  display: flex; align-items: center; gap: 10px;
  background: #fff; padding: 10px 16px; color: #d32f2f; font-weight: 600; font-size: 14px;
}
.wa-record .rec-label { color: var(--ink); font-weight: 500; }
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #d32f2f;
  animation: pulse 1s infinite;
}

.wa-composer {
  display: flex; align-items: center; gap: 6px;
  background: #f0f2f5; padding: 8px 8px 16px;
}
.wa-composer input {
  flex: 1; border: 0; background: #fff; border-radius: 20px;
  padding: 9px 14px; font: 15px/1.3 Inter, sans-serif; outline: none;
}
.icon-btn {
  width: 38px; height: 38px; border: 0; background: none; color: #54656f;
  display: grid; place-items: center; cursor: pointer; border-radius: 50%;
}
.icon-btn.send { background: var(--wa-teal); color: #fff; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

.board {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 24px 16px;
  box-shadow: 0 10px 30px rgba(10,20,10,.05);
  min-height: 740px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.board-title { display: flex; align-items: center; gap: 12px; }
.board-title img { width: 42px; height: 42px; object-fit: contain; }
.board-title h2 { font-size: 22px; letter-spacing: -0.03em; }
.board-title p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.live {
  display: inline-flex; align-items: center; gap: 8px;
  background: #e9f8ef; color: var(--nufarm-dark);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--nufarm); animation: pulse 1.4s infinite; }

.kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.kpi.hero { background: #f3fbf6; border-color: #cfead9; }
.kpi.hero.flash { animation: flash 1.1s ease; }
.kpi-label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin-top: 4px; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-note { display: block; margin-top: 6px; font-size: 13px; color: var(--nufarm-dark); font-weight: 600; min-height: 1.2em; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.stock { width: 100%; border-collapse: collapse; font-size: 14px; }
.stock th, .stock td { padding: 11px 14px; text-align: right; }
.stock th { background: #f3f6f4; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: right; }
.stock th:first-child, .stock td:first-child, .stock th:nth-child(2), .stock td:nth-child(2) { text-align: left; }
.stock td { border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stock tr.hit td.hit { background: #d9f7e6; color: var(--nufarm-dark); font-weight: 800; transition: background .4s ease; }
.stock .total { font-weight: 700; }

.feed-wrap h3 { font-size: 14px; margin-bottom: 10px; }
.feed { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.feed li {
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
  animation: pop .25s ease;
}
.feed li strong { font-weight: 700; }
.feed li .when { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.feed-empty { color: var(--muted); background: transparent !important; padding-left: 0 !important; animation: none !important; }

@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes typ { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-3px); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes bar { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(0,170,78,.45); } 100% { box-shadow: 0 0 0 16px rgba(0,170,78,0); } }

@media (max-width: 980px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  .stage { grid-template-columns: 1fr; padding: 16px; }
  .kpis { grid-template-columns: 1fr; }
  .device { width: min(360px, 100%); height: 700px; }
  .board { min-height: 0; }
  .board-foot { text-align: center; }
}
