:root {
  color-scheme: dark;
  --bg: #10120e;
  --panel: #181b14;
  --panel-2: #21261b;
  --line: rgba(244, 241, 230, 0.1);
  --text: #f4f1e6;
  --muted: #a4a894;
  --accent: #dff25a;
  --ink: #17190f;
  --ok: #c6f58a;
  --wait: #ffc56b;
  --bad: #ff7d6a;
  --run: #9fd0ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  font-family: Manrope, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(880px 380px at 100% -10%, rgba(223, 242, 90, 0.09), transparent 55%),
    var(--bg);
  color: var(--text);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, strong { font-family: Unbounded, Manrope, sans-serif; }
h1 { margin: 0; font-size: 32px; letter-spacing: -0.04em; }
h2 { margin: 0 0 8px; font-size: 22px; }

.panel-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.panel-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.panel-card h1 { font-size: 28px; }
.panel-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12150f;
}
#panel-login-error { margin: 0; color: var(--bad); }
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}
aside {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand strong { display: block; font-size: 18px; }
.brand small, .aside-foot, .hint, .lead, .muted { color: var(--muted); }
.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  display: grid;
  place-items: center;
}
.mark::before {
  content: "";
  border-style: solid;
  border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent var(--ink);
  margin-left: 3px;
}
nav { display: flex; flex-direction: column; gap: 6px; }
nav button, .toolbar button, .picker-head button, .dialog-actions button:not(.primary), .ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}
nav button.active, nav button:hover, .toolbar button:hover, .picker-head button:hover {
  background: var(--panel-2);
}
nav em {
  font-style: normal;
  color: var(--accent);
  margin-left: 6px;
}
.aside-foot { margin-top: auto; font-size: 13px; line-height: 1.45; }
.aside-foot p { margin: 0 0 8px; }
main { padding: 28px 32px 64px; }
.page-head, .toolbar, .composer-foot, .picker-head, .dialog-actions, .card-actions, .target {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.page-head { align-items: flex-start; margin-bottom: 18px; }
.lead { max-width: 760px; line-height: 1.5; margin: 8px 0 0; }
button.primary {
  background: var(--accent);
  color: var(--ink);
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
}
.primary:disabled, button:disabled { opacity: 0.45; cursor: default; }
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
#summary { grid-template-columns: repeat(2, minmax(160px, 240px)); }
.metric, .card, .reel, .composer, dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.metric { padding: 14px 16px; }
.metric b { display: block; font-size: 26px; font-family: Unbounded, Manrope, sans-serif; }
.metric span { color: var(--muted); font-size: 13px; }
.toolbar { margin-bottom: 14px; }
.toolbar input, .stack input, .stack textarea, .stack select, .card-form input, .card-form select {
  width: 100%;
  background: #10130e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.toolbar input { flex: 1; }
.cards, .picker { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.card, .reel { padding: 16px; }
.card header, .who { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.user { font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flag { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); }
.cc { font-size: 12px; letter-spacing: 0.04em; color: var(--muted); }
.proxy-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.proxy-tail { display: inline-flex; gap: 6px; align-items: center; }
.fold { border: 1px solid var(--line); border-radius: 14px; padding: 0 12px 12px; background: #12150f; }
.fold:not([open]) { padding-bottom: 0; }
.fold summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.fold summary::-webkit-details-marker { color: var(--accent); }
.secret-mask {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  background: #10130e;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.proxy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.proxy-row .who { align-items: center; }
.proxy-row button { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.stack.slim { gap: 4px; min-width: 150px; font-size: 12px; color: var(--muted); }
.view-switch { display: flex; gap: 6px; }
.view-switch button.active { background: var(--panel-2); border-color: var(--accent); }
.cards.as-list { grid-template-columns: 1fr; }
.cards.as-list .card:not(.editing):not(.detailed) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.cards.as-list .card:not(.editing):not(.detailed) header { flex: 1 1 240px; }
.cards.as-list .card:not(.editing):not(.detailed) .stats-line,
.cards.as-list .card:not(.editing):not(.detailed) .proxy-line { margin: 0; }
.cards.as-list .card:not(.editing):not(.detailed) .card-actions { margin-left: auto; }
.cards.as-list .card:not(.detailed) .bio-line,
.cards.as-list .card:not(.detailed) .checked { display: none; }
.detail {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.detail-head { display: flex; gap: 14px; align-items: center; }
.avatar-wrap { width: 96px; height: 96px; flex: none; position: relative; }
.avatar-wrap.lg { width: 108px; height: 108px; }
.avatar-replace {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 3px solid #10140c;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.avatar-replace svg { width: 16px; height: 16px; display: block; }
.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 15px; height: 15px; display: block; }
.inline-fact { display: flex; gap: 8px; align-items: center; }
.inline-editor { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.inline-editor input, .inline-editor textarea { flex: 1 1 220px; }
.save-note { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--muted); }
.save-note.ok { color: var(--ok); }
.save-note.bad { color: var(--bad); }
.account-link { font-weight: 700; }
.meter { height: 6px; border-radius: 99px; background: #2a2e24; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--accent); }
.upload-progress { display: grid; gap: 6px; }
.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #121212;
  display: block;
}
.ig-fallback { display: block; width: 100%; height: 100%; }
.ig-fallback svg { width: 100%; height: 100%; display: block; }
.profile-page { display: grid; gap: 20px; }
.profile-head { display: grid; gap: 8px; max-width: 720px; }
.profile-top { display: flex; gap: 14px; align-items: center; }
.profile-top h1 { margin: 0; font-size: 22px; }
.profile-stats { display: flex; gap: 14px; margin: 4px 0 0; font-size: 13px; }
.profile-stats b { font-family: Unbounded, Manrope, sans-serif; font-size: 15px; }
.profile-head .sub { margin-top: 2px; }
.identity { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.farm-totals { display: flex; gap: 14px; flex: none; }
.farm-totals span { display: grid; justify-items: end; gap: 2px; }
.farm-totals b { font-size: 18px; line-height: 1; }
.farm-totals em { font-style: normal; color: var(--muted); font-size: 11px; }
.note-line.empty { color: var(--muted); }
.bio-block { display: grid; gap: 2px; }
.bio-text { margin: 0; white-space: pre-wrap; }
.bio-text.empty { color: var(--muted); }
.profile-edit { display: grid; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.reel-mini {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto auto auto auto auto;
  align-items: center;
  column-gap: 16px;
  width: 100%;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.reel-updated { white-space: nowrap; }
.reel-file, .reel-when {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reel-file { font-size: 13px; }
.reel-mini .sub { margin: 0; }
.reel-mini .stat { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.reel-mini .stat b { font-size: 18px; line-height: 1; }
.reel-mini .stat em { font-style: normal; color: var(--muted); font-size: 12px; }
.reel-mini .meter, .reel-mini .message { grid-column: 1 / -1; }
.reel-mini .message { margin: 0; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stats-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 14px 0;
  font-size: 13px;
}
.stats-line b { display: block; font-family: Unbounded, Manrope, sans-serif; font-size: 16px; }
.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #2a2e24;
}
.pill.ok { color: var(--ok); }
.pill.wait { color: var(--wait); }
.pill.bad { color: var(--bad); }
.pill.run { color: var(--run); }
.message { color: var(--wait); font-size: 13px; line-height: 1.4; margin: 8px 0; }
.card.editing { grid-column: 1 / -1; }
.card-form, .edit-slot form { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.edit-slot:empty { display: none; }
.card-actions { justify-content: flex-start; flex-wrap: wrap; }
.card-actions button, .target button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.danger { color: var(--bad); }
.composer { padding: 16px; display: grid; gap: 14px; }
.drop {
  border: 1px dashed rgba(223, 242, 90, 0.45);
  border-radius: 16px;
  min-height: 140px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: rgba(223, 242, 90, 0.03);
}
.drop input { display: none; }
.drop.hot { background: rgba(223, 242, 90, 0.12); }
.stack { display: grid; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 13px; margin: 0; line-height: 1.45; }
.check { display: flex; gap: 8px; align-items: center; }
.picker { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pick {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12150f;
}
.stack-list { display: grid; gap: 12px; }
.target { padding: 8px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
a { color: var(--accent); }
.empty { padding: 28px; color: var(--muted); }
dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  color: var(--text);
  padding: 18px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
dialog form { display: grid; gap: 12px; }
.dialog-actions { justify-content: flex-end; }
.error { color: var(--bad); }
#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 5;
}
.toast {
  background: #262b1e;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.toast.bad { border-left-color: var(--bad); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { flex-direction: row; overflow: auto; }
  main { padding: 18px 14px 40px; }
  .summary, .grid-2 { grid-template-columns: 1fr 1fr; }
  .page-head, .toolbar { flex-direction: column; align-items: stretch; }
}
