.app-page { display: grid; gap: 12px; min-width: 0; }
.dash-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.app-page h1 { font-size: 22px; letter-spacing: -0.03em; }
.app-page h2 { font-size: 16px; }
.app-page h3 { margin: 0 0 4px; font-size: 16px; }
.app-page p { color: var(--muted); }
.app-head p { font-size: 13px; line-height: 1.45; margin-top: 2px; }
.app-page button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
}
.app-page button:hover { background: rgba(61, 220, 132, 0.06); }
.app-page button:disabled { opacity: 0.45; cursor: default; }
.app-page button.primary {
  background: var(--green-deep);
  border-color: transparent;
  color: white;
  font-weight: 600;
}
.app-page button.primary:hover { background: #22b15a; }
.app-page button.danger {
  border-color: rgba(255, 107, 107, 0.45);
  color: #ff9a9a;
}
.app-page button.danger:hover { background: rgba(255, 107, 107, 0.08); }
.app-page input,
.app-page select,
.app-page textarea {
  width: 100%;
  background: #07140f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
  outline: none;
}
.app-page select {
  appearance: none;
  padding-right: 30px;
  background: #07140f url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2386a394' stroke-width='1.6'/></svg>") no-repeat right 10px center;
}
.app-page input:focus,
.app-page select:focus,
.app-page textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.16); }
.app-page code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.app-page .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.settings-tabs, .logs-filters, .economy-form, .macro-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.settings-tabs { margin-bottom: 4px; }
.settings-tabs button {
  border-radius: 999px;
  color: var(--muted);
  padding: 6px 12px;
}
.settings-tabs button.active {
  background: var(--green-deep);
  border-color: transparent;
  color: white;
  font-weight: 600;
}
.settings-panel { display: grid; gap: 0; }
.settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 12px 24px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid rgba(78, 186, 122, 0.14);
}
.settings-row p { font-size: 13px; line-height: 1.45; }
.settings-row input,
.settings-row select,
.split-input input,
.split-input select,
.inline-save input,
.join-msg-input { max-width: 440px; }
.split-input, .inline-save { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px; max-width: 440px; }
.inline-save { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.inline-save button, .discord-actions button { width: auto; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.pick-grid.two { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pick-card {
  width: 100%;
  text-align: left;
  background: rgba(7, 20, 15, 0.65);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  position: relative;
}
.pick-card span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 400; }
.pick-card.selected {
  border-color: var(--green);
  background: rgba(61, 220, 132, 0.08);
  box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.35);
}
.pick-card.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--green);
  font-size: 13px;
}
.join-messages { display: grid; gap: 8px; margin-bottom: 8px; max-width: 440px; }
.join-msg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.join-msg-input { max-width: none; }
#add-join-message { width: auto; border: 0; color: var(--green); padding: 0; background: none; }
#add-join-message:hover { background: none; text-decoration: underline; }
.danger-box {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
}
.danger-box p { margin: 4px 0 0; }
.settings-panel[data-lock-panel].locked input,
.settings-panel[data-lock-panel].locked select,
.settings-panel[data-lock-panel].locked .pick-card,
.settings-panel[data-lock-panel].locked .inline-save button:not(.danger) {
  pointer-events: none;
  opacity: 0.55;
}
.banner.warn {
  border: 1px solid rgba(240, 180, 41, 0.45);
  background: rgba(240, 180, 41, 0.08);
  color: #f4e6b0;
  border-radius: 12px;
  padding: 12px 14px;
}
.banner.warn p { color: inherit; margin-top: 4px; }
.agent-command {
  margin: 0;
  padding: 12px;
  background: #07140f;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 520px;
  color: var(--text);
}
.invite-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; max-width: 640px; }
.invite-form input { flex: 1; min-width: 140px; width: auto; }
.proxy-list, .users-list, .proxy-form { display: grid; gap: 8px; max-width: 520px; }
.proxy-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.proxy-row, .user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 20, 15, 0.55);
}
.proxy-row strong, .user-row strong { display: block; }
.proxy-row small, .user-row small { color: var(--muted); }
.user-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.online { color: var(--green); border-color: rgba(61, 220, 132, 0.45); }
.pill.offline { color: #ff9a9a; border-color: rgba(255, 107, 107, 0.35); }
.discord-check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.discord-check input { width: auto; }
.discord-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.discord-accounts { display: grid; gap: 8px; max-width: 720px; }
.discord-account {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(88px, 1fr));
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 20, 15, 0.55);
}
.discord-account-head {
  background: transparent;
  border: 0;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.discord-account strong { font-weight: 600; }
.discord-account small { display: block; color: var(--muted); font-size: 12px; }
.discord-account .discord-check { font-size: 13px; }
@media (min-width: 981px) {
  .discord-account:not(.discord-account-head) .discord-check {
    font-size: 0;
    justify-content: center;
    width: 100%;
    min-height: 28px;
  }
}

.logs-layout, .macros-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.macros-layout { grid-template-columns: minmax(0, 1fr) 280px; }
.logs-bots, .logs-panel, .macro-bot-states, .macro-instance, .order-row {
  background: linear-gradient(180deg, rgba(16, 40, 30, 0.96), rgba(10, 26, 20, 0.96));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.logs-bots, .logs-panel, .macro-bot-states { padding: 14px; }
.logs-bots h2, .macro-bot-states h2 { margin-bottom: 10px; }
.logs-bot-list, .macro-instance-list, .order-list { display: grid; gap: 8px; }
.order-list { list-style: none; margin: 0; padding: 0; }
.logs-bot {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px;
}
.logs-bot.active {
  border-color: rgba(61, 220, 132, 0.55);
  background: rgba(61, 220, 132, 0.08);
}
.logs-bot img, .order-row img, .macro-bot-state img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  image-rendering: pixelated;
}
.logs-bot strong, .order-row strong { display: block; }
.logs-bot small, .order-row small { color: var(--muted); }
.logs-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); min-width: 140px; }
.logs-filters label.logs-chat-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
}
.logs-filters .logs-chat-toggle input { width: auto; min-width: 0; }
.logs-view.log {
  flex: none;
  height: min(62vh, 680px);
  margin-top: 8px;
  background: #07140f;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.logs-view .error { color: #ff9a9a; }
.logs-view .warn { color: var(--amber); }
.logs-view .muted { color: var(--faint); margin-right: 6px; }
.log-chat-tag { color: var(--blue); margin-right: 4px; }
.logs-view .mc-msg { color: #e7f6ee; white-space: pre-wrap; }
.logs-view .mc-msg span { text-shadow: 1px 1px 0 #1a1a1a; }
.inv-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }

.economy-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 40, 30, 0.55);
}
.economy-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.economy-form label.logs-chat-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  min-height: 38px;
}
.economy-form input[type="checkbox"] { width: auto; }
.economy-actions { display: flex; gap: 8px; }
.economy-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 40, 30, 0.96), rgba(10, 26, 20, 0.96));
}
.economy-block h2 { margin-bottom: 8px; }
.earnings-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.earnings-head label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); min-width: 220px; }
.economy-possible { display: grid; gap: 8px; }
.economy-pair {
  padding: 10px 12px;
  border: 1px solid rgba(78, 186, 122, 0.16);
  border-radius: 10px;
  background: rgba(7, 20, 15, 0.45);
}
.economy-pair small { color: var(--faint); }
.economy-raw {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: #07140f;
  border: 1px solid var(--line);
  color: #c9ddd2;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}
.earn-chart { margin-top: 8px; }
.earn-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.earn-filters button { border-radius: 999px; color: var(--muted); padding: 5px 10px; font-size: 12px; }
.earn-filters button.active { background: var(--green-deep); border-color: transparent; color: white; font-weight: 600; }
.earn-plot { position: relative; height: 240px; }
.earn-plot canvas { width: 100%; height: 220px; display: block; }
.earn-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: #10261c;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text);
}
.earn-tip strong { display: block; margin-bottom: 2px; }
.earn-tip i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 2px;
  background: #3dcc7a;
}
.earn-tip i.cash { background: #e6c35c; }

.order-row {
  display: grid;
  grid-template-columns: 28px 36px 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}
.order-row.dragging { opacity: 0.45; border-color: var(--green); }
.order-handle { cursor: grab; color: var(--muted); letter-spacing: -1px; text-align: center; user-select: none; }
.order-index {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #07140f;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 600;
}
.order-moves { display: flex; gap: 6px; }
.order-moves button { min-width: 36px; padding: 6px 10px; }

.macro-toolbar {
  padding: 10px 12px;
  background: rgba(16, 40, 30, 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  align-items: center;
}
.macro-toolbar input { flex: 1; min-width: 160px; width: auto; }
.macro-instance { overflow: visible; }
.macro-instance.started { border-color: rgba(73, 200, 255, 0.55); }
.macro-instance.paused { border-color: rgba(240, 180, 41, 0.7); }
.macro-instance-head {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
}
.macro-instance-head small { color: var(--muted); margin-left: auto; }
.macro-avatars { display: flex; gap: 4px; }
.macro-avatars img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  image-rendering: pixelated;
  background: #07140f;
}
.macro-avatars img.off { filter: grayscale(1) opacity(0.55); }
.macro-status-dot { width: 10px; height: 10px; border-radius: 50%; background: #648274; flex: none; }
.macro-status-dot.started { background: var(--blue); box-shadow: 0 0 8px rgba(73, 200, 255, 0.45); }
.macro-status-dot.paused { background: var(--amber); }
.macro-instance-body { padding: 0 14px 14px; display: grid; gap: 12px; }
.run-on { position: relative; display: grid; gap: 6px; }
.run-on-label { font-size: 13px; color: var(--muted); }
.run-on-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  background: #07140f;
  border-radius: 12px;
  padding: 10px 14px;
}
.run-on-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid #86a394;
  border-bottom: 2px solid #86a394;
  transform: rotate(45deg);
  margin-top: -4px;
}
.run-on-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #10261c;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--shadow);
}
.run-on-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.run-on-list { display: grid; gap: 4px; max-height: 280px; overflow: auto; }
label.run-on-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid transparent;
  position: relative;
  cursor: pointer;
}
.run-on-item:hover { background: rgba(61, 220, 132, 0.06); }
.run-on-item.picked { background: rgba(61, 220, 132, 0.1); border-color: rgba(61, 220, 132, 0.35); }
.run-on-item input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.run-on-check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid #4a6358;
  background: #07140f;
  flex: none;
  position: relative;
}
.run-on-item.picked .run-on-check { background: var(--green); border-color: var(--green); }
.run-on-item.picked .run-on-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #062112;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.run-on-item img { width: 32px; height: 32px; border-radius: 8px; image-rendering: pixelated; }
.run-on-meta { display: grid; min-width: 0; }
.run-on-meta small { color: var(--muted); font-size: 12px; }
.run-on-item.online .run-on-meta small { color: var(--green); }
.macro-instance-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.macro-bot-states { position: sticky; top: 12px; }
.macro-bot-state {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(78, 186, 122, 0.14);
}
.macro-bot-state:last-child { border-bottom: 0; }
.macro-bot-state span { flex: 1; min-width: 0; }
.macro-bot-state small { display: block; color: var(--muted); }
.macro-step-badge {
  font-style: normal;
  font-size: 12px;
  color: var(--blue);
  background: rgba(73, 200, 255, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.macro-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  min-height: calc(100vh - 180px);
}
.macro-canvas {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background-color: #07140f;
  background-image: radial-gradient(circle, rgba(61, 220, 132, 0.28) 1px, transparent 1px);
  background-size: 18px 18px;
  min-height: 560px;
}
.macro-wires { position: absolute; inset: 0; width: 1600px; height: 900px; pointer-events: none; overflow: visible; }
.macro-wire { pointer-events: auto; cursor: pointer; }
.macro-wire-hit { stroke: transparent; stroke-width: 18; }
.macro-wire-line { stroke: var(--blue); stroke-width: 2; fill: none; }
.macro-wire-cut circle { fill: #07140f; stroke: var(--blue); stroke-width: 1.5; }
.macro-wire-cut path { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.macro-wire:hover .macro-wire-line,
.macro-wire:hover .macro-wire-cut circle,
.macro-wire:hover .macro-wire-cut path { stroke: #ff8d8d; }
.macro-nodes { position: relative; min-width: 1600px; min-height: 700px; }
.macro-node {
  position: absolute;
  width: 220px;
  background: #10261c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 14px;
  cursor: grab;
  user-select: none;
}
.macro-node.selected { border-color: var(--green); box-shadow: 0 0 0 1px rgba(61, 220, 132, 0.35); }
.macro-node strong { display: block; margin-bottom: 4px; }
.macro-node small { color: var(--muted); font-size: 12px; line-height: 1.35; display: block; }
.macro-port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  top: 50%;
  margin-top: -6px;
}
.macro-port.in { left: -6px; }
.macro-port.out { right: -6px; }
.macro-inspector {
  background: linear-gradient(180deg, rgba(16, 40, 30, 0.96), rgba(10, 26, 20, 0.96));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.macro-inspector label { display: grid; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.macro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  z-index: 30;
}
.macro-overlay-card {
  width: min(560px, 92vw);
  background: #0d1c16;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.macro-palette-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.macro-palette-grid button { text-align: left; padding: 12px; }
.macro-palette-grid span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 400; }
.empty.nested { padding: 28px 8px; }
.empty.nested h1 { font-size: 20px; margin-bottom: 6px; }

@media (max-width: 980px) {
  .settings-row, .logs-layout, .macros-layout, .macro-workspace, .split-input, .inline-save, .danger-box, .proxy-row, .user-row {
    grid-template-columns: 1fr;
  }
  .discord-account { grid-template-columns: 1fr; }
  .discord-account-head { display: none; }
  .macro-palette-grid { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: 28px 36px 40px minmax(0, 1fr); }
  .order-moves { grid-column: 1 / -1; }
  .logs-view.log { height: 52vh; }
}
