/* Network: dashboard app shell + pages */
:root { --side: 280px; --top: 68px; --side-bg: #ececee; }
:root[data-theme="dark"] { --side-bg: #0c0c0e; }

.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side-bg); border-right: 1px solid var(--border); }
.side-brand { display: flex; align-items: center; gap: 8px; height: var(--top); padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); }
.side-brand-link { display: flex; align-items: center; gap: 12px; min-width: 0; }
.side-back { margin-left: auto; color: var(--muted); }
.side-back:hover { color: var(--text); }
.side-back .icon { transition: transform .2s var(--ease); }
.side-back:hover .icon { transform: translateX(-3px); }
.brand-box { width: 40px; height: 40px; display: grid; place-items: center; color: var(--text); }   /* just the dino, no box behind it */
.side-brand .brand-text strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; }
.side-brand .brand-text span { display: block; font-size: 13px; color: var(--muted); }
.side-nav { flex: 1; overflow-y: auto; padding: 18px 10px; display: flex; flex-direction: column; gap: 3px; }
.side-cap { padding: 18px 10px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.side-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 9px; font-size: 15px; font-weight: 500; color: var(--text-2); border: 1px solid transparent; }
.side-link .icon { color: var(--muted); }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link.on { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); color: var(--text); }
.side-link.on .icon { color: var(--text); }
.side-link .badge { margin-left: auto; height: 20px; font-size: 11.5px; }
.side-user { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--text-2); text-transform: uppercase; }
.side-user .who { min-width: 0; flex: 1; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-user .who strong { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- top bar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; height: var(--top); padding: 0 28px 0 24px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .btn-ghost { color: var(--muted); }
.crumbs { display: flex; align-items: center; gap: 8px; margin-left: 4px; font-size: 16px; color: var(--muted); min-width: 0; }
.crumbs b { font-weight: 500; color: var(--text); white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-right .btn-outline.btn-icon { width: 38px; height: 38px; color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--border-strong); }
.preview-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--orange-bg); color: var(--orange); font-size: 12.5px; font-weight: 600; }
.side-open { display: none; }

/* ---------- content ---------- */
.content { padding: 40px 40px 64px; width: 100%; max-width: 1600px; }
/* each route re-renders the content, so these play on every page switch */
.content > * { animation: rise .45s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; }
.side-link { transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease); }
.card { transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; }
.page-head p { margin-top: 8px; font-size: 16px; color: var(--muted); }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.stack { display: grid; gap: 20px; align-content: start; }

.lic-grid { display: grid; grid-template-columns: 1fr 430px; gap: 20px; align-items: start; margin-top: 30px; }
.lic-cart { position: sticky; top: calc(var(--top) + 20px); }

.row-list > .lrow { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-top: 1px solid var(--border); }
.lrow .name { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; }
.lrow .sub { margin-top: 6px; font-size: 14.5px; color: var(--muted); }
.lrow .price { margin-left: auto; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.cart-empty { padding: 54px 24px; text-align: center; color: var(--text-2); font-size: 15px; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); font-size: 15px; }
.cart-item .x { margin-left: 4px; }
.cart-total { display: flex; justify-content: space-between; padding: 18px 24px; border-top: 1px solid var(--border); font-weight: 600; }
.cart-foot { padding: 0 24px 22px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.stat { padding: 22px 24px; }
.stat .k { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.stat .v { margin-top: 12px; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.stat .v small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat .s { margin-top: 6px; font-size: 14px; color: var(--muted); }
.stat .bar { margin-top: 14px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--text); transition: width .4s var(--ease); }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 12px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 14px 24px; border-top: 1px solid var(--border); white-space: nowrap; }
.table td.grow { width: 100%; white-space: normal; }
.empty { padding: 56px 24px; text-align: center; }
.empty .tile { margin: 0 auto 16px; }
.empty h4 { font-size: 16px; font-weight: 600; }
.empty p { margin: 6px auto 18px; max-width: 340px; color: var(--muted); font-size: 14.5px; }

/* deobfuscate */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.editors { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.editor { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.editor-body { position: relative; height: calc(100vh - 360px); min-height: 380px; }
.editor-body textarea, .editor-body pre {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 16px 18px; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--text-2); font: 13px/1.7 var(--mono); white-space: pre; overflow: auto; tab-size: 4;
}
.editor-body textarea::placeholder { color: var(--faint); font-family: var(--font); font-size: 14.5px; }
.drop-hint { position: absolute; inset: 10px; display: grid; place-items: center; border: 2px dashed var(--border-strong); border-radius: 10px; background: color-mix(in srgb, var(--surface) 85%, transparent); font-weight: 500; color: var(--text-2); pointer-events: none; }

.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in .2s var(--ease) both; }
.modal-card { width: min(980px, 100%); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); animation: rise .3s var(--ease) both; }
.modal-pre { flex: 1; margin: 0; padding: 16px 18px; overflow: auto; white-space: pre; }

.settings-grid { display: grid; gap: 20px; max-width: 860px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* owner: Passwords page revealed cell */
.pw-shown { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: var(--orange-bg); color: var(--orange); border: 1px solid transparent; animation: fade-in .18s var(--ease) both; }
.pw-text { font-size: 13.5px; word-break: break-all; user-select: all; }
.pw-countdown { font-size: 11.5px; font-weight: 500; letter-spacing: .02em; color: var(--orange); opacity: .75; min-width: 24px; text-align: right; }

/* ---------- staff: users ---------- */
.badge-red { background: var(--red-bg); border-color: transparent; color: var(--red); }
.tile-red { background: var(--red-bg); color: var(--red); }
.small { font-size: 12.5px; margin-top: 2px; }
.users-search { width: 340px; max-width: 100%; }
.users-table td { vertical-align: middle; }
.ucell { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.ucell b { display: block; font-weight: 500; }
.ucell span:not(.avatar) { display: block; font-size: 13px; color: var(--muted); }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* visible overflow so the dropdowns aren't clipped; the backdrop scrolls instead */
.modal:has(.um) { overflow-y: auto; }
.modal-card.um { width: min(680px, 100%); max-height: none; overflow: visible; margin: auto 0; }
.um-act .sel-trigger { height: 34px; }
.um-act .sel-menu { left: auto; min-width: 220px; }
.um-head { display: flex; align-items: center; gap: 14px; padding: 22px 24px 0; }
.um-who { flex: 1; min-width: 0; }
.um-who b { display: block; font-size: 17px; font-weight: 600; }
.um-who span { display: block; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 24px 0; }
.um-reason { padding: 18px 24px 20px; }
.um-row { display: flex; align-items: center; gap: 14px; padding: 16px 24px; border-top: 1px solid var(--border); }
.um-text { flex: 1; min-width: 0; }
.um-text b { display: block; font-weight: 500; }
.um-text span { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.um-act { display: flex; align-items: center; gap: 8px; flex: none; }
.um-len { width: 140px; }
.um-plan { width: 150px; }

/* banned / timed out: replaces the whole dashboard */
.app.is-blocked { display: block; }
.blocked { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.blocked-card { width: min(480px, 100%); padding: 36px; text-align: center; animation: rise .5s var(--ease) both; }
.blocked-card .tile { margin: 0 auto 18px; }
.blocked-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.blocked-card p { margin-top: 10px; color: var(--muted); }
.blocked-card p b { color: var(--text); font-weight: 500; }
.blocked-reason { margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); text-align: left; font-size: 14.5px; }
.blocked-reason span { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.blocked-actions { display: flex; justify-content: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
.scrim { display: none; }
@media (max-width: 1200px) {
  .lic-grid { grid-template-columns: 1fr; }
  .lic-cart { position: static; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: var(--side); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .app.side-shown .side { transform: none; box-shadow: var(--shadow-lg); }
  .app.side-shown .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
  .side-open { display: inline-flex; }
  .topbar .nav-hist { display: none; }
  .content { padding: 28px 20px 48px; }
  .stats, .editors { grid-template-columns: 1fr; }
  .editor-body { height: 420px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top-right .hide-sm { display: none; }
  .lrow { flex-wrap: wrap; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table th.keep, .table td.keep { display: table-cell; }
  .um-row { flex-wrap: wrap; }
  .um-act { width: 100%; flex-wrap: wrap; }
}
