/* TBuddy - same look as the desktop overlay (TradingView dark). */
:root {
  --bg: #000000;
  --card: #1e1e1e;
  --card-hi: #2e2e2e;
  --hover: #3a3a3a;
  --border: #434343;
  --border-hi: #5d5d5d;
  --divider: #2a2a2a;
  --outline: #222222;
  --text: #ededed;
  --dim: #9b9b9b;
  --blue: #2962ff;
  --green: #22ab94;
  --red: #f23645;
  --amber: #ff9800;
  --gold: #ffca28;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); }

.dim { color: var(--dim); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.blue { color: var(--blue); }
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 600; }

/* ---- layout ---- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(0, 0, 0, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--outline);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; margin-right: auto; }
.logo {
  width: 28px; height: 28px; border-radius: 6px; background: var(--text); color: #000;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; letter-spacing: -0.2px; flex: none;
}
.user { display: flex; align-items: center; gap: 10px; }

.section { margin-top: 20px; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; font-weight: 600; margin: 0; margin-right: auto; }

.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* ---- cards ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .label { color: var(--dim); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.kpi .value { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { color: var(--dim); font-size: 12.5px; margin-top: 2px; }

.split { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.split > div { padding: 12px 14px; }
.split > div + div { border-left: 1px solid var(--bg); text-align: right; }
.split .label { color: var(--dim); }
.split .value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- controls ---- */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 0; border-radius: 999px; padding: 6px 14px; background: var(--card-hi); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: var(--hover); }
.pill.on { background: var(--text); color: #000; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 6px 4px 12px;
  background: rgba(41, 98, 255, 0.18); color: var(--text); font-size: 13px; font-weight: 600; border: 0; cursor: pointer;
}
.chip span.x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.12); font-size: 12px; }

.btn {
  border: 0; border-radius: 10px; padding: 10px 18px; background: var(--card-hi); color: var(--text);
  font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn:active { background: var(--border-hi); }
.btn.white { background: var(--text); color: #000; }
.btn.white:hover { background: #ffffff; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer; font-size: 18px; flex: none;
}
.icon-btn:hover { background: var(--card-hi); }

input.field, textarea.field, select.field {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; outline: none;
}
input.field:hover, textarea.field:hover, select.field:hover { border-color: var(--border-hi); }
input.field:focus, textarea.field:focus, select.field:focus { border-color: var(--blue); }
textarea.field { resize: vertical; min-height: 110px; }
.field-label { color: var(--dim); margin: 14px 0 6px; display: block; }

.badge {
  display: inline-block; background: var(--blue); color: #fff; font-weight: 600; font-size: 13px;
  border-radius: 5px; padding: 2px 8px; white-space: nowrap;
}

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; color: var(--dim); font-weight: 400; font-size: 13px; padding: 8px 10px;
  border-bottom: 1px solid var(--divider); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--divider); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #161616; }
th.r, td.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
.bar { height: 6px; border-radius: 3px; min-width: 2px; }
.bar-cell { width: 22%; min-width: 90px; }
@media (max-width: 700px) { .hide-sm { display: none; } }

.stars { color: var(--gold); letter-spacing: 1px; }
.stars .off { color: var(--border); }

.empty { text-align: center; color: var(--dim); padding: 32px 12px; }
.empty .big { color: var(--text); font-weight: 600; font-size: 15px; margin-bottom: 4px; }

/* ---- login ---- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 360px; background: var(--bg); border: 3px solid var(--outline); border-radius: 12px; padding: 24px; }
.login .brand { margin-bottom: 6px; }
.login p { margin: 0 0 8px; }
.error { color: var(--red); margin-top: 10px; min-height: 20px; }

/* ---- drawer ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 21;
  background: var(--bg); border-left: 3px solid var(--outline); overflow-y: auto; padding: 16px;
}
.drawer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.drawer-head .pnl { margin-left: auto; font-size: 18px; font-weight: 600; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shot {
  display: block; width: 100%; border: 0; padding: 0; text-align: left; color: inherit; cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden; background: var(--card);
}
.shot:hover { outline: 1px solid var(--border-hi); }
.shot:focus-visible { outline: 2px solid var(--blue); }
.shots img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #111; }
.shots .cap { font-size: 12.5px; color: var(--dim); padding: 6px 8px; }
.cam { color: var(--dim); vertical-align: -2px; margin-left: 8px; }

/* ---- screenshot viewer ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.94);
  display: grid; place-items: center; padding: 56px 16px 16px;
}
.lightbox figure { margin: 0; max-width: 100%; }
.lightbox img {
  display: block; max-width: min(1600px, 94vw); max-height: calc(100vh - 120px);
  border-radius: var(--radius); border: 3px solid var(--outline);
}
.lightbox figcaption { margin-top: 10px; text-align: center; font-size: 13.5px; }
.lb-btn { position: absolute; background: var(--card-hi); }
.lb-btn:hover { background: var(--hover); }
.lb-close { top: 12px; right: 12px; font-size: 22px; }
.lb-prev, .lb-next { top: 50%; width: 44px; height: 44px; margin-top: -22px; font-size: 28px; border-radius: 50%; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.rating button { border: 0; background: none; font-size: 24px; padding: 0 2px; cursor: pointer; color: var(--border); }
.rating button.on { color: var(--gold); }
.rating button:hover { color: var(--border-hi); }
.rating button.on:hover { color: var(--gold); }
.saved { font-size: 12.5px; color: var(--dim); margin-left: 8px; }

.balance-edit { display: flex; gap: 8px; margin-top: 8px; }

/* ---- sign-in, account, admin ---- */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; margin-top: 16px; }
.dl { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle;
  background: var(--card-hi); color: var(--text); display: inline-grid; place-items: center; font-weight: 600; font-size: 12.5px;
}
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--card-hi); margin-right: 4px; }
.tag.red { color: var(--red); }
.progress { height: 6px; background: var(--card-hi); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress .fill { height: 100%; width: 0; background: var(--blue); transition: width 0.15s; }
input[type="file"].field { padding: 7px 10px; }
input[type="file"].field::file-selector-button {
  border: 0; border-radius: 6px; background: var(--card-hi); color: var(--text); padding: 5px 10px; margin-right: 10px; font-weight: 600; cursor: pointer;
}
.balance-edit input { min-width: 0; }
