/* ============================================================
   Stanly — Operator Console styles (admin.html)
   Reuses the core design system; adds login, table, KPI styles.
   ============================================================ */

.admin-body { background: var(--paper); }

/* ---------------- LOGIN GATE ---------------- */
.admin-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(108,76,241,.16), transparent 60%),
    radial-gradient(700px 420px at 90% 110%, rgba(255,93,82,.12), transparent 60%);
}
.al-card {
  width: 100%; max-width: 410px; background: var(--card); border: 1px solid var(--line);
  border-radius: 26px; box-shadow: var(--shadow-lg); padding: 30px;
}
.al-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.al-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.al-brand .brand-mark svg { width: 24px; height: 24px; }
.al-title { font-family: var(--ff-display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.al-sub { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.al-access-copy { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.al-error { background: rgba(255,93,82,.1); color: var(--coral-deep); font-size: 13px; font-weight: 600; padding: 10px 13px; border-radius: 12px; margin: 4px 0 12px; }
.al-back { display: block; text-align: center; margin-top: 20px; font-size: 13px; font-weight: 700; color: var(--ink-faint); }
.al-back:hover { color: var(--ink); }

/* ---------------- SHELL ---------------- */
.admin-shell { min-height: 100vh; display: flex; }
.admin-shell[hidden], .admin-login[hidden] { display: none !important; }
.admin-sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  padding: 22px 18px; display: flex; flex-direction: column; gap: 4px;
  background: rgba(255,250,243,.78); backdrop-filter: blur(14px); border-right: 1px solid var(--line);
}
.admin-sidebar .op-tag { font-size: 11px; font-weight: 800; background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 7px; margin-left: 6px; vertical-align: middle; letter-spacing: .02em; }
.admin-sidebar .nav-item.active { background: var(--ink); color: #fff; }
.admin-sidebar .count.flag { background: var(--coral); color: #fff; padding: 1px 7px; border-radius: 999px; font-size: 11px; }
.admin-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.op-av { width: 38px; height: 38px; border-radius: 11px; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; font-family: var(--ff-display); flex: 0 0 auto; }
.admin-foot .profile-card .btn-icon { width: 32px; height: 32px; }
.admin-foot .profile-card .btn-icon svg { width: 15px; height: 15px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-main .topbar { display: flex; align-items: center; gap: 14px; }
.admin-menu-btn { display: none; width: 40px; height: 40px; border-radius: 11px; background: var(--card); box-shadow: var(--shadow-sm); border: 1px solid var(--line); align-items: center; justify-content: center; color: var(--ink); }
.admin-menu-btn svg { width: 20px; height: 20px; }
.env-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.admin-scrim { position: fixed; inset: 0; background: rgba(20,12,30,.5); z-index: 49; }

/* ---------------- KPI / OVERVIEW ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.admin-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.admin-row.thirds { grid-template-columns: repeat(3, 1fr); }

.rev-split { padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.rev-big { font-family: var(--ff-display); font-weight: 800; font-size: 32px; letter-spacing: -.02em; }
.rev-sub { font-size: 12.5px; color: var(--ink-faint); }
.rev-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.rev-line:last-child { border-bottom: none; }
.rev-line span { color: var(--ink-soft); font-weight: 600; }
.rev-line b { font-family: var(--ff-display); font-weight: 800; }
.rev-line.danger b { color: var(--coral-deep); }

.plan-row { display: grid; grid-template-columns: auto 1fr auto 90px auto; align-items: center; gap: 10px; padding: 9px 0; }
.plan-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.plan-name { font-weight: 700; font-size: 13.5px; }
.plan-rev { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.plan-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 60px; }
.plan-bar i { display: block; height: 100%; border-radius: 999px; }
.plan-count { font-family: var(--ff-display); font-weight: 800; font-size: 14px; text-align: right; }

.feat-star { color: var(--sun); font-size: 13px; }
.activity-feed { display: flex; flex-direction: column; }
.act-row { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.act-row:last-child { border-bottom: none; }
.act-ic { font-size: 17px; flex: 0 0 auto; }
.act-text { font-size: 13px; font-weight: 600; line-height: 1.4; }
.act-time { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }

/* ---------------- TOOLBAR / FILTERS ---------------- */
.admin-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-select { width: auto; min-width: 130px; padding: 9px 13px; border-radius: 999px; background: var(--card); font-weight: 600; font-size: 13.5px; }
.tb-count { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink-faint); }

/* ---------------- TABLE ---------------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.admin-table th.num, .admin-table td.num { text-align: right; }
.admin-table th.ta-right, .admin-table td.ta-right { text-align: right; }
.admin-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--paper-2); }
.admin-table td.muted { color: var(--ink-faint); }
.admin-table td.num { font-family: var(--ff-display); font-weight: 700; }

.cell-creator { display: flex; align-items: center; gap: 11px; }
.cell-creator img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; flex: 0 0 auto; }
.cc-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 5px; }
.cc-handle { font-size: 11.5px; color: var(--ink-faint); }

.plan-pill { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 3px 11px; border-radius: 999px; color: var(--pc, var(--violet)); background: color-mix(in srgb, var(--pc, var(--violet)) 14%, transparent); }
.status-pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.status-pill.active { background: rgba(20,124,93,.14); color: #12694f; }
.status-pill.suspended { background: rgba(255,93,82,.14); color: var(--coral-deep); }
.status-pill.pay-pending { background: rgba(138,90,0,.14); color: #744c00; }
.status-pill.pay-processing { background: rgba(108,76,241,.13); color: var(--violet-deep); }
.status-pill.pay-paid { background: rgba(20,124,93,.14); color: #12694f; }
.status-pill.pay-held { background: rgba(255,93,82,.14); color: var(--coral-deep); }
.status-pill.cat-live { background: rgba(20,124,93,.14); color: #12694f; }
.status-pill.cat-review { background: rgba(138,90,0,.14); color: #744c00; }

.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions .btn-icon { width: 32px; height: 32px; }
.row-actions .btn-icon svg { width: 16px; height: 16px; }
.cm-danger { color: var(--coral-deep) !important; }
.cm-danger:hover { background: rgba(255,93,82,.08); }

.row-popmenu { position: fixed; z-index: 120; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; width: 184px; opacity: 0; transform: translateY(-6px); transition: opacity .14s, transform .14s; }
.row-popmenu.open { opacity: 1; transform: none; }
.row-popmenu button { display: flex; align-items: center; gap: 9px; width: 100%; border: none; background: transparent; padding: 9px 10px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--ink); text-align: left; }
.row-popmenu button:hover { background: var(--paper-2); }
.row-popmenu button svg { width: 16px; height: 16px; color: var(--ink-soft); }

/* creator modal */
.cm-avatar { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: 0 0 auto; }
.cm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.cm-stat { background: var(--paper-2); border: 1px solid var(--line); border-radius: 15px; padding: 14px 12px; text-align: center; }
.cm-stat .v { font-family: var(--ff-display); font-weight: 800; font-size: 19px; }
.cm-stat .l { font-size: 11px; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }
.cm-meta-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cm-meta-row:last-child { border-bottom: none; }
.cm-meta-row > span:first-child { color: var(--ink-faint); font-weight: 600; }
.cm-foot { flex-wrap: wrap; }
.cm-foot .btn { flex: 1; min-width: 120px; }

/* plan picker */
.plan-pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.plan-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 15px; border: 1.5px solid var(--line-2); background: var(--paper-2); transition: all .14s; }
.plan-pick:hover { border-color: var(--violet); }
.plan-pick.sel { border-color: var(--violet); background: rgba(108,76,241,.07); box-shadow: 0 0 0 3px rgba(108,76,241,.12); }
.plan-pick .pp-dot { width: 12px; height: 12px; border-radius: 50%; }
.plan-pick b { font-size: 14.5px; font-weight: 800; }
.plan-pick i { font-style: normal; font-size: 12px; color: var(--ink-faint); }

/* ---------------- PAYOUTS ---------------- */
.payout-summary { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 16px; align-items: center; }
.ps-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.ps-label { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.ps-val { font-family: var(--ff-display); font-weight: 800; font-size: 26px; margin-top: 4px; letter-spacing: -.02em; }
.ps-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.ps-action { display: flex; justify-content: flex-end; }
.payout-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.payout-row:last-child { border-bottom: none; }
.payout-row img { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; flex: 0 0 auto; }
.pr-mid { flex: 1; min-width: 0; }
.pr-name { font-weight: 700; font-size: 14px; }
.pr-meta { font-size: 11.5px; color: var(--ink-faint); }
.pr-amt { font-family: var(--ff-display); font-weight: 800; font-size: 17px; flex: 0 0 auto; }
.pr-actions { display: inline-flex; gap: 6px; flex: 0 0 auto; min-width: 150px; justify-content: flex-end; }

/* ---------------- MODERATION ---------------- */
.mod-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.mod-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.mod-stat .v { font-family: var(--ff-display); font-weight: 800; font-size: 30px; }
.mod-stat .l { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.mod-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.mod-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.mod-card.closed { opacity: .55; }
.mc-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.sev-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; }
.sev-badge.high { background: rgba(255,93,82,.14); color: var(--coral-deep); }
.sev-badge.medium { background: rgba(255,194,75,.2); color: #a9711a; }
.sev-badge.low { background: rgba(79,195,247,.16); color: #1c7da6; }
.mc-status { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); text-transform: capitalize; }
.mc-time { margin-left: auto; font-size: 11.5px; color: var(--ink-faint); }
.mc-creator { font-size: 13.5px; font-weight: 600; }
.mc-creator b { font-weight: 800; }
.mc-reason { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-top: 8px; }
.mc-reason svg { width: 16px; height: 16px; color: var(--coral); flex: 0 0 auto; }
.mc-reports { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.mc-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-row, .admin-row.thirds { grid-template-columns: 1fr; }
  .mod-list { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; height: 100vh; width: 280px; flex: none;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.2,.9,.3,1);
  }
  .admin-sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-menu-btn { display: inline-flex; }
  .admin-main .topbar { padding: 14px 18px; }
}
@media (max-width: 720px) {
  .payout-summary { grid-template-columns: 1fr 1fr; }
  .ps-action { grid-column: 1 / -1; }
  .ps-action .btn { width: 100%; }
  .mod-head { grid-template-columns: 1fr; }
  .pr-actions { min-width: auto; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .payout-summary { grid-template-columns: 1fr; }
  .cm-stats { grid-template-columns: repeat(2, 1fr); }
  .plan-pick-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: 12.5px; }
  .admin-table th:nth-child(4), .admin-table td:nth-child(4),
  .admin-table th:nth-child(6), .admin-table td:nth-child(6) { display: none; }
  .payout-row { flex-wrap: wrap; }
  .pr-actions { width: 100%; justify-content: flex-start; margin-top: 6px; }
}
