/* ================================================================
   Dashboard styles — sidebar, panels, cards, mobile-first.
   Loaded after app.css.
================================================================ */

:root{
  --sidebar-w: 260px;
  --dash-bg: #f4f6fa;
  --dash-elev: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --dash-elev-hover: 0 8px 24px -4px rgba(15,23,42,.18);
}

body.dash{ background: var(--dash-bg); }

/* Hide the global header on dashboard pages — we get our own */
body.dash > div#site-header{ display: none; }
body.dash > div#site-footer{ display: none; }

/* ----- Layout shell ----- */
.dash-shell{
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 1024px){
  .dash-shell{
    grid-template-columns: var(--sidebar-w) 1fr;
  }
}

/* ----- Mobile top bar ----- */
.dash-top{
  position: sticky; top: 0; z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  height: 60px;
}
.dash-top .brand{
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: 1rem;
}
.dash-top .brand .badge{
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff; display: grid; place-items: center; font-size: .85rem;
}
.dash-top-actions{ display: flex; align-items: center; gap: .25rem; }
@media (min-width: 1024px){
  .dash-top{ display: none; }
}

/* ----- Sidebar ----- */
.dash-side{
  position: fixed; inset: 0 30% 0 0;
  z-index: 60;
  background: #fff; max-width: 280px;
  transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.dash-side.open{ transform: translateX(0); }
.dash-side-backdrop{
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15,23,42,.5);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.dash-side-backdrop.open{ opacity: 1; pointer-events: auto; }

@media (min-width: 1024px){
  .dash-side{
    position: sticky; top: 0; transform: none;
    height: 100vh; max-width: none; box-shadow: none;
    border-right: 1px solid var(--line);
  }
  .dash-side-backdrop{ display: none; }
}

.side-head{
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem;
}
.side-head .badge{
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.side-head .title{ font-weight: 800; font-size: .95rem; }
.side-head .subtitle{ font-size: .78rem; color: var(--ink-3); }

.side-user{
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid var(--line);
}
.side-user .avatar{
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 1.05rem;
  flex-shrink: 0;
}
.side-user .info{ flex: 1; min-width: 0; }
.side-user .name{
  font-weight: 700; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-user .email{
  font-size: .78rem; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.side-nav{
  padding: .5rem 0; flex: 1; overflow-y: auto;
}
.side-nav .section-label{
  padding: .85rem 1.25rem .35rem;
  font-size: .68rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-3); font-weight: 700;
}
.side-nav a, .side-nav button.nav-item{
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem;
  color: var(--ink-2); font-weight: 500; font-size: .92rem;
  cursor: pointer; border: 0; background: transparent; width: 100%;
  text-align: left; border-left: 3px solid transparent;
  transition: background .12s, color .12s;
}
.side-nav .nav-item:hover{ background: var(--surface-2); color: var(--ink); }
.side-nav .nav-item.active{
  background: rgba(10,124,58,.08);
  color: var(--brand-dark);
  border-left-color: var(--brand);
  font-weight: 600;
}
.side-nav .nav-item .icon{
  width: 20px; height: 20px; color: currentColor; flex-shrink: 0;
}
.side-nav .nav-item .badge-pill{
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: .7rem; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  display: grid; place-items: center;
}

.side-foot{
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
}

/* ----- Main panel ----- */
.dash-main{
  padding: 1rem;
  min-width: 0; /* allow grid items to shrink */
}
@media (min-width: 768px){ .dash-main{ padding: 1.5rem; } }
@media (min-width: 1024px){ .dash-main{ padding: 2rem 2.5rem; } }

.dash-section{
  display: none; /* JS will toggle */
}
.dash-section.active{ display: block; }

.dash-header{
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: flex-end;
  margin-bottom: 1.5rem;
}
.dash-header h1{
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0 0 .15em;
}
.dash-header p{ margin: 0; color: var(--ink-3); font-size: .92rem; }
.dash-header .actions{ display: flex; gap: .5rem; flex-wrap: wrap; }

/* ----- Stat cards ----- */
.stats{
  display: grid; gap: .85rem;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 1.5rem;
}
@media (min-width: 768px){ .stats{ grid-template-columns: repeat(4, 1fr); } }
.stat{
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  position: relative; overflow: hidden;
}
.stat .stat-icon{
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  position: absolute; top: .85rem; right: .85rem;
  opacity: .9;
}
.stat .label{
  font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); font-weight: 700;
}
.stat .value{
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 1.7rem);
  font-weight: 800; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .delta{ font-size: .8rem; color: var(--ink-3); }
.stat .delta.up{ color: var(--ok); }
.stat .delta.down{ color: var(--err); }

/* ----- Panel cards ----- */
.panel{
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.25rem; overflow: hidden;
}
.panel-head{
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.panel-head h3{ margin: 0; font-size: 1rem; }
.panel-body{ padding: 1.25rem; }
.panel-foot{
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem;
}

/* ----- Lists / rows ----- */
.list-item{
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.list-item:last-child{ border-bottom: 0; }
.list-item:hover{ background: var(--surface-2); }
.list-item .li-icon{
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--surface-3);
}
.list-item .li-body{ flex: 1; min-width: 0; }
.list-item .li-title{
  font-weight: 600; font-size: .92rem; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .li-meta{
  font-size: .8rem; color: var(--ink-3); margin: 2px 0 0;
}
.list-item .li-right{ text-align: right; flex-shrink: 0; }
.list-item .li-amt{ font-weight: 700; font-size: .95rem; }
.list-item .li-status{ font-size: .75rem; color: var(--ink-3); }

/* ----- Status pills ----- */
.pill{
  display: inline-flex; align-items: center; gap: .35em;
  padding: .2em .55em; border-radius: 999px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em;
}
.pill-ok{ background: rgba(22,163,74,.12); color: #15803d; }
.pill-warn{ background: rgba(245,158,11,.12); color: #b45309; }
.pill-err{ background: rgba(220,38,38,.12); color: #b91c1c; }
.pill-info{ background: rgba(37,99,235,.12); color: #1d4ed8; }
.pill-neutral{ background: var(--surface-3); color: var(--ink-2); }

/* ----- Toggle switch ----- */
.toggle-sw{
  position: relative; width: 44px; height: 24px;
  background: var(--line-strong); border-radius: 12px;
  cursor: pointer; transition: background .15s;
  flex-shrink: 0;
}
.toggle-sw::after{
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-sw.on{ background: var(--brand); }
.toggle-sw.on::after{ transform: translateX(20px); }
input.toggle-input{ position: absolute; opacity: 0; pointer-events: none; }

/* ----- Setting rows ----- */
.setting-row{
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child{ border-bottom: 0; }
.setting-row .setting-info{ flex: 1; min-width: 0; }
.setting-row .setting-info .label{ font-weight: 600; }
.setting-row .setting-info .desc{ font-size: .82rem; color: var(--ink-3); margin-top: 2px; }
.setting-row .setting-control{ flex-shrink: 0; }

/* ----- Avatar color picker ----- */
.color-grid{
  display: grid; grid-template-columns: repeat(8, 1fr); gap: .5rem;
  max-width: 320px;
}
.color-swatch{
  aspect-ratio: 1; border-radius: 50%;
  cursor: pointer; transition: transform .1s;
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.color-swatch:hover{ transform: scale(1.1); }
.color-swatch.active{ box-shadow: 0 0 0 2px var(--brand); }

/* ----- Tabs (panel-internal) ----- */
.subtabs{
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
  margin-bottom: 1rem;
}
.subtabs::-webkit-scrollbar{ display: none; }
.subtab{
  padding: .65rem 1rem; font-size: .88rem; font-weight: 600;
  color: var(--ink-3); border-bottom: 2px solid transparent;
  white-space: nowrap; cursor: pointer; background: transparent; border-top:0; border-left:0; border-right:0;
}
.subtab.active{ color: var(--brand); border-bottom-color: var(--brand); }
.subtab:hover{ color: var(--ink); }

/* ----- Toast ----- */
.toast-stack{
  position: fixed; bottom: 1rem; right: 1rem; z-index: 100;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: calc(100vw - 2rem);
}
.toast{
  background: #0f172a; color: #fff;
  padding: .85rem 1.1rem; border-radius: 10px;
  font-size: .9rem; font-weight: 500;
  display: flex; align-items: center; gap: .6rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  max-width: 360px;
}
.toast-ok{ background: #15803d; }
.toast-err{ background: #b91c1c; }
.toast .x{
  margin-left: auto; opacity: .7; cursor: pointer;
  background: transparent; color: inherit; padding: 0 .25rem;
}
@keyframes toastIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ----- Quick actions grid (overview) ----- */
.quick-grid{
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem;
}
@media (min-width: 600px){ .quick-grid{ grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px){ .quick-grid{ grid-template-columns: repeat(4, 1fr); } }
.quick-card{
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem; cursor: pointer;
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .12s, border-color .12s, box-shadow .15s;
  text-align: left; width: 100%;
}
.quick-card:hover{
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--dash-elev-hover);
}
.quick-card .qc-icon{
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(10,124,58,.1); color: var(--brand);
}
.quick-card .qc-title{ font-weight: 700; font-size: .92rem; color: var(--ink); }
.quick-card .qc-desc{ font-size: .78rem; color: var(--ink-3); }

/* ----- Modal ----- */
.modal-back{
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.6); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-back.open{ opacity: 1; pointer-events: auto; }
.modal{
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 480px; max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px); transition: transform .2s;
}
.modal-back.open .modal{ transform: translateY(0); }
.modal-head{
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3{ margin: 0; }
.modal-head .x{
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3);
}
.modal-body{ padding: 1.5rem; }
.modal-foot{
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  display: flex; gap: .5rem; justify-content: flex-end;
  background: var(--surface-2);
}

/* ----- Search input ----- */
.search-box{
  position: relative;
}
.search-box input{
  width: 100%; padding: .7em 1em .7em 2.4em;
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 10px; font-size: .92rem;
}
.search-box input:focus{
  outline: none; background: #fff; border-color: var(--brand);
}
.search-box svg{
  position: absolute; left: .85em; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-3);
}

/* ----- Empty state ----- */
.empty-soft{
  text-align: center; padding: 2rem 1rem; color: var(--ink-3);
}
.empty-soft svg{
  width: 56px; height: 56px; margin: 0 auto .75rem;
  color: var(--line-strong);
}
.empty-soft h4{ margin: 0 0 .25rem; color: var(--ink-2); }
.empty-soft p{ margin: 0 0 1rem; font-size: .9rem; }

/* ----- Hotel/flight result cards ----- */
.result-card{
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem; margin-bottom: .75rem;
  display: grid; grid-template-columns: 1fr; gap: .75rem;
}
@media (min-width: 600px){
  .result-card{ grid-template-columns: 1fr auto; align-items: center; }
}
.result-card .rc-info h4{ margin: 0 0 .25rem; }
.result-card .rc-info .meta{
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  font-size: .82rem; color: var(--ink-3);
}
.result-card .rc-info .meta span{ white-space: nowrap; }
.result-card .rc-price{
  text-align: right; min-width: 130px;
}
.result-card .rc-price .price{
  font-size: 1.4rem; font-weight: 800; color: var(--brand-dark);
}
.result-card .rc-price .per{ font-size: .8rem; color: var(--ink-3); }
.result-card .rc-price .breakdown{ font-size: .72rem; color: var(--ink-3); margin: 2px 0 .5rem; }

.stars{ color: var(--gold); font-size: .85rem; }

/* Theme: dark mode (toggle adds class to <body>) */
body.dash.theme-dark{ background: #0b1220; color: #e2e8f0; }
body.dash.theme-dark .dash-top,
body.dash.theme-dark .dash-side,
body.dash.theme-dark .panel,
body.dash.theme-dark .stat,
body.dash.theme-dark .quick-card,
body.dash.theme-dark .modal,
body.dash.theme-dark .result-card{
  background: #111a2e;
  border-color: #1f2937;
  color: #e2e8f0;
}
body.dash.theme-dark .panel-foot{ background: #0b1220; }
body.dash.theme-dark .stat .value,
body.dash.theme-dark h1, body.dash.theme-dark h2, body.dash.theme-dark h3, body.dash.theme-dark h4,
body.dash.theme-dark .list-item .li-title{ color: #f1f5f9; }
body.dash.theme-dark .stat .label,
body.dash.theme-dark .list-item .li-meta,
body.dash.theme-dark .quick-card .qc-desc,
body.dash.theme-dark .dash-header p{ color: #94a3b8; }
body.dash.theme-dark .panel-head,
body.dash.theme-dark .list-item,
body.dash.theme-dark .setting-row,
body.dash.theme-dark .side-head,
body.dash.theme-dark .side-user,
body.dash.theme-dark .panel-foot,
body.dash.theme-dark .modal-head,
body.dash.theme-dark .modal-foot{ border-color: #1f2937; }
body.dash.theme-dark .list-item:hover,
body.dash.theme-dark .side-nav .nav-item:hover{ background: #0b1220; }
body.dash.theme-dark .input,
body.dash.theme-dark .select,
body.dash.theme-dark .textarea,
body.dash.theme-dark .search-box input{
  background: #0b1220; border-color: #1f2937; color: #e2e8f0;
}
body.dash.theme-dark .surface-2,
body.dash.theme-dark .panel-foot{ background: #0b1220 !important; }

/* ============================================================
   Mobile-first payment sheet (multi-step modal)
   ============================================================ */
.modal-back.payment-sheet-back .modal,
.modal.payment-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 600px){
  .modal-back .modal.payment-sheet {
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  .modal-back { padding: 0; align-items: stretch; }
  .modal-back.open .modal.payment-sheet {
    transform: translateY(0);
    animation: slideUp .25s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* Payment method picker grid (Step 1) */
.pay-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .65rem;
}
.pay-method-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 1rem .75rem;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
  display: flex; flex-direction: column; gap: .35rem;
  align-items: center;
  min-height: 110px;
  justify-content: center;
}
.pay-method-card:hover, .pay-method-card:active {
  border-color: var(--brand);
  background: rgba(10,124,58,.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10,124,58,0.1);
}
.pay-method-card .pmc-icon {
  font-size: 2rem;
  line-height: 1;
}
.pay-method-card .pmc-label {
  font-weight: 700;
  font-size: .88rem;
  color: var(--ink);
}
.pay-method-card .pmc-count {
  font-size: .7rem;
  color: var(--ink-3);
}

/* Account row (Step 2 list) */
.acc-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
}
.acc-row:hover, .acc-row:active {
  border-color: var(--brand);
  background: rgba(10,124,58,.03);
}

/* Account detail rows (Step 3) */
.acc-detail-row {
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--line);
}
.acc-detail-row:last-child { border-bottom: 0; }

/* Back button */
.back-btn {
  background: none;
  border: 0;
  color: var(--brand);
  font-size: .85rem;
  font-weight: 600;
  padding: .25rem 0;
  cursor: pointer;
}
.back-btn:hover { text-decoration: underline; }

/* ============================================================
   RTL support (Arabic)
   ============================================================ */
[dir="rtl"] .dash-shell { direction: rtl; }
[dir="rtl"] .nav-item { text-align: right; }
[dir="rtl"] .nav-item .icon { margin-right: 0; margin-left: .65rem; }
[dir="rtl"] .li-right { text-align: left; }
[dir="rtl"] .back-btn::before { content: '→ '; }
[dir="rtl"] .back-btn { content: ''; }
/* Keep numbers and codes LTR */
[dir="rtl"] code,
[dir="rtl"] .tt,
[dir="rtl"] .ref,
[dir="rtl"] [style*="font-family:monospace"] { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ============================================================
   Professional Referrals dashboard redesign
   ============================================================ */
.ref-page{
  max-width: 1420px;
  margin: 0 auto;
}
.ref-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:1rem;
  margin-bottom:1.35rem;
}
.ref-kicker{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  margin-bottom:.35rem;
  color:var(--brand-dark);
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.12em;
  font-weight:800;
}
.ref-hero h1{
  margin:0 0 .2rem;
  font-size:clamp(1.8rem,3vw,2.35rem);
  letter-spacing:-.035em;
  color:var(--ink);
}
.ref-hero p{
  margin:0;
  color:var(--ink-3);
  font-size:.98rem;
  max-width:760px;
  line-height:1.55;
}
.ref-hero-actions{
  display:flex;
  align-items:center;
  gap:.55rem;
  flex-wrap:wrap;
}
.ref-stats-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:.9rem;
  margin-bottom:1.05rem;
}
.ref-stat-card{
  background:linear-gradient(180deg,#fff 0%,#fbfcff 100%);
  border:1px solid rgba(15,23,42,.08);
  border-radius:18px;
  padding:1.05rem 1.1rem;
  box-shadow:0 8px 24px rgba(15,23,42,.06);
  min-height:132px;
  display:grid;
  grid-template-columns:auto 1fr;
  column-gap:.9rem;
  align-items:start;
  position:relative;
  overflow:hidden;
}
.ref-stat-card:after{
  content:'';
  position:absolute;
  right:-48px;
  top:-48px;
  width:110px;
  height:110px;
  border-radius:999px;
  background:rgba(10,124,58,.045);
}
.ref-stat-icon{
  width:46px;
  height:46px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(10,124,58,.1);
  color:var(--brand);
  grid-row:1 / span 3;
}
.ref-stat-icon svg{ width:21px; height:21px; }
.ref-stat-card span{
  color:var(--ink-3);
  font-weight:700;
  font-size:.83rem;
}
.ref-stat-card strong{
  color:var(--ink);
  font-size:1.75rem;
  line-height:1.1;
  font-weight:900;
  letter-spacing:-.03em;
  font-variant-numeric:tabular-nums;
}
.ref-stat-card small{
  color:var(--ink-3);
  font-size:.8rem;
}
.ref-layout-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 390px;
  gap:1rem;
  align-items:start;
}
.ref-main-col,
.ref-side-col{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.ref-card{
  background:#fff;
  border:1px solid rgba(15,23,42,.09);
  border-radius:20px;
  box-shadow:0 10px 30px rgba(15,23,42,.065);
  overflow:hidden;
}
.ref-card-head{
  padding:1.15rem 1.25rem 0;
}
.ref-card-title{
  display:flex;
  align-items:flex-start;
  gap:.85rem;
}
.ref-card-title h3{
  margin:.05rem 0 .15rem;
  font-size:1.05rem;
  letter-spacing:-.02em;
  color:var(--ink);
}
.ref-card-title p{
  margin:0;
  color:var(--ink-3);
  font-size:.86rem;
  line-height:1.5;
}
.ref-card-icon,
.ref-telegram-logo{
  width:44px;
  height:44px;
  flex:0 0 44px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:var(--brand);
  background:rgba(10,124,58,.1);
  font-weight:900;
}
.ref-card-icon svg{ width:20px; height:20px; }
.ref-telegram-logo{
  background:linear-gradient(135deg,#22a8e8,#1689cf);
  color:#fff;
  font-size:1.15rem;
}
.ref-link-card{
  padding-bottom:1.2rem;
}
.ref-link-fields{
  padding:1.05rem 1.25rem 0;
  display:grid;
  gap:.85rem;
}
.ref-field-line{
  display:grid;
  grid-template-columns:130px minmax(0,1fr);
  align-items:center;
  gap:.9rem;
}
.ref-field-line label{
  font-weight:800;
  color:var(--ink-2);
  font-size:.84rem;
}
.ref-copy-box{
  display:flex;
  align-items:center;
  border:1px solid rgba(15,23,42,.13);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
  transition:border-color .15s, box-shadow .15s;
}
.ref-copy-box:focus-within{
  border-color:rgba(10,124,58,.5);
  box-shadow:0 0 0 4px rgba(10,124,58,.08);
}
.ref-copy-box input{
  width:100%;
  border:0;
  outline:0;
  min-width:0;
  padding:.82rem .95rem;
  color:var(--ink);
  font-weight:650;
  background:transparent;
}
.ref-copy-box button{
  border:0;
  border-left:1px solid rgba(15,23,42,.1);
  background:#fbfcff;
  color:var(--brand-dark);
  padding:.82rem .95rem;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.ref-copy-box button:hover{ background:rgba(10,124,58,.07); }
.ref-code-box{
  max-width:420px;
}
.ref-code-box input{
  color:var(--brand-dark);
  letter-spacing:.03em;
}
.ref-actions-row{
  padding:1.05rem 1.25rem 0;
  display:flex;
  gap:.65rem;
  flex-wrap:wrap;
}
.ref-side-col .ref-card{
  padding:1.15rem;
}
.ref-telegram-card{
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.ref-warning-box,
.ref-success-box{
  border-radius:14px;
  padding:.9rem 1rem;
  display:flex;
  flex-direction:column;
  gap:.22rem;
  line-height:1.45;
}
.ref-warning-box{
  background:#fff8e6;
  border:1px solid #fde68a;
  color:#92400e;
}
.ref-warning-box.admin{
  margin-top:.1rem;
}
.ref-success-box{
  background:#eefdf4;
  border:1px solid #bbf7d0;
  color:#166534;
}
.ref-warning-box strong,
.ref-success-box strong{
  font-size:.9rem;
}
.ref-warning-box span,
.ref-success-box span{
  font-size:.82rem;
}
.ref-wide-btn{
  width:100%;
  justify-content:center;
}
.ref-connect-status{
  min-height:18px;
  color:var(--ink-3);
  font-size:.82rem;
  line-height:1.45;
}
.ref-mini-actions{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
}
.ref-manual-box{
  border:1px solid rgba(15,23,42,.09);
  border-radius:14px;
  padding:.85rem;
  background:var(--surface-2);
}
.ref-manual-box summary{
  cursor:pointer;
  font-weight:800;
  color:var(--ink-2);
}
.ref-manual-box form{
  margin-top:.85rem;
}
.ref-tips-card{
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.ref-tips-list{
  margin:0;
  padding:0;
  list-style:none;
  display:grid;
  gap:.7rem;
}
.ref-tips-list li{
  position:relative;
  padding-left:1.6rem;
  color:var(--ink-2);
  font-size:.9rem;
  line-height:1.45;
}
.ref-tips-list li:before{
  content:'✓';
  position:absolute;
  left:0;
  top:.02rem;
  width:1.05rem;
  height:1.05rem;
  border-radius:999px;
  background:rgba(10,124,58,.11);
  color:var(--brand);
  display:grid;
  place-items:center;
  font-size:.7rem;
  font-weight:900;
}
.ref-gift-box{
  display:flex;
  align-items:center;
  gap:.7rem;
  background:linear-gradient(135deg,rgba(10,124,58,.1),rgba(10,124,58,.05));
  border:1px solid rgba(10,124,58,.15);
  color:var(--brand-dark);
  border-radius:14px;
  padding:.9rem;
  font-weight:700;
  line-height:1.4;
}
.ref-table-card{
  padding:0;
}
.ref-table-head{
  padding-bottom:1rem;
  border-bottom:1px solid rgba(15,23,42,.08);
}
.ref-table-wrap{
  overflow:auto;
  min-height:220px;
}
.ref-table-wrap.compact{
  min-height:160px;
}
.ref-table{
  width:100%;
  border-collapse:collapse;
  min-width:850px;
}
.ref-table th{
  text-align:left;
  background:#f8fafc;
  color:#64748b;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.06em;
  font-weight:900;
  padding:.75rem 1rem;
  border-bottom:1px solid rgba(15,23,42,.08);
}
.ref-table td{
  padding:.9rem 1rem;
  border-bottom:1px solid rgba(15,23,42,.075);
  vertical-align:top;
  color:var(--ink-2);
  font-size:.86rem;
}
.ref-table tbody tr:hover{
  background:#fbfcff;
}
.ref-table td strong{
  display:block;
  color:var(--ink);
  font-weight:800;
  margin-bottom:.18rem;
}
.ref-table-sub{
  display:block;
  color:var(--ink-3);
  font-size:.78rem;
  line-height:1.45;
  max-width:260px;
}
.ref-person{
  display:flex;
  align-items:center;
  gap:.65rem;
  min-width:190px;
}
.ref-person span{
  display:block;
  color:var(--ink-3);
  font-size:.78rem;
  line-height:1.35;
}
.ref-avatar-sm{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(37,99,235,.1);
  color:#1d4ed8;
  font-weight:900;
}
.ref-avatar-green{
  background:rgba(10,124,58,.1);
  color:var(--brand-dark);
}
.ref-empty-state{
  display:grid;
  place-items:center;
  text-align:center;
  padding:2.2rem 1rem;
  color:var(--ink-3);
}
.ref-empty-state svg{
  width:56px;
  height:56px;
  color:#cbd5e1;
  margin-bottom:.75rem;
}
.ref-empty-state h4{
  margin:0 0 .25rem;
  color:var(--ink-2);
  font-size:1rem;
}
.ref-empty-state p{
  margin:0;
  max-width:360px;
  font-size:.88rem;
  line-height:1.5;
}
.ref-pagination{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.7rem;
  padding:.85rem 1rem;
  border-top:1px solid rgba(15,23,42,.08);
  background:#fbfcff;
}
.ref-page-btn{
  min-width:112px;
  border:1px solid rgba(15,23,42,.12);
  background:#fff;
  color:var(--ink-2);
  border-radius:10px;
  padding:.58rem .8rem;
  font-weight:800;
  cursor:pointer;
}
.ref-page-btn:hover:not(:disabled){
  border-color:rgba(10,124,58,.35);
  color:var(--brand-dark);
  background:rgba(10,124,58,.05);
}
.ref-page-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.ref-page-label{
  color:var(--ink-3);
  font-size:.84rem;
  font-weight:650;
}
.pill-mute{ background:var(--surface-3); color:var(--ink-2); }

@media (max-width: 1180px){
  .ref-layout-grid{ grid-template-columns:1fr; }
  .ref-side-col{ grid-template-columns:1fr 1fr; display:grid; }
}
@media (max-width: 920px){
  .ref-stats-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ref-hero{ align-items:flex-start; flex-direction:column; }
  .ref-side-col{ display:flex; }
}
@media (max-width: 640px){
  .ref-stats-grid{ grid-template-columns:1fr; }
  .ref-stat-card{ min-height:auto; }
  .ref-field-line{ grid-template-columns:1fr; gap:.35rem; }
  .ref-copy-box{ align-items:stretch; }
  .ref-copy-box input{ font-size:.85rem; }
  .ref-actions-row .btn,
  .ref-hero-actions .btn{ width:100%; justify-content:center; }
  .ref-pagination{ flex-direction:column; }
  .ref-page-btn{ width:100%; }
  .ref-table{ min-width:760px; }
}

body.dash.theme-dark .ref-card,
body.dash.theme-dark .ref-stat-card,
body.dash.theme-dark .ref-copy-box,
body.dash.theme-dark .ref-page-btn{
  background:#111a2e;
  border-color:#1f2937;
}
body.dash.theme-dark .ref-copy-box button,
body.dash.theme-dark .ref-pagination,
body.dash.theme-dark .ref-table th,
body.dash.theme-dark .ref-manual-box,
body.dash.theme-dark .ref-table tbody tr:hover{
  background:#0b1220;
}
body.dash.theme-dark .ref-hero h1,
body.dash.theme-dark .ref-card-title h3,
body.dash.theme-dark .ref-stat-card strong,
body.dash.theme-dark .ref-table td strong{
  color:#f1f5f9;
}
body.dash.theme-dark .ref-hero p,
body.dash.theme-dark .ref-card-title p,
body.dash.theme-dark .ref-stat-card span,
body.dash.theme-dark .ref-stat-card small,
body.dash.theme-dark .ref-table-sub,
body.dash.theme-dark .ref-person span,
body.dash.theme-dark .ref-page-label{
  color:#94a3b8;
}
