body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
}
.app { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: 24px 28px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}
.right-col { display: flex; flex-direction: column; gap: 16px; }

.panel {
  background: var(--bg-white);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
}
.panel-header h3 { font-size: 14px; font-weight: 500; }
.panel-link { font-size: 12px; color: var(--green-accent); }
.panel-link:hover { opacity: 0.7; }

.panel-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 0.5px solid var(--border);
}
.panel-footer--single { padding: 12px 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn--primary { background: var(--green-dark); color: #fff; flex: 1; }
.btn--primary:hover { background: var(--green-mid); }
.btn--secondary {
  background: transparent;
  color: var(--text-muted);
  border: 0.5px solid var(--border-strong);
}
.btn--secondary:hover { background: var(--bg-subtle); }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: #fff;
  flex-shrink: 0;
  background: var(--green-accent);
}

.badge {
  margin-left: auto;
  background: #e8673a;
  color: #fff;
  font-size: 10px; font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px; text-align: center;
}
.badge--green { background: var(--green-accent); }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.status-pill::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; flex-shrink: 0;
}
.pill--urgent   { background: var(--urgent-bg);   color: var(--urgent); }
.pill--urgent::before   { background: var(--urgent); }
.pill--waiting  { background: var(--waiting-bg);  color: var(--waiting); }
.pill--waiting::before  { background: var(--waiting); }
.pill--progress { background: var(--progress-bg); color: var(--progress); }
.pill--progress::before { background: var(--progress); }

.tag {
  font-size: 10px; padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 500; white-space: nowrap;
}
.tag--hoje    { background: var(--urgent-bg);  color: var(--urgent); }
.tag--escrit  { background: #f0f0ff;           color: #4a4aaa; }
.tag--digital { background: var(--waiting-bg); color: var(--waiting); }

.online-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint); flex-shrink: 0;
}
.online-dot--active { background: #2d9a52; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  width: 480px; max-width: 90vw;
  box-shadow: var(--shadow-md);
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 0.5px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 500; }
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted); transition: background 0.1s;
}
.modal-close:hover { background: var(--bg-subtle); }
.modal-close svg { width: 15px; height: 15px; }

.modal-body {
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-group input,
.form-group select {
  padding: 9px 12px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13.5px; color: var(--text-primary);
  background: var(--bg-white); transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--green-accent); outline: none; }
.form-group input::placeholder { color: var(--text-faint); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-footer {
  display: flex; gap: 10px;
  padding: 16px 24px;
  border-top: 0.5px solid var(--border);
  justify-content: flex-end;
}
.modal-footer .btn { flex: none; }
.modal-footer .btn--primary { padding: 9px 24px; }