/* app.css — Vulpes Dashboard. Tema escuro sobrio, responsivo. */
:root {
  --bg: #0f1216;
  --bg-2: #161b22;
  --bg-3: #1c232d;
  --panel: #131820;
  --border: #263140;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #e8802a;
  --accent-2: #f2a45c;
  --ok: #3fb950;
  --err: #f85149;
  --hit: #d29922;
  --info: #388bfd;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ---- botoes ---- */
.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: #22303f;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-2);
}
.btn-secondary {
  background: var(--bg-3);
}
.btn-ghost {
  background: transparent;
}
.btn-mini {
  padding: 4px 9px;
  font-size: 15px;
  line-height: 1;
}
.btn-remove {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--err);
  border-color: transparent;
  background: transparent;
}
.btn-remove:hover {
  background: rgba(248, 81, 73, 0.12);
}
.btn-preset {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---- login ---- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  font-size: 34px;
}
.brand h1 {
  margin: 0;
  font-size: 20px;
}
.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.field input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}
.error-msg {
  color: var(--err);
  font-size: 13px;
  margin: 0;
}

/* ---- shell ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}
.topbar-brand .brand-mark {
  font-size: 22px;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-label {
  color: var(--muted);
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tab-panel {
  padding: 20px 22px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- callouts ---- */
.callout {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.callout-info {
  background: rgba(56, 139, 253, 0.1);
  border-color: rgba(56, 139, 253, 0.35);
}
.callout-warn {
  background: rgba(210, 153, 34, 0.12);
  border-color: rgba(210, 153, 34, 0.4);
}

/* ---- layout bloqueio ---- */
.blocking-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 820px) {
  .blocking-layout {
    grid-template-columns: 1fr;
  }
}

.tree-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 16px;
}
.tree-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.tree-head h2 {
  margin: 0;
  font-size: 15px;
}
.tree {
  max-height: 70vh;
  overflow-y: auto;
}
.tree-customer {
  margin-bottom: 12px;
}
.tree-customer-title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  color: var(--text);
}
.tree-posto {
  margin: 4px 0 4px 10px;
}
.tree-posto-title {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.tree-machines {
  list-style: none;
  margin: 0;
  padding: 0 0 0 8px;
}
.tree-machine {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.tree-machine:hover {
  background: var(--bg-3);
}
.tree-machine.is-selected {
  background: rgba(232, 128, 42, 0.16);
  outline: 1px solid rgba(232, 128, 42, 0.4);
}
.tree-machine-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.status-dot.online {
  background: var(--ok);
}
.status-dot.offline {
  background: #4b5563;
}

/* ---- editor ---- */
.editor-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.empty-state {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.editor,
.events-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.editor-head h2 {
  margin: 0;
  font-size: 18px;
}

/* switch */
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  display: none;
}
.switch-track {
  width: 42px;
  height: 24px;
  background: #33404f;
  border-radius: 999px;
  position: relative;
  transition: background 0.15s;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .switch-track {
  background: var(--accent);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
}
.switch-label {
  font-size: 13px;
  color: var(--muted);
}

/* presets */
.presets {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.presets-label {
  font-size: 13px;
  color: var(--muted);
}
.preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* listas */
.list-section {
  margin-bottom: 18px;
}
.list-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.add-row input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.add-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.domain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.domain-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 6px 6px 12px;
}
.domain-text {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}
.domain-empty {
  padding: 8px 2px;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.save-status {
  font-size: 13px;
  color: var(--muted);
}
.save-status.ok {
  color: var(--ok);
}
.save-status.error {
  color: var(--err);
}
.save-status.pending {
  color: var(--hit);
}
.policy-meta {
  margin-left: auto;
}

/* eventos */
.events-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.events-head h3 {
  margin: 0;
  font-size: 15px;
}
.events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}
.event-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.event-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
  background: var(--bg-3);
  color: var(--muted);
}
.event-badge.ok {
  background: rgba(63, 185, 80, 0.16);
  color: var(--ok);
}
.event-badge.err {
  background: rgba(248, 81, 73, 0.16);
  color: var(--err);
}
.event-badge.hit {
  background: rgba(210, 153, 34, 0.16);
  color: var(--hit);
}
.event-badge.info {
  background: rgba(56, 139, 253, 0.16);
  color: var(--info);
}
.event-body {
  flex: 1;
  min-width: 0;
}
.event-detail {
  font-size: 13px;
  word-break: break-word;
}
.event-time {
  font-size: 12px;
}

/* toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 50;
  max-width: 90vw;
}
.toast.ok {
  border-color: var(--ok);
}
.toast.error {
  border-color: var(--err);
}
