:root {
  --bg: #0b1224;
  --panel: #0f172a;
  --card: #111a30;
  --border: rgba(148, 163, 184, 0.2);
  --muted: #9ca3af;
  --text: #e5e7eb;
  --accent: #7c3aed;
  --accent-2: #22c55e;
  --accent-soft: rgba(124, 58, 237, 0.15);
}

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at 20% 20%, #131c35, #060a18 50%, #02040a);
  color: var(--text);
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 20% 20%, #131c35, #060a18 50%, #02040a);
}

.login-card {
  width: min(420px, 94vw);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem 1.6rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.2), transparent 55%);
  transform: rotate(12deg);
  pointer-events: none;
}

.login-card h2 {
  margin: 0 0 0.2rem;
}

.login-card .form-field input {
  width: 100%;
}

.login-card .btn.full {
  margin-top: 0.2rem;
}

.login-error {
  color: #f87171;
  margin: 0.2rem 0 0.6rem;
  font-size: 0.9rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
}

.topbar h1 {
  margin: 0.15rem 0 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.4rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.charts-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stat-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.stat-card h3 {
  margin: 0.2rem 0;
  font-size: 1.8rem;
}

.chart-card {
  min-height: 220px;
}

.line-chart {
  width: 100%;
  height: 220px;
}

.line-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

.config-actions {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.5rem;
  flex-direction: column;
}

.config-commands {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.config-commands code {
  display: block;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  word-break: break-all;
}

.runtime-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.runtime-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  gap: 0.5rem;
}

.runtime-row .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.1rem 0 0;
}

.runtime-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 8px;
  width: 34px;
  height: 32px;
  font-size: 16px;
}

.btn.icon-only:disabled {
  opacity: 0.5;
}

.btn.icon-connect {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #bfdbfe;
}

.btn.icon-restart {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #cffafe;
}

.btn.icon-stop {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecdd3;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.status-dot.error {
  background: #f87171;
  box-shadow: 0 0 0 6px rgba(248, 113, 113, 0.12);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 0.5rem;
  align-items: center;
}

.bar-label {
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.bar-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, #7c3aed, #22c55e);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel-wide {
  width: 100%;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.panel-header h2 {
  margin: 0 0 0.2rem;
}

.panel-header .muted {
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.panel-actions-wrap {
  flex-wrap: wrap;
}

.search-input {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  min-width: 180px;
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.tab {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

.tab.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 860px) {
  .grid.two {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--card);
}

.card h3 {
  margin: 0 0 0.6rem;
}

.persona-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.persona-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.06), #0f162c);
  transition: border-color 120ms ease, transform 120ms ease;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.persona-name {
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.persona-meta {
  margin: 0.15rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-line;
}

.persona-desc {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 72px;
}

.account-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.1;
}

.net-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.account-badge .bubble {
  background: rgba(124, 58, 237, 0.2);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
}

.account-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 8px;
  color: #d1fae5;
  font-size: 0.85rem;
  margin-top: 0.2rem;
  line-height: 1.1;
  min-width: 180px;
}

.persona-actions {
  margin-top: auto;
  display: flex;
  gap: 0.35rem;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.persona-actions .btn {
  min-width: 40px;
}

.btn.edit {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn.posts {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #d1fae5;
}

.persona-card:hover {
  border-color: rgba(124, 58, 237, 0.6);
  transform: translateY(-2px);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid rgba(124, 58, 237, 0.5);
  font-size: 0.85rem;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 0.55rem 0.9rem;
  font: inherit;
  cursor: pointer;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  top: 0;
}

.btn.primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  font-weight: 600;
}

.btn:active {
  top: 1px;
}

.btn.secondary {
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.03);
}

.btn.ghost {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.btn.full {
  width: 100%;
  justify-content: center;
}

.btn.small {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
}

.btn-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0.2rem;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 110%;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  min-width: 220px;
  z-index: 20;
}
.dropdown-menu.hidden {
  display: none;
}
.dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.actions-inline {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.small {
  font-size: 0.9rem;
}

.tiny {
  font-size: 0.82rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-form {
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .modal-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.75rem;
    row-gap: 0.75rem;
  }
  .modal-form .full-row {
    grid-column: 1 / -1;
  }
}

@media (min-width: 980px) {
  .config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 280px;
    align-items: start;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field span {
  color: var(--muted);
  font-size: 0.9rem;
}

.form select,
.form input,
.form textarea {
  width: 100%;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: rgba(17, 24, 39, 0.7);
  color: var(--text);
  font: inherit;
}

input:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
}

.results-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table thead {
  background: rgba(124, 58, 237, 0.08);
}

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

.results-table th {
  font-weight: 600;
  color: var(--text);
}

.results-table td {
  color: var(--text);
  font-size: 0.92rem;
}

.results-table .muted {
  color: var(--muted);
}

.account-list-empty {
  color: var(--muted);
  padding: 0.6rem 0.75rem;
}

.post-text {
  white-space: pre-line;
}

.result-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.result-account {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.result-account .net-icon {
  width: 18px;
  height: 18px;
}

.empty-msg {
  padding: 0.85rem 1rem;
  text-align: center;
  color: var(--muted);
}

.bp-people {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hidden {
  display: none !important;
}
.logged-in #login-screen {
  display: none !important;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 0.15rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
}

.pill.subtle {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.4);
}

.pill.success {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.6);
  color: #dcfce7;
}

.pill.error {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecdd3;
}

.pill.hidden {
  display: none;
}

.select-filter {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font: inherit;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(640px, 94vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.3rem 1.3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  z-index: 60;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.modal-dialog::-webkit-scrollbar {
  width: 8px;
}

.modal-dialog::-webkit-scrollbar-track {
  background: transparent;
}

.modal-dialog::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.status-text {
  color: var(--muted);
  font-size: 0.9rem;
  display: block;
  width: 100%;
  text-align: right;
  margin-top: 2px;
}

.debug-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 0.6rem;
  padding: 0.75rem;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.03);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-item {
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.25);
  padding-bottom: 0.35rem;
}

.history-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.account-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.account-row .remove-account {
  height: 42px;
  width: 42px;
  justify-content: center;
}

.account-row[data-row-template] {
  display: none;
}

.account-icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.modal-open {
  overflow: hidden;
}

.generation-dialog {
  width: min(900px, 96vw);
}

.generation-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.generation-banner {
  border: 1px dashed var(--border);
  background: rgba(124, 58, 237, 0.1);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  color: var(--text);
}

.generation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.75rem;
}

.generation-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.generation-card h4 {
  margin: 0;
}

.gen-mode-card {
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.gen-mode-card:hover {
  border-color: rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}

.gen-mode-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.gen-mode-card input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #a855f7;
  margin-top: 0.25rem;
}

.gen-mode-card .form-field.inline input {
  background: rgba(17, 24, 39, 0.9);
}

.bp-option-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.4rem 0 0.2rem;
}

.bp-option {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
}

.bp-option input {
  width: 18px;
  height: 18px;
  accent-color: #a855f7;
}

.bp-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bp-option-name {
  font-weight: 600;
}

.bp-option-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.generation-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.form-field.inline {
  margin: 0;
}

.form-field.inline input[disabled],
.form-field.inline select[disabled] {
  opacity: 0.9;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.timeline-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
}

.timeline-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.timeline-text strong {
  font-weight: 600;
}

.generation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}

.generation-footer .footer-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.spinner{width:16px;height:16px;border:2px solid rgba(255,255,255,0.25);border-top-color:#a855f7;border-radius:50%;animation:spin 0.8s linear infinite;display:inline-block;}@keyframes spin{to{transform:rotate(360deg);}}
