/* ============================================================
   panel.css — CR7 SMS dark cyan theme (RTL + Arabic, Cairo).
   Fully self-contained.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #06181d;
  --bg2: #0a2228;
  --card: #0d2a31;
  --card2: #10323a;
  --line: #163c46;
  --line2: #1e4a56;
  --cyan: #00e0ff;
  --cyan-soft: rgba(0, 224, 255, .12);
  --cyan-dim: #1a8ba0;
  --green: #2dd4a7;
  --amber: #ffc24b;
  --red: #ff5c6c;
  --purple: #9d7bff;
  --text: #d8f3f7;
  --muted: #7fb3bf;
  --muted2: #5c8a96;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: 'Cairo', 'Inter', Tahoma, sans-serif;
  /* theme-dependent surfaces */
  --body-bg: radial-gradient(1200px 600px at 85% -10%, rgba(0, 224, 255, .10), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(45, 212, 167, .08), transparent 60%),
             var(--bg);
  --input-bg: #07242b;
  --code-bg: #062a33;
  --captcha-bg: #062a33;
  --sidebar-bg: linear-gradient(180deg, #072830, #06181d);
  --topbar-bg: rgba(6, 24, 29, .88);
  --overlay: rgba(1, 10, 14, .55);
  --modal-backdrop: rgba(2, 12, 16, .72);
  --th-bg: rgba(0, 224, 255, .04);
  --row-hover: rgba(0, 224, 255, .03);
  --btn-hover: rgba(0, 224, 255, .22);
  --solid-fg: #05353e;
  --solid-hover: #3fe7ff;
}

/* ---------- light theme ---------- */
body.light {
  --bg: #eef5f7;
  --bg2: #e6f0f3;
  --card: #ffffff;
  --card2: #f3fafb;
  --line: #d6e5e9;
  --line2: #c1d7dd;
  --cyan: #0089a7;
  --cyan-soft: rgba(0, 137, 167, .10);
  --cyan-dim: #0a6d84;
  --green: #0f9d76;
  --amber: #b5791a;
  --red: #d23a4b;
  --purple: #6b4fd8;
  --text: #0d2b31;
  --muted: #4f747c;
  --muted2: #6f9299;
  --shadow: 0 10px 30px rgba(12, 44, 52, .12);
  --body-bg: radial-gradient(1200px 600px at 85% -10%, rgba(0, 137, 167, .08), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(15, 157, 118, .07), transparent 60%),
             var(--bg);
  --input-bg: #ffffff;
  --code-bg: #eaf3f5;
  --captcha-bg: #f3fafb;
  --sidebar-bg: linear-gradient(180deg, #ffffff, #eef5f7);
  --topbar-bg: rgba(255, 255, 255, .9);
  --overlay: rgba(20, 44, 50, .35);
  --modal-backdrop: rgba(18, 40, 46, .45);
  --th-bg: rgba(0, 137, 167, .06);
  --row-hover: rgba(0, 137, 167, .05);
  --btn-hover: rgba(0, 137, 167, .16);
  --solid-fg: #ffffff;
  --solid-hover: #0aa3c4;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: .95rem; }
input, select, textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line2);
  border-radius: 8px;
  color: var(--text);
  padding: .55rem .7rem;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 224, 255, .15);
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; margin: .5rem 0 .25rem; color: var(--muted); font-size: .85rem; }
::placeholder { color: var(--muted2); }
code {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px;
  padding: .05rem .35rem; font-family: Consolas, monospace; font-size: .85em; color: var(--cyan);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--muted2); }
.small { font-size: .82rem; }
.mono { font-family: Consolas, monospace; direction: ltr; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.spread { justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }
.col { display: flex; flex-direction: column; gap: .6rem; }
.wrap { flex-wrap: wrap; }
.gap1 { gap: 1rem; }
.mt1 { margin-top: .6rem; } .mt2 { margin-top: 1rem; } .mb1 { margin-bottom: .6rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--cyan-soft); color: var(--cyan);
  border: 1px solid var(--line2); border-radius: 8px;
  padding: .5rem .9rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--btn-hover); border-color: var(--cyan-dim); }
.btn:active { transform: translateY(1px); }
.btn.solid { background: var(--cyan); color: var(--solid-fg); border-color: var(--cyan); font-weight: 700; }
.btn.solid:hover { background: var(--solid-hover); filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 92, 108, .12); color: var(--red); border-color: rgba(255, 92, 108, .3); }
.btn.danger:hover { background: rgba(255, 92, 108, .22); }
.btn.warn { background: rgba(255, 194, 75, .12); color: var(--amber); border-color: rgba(255, 194, 75, .3); }
.btn.green { background: rgba(45, 212, 167, .12); color: var(--green); border-color: rgba(45, 212, 167, .3); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 7px; }
.btn.lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { padding: .35rem .5rem; }

/* ---------- badges / pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .08rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.pill.cyan { color: var(--cyan); background: var(--cyan-soft); border-color: rgba(0, 224, 255, .35); }
.pill.green { color: var(--green); background: rgba(45, 212, 167, .12); border-color: rgba(45, 212, 167, .35); }
.pill.amber { color: var(--amber); background: rgba(255, 194, 75, .12); border-color: rgba(255, 194, 75, .35); }
.pill.red { color: var(--red); background: rgba(255, 92, 108, .12); border-color: rgba(255, 92, 108, .35); }
.pill.purple { color: var(--purple); background: rgba(157, 123, 255, .12); border-color: rgba(157, 123, 255, .35); }
.pill.gray { color: var(--muted); background: rgba(127, 179, 191, .10); border-color: var(--line); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg);
  border-inline-start: 1px solid var(--line);
  padding: 1rem .8rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 .4rem 1rem; }
.brand {
  font-weight: 800; font-size: 1.25rem; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand small { display: block; font-weight: 400; color: var(--muted2); font-size: .68rem; letter-spacing: 2px; }
.nav-group { margin-bottom: .7rem; }
.nav-group-title { color: var(--muted2); font-size: .68rem; letter-spacing: 1.5px; padding: .5rem .6rem .3rem; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-size: .9rem; margin-bottom: 2px;
  transition: background .15s, color .15s; border: 1px solid transparent;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--cyan-soft); color: var(--text); }
.nav-item.active { background: var(--cyan-soft); color: var(--cyan); border-color: rgba(0, 224, 255, .3); font-weight: 700; }
.nav-badge { margin-inline-start: auto; background: var(--red); color: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .68rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.2rem; position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: .9rem; }
.view-title { font-size: 1.25rem; font-weight: 800; }
.view-sub { color: var(--muted); font-size: .82rem; }
.user-pill { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: var(--solid-fg); font-weight: 800; display: grid; place-items: center; font-size: .82rem;
}
.search-box { width: 260px; }
.search-box input { padding: .4rem .7rem; }
#bellBtn { font-size: 14px; line-height: 1; padding: .25rem .35rem; }
#bellBtn .badge { font-size: .68rem; padding: .05rem .3rem; }

#view { padding: 1.2rem; flex: 1; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%; max-width: 410px;
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line2); border-radius: 16px;
  box-shadow: var(--shadow); padding: 2rem 1.8rem;
}
.login-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.4rem; }
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
  color: var(--solid-fg); box-shadow: 0 0 24px rgba(0, 224, 255, .35);
}
.login-brand { font-size: 1.5rem; font-weight: 800; }
.login-sub { color: var(--muted); font-size: .82rem; }
.login-banner { border-radius: 9px; padding: .6rem .8rem; font-size: .85rem; margin-bottom: 1rem; }
.login-banner.err { background: rgba(255, 92, 108, .12); color: var(--red); border: 1px solid rgba(255, 92, 108, .3); }
.login-banner.info { background: var(--cyan-soft); color: var(--cyan); border: 1px solid rgba(0, 224, 255, .3); }
.captcha-box {
  display: flex; align-items: center; gap: .7rem; margin-top: .8rem;
  background: var(--captcha-bg); border: 1px solid var(--line2); border-radius: 10px; padding: .6rem .8rem;
}
.captcha-math { font-size: 1.15rem; font-weight: 800; color: var(--cyan); letter-spacing: 2px; min-width: 6ch; text-align: center; }
.captcha-box input { flex: 1; min-width: 0; }
.demo-hint { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--line2); }
.demo-hint .muted { font-size: .8rem; }
.foot-links { display: flex; justify-content: space-between; margin-top: 1.1rem; font-size: .8rem; color: var(--muted2); }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ac, var(--cyan)); opacity: .8;
}
.stat .k { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: .4rem; }
.stat .v { font-size: 1.5rem; font-weight: 800; margin-top: .25rem; }
.stat .s { color: var(--muted2); font-size: .75rem; margin-top: .15rem; }
.stat .v.green { color: var(--green); } .stat .v.amber { color: var(--amber); } .stat .v.red { color: var(--red); } .stat .v.cyan { color: var(--cyan); } .stat .v.purple { color: var(--purple); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-title { font-weight: 800; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; }
.card-title svg { color: var(--cyan); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .87rem; }
th, td { padding: .55rem .7rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--muted); font-weight: 600; font-size: .78rem;
  background: var(--th-bg); white-space: nowrap;
}
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { direction: ltr; text-align: end; font-family: Consolas, monospace; }
.check-col { width: 34px; }
.check-col input { width: auto; }

/* ---------- charts (CSS bar) ---------- */
.bars { display: flex; align-items: flex-end; gap: .4rem; height: 120px; padding-top: .5rem; }
.bars .bar {
  flex: 1; min-width: 14px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--cyan), var(--cyan-dim));
  position: relative; transition: height .3s; min-height: 2px;
}
.bars .bar span { position: absolute; top: -18px; inset-inline: 0; text-align: center; font-size: .66rem; color: var(--muted); }
.bars .axis { display: flex; justify-content: space-between; margin-top: .2rem; font-size: .66rem; color: var(--muted2); }

/* ---------- pagination ---------- */
.pager { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.pager .pageinfo { color: var(--muted); font-size: .8rem; }

/* ---------- forms inside cards ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.input-wrap { position: relative; }
.inline-note { color: var(--muted2); font-size: .78rem; margin-top: .2rem; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--modal-backdrop);
  backdrop-filter: blur(4px); z-index: 200; display: grid; place-items: center; padding: 1rem;
}
.modal {
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 800; }
.modal-body { padding: 1.1rem 1.2rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.2rem; border-top: 1px solid var(--line); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 1rem; inset-inline-start: 1rem; z-index: 300; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  display: flex; align-items: center; gap: .6rem;
  background: var(--card); border: 1px solid var(--line2); border-inline-start: 4px solid var(--cyan);
  border-radius: 10px; padding: .65rem 1rem; min-width: 240px; max-width: 380px;
  box-shadow: var(--shadow); font-size: .87rem; animation: slideIn .25s ease;
}
.toast.ok { border-inline-start-color: var(--green); }
.toast.err { border-inline-start-color: var(--red); }
.toast .t-close { margin-inline-start: auto; cursor: pointer; color: var(--muted); font-size: 1rem; background: none; border: none; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- empty / spinner ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
.empty .big { font-size: 2rem; opacity: .5; margin-bottom: .4rem; }
.spin {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line2);
  border-top-color: var(--cyan); animation: rot .7s linear infinite; display: inline-block;
}
@keyframes rot { to { transform: rotate(360deg); } }
.loading-wrap { display: grid; place-items: center; padding: 3rem; gap: .7rem; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tab {
  padding: .5rem 1rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
  font-size: .88rem; font-weight: 600; border-radius: 8px 8px 0 0; background: none; border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); background: var(--cyan-soft); }

/* ---------- otp feed ---------- */
.otp-item {
  display: flex; align-items: center; gap: .8rem;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem;
  background: linear-gradient(180deg, var(--card), var(--bg2));
}
.otp-item .otp-num { font-weight: 800; }
.otp-item .otp-code { font-family: Consolas, monospace; font-size: 1.05rem; color: var(--cyan); font-weight: 800; letter-spacing: 1px; }
.otp-item .otp-msg { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

/* ---------- responsive ---------- */

/* PWA install button — only visible when installable */
#installAppBtn {
  background: rgba(45, 212, 167, .14);
  color: var(--green);
  border-color: rgba(45, 212, 167, .35);
  font-weight: 600;
}
#installAppBtn:hover {
  background: rgba(45, 212, 167, .25);
  border-color: var(--green);
}

/* Desktop nav affordance: the drawer toggle is desktop-invisible by
   default and only appears when the fixed-off-canvas drawer is active. */
#navToggle { display: none; }

/* Laptop / tablet — tighten paddings and let stat cards flow in pairs */
@media (min-width: 901px) and (max-width: 1280px) {
  #view { padding: 1rem; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .stat .v { font-size: 1.3rem; }
  #view { padding-inline: .9rem; }
}

/* Tablet portrait + phone — off-canvas sidebar drawer w/ overlay */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #navToggle { display: inline-flex; }
  #collapseBtn { display: none; }

  .sidebar {
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0; z-index: 150;
    width: min(82vw, 300px); max-width: 300px;
    transform: translateX(-105%); transition: transform .28s ease;
    box-shadow: var(--shadow); padding-bottom: env(safe-area-inset-bottom);
  }
  html[dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: none; }
  html[dir="rtl"] .sidebar.open { transform: none; }

  /* Backdrop overlay when drawer is open */
  .sidebar.open ~ .main::before {
    content: ''; position: fixed; inset: 0; z-index: 140;
    background: var(--overlay); pointer-events: auto;
  }

  .topbar { flex-wrap: wrap; row-gap: .5rem; padding: .6rem .8rem; }
  .topbar-left { gap: .6rem; }
  .view-title { font-size: 1.05rem; }
  .search-box { width: min(46vw, 220px); min-width: 0; }
  #view { padding: .8rem; }
  .user-pill .small, .user-pill #userName { max-width: 15vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Phones — single-column forms, stacking toolbars, compact tables */
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .8rem .9rem; }
  .stat .v { font-size: 1.15rem; }
  .stat .k { font-size: .7rem; }
  .card { padding: .85rem .9rem; }
  .card-head { gap: .6rem; }
  .row { gap: .4rem; }
  .topbar { padding: .5rem .6rem; }
  .topbar .btn, .topbar .pill { font-size: .74rem; padding: .25rem .5rem; }
  .avatar { width: 30px; height: 30px; font-size: .74rem; }
  .search-box input { padding: .35rem .55rem; }
  .user-pill { gap: .4rem; }
  #view { padding: .6rem; }
  .login-card { padding: 1.4rem 1.1rem; }
  .bars { gap: .25rem; height: 90px; }
  .bars .bar span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .pager { justify-content: center; }
  .toast { min-width: 0; width: calc(100vw - 2rem); }
  .modal { max-width: calc(100vw - 1.2rem); }
  .modal-body, .modal-head { padding: .9rem 1rem; }
  .captcha-box { flex-wrap: wrap; }
  .captcha-math { min-width: 100%; text-align: center; }

  /* OTP feed — phone layout: number + code on one line, message and
     sender/date stacked underneath so nothing overlaps. */
  .otp-item { align-items: flex-start; flex-wrap: wrap; gap: .3rem .5rem; padding: .6rem; }
  .otp-item .grow { flex: 1 1 auto; min-width: 0; }
  .otp-item .otp-num { font-size: .86rem; }
  .otp-item .otp-code { align-self: center; font-size: 1rem; }
  .otp-item .otp-msg { max-width: none; white-space: normal; margin-top: .2rem; }
  .otp-item > .small { order: 1; flex-basis: 100%; margin-top: .25rem; }

  /* API page (user) on phones — let tables compact instead of forcing a
     640px+ min-width that overflows the viewport. */
  table { min-width: 460px; }
  .toolbar > .btn { flex: 1 1 auto; justify-content: center; }
  .toolbar .muted { width: 100%; order: 10; margin-inline-start: 0; white-space: normal; word-break: break-all; }
  pre.code { font-size: .72rem; padding: .6rem .7rem; }
  td code { word-break: break-all; }
}

/* Very small phones — drop noisy UI, keep content readable */
@media (max-width: 380px) {
  .tabs { gap: .2rem; }
  .tab { padding: .4rem .7rem; font-size: .82rem; }
  .user-pill .pill { display: none; }
  .user-pill .small, .user-pill #userName { max-width: 30vw; }
  .editnum, td.num, th.num { font-size: .8rem; }
}

/* ---------- CR7 legacy views mounted inside the shell ---------- */
/* cards.css / forms.css are not loaded in the shell, so the CR7 statCards,
   stat icons and small form helpers get their essential styles here. */
.user-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-top { display: flex; align-items: center; gap: 8px; }
.stat-icon svg { width: 15px; height: 15px; fill: currentColor; }
.stat .label { color: var(--muted); font-size: .78rem; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 1.5rem; font-weight: 800; margin-top: .1rem; }
.stat .value.green { color: var(--green); } .stat .value.cyan { color: var(--cyan); }
.stat .value.amber { color: var(--amber); } .stat .value.red { color: var(--red); }
.stat .value.info { color: var(--info, var(--cyan)); } .stat .value.blue { color: var(--info, var(--cyan)); }
.stat.clickable, .card.clickable { cursor: pointer; }
.stat.clickable:hover, .card.clickable:hover { filter: brightness(1.06); }
.form-row { display: flex; flex-wrap: wrap; gap: .7rem .9rem; align-items: flex-end; }
.form-row .field { margin: 0; }
.field .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }

/* ---------- CR7 shared UI components mounted in the shell ---------- */
/* toolbar / badge / code / spinner / modal-actions are produced by the CR7
   views (app.js + core.js) but cards.css / forms.css / badges.css are NOT
   loaded in the shell, so their essential styles live here. Without these
   the API page and other user views break on narrow (phone) screens. */
.toolbar { display: flex; gap: .5rem 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar .field { min-width: 150px; margin: 0; }
.toolbar > .btn { white-space: nowrap; }
.toolbar-between { justify-content: space-between; }

.badge {
  display: inline-flex; align-items: center;
  padding: .1rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.55;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.green { color: var(--green); background: rgba(45, 212, 167, .12); border-color: rgba(45, 212, 167, .35); }
.badge.red { color: var(--red); background: rgba(255, 92, 108, .12); border-color: rgba(255, 92, 108, .35); }
.badge.gray { color: var(--muted); background: rgba(127, 179, 191, .10); border-color: var(--line); }
.badge.orange { color: var(--amber); background: rgba(255, 194, 75, .12); border-color: rgba(255, 194, 75, .35); }
.badge.blue { color: var(--cyan); background: var(--cyan-soft); border-color: rgba(0, 224, 255, .35); }

pre.code {
  direction: ltr; text-align: left; unicode-bidi: embed;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem .9rem; margin: .6rem 0 0;
  font-family: Consolas, 'Courier New', monospace; font-size: .8rem; line-height: 1.6;
  color: var(--cyan); white-space: pre-wrap; word-break: break-all;
  overflow-x: auto; max-width: 100%;
}

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line2); border-top-color: var(--cyan);
  animation: rot .7s linear infinite; display: inline-block;
}

.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.confirm-body { margin: .2rem 0; }

/* ---------- searchable user combobox (transfers) ---------- */
.uc-wrap { position: relative; width: 220px; min-width: 180px; flex: 1 1 auto; max-width: 280px; }
.uc-wrap input { padding: .4rem .7rem; cursor: text; }
.uc-drop {
  position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 220;
  width: 100%; max-height: 240px; overflow-y: auto;
  background: var(--card2); border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: var(--shadow); display: none; padding: .25rem;
}
.uc-drop.open { display: block; }
.uc-drop button {
  display: block; width: 100%; text-align: start; padding: .45rem .6rem;
  background: none; border: none; color: var(--text);
  font-family: inherit; font-size: .9rem; cursor: pointer; border-radius: 7px;
}
.uc-drop button:hover, .uc-drop button.sel { background: var(--cyan-soft); color: var(--cyan); }
.uc-drop .uc-empty { padding: .5rem .6rem; color: var(--muted); font-size: .85rem; }