:root{
  --bg:#f5f6f7;
  --surface:#ffffff;
  --surface-2:#f0f2f5;
  --border:#dfe3e8;
  --text:#1c1e21;
  --text-muted:#606770;
  --line:var(--border);
  --muted:var(--text-muted);
  --card:var(--surface);
  --brand-primary:#2374e1;
  --sidebar:var(--brand-primary);
  --sidebar2:var(--brand-primary);
  --primary:var(--brand-primary);
  --primary-hover:#1f67cc;
  --danger:#e03131;
  --warning:#f08c00;
  --success:#2f9e44;
  --radius-sm:6px;
  --radius-md:10px;
  --shadow-sm:0 1px 2px rgba(0,0,0,.06);
  --shadow-md:0 6px 18px rgba(0,0,0,.10);
  --font-family:"Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-size-12:12px;
  --font-size-13:13px;
  --font-size-14:14px;
  --font-size-16:16px;
  --line-height:1.4;
  --font-weight-regular:400;
  --font-weight-medium:500;
  --font-weight-semibold:600;
  --space-4:4px;
  --space-6:6px;
  --space-8:8px;
  --space-10:10px;
  --space-12:12px;
  --space-16:16px;
  --space-20:20px;
}

*,
*::before,
*::after{
  box-sizing:border-box;
}

html, body{
  height:100%;
}

body{
  margin:0;
  font-family:var(--font-family);
  font-size:var(--font-size-14);
  line-height:var(--line-height);
  color:var(--text);
  background:var(--bg);
}

a{
  color:inherit;
}

button{
  font-family:inherit;
}

.layout{
  background:var(--bg);
}

.sidebar{
  background:var(--brand-primary) !important;
  color:#e5e7eb;
}

.brand{
  border-bottom:1px solid rgba(255,255,255,.08);
}

.nav a{
  color:#e5e7eb;
  border-radius:var(--radius-sm);
}

.nav a.active,
.nav a:hover{
  background:rgba(255,255,255,.10);
}

.topbar{
  background:var(--surface);
  border-bottom:1px solid var(--border);
}

.content{
  background:var(--bg);
}

.page-title{
  font-size:var(--font-size-16);
  font-weight:var(--font-weight-semibold);
  color:var(--text);
}

.card,
.dash-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-sm);
}

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:var(--space-12) var(--space-16);
  border-bottom:1px solid var(--border);
  font-weight:var(--font-weight-semibold);
}

.card-body{
  padding:var(--space-16);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:var(--space-6);
  height:34px;
  padding:0 var(--space-12);
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  font-size:var(--font-size-13);
  font-weight:var(--font-weight-semibold);
  cursor:pointer;
  text-decoration:none;
  transition:background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn:hover{
  background:var(--surface-2);
}

.btn.primary,
.btn-primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.btn.primary:hover,
.btn-primary:hover{
  background:var(--primary-hover);
  border-color:var(--primary-hover);
}

button.primary,
.primary.button,
.primary{
  background:var(--primary);
  border:1px solid var(--primary);
  color:#fff;
  border-radius:var(--radius-sm);
  height:34px;
  padding:0 var(--space-12);
  font-weight:var(--font-weight-semibold);
  cursor:pointer;
}

button.primary:hover,
.primary.button:hover,
.primary:hover{
  background:var(--primary-hover);
  border-color:var(--primary-hover);
}

button.secondary,
.secondary{
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:var(--radius-sm);
  height:34px;
  padding:0 var(--space-12);
  font-weight:var(--font-weight-semibold);
  cursor:pointer;
}

button.secondary:hover,
.secondary:hover{
  background:var(--surface-2);
}

.ghost-btn{
  background:transparent;
  border:0;
  color:var(--text-muted);
  cursor:pointer;
}

.link{
  color:var(--primary);
  text-decoration:none;
  font-weight:var(--font-weight-medium);
}

.link:hover{
  text-decoration:underline;
}

.btn-secondary{
  background:var(--surface);
  border-color:var(--border);
  color:var(--text);
}

.btn-ghost{
  background:transparent;
  border-color:transparent;
  color:var(--text);
}

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

.btn.danger:hover{
  background:#c92525;
  border-color:#c92525;
  color:#fff;
}

.btn-icon{
  width:34px;
  padding:0;
}

.btn.small{
  height:30px;
  padding:0 var(--space-10);
  font-size:var(--font-size-12);
}

.btn:disabled,
.btn[disabled]{
  opacity:.6;
  cursor:not-allowed;
}

input,
select,
textarea{
  font-family:var(--font-family);
  font-size:var(--font-size-13);
  color:var(--text);
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:var(--space-8) var(--space-10);
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(24,119,242,.18);
}

.field label{
  font-size:var(--font-size-12);
  font-weight:var(--font-weight-semibold);
  color:var(--text-muted);
}

.search,
.search-input{
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  height:34px;
  padding:0 var(--space-10);
  display:flex;
  align-items:center;
  gap:var(--space-8);
}

.search input{
  border:0;
  background:transparent;
  padding:0;
}

.toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--space-12);
  padding:var(--space-8) 0;
}

.toolbar-left,
.toolbar-right{
  display:flex;
  align-items:center;
  gap:var(--space-8);
}

.tabs{
  display:flex;
  gap:var(--space-6);
  border-bottom:1px solid var(--border);
  margin-bottom:var(--space-12);
}

.tab{
  padding:var(--space-8) var(--space-12);
  border-radius:var(--radius-sm);
  text-decoration:none;
  color:var(--text-muted);
  font-weight:var(--font-weight-semibold);
}

.tab.active,
.tab-active{
  color:var(--text);
  background:var(--surface);
  border:1px solid var(--border);
}

.badge,
.pill,
.status-badge{
  display:inline-flex;
  align-items:center;
  padding:2px var(--space-8);
  border-radius:999px;
  background:var(--surface-2);
  border:1px solid var(--border);
  font-size:var(--font-size-12);
  font-weight:var(--font-weight-semibold);
  color:var(--text);
}

.table{
  width:100%;
  border-collapse:collapse;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  overflow:hidden;
}

.table th,
.table td{
  text-align:left;
  padding:var(--space-10) var(--space-12);
  border-bottom:1px solid var(--border);
  font-size:var(--font-size-13);
}

.table th{
  background:var(--surface-2);
  color:var(--text-muted);
  font-weight:var(--font-weight-semibold);
}

.table tbody tr:hover{
  background:#f8fafc;
}

.menu{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow-md);
  padding:var(--space-6);
}

.menu-item{
  padding:var(--space-8) var(--space-10);
  border-radius:var(--radius-sm);
  cursor:pointer;
}

.menu-item:hover{
  background:var(--surface-2);
}

.menu-divider{
  height:1px;
  background:var(--border);
  margin:var(--space-6) 0;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:9999;
  background:rgba(0,0,0,.35);
}

.modal-backdrop.show{
  display:flex;
}

.modal{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-md);
  animation:modalFade .18s ease;
}

.modal-head,
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:var(--space-12) var(--space-16);
  border-bottom:1px solid var(--border);
}

.modal-title{
  font-weight:var(--font-weight-semibold);
}

.modal-body{
  padding:var(--space-16);
}

.modal-actions,
.modal-footer{
  display:flex;
  justify-content:flex-end;
  gap:var(--space-8);
  padding:var(--space-12) var(--space-16);
  border-top:1px solid var(--border);
}

.modal-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.modal-grid .span-2{
  grid-column:1 / -1;
}

.form-group{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.form-group label{
  font-size:var(--font-size-12);
  font-weight:var(--font-weight-semibold);
  color:var(--text-muted);
}

.help-text{
  font-size:12px;
  color:var(--text-muted);
}

.repeat-row{
  display:flex;
  align-items:center;
  gap:8px;
  height:40px;
}

.repeat-row input[type="number"]{
  width:90px;
}

.modal input,
.modal select,
.modal textarea{
  height:40px;
}

.modal textarea{
  height:auto;
  min-height:84px;
}

.modal-footer{
  background:var(--surface);
}

@media (max-width: 860px){
  .modal-grid{
    grid-template-columns:1fr;
  }
}

@keyframes modalFade{
  from{ transform:translateY(4px) scale(.98); opacity:0; }
  to{ transform:translateY(0) scale(1); opacity:1; }
}

.spinner{
  width:20px;
  height:20px;
  border:2px solid var(--border);
  border-top-color:var(--primary);
  border-radius:50%;
  animation:spin .8s linear infinite;
}

.skeleton{
  background:linear-gradient(90deg, #f1f3f5 25%, #e9ecef 50%, #f1f3f5 75%);
  background-size:200% 100%;
  animation:shimmer 1.2s infinite;
}

@keyframes spin{
  to{ transform:rotate(360deg); }
}

@keyframes shimmer{
  0%{ background-position:200% 0; }
  100%{ background-position:-200% 0; }
}

.tooltip,
.btn-inativar.tooltip{
  position:relative;
}

.btn-inativar.tooltip:hover::after{
  content:attr(data-tooltip);
  position:absolute;
  bottom:calc(100% + 8px);
  left:50%;
  transform:translateX(-50%);
  max-width:220px;
  background:#111827;
  color:#fff;
  padding:6px 8px;
  border-radius:var(--radius-sm);
  font-size:var(--font-size-12);
  white-space:normal;
  text-align:left;
  z-index:50;
  pointer-events:none;
  box-shadow:var(--shadow-sm);
}

.btn-inativar.tooltip:hover::before{
  content:"";
  position:absolute;
  bottom:calc(100% + 2px);
  left:50%;
  transform:translateX(-50%);
  border-width:6px;
  border-style:solid;
  border-color:#111827 transparent transparent transparent;
  z-index:49;
  pointer-events:none;
}

.alert{
  padding:var(--space-10) var(--space-12);
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
  background:var(--surface-2);
  font-size:var(--font-size-13);
}

.alert.success{ border-color:rgba(47,158,68,.3); background:rgba(47,158,68,.08); }
.alert.warning{ border-color:rgba(240,140,0,.3); background:rgba(240,140,0,.08); }
.alert.danger{ border-color:rgba(224,49,49,.3); background:rgba(224,49,49,.08); }

.btn.whatsapp{
  background:#22c55e;
  border-color:#22c55e;
  color:#fff;
}

.btn.whatsapp:hover{
  background:#16a34a;
  border-color:#16a34a;
}

.group-container{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.group-card{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:14px 16px;
  border-radius:12px;
  border:1px solid #e2e8f0;
  background:#ffffff;
  cursor:pointer;
  transition:all .2s ease;
}

.group-card:hover{
  border-color:#cbd5e1;
  transform:translateY(-1px);
}

.group-card input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.group-card.is-selected{
  border-color:var(--primary);
  background:#eff6ff;
  box-shadow:0 0 0 3px rgba(37,99,235,.15);
}

.group-content{
  display:flex;
  align-items:center;
  gap:8px;
}

.group-color{
  width:8px;
  height:24px;
  border-radius:4px;
  background-color:var(--group-color, #2563eb);
}

.group-name{
  font-weight:var(--font-weight-semibold);
  font-size:var(--font-size-13);
  color:var(--text);
}
