@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:        #14171A;
  --panel:     #1C2024;
  --panel-2:   #21262B;
  --border:    #2C3238;
  --text:      #EDEFEF;
  --text-dim:  #9AA3AB;
  --accent:    #3DDC84;
  --accent-dim: #2A8F5A;
  --warn:      #E0A857;
  --danger:    #E0645A;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
}

.shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 24px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.15);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  text-align: left;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--panel-2); color: var(--text); }

.nav-item.active {
  background: var(--panel-2);
  color: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 0 8px;
  opacity: 0.6;
}

.logout-link {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
  text-decoration: underline;
}

.logout-link:hover { color: var(--danger); }

/* ---------- CONTENT ---------- */

.content {
  flex: 1;
  padding: 40px 48px;
  max-width: 980px;
}

.view.hidden { display: none; }
.hidden { display: none; }
.nav-item.admin-only { display: none; }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.view-head h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.hint {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: -12px;
  margin-bottom: 20px;
  max-width: 60ch;
}

.hint strong { color: var(--warn); font-weight: 600; }

/* ---------- STATS ---------- */

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1;
}

.stat-value {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}

/* ---------- SEARCH / INPUT ---------- */

.search, .input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.search {
  width: 280px;
}

.search:focus, .input:focus {
  border-color: var(--accent-dim);
}

.textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  margin-top: 6px;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  margin-top: 18px;
}

.field-label:first-child { margin-top: 0; }

select.input {
  width: 100%;
  margin-bottom: 6px;
}

/* ---------- MEDIA TYPE SELECTOR ---------- */

.media-type-group {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.media-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.media-btn:hover { border-color: var(--accent-dim); color: var(--text); }

.media-btn.active {
  background: var(--accent);
  color: #0C1410;
  border-color: var(--accent);
}

.media-upload {
  margin: 12px 0;
  padding: 14px;
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.media-upload.hidden { display: none; }

.input-file {
  color: var(--text-dim);
  font-size: 13px;
}

.file-hint {
  display: block;
  color: var(--text-dim);
  font-size: 11.5px;
  margin-top: 6px;
}

.link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.link-row .input { flex: 1; }

.video-note-warning {
  background: rgba(224, 168, 87, 0.12);
  border: 1px solid rgba(224, 168, 87, 0.3);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  margin: 12px 0;
}

.video-note-warning.hidden { display: none; }

.media-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-dim);
  flex-shrink: 0;
}

.media-tag.photo { color: var(--accent); }
.media-tag.audio { color: #8AB4F8; }
.media-tag.voice { color: #8AB4F8; }
.media-tag.video_note { color: var(--warn); }

/* ---------- GRAVAÇÃO DE ÁUDIO ---------- */

.audio-mode-group {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.audio-mode-group.hidden { display: none; }

.audio-mode-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.audio-mode-btn.active {
  background: var(--accent-dim);
  color: var(--text);
  border-color: var(--accent-dim);
}

.record-box.hidden { display: none; }

.record-btn {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.record-btn.recording {
  animation: pulse-rec 1.2s infinite;
}

@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.record-timer {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  margin-left: 10px;
  font-size: 13px;
}

.record-preview {
  display: block;
  margin-top: 12px;
  width: 100%;
  height: 36px;
}

.record-preview.hidden { display: none; }

.video-preview {
  display: block;
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  margin: 10px 0;
  background: #000;
}

.video-preview.hidden { display: none; }

.section-subtitle {
  font-size: 15px;
  font-weight: 700;
  margin: 32px 0 12px 0;
  color: var(--text-dim);
}

.oneoff-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.oneoff-status.pending {
  background: rgba(224, 168, 87, 0.15);
  color: var(--warn);
}

.oneoff-status.sent {
  background: rgba(61, 220, 132, 0.15);
  color: var(--accent);
}

.datetime-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.datetime-row .input { flex: 0 0 auto; }

.brasilia-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}

.oneoff-item {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.oneoff-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.oneoff-item-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 76px;
}

.oneoff-target {
  font-size: 12.5px;
  color: var(--text-dim);
  flex: 1;
}

.link-btn.danger { color: var(--danger); }

.campaign-filter {
  width: 240px;
  margin-bottom: 14px;
}

.campaign-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(138, 180, 248, 0.15);
  color: #8AB4F8;
  flex-shrink: 0;
}

.created-by {
  font-size: 11.5px;
  color: var(--text-dim);
  font-style: italic;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(61, 220, 132, 0.15);
  color: var(--accent);
  text-transform: uppercase;
}

/* ---------- TABLE ---------- */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.tbl tr:last-child td { border-bottom: none; }

.tbl tr:hover { background: var(--panel-2); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text-dim); }

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 32px !important;
}

.tag-phone {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}

.tag-none {
  color: var(--text-dim);
  font-size: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 8px;
}

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

/* ---------- PANEL / BUTTONS ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
}

.btn-primary {
  background: var(--accent);
  color: #0C1410;
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover { border-color: var(--accent-dim); }

.result {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
}

.result.ok { color: var(--accent); }
.result.err { color: var(--danger); }

/* ---------- SCHEDULE ---------- */

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.schedule-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  width: 64px;
  flex-shrink: 0;
}

.schedule-msg {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-toggle {
  width: 38px;
  height: 22px;
  border-radius: 20px;
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}

.schedule-toggle.on { background: var(--accent-dim); }

.schedule-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s;
}

.schedule-toggle.on::after { transform: translateX(16px); background: var(--accent); }

.schedule-del {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.schedule-del:hover { color: var(--danger); }

/* ---------- MODAL (novo horário) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 400px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 16px;
  margin: 0 0 16px 0;
}

.modal-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.modal-row .input { width: 80px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 16px; }
  .nav { flex-direction: row; }
  .sidebar-foot { display: none; }
  .content { padding: 24px 20px; }
  .search { width: 100%; }
  .stats-row { flex-wrap: wrap; }
}
