/* Ram Admin — white / black / orange */
:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-soft: #fff3ea;
  --black: #0a0a0a;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #999999;
  --bg: #fafafa;
  --card: #ffffff;
  --line: #ececec;
  --danger: #dc2626;
  --green: #16a34a;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
[hidden] { display: none !important; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--black);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 36px;
  width: 100%; max-width: 400px; text-align: center;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; text-align: left; }
.login-logo {
  width: 52px; height: 52px; border-radius: 16px; background: var(--black);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex-shrink: 0;
}
.login-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.login-text { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin-bottom: 22px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff;
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  transition: box-shadow .15s, transform .1s;
}
.btn-google:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 14px; }

/* ── Shell ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: var(--black); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.side-logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.side-name { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.side-nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border: none; background: none; color: #b5b5b5;
  border-radius: 10px; font-size: 14px; font-weight: 600; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--orange); color: #fff; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 99px;
  min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.side-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.side-admin { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.side-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.side-admin-meta { min-width: 0; }
.side-admin-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-admin-email { font-size: 11.5px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-ghost {
  width: 100%; padding: 9px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18);
  background: none; color: #ccc; font-size: 13px; font-weight: 600;
}
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.topbar p { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.data-note { font-size: 12px; color: var(--ink-3); }

.content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 20px; }

/* ── Cards / panels ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cards.sm { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.stat-card .label { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.stat-card.accent { border-left: 4px solid var(--orange); }
.stat-card .value.orange { color: var(--orange-dark); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel.pad-0 { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.panel-hint { font-size: 12px; color: var(--ink-3); }
.link { background: none; border: none; color: var(--orange-dark); font-size: 13px; font-weight: 600; }
.link:hover { text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.chart-box { position: relative; height: 260px; }

.seg { display: flex; background: #f1f1f1; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── Mini lists ── */
.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.mini-row:last-child { border-bottom: none; }
.mini-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--orange-soft);
  color: var(--orange-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0; overflow: hidden;
}
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mini-main { flex: 1; min-width: 0; }
.mini-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { color: var(--ink-3); font-size: 12px; }
.mini-val { font-weight: 700; font-size: 13px; white-space: nowrap; }
.mini-val.orange { color: var(--orange-dark); }

/* ── Toolbar / table ── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 9px; background: #fff;
  border: 1px solid var(--line); border-radius: 11px; padding: 0 14px; height: 42px;
  flex: 1; min-width: 220px; max-width: 420px;
}
.search-box svg { width: 17px; height: 17px; fill: var(--ink-3); flex-shrink: 0; }
.search-box input { border: none; outline: none; flex: 1; font-size: 13.5px; background: none; }
.select {
  height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px;
  font-size: 13px; font-weight: 600; background: #fff; color: var(--ink);
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 13px 16px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3);
  border-bottom: 1px solid var(--line); background: #fbfbfb; white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #fffaf5; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--orange-soft);
  color: var(--orange-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0; overflow: hidden;
}
.cell-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: #f1f1f1; color: var(--ink-2); white-space: nowrap;
}
.pill.google { background: #e8f0fe; color: #1a56db; }
.pill.apple { background: #ececec; color: #111; }
.pill.warn { background: #fef3c7; color: #b45309; }
.pill.bad { background: #fee2e2; color: var(--danger); }
.pill.good { background: #dcfce7; color: var(--green); }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

.pager { display: flex; align-items: center; justify-content: space-between; }
.pager.center { justify-content: center; }
.pager span { font-size: 12.5px; color: var(--ink-3); }
.pager div { display: flex; gap: 8px; }

.btn-secondary {
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--ink);
}
.btn-secondary:hover { background: #f6f6f6; }
.btn-secondary.sm { padding: 8px 14px; font-size: 12.5px; }
.btn-secondary:disabled { opacity: .45; cursor: default; }
.btn-danger {
  padding: 10px 18px; border-radius: 10px; border: none;
  background: var(--danger); color: #fff; font-size: 13px; font-weight: 700;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger.sm { padding: 7px 12px; font-size: 12px; }
.btn-primary {
  padding: 10px 18px; border-radius: 10px; border: none;
  background: var(--orange); color: #fff; font-size: 13px; font-weight: 700;
}
.btn-primary:hover { background: var(--orange-dark); }

/* ── Content cards ── */
.tabs { display: flex; gap: 6px; }
.tabs button {
  padding: 10px 20px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.tabs button.active { background: var(--black); color: #fff; border-color: var(--black); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.content-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.content-card img.thumb { width: 100%; height: 150px; object-fit: cover; display: block; background: #eee; }
.content-card .no-thumb { width: 100%; height: 150px; background: var(--orange-soft); display: flex; align-items: center; justify-content: center; color: var(--orange-dark); font-size: 13px; font-weight: 600; padding: 16px; text-align: center; }
.content-card .cc-body { padding: 13px 14px; }
.content-card .cc-title { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-card .cc-meta { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.content-card .cc-stats { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.content-card .cc-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Drawer ── */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 92vw;
  background: #fff; z-index: 50; box-shadow: -8px 0 30px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
  animation: slide-in .22s ease;
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; font-weight: 800; }
.icon-btn { border: none; background: #f1f1f1; width: 32px; height: 32px; border-radius: 9px; font-size: 14px; color: var(--ink-2); }
.icon-btn:hover { background: #e5e5e5; }
.drawer-body { padding: 22px; overflow-y: auto; flex: 1; }
.d-profile { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.d-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-dark); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.d-avatar img { width: 100%; height: 100%; object-fit: cover; }
.d-name { font-size: 17px; font-weight: 800; }
.d-user { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.d-section { margin-bottom: 20px; }
.d-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 10px; font-weight: 700; }
.d-kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f3f3f3; font-size: 13px; }
.d-kv:last-child { border-bottom: none; }
.d-kv .k { color: var(--ink-2); }
.d-kv .v { font-weight: 600; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* ── Modal / toast ── */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 18px; padding: 26px; width: 380px; max-width: 90vw;
  z-index: 60; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.modal p { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--black); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; z-index: 70; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: slide-in .2s ease;
}
.boot-error {
  position: fixed; inset: auto 16px 16px 16px; background: #fee2e2; color: #991b1b;
  border: 1px solid #fecaca; border-radius: 12px; padding: 14px 18px; font-size: 13px;
  z-index: 100; line-height: 1.5;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .sidebar { width: 76px; }
  .side-name, .side-admin-meta, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item svg { width: 21px; height: 21px; }
  .side-brand { justify-content: center; padding: 18px 0; }
  .side-foot { padding: 12px 8px; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 16px; }
}
