/* Fytrade admin portal */

:root {
  --bg: #070b0c;
  --bg-2: #0b1112;
  --panel: #0f1617;
  --panel-2: #141d1e;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #e8f1ee;
  --sub: #95a5a0;
  --muted: #627570;
  --brand: #00b386;
  --brand-2: #2fe0b0;
  --brand-bg: rgba(47, 224, 176, 0.1);
  --red: #ff6b4a;
  --red-bg: rgba(255, 107, 74, 0.12);
  --amber: #ffc164;
  --amber-bg: rgba(255, 193, 100, 0.12);
  --blue: #5aa9ff;
  --blue-bg: rgba(90, 169, 255, 0.12);
  --radius: 14px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --scroll-max: min(520px, 65vh);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(47, 224, 176, 0.3); }

.boot { height: 100vh; display: grid; place-items: center; }
.boot img { border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ------------------------------------------------------------- login */

.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0, 179, 134, 0.22), transparent 70%),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
}
.login-card { width: 100%; max-width: 400px; background: rgba(15, 22, 23, 0.9); border: 1px solid var(--line-2); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 0 24px rgba(0, 179, 134, 0.45); }
.login-brand b { display: block; font-size: 18px; }
.login-brand span { color: var(--sub); font-size: 12.5px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------ layout */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.side-brand img { width: 32px; height: 32px; border-radius: 9px; }
.side-brand b { font-size: 15px; }
.side-brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--sub); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-bg); color: var(--brand-2); }
.nav a .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #00140e; background: linear-gradient(135deg, var(--brand-2), var(--brand)); flex: none; font-size: 13px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(7, 11, 12, 0.85); backdrop-filter: blur(10px); z-index: 5; }
.top .menu { display: none; }
.top .spacer { flex: 1; }
.content { padding: 24px 28px 48px; max-width: 1320px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .top .menu { display: inline-flex; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
}

/* ---------------------------------------------------------- elements */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #1b2627; border-color: rgba(255,255,255,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #00140e; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: rgba(255,107,74,.35); background: var(--red-bg); }
.btn.danger:hover { background: rgba(255,107,74,.2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sub); }
.btn.ghost:hover { background: rgba(255,255,255,.05); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; height: 42px; }
.icon { width: 18px; height: 18px; flex: none; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--sub); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
input, select, textarea {
  width: 100%; background: #0a1011; border: 1px solid var(--line-2); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 179, 134, .18); }
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"] { width: auto; }
.code-input { font: 600 22px var(--mono); letter-spacing: .4em; text-align: center; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: #2a3536; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand-2); outline-offset: 2px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

.kpi { padding: 18px; }
.kpi small { color: var(--sub); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.kpi b { display: block; font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi .up { color: var(--brand-2); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { color: var(--brand-2); background: var(--brand-bg); }
.pill.red { color: var(--red); background: var(--red-bg); }
.pill.amber { color: var(--amber); background: var(--amber-bg); }
.pill.blue { color: var(--blue); background: var(--blue-bg); }
.pill.grey { color: var(--sub); background: rgba(255,255,255,.06); }
.tag { display: inline-block; font: 600 11px var(--mono); padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--sub); }

/* Long tables and lists scroll inside their card, so a card never grows
   with its data and the page layout stays fixed. */
.table-wrap { overflow: auto; max-height: var(--scroll-max); overscroll-behavior: contain; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); box-shadow: inset 0 -1px 0 var(--line); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: rgba(255,255,255,.025); }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
td.nowrap { white-space: nowrap; }
td.detail { min-width: 220px; max-width: 420px; font: 12.5px/1.5 var(--mono); overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ellipsis { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; min-width: 0; }
.toolbar select { max-width: 100%; }
.toolbar input[type="search"] { max-width: 320px; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--sub); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--brand-2); border-color: var(--brand-2); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head .spacer { flex: 1; }
.page-head p { color: var(--sub); margin: 4px 0 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--sub); margin-bottom: 12px; font-size: 13px; }

dl.props { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
dl.props dt { color: var(--muted); font-size: 13px; }
dl.props dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.props { grid-template-columns: 1fr; gap: 2px; } dl.props dd { margin-bottom: 10px; } }

.list { display: grid; max-height: var(--scroll-max); overflow-y: auto; overscroll-behavior: contain; align-content: start; }
.list-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.dot.green { background: var(--brand-2); } .dot.red { background: var(--red); } .dot.amber { background: var(--amber); }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid; margin-bottom: 16px; }
.notice.amber { border-color: rgba(255,193,100,.3); background: var(--amber-bg); color: #f6dcb0; }
.notice.red { border-color: rgba(255,107,74,.3); background: var(--red-bg); color: #ffc9bb; }
.notice.green { border-color: rgba(47,224,176,.3); background: var(--brand-bg); color: #c9f2e5; }
.notice p:last-child { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }
.sub { color: var(--sub); }
.right { text-align: right; }
.mt { margin-top: 16px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.qr { background: #fff; padding: 10px; border-radius: 12px; width: 200px; height: 200px; }
.secret { font: 600 14px var(--mono); letter-spacing: .12em; background: #0a1011; border: 1px dashed var(--line-2); padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }

.chart { width: 100%; height: 180px; display: block; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { fill: var(--brand-2); }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .gridline { stroke: rgba(255,255,255,.06); }

.meter { height: 8px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.meter.amber > span { background: var(--amber); } .meter.red > span { background: var(--red); }

/* ---------------------------------------------------------- overlays */

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: #182223; border: 1px solid var(--line-2); border-left: 3px solid var(--brand-2); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; animation: fade .15s; }
.toast.error { border-left-color: var(--red); }

.err { color: var(--red); font-size: 13px; margin: -4px 0 12px; min-height: 0; }
.err:empty { display: none; }

[hidden] { display: none !important; }

/* Devices */
.split { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.07); gap: 2px; }
.split span { display: block; height: 100%; }
.seg-android { background: var(--brand); }
.seg-ios { background: var(--blue); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.legend > span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; display: inline-block; }
.barlist { display: grid; gap: 12px; }
.barlist-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.barlist-head .ellipsis { max-width: none; min-width: 0; }
.barlist .meter { margin-top: 5px; height: 6px; }

/* Thin scrollbars that suit the dark panels */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* Images */
img.avatar { object-fit: cover; background: var(--panel-2); padding: 0; }
.post-image { display: block; max-width: 100%; max-height: 420px; border-radius: 12px; border: 1px solid var(--line); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 16px; max-height: var(--scroll-max); overflow-y: auto; }
.tile { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; }
.tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #0a1011; }
.tile figcaption { padding: 10px 12px; display: grid; gap: 6px; font-size: 12.5px; }
