:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #eef3ec;
  --ink: #16201c;
  --muted: #65736b;
  --line: #dce5dc;
  --brand: #176f5b;
  --brand-dark: #115144;
  --accent: #d65f31;
  --warning: #b57a13;
  --danger: #b94040;
  --good: #237a40;
  --shadow: 0 18px 48px rgba(22, 32, 28, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body:not(.is-authenticated) {
  display: block;
  background: linear-gradient(135deg, #f4f6f2 0%, #e8f1ea 100%);
}
body:not(.is-authenticated) .sidebar,
body:not(.is-authenticated) .shell {
  display: none;
}
body.is-authenticated .login-screen {
  display: none;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); font-weight: 800; text-decoration: none; }
.sidebar {
  min-height: 100vh;
  padding: 22px;
  color: #f7fbf6;
  background: #14231f;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login-brand {
  color: var(--ink);
}
.login-form {
  display: grid;
  gap: 12px;
}
.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}
.demo-users {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--muted);
}
.demo-users strong {
  color: var(--ink);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 8px; background: #e6f3e8; color: #14231f; font-weight: 900;
}
.brand strong, .brand small, .sidebar-note strong, .sidebar-note span { display: block; }
.brand small, .sidebar-note span { color: #adbbb4; margin-top: 3px; }
.workspace-switch { display: grid; gap: 7px; }
.workspace-switch label { color: #adbbb4; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.workspace-switch select, .sidebar select { width: 100%; }
.nav { display: grid; gap: 6px; overflow-y: auto; padding-right: 2px; }
.nav-title { color: #83948b; font-size: 11px; font-weight: 900; text-transform: uppercase; margin: 12px 4px 4px; }
.nav-item {
  border: 1px solid transparent; background: transparent; color: #d7e0da;
  text-align: left; padding: 11px 12px; border-radius: 8px;
}
.nav-item.active, .nav-item:hover { background: #223630; border-color: #39544c; color: #fff; }
.sidebar-note { margin-top: auto; padding: 14px; border: 1px solid #39544c; border-radius: 8px; line-height: 1.4; }
.shell { min-width: 0; padding: 26px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 900; text-transform: uppercase; margin: 0 0 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
select, input, textarea {
  min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); padding: 0 12px; outline-color: var(--brand);
}
textarea { min-height: 88px; padding: 10px 12px; resize: vertical; }
.primary-button, .ghost-button, .mini-button, .danger-button {
  min-height: 40px; border-radius: 8px; border: 1px solid var(--line); padding: 0 14px; background: #fff; color: var(--ink); font-weight: 800;
}
.primary-button { background: var(--brand); color: #fff; border-color: var(--brand); }
.danger-button { background: #fff1f1; color: var(--danger); border-color: #f0c8c8; }
.mini-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.file-button {
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.view { display: none; }
.view.active { display: block; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card, .panel, .metric, .stat-row, .plan-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.metric { padding: 16px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 28px; margin-top: 8px; }
.panel { padding: 18px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.panel-header span, .muted { color: var(--muted); }
.stack { display: grid; gap: 10px; }
.item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa; }
.item-main { min-width: 0; }
.item-main strong, .item-main small { display: block; }
.item-main small { color: var(--muted); margin-top: 4px; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--brand); font-size: 12px; font-weight: 900; white-space: nowrap; }
.badge.good { color: var(--good); background: #e1f4e7; }
.badge.warn { color: var(--warning); background: #fff1ce; }
.badge.bad { color: var(--danger); background: #ffe4e4; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 240px; }
.tenant-notice {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #cce2d5;
  border-radius: 8px;
  background: #edf8f0;
  color: var(--brand-dark);
}
.tenant-notice strong, .tenant-notice span { display: block; }
.tenant-notice span { color: var(--muted); }
select:disabled {
  background: #edf3ef;
  color: var(--brand-dark);
  cursor: not-allowed;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #fbfcfa; }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--surface-2); border-radius: 8px; padding: 12px; min-height: 330px; }
.kanban-col h3 { display: flex; justify-content: space-between; margin-bottom: 10px; }
.kanban-col.collapsed { min-height: 64px; }
.kanban-col.collapsed .kanban-dropzone { display: none; }
.kanban-toggle {
  width: 26px;
  height: 26px;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-weight: 900;
}
.kanban-dropzone {
  min-height: 260px;
  border: 1px dashed transparent;
  border-radius: 8px;
}
.kanban-dropzone.drag-over {
  border-color: var(--brand);
  background: #e4f3eb;
}
.lead-card { display: grid; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.lead-card { cursor: grab; }
.lead-card.dragging { opacity: .55; }
.lead-card span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .full { display: grid; gap: 6px; color: var(--muted); font-weight: 800; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-weight: 900;
}
.permission-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
  font-weight: 800;
}
.permission-grid input {
  min-height: auto;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.timeline { display: grid; gap: 10px; }
.timeline div { padding: 12px; border-left: 4px solid var(--brand); background: #f8fbf6; }
.timeline.compact { margin-top: 12px; }
.timeline.compact div { padding: 9px 10px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); }
.finance-note { margin-top: 16px; }
.marketing-list { display: grid; gap: 14px; }
.marketing-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.marketing-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.marketing-card h3 { margin-top: 4px; }
.marketing-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.marketing-meta strong { color: var(--text); }
.creative-preview {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px dashed #bdd5c7;
  border-radius: 8px;
  background: #fff;
}
.creative-preview span { color: var(--muted); }
.marketing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.user-card {
  display: grid;
  gap: 10px;
}
.workflow-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.workflow-col {
  min-height: 420px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.workflow-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.workflow-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}
.workflow-meta strong {
  color: var(--ink);
}
.chat-panel {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.chat-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 470px;
  overflow: auto;
  padding-right: 4px;
}
.chat-message {
  max-width: 78%;
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.chat-message.mine {
  justify-self: end;
  background: #e8f4ec;
  border-color: #c9dfd1;
}
.chat-message span {
  color: var(--muted);
  font-size: 11px;
}
.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}
.whatsapp-connect {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}
.qr-code {
  width: 150px;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.qr-code span {
  border-radius: 2px;
  background: #e7ede8;
}
.qr-code span.on {
  background: #14231f;
}
.plan-card { padding: 18px; display: grid; gap: 12px; }
.plan-card strong { font-size: 22px; }
.plan-card ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }
.modal { display: none; position: fixed; inset: 0; background: rgba(20, 35, 31, 0.55); align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal.open { display: flex; }
.modal-card { width: min(760px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.toast { position: fixed; right: 22px; bottom: 22px; background: #14231f; color: #fff; padding: 12px 14px; border-radius: 8px; box-shadow: var(--shadow); transform: translateY(80px); opacity: 0; transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; background: #fbfcfa; }
@media (max-width: 1180px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .metrics, .four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .three { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { padding: 18px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .metrics, .four, .form-grid { grid-template-columns: 1fr; }
  .permission-grid, .workflow-board, .chat-form { grid-template-columns: 1fr; }
  .chat-message { max-width: 100%; }
  h1 { font-size: 24px; }
  .topbar-actions { justify-content: stretch; }
  .topbar-actions > * { width: 100%; }
}
