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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #e7e9ea;
  --text-muted: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --danger: #f4212e;
  --success: #00ba7c;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* Abas */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tab {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: var(--text);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text);
}

.toolbar {
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.btn.primary:hover {
  background: var(--accent-hover);
}

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

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.btn.danger:hover {
  background: rgba(244, 33, 46, 0.1);
}

.btn.media-auth {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  text-decoration: none;
}

.btn.media-auth:hover {
  background: rgba(29, 155, 240, 0.1);
}

.media-auth-link {
  color: var(--accent);
  font-weight: 600;
}

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

.account-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}

.account-list li:last-child {
  border-bottom: none;
}

.account-list .username {
  font-weight: 600;
  color: var(--accent);
}

.account-list .remove {
  flex-shrink: 0;
}

.account-list .star-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  transition: color 0.2s;
}
.account-list .star-btn:hover {
  color: #ffc107;
}
.account-list .star-btn.filled {
  color: #ffc107;
}

.account-filter {
  margin: 0.5rem 0 1rem 0;
  padding: 0.5rem 0;
  border: none;
}
.account-filter legend {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.account-filter .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 0.5rem 0;
}

.hidden {
  display: none !important;
}

.empty.hidden {
  display: none;
}

.account-list:empty ~ .empty { display: block; }
.account-list:not(:empty) ~ .empty { display: none; }

#account-list:not(:empty) + .empty {
  display: none;
}

/* Logs (requests por fluxo) */
.logs-toolbar {
  margin-bottom: 1rem;
}

.logs-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.logs-table th,
.logs-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.logs-table th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.logs-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

#empty-logs.hidden {
  display: none;
}

form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

form select,
form textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.2);
}

form textarea {
  resize: vertical;
  min-height: 100px;
}

.counter {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

#media-file {
  display: block;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

#media-file::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}

.file-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

form button[type="submit"] {
  margin-top: 0.25rem;
}

.message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

.message.show {
  display: block;
}

.message.success {
  background: rgba(0, 186, 124, 0.15);
  color: var(--success);
  border: 1px solid rgba(0, 186, 124, 0.3);
}

.message.error {
  background: rgba(244, 33, 46, 0.1);
  color: var(--danger);
  border: 1px solid rgba(244, 33, 46, 0.25);
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.banner.success {
  background: rgba(0, 186, 124, 0.15);
  color: var(--success);
  border: 1px solid rgba(0, 186, 124, 0.3);
}

.banner.error {
  background: rgba(244, 33, 46, 0.1);
  color: var(--danger);
  border: 1px solid rgba(244, 33, 46, 0.25);
}

/* Configurações / agendamento */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.todas-contas-badges-wrap {
  margin: 0.75rem 0 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.todas-contas-badges-wrap.hidden {
  display: none;
}

.todas-contas-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.todas-contas-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 999px;
  font-size: 0.9rem;
}

.account-badge .badge-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  margin: 0;
  margin-left: 0.15rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.account-badge .badge-remove:hover {
  background: rgba(0, 0, 0, 0.35);
}

.settings-interval {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.settings-interval label { margin-bottom: 0; }

.settings-interval input[type="number"] {
  width: 4rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.75rem 0 0;
}

/* Fila de posts */
.queue-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.35rem;
}

.queue-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.queue-actions.hidden {
  display: none;
}

.queue-actions-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.queue-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.queue-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.queue-list li:last-child { border-bottom: none; }

.queue-list .queue-item-text {
  flex: 1;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.queue-list .queue-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.queue-list .queue-item-datetime {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
}

.queue-list .queue-item-fila {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.agendar-fila-wrap {
  margin: 0.5rem 0 1rem;
}
.agendar-fila-wrap .agendar-fila-label {
  margin-right: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.agendar-fila-wrap .radio-inline {
  margin-right: 1rem;
  font-size: 0.9rem;
}
.agendar-fila-wrap .radio-inline input {
  margin-right: 0.25rem;
}
