/* ==========================================================================
   GPLAY — dark / purple glassmorphism theme
   ========================================================================== */
:root{
  --bg-0:#07070c;
  --bg-1:#0c0c16;
  --bg-2:#111120;
  --glass:rgba(255,255,255,.045);
  --glass-strong:rgba(255,255,255,.08);
  --border:rgba(255,255,255,.09);
  --border-strong:rgba(255,255,255,.16);
  --text-0:#f4f3fb;
  --text-1:#c9c6dd;
  --text-2:#8d89a8;
  --purple-1:#a855f7;
  --purple-2:#7c3aed;
  --purple-3:#c084fc;
  --violet-glow:rgba(139,92,246,.45);
  --green:#22c55e;
  --yellow:#eab308;
  --red:#ef4444;
  --blue:#38bdf8;
  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow-lg:0 20px 60px rgba(0,0,0,.55);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:"Inter","Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text-0);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(168,85,247,.28), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(124,58,237,.22), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, rgba(192,132,252,.14), transparent 60%),
    var(--bg-0);
  /* Anchor the decorative glow to the viewport, not the document: without
     this, the gradients are painted once across the full (tall) page and
     scrolling past their fixed-size radius hits flat --bg-0, showing an
     abrupt hard seam from purple glow to plain black on any page taller
     than one screen (long chats/tickets/lists). */
  background-attachment:fixed;
  min-height:100%;
  line-height:1.5;
  /* Sticky footer: header/main/footer are direct body children, main grows
     to fill remaining space so the footer always sits at the bottom of the
     viewport instead of leaving a gap on short pages. */
  display:flex;
  flex-direction:column;
}
a{color:inherit;text-decoration:none;}
img{max-width:100%;display:block;}
ul{list-style:none;margin:0;padding:0;}
button{font-family:inherit;}

.container{max-width:1200px;margin:0 auto;padding:0 20px;}

/* ---- glass surfaces --------------------------------------------------- */
.glass{
  background:var(--glass);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}
.card{
  background:var(--glass);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  padding:20px;
}
.card:hover{border-color:var(--border-strong);}

/* ---- top navigation ---------------------------------------------------- */
.navbar{
  position:sticky;top:0;z-index:50;
  background:rgba(9,9,16,.72);
  border-bottom:1px solid var(--border);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  flex-shrink:0;
}
.navbar-inner{display:flex;align-items:center;gap:20px;padding:14px 20px;max-width:1200px;margin:0 auto;}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:20px;letter-spacing:.5px;}
.brand .dot{
  width:34px;height:34px;border-radius:10px;
  background:linear-gradient(135deg,var(--purple-1),var(--purple-2));
  display:flex;align-items:center;justify-content:center;font-size:18px;
  box-shadow:0 0 24px var(--violet-glow);
}
.brand-logo{
  width:34px;height:34px;border-radius:10px;object-fit:cover;
  box-shadow:0 0 24px var(--violet-glow);
}
.nav-links{display:flex;gap:4px;flex:1;}
.nav-links a{
  display:inline-flex;align-items:center;gap:6px;
  padding:9px 14px;border-radius:10px;color:var(--text-1);font-weight:600;font-size:14px;
  transition:.15s;
}
.nav-links a:hover,.nav-links a.active{background:var(--glass-strong);color:var(--text-0);}
.nav-search{
  flex:1;max-width:340px;display:flex;align-items:center;gap:8px;
  background:rgba(255,255,255,.05);border:1px solid var(--border);border-radius:12px;padding:8px 14px;
}
.nav-search input{background:none;border:none;outline:none;color:var(--text-0);width:100%;font-size:14px;}
.nav-right{display:flex;align-items:center;gap:10px;}
.balance-pill{
  display:flex;align-items:center;gap:6px;padding:8px 14px;border-radius:999px;
  background:linear-gradient(135deg,rgba(168,85,247,.22),rgba(124,58,237,.14));
  border:1px solid var(--border-strong);font-weight:700;font-size:14px;
}
.avatar{
  width:38px;height:38px;border-radius:50%;object-fit:cover;background:#1c1c2b;
  border:2px solid var(--border-strong);
}
.avatar.frame-neon{border-color:var(--purple-1);box-shadow:0 0 14px var(--violet-glow);}
.avatar.frame-gold{border-color:#f5c542;box-shadow:0 0 14px rgba(245,197,66,.5);}
.avatar.frame-fire{border-color:#f97316;box-shadow:0 0 14px rgba(249,115,22,.55);}
.avatar.frame-ice{border-color:#38bdf8;box-shadow:0 0 14px rgba(56,189,248,.5);}
.avatar-lg{width:104px;height:104px;border-width:4px;}

/* ---- buttons ------------------------------------------------------------ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 18px;border-radius:12px;border:1px solid var(--border-strong);
  background:var(--glass-strong);color:var(--text-0);font-weight:600;font-size:14px;cursor:pointer;
  transition:.15s;
}
.btn:hover{border-color:var(--purple-1);}
.btn-primary{
  background:linear-gradient(135deg,var(--purple-1),var(--purple-2));
  border:none;box-shadow:0 8px 24px var(--violet-glow);
}
.btn-primary:hover{filter:brightness(1.08);}
.btn-ghost{background:transparent;border:1px solid var(--border);}
.btn-danger{background:rgba(239,68,68,.15);border:1px solid rgba(239,68,68,.4);color:#fca5a5;}
.btn-sm{padding:6px 12px;font-size:13px;border-radius:9px;}
.btn-block{width:100%;}

/* ---- forms --------------------------------------------------------------- */
.field{margin-bottom:16px;}
.field label{display:block;font-size:13px;color:var(--text-1);margin-bottom:6px;font-weight:600;}
.input,textarea.input,select.input{
  width:100%;padding:11px 14px;border-radius:11px;border:1px solid var(--border);
  background:rgba(255,255,255,.04);color:var(--text-0);font-size:14px;outline:none;
  transition:.15s;
}
.input:focus{border-color:var(--purple-1);box-shadow:0 0 0 3px rgba(168,85,247,.18);}
textarea.input{resize:vertical;min-height:90px;}
.form-narrow{max-width:420px;margin:60px auto;}

/* Tell the browser to use its dark native-control theme everywhere: this
   alone fixes white backgrounds on <select> dropdown lists, checkboxes,
   radio buttons, and scrollbars in modern browsers. */
:root{color-scheme:dark only;}
/* Belt-and-suspenders for the <select> dropdown list background: some
   browsers/versions don't fully theme the native popup from color-scheme
   alone, but background/color on <option> are honoured directly. */
select.input, select.input option{background-color:#15111f;color:#f4f3fb;}

/* Custom file input: hides the native "Choose file"/"Выберите файл"
   button/text and replaces it with a themed button + filename readout
   (see assets/js/site.js). */
.file-input-wrap{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.file-input-native{
  position:absolute;width:1px;height:1px;opacity:0;overflow:hidden;pointer-events:none;
}
.file-input-btn{flex-shrink:0;}
.file-input-name{color:var(--text-1);font-size:13px;}

/* ---- alerts / flash -------------------------------------------------------- */
.alert{padding:12px 16px;border-radius:12px;margin-bottom:16px;font-size:14px;border:1px solid var(--border);}
.alert-success{background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.35);color:#86efac;}
.alert-error{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.35);color:#fca5a5;}
.alert-info{background:rgba(56,189,248,.12);border-color:rgba(56,189,248,.35);color:#93d9fb;}

/* ---- badges ----------------------------------------------------------------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:700;border:1px solid transparent;}
.badge-high{background:rgba(239,68,68,.15);color:#fca5a5;border-color:rgba(239,68,68,.35);}
.badge-medium{background:rgba(234,179,8,.15);color:#fde047;border-color:rgba(234,179,8,.35);}
.badge-low{background:rgba(56,189,248,.15);color:#93d9fb;border-color:rgba(56,189,248,.35);}
.badge-open{background:rgba(234,179,8,.15);color:#fde047;border-color:rgba(234,179,8,.35);}
.badge-in_progress{background:rgba(56,189,248,.15);color:#93d9fb;border-color:rgba(56,189,248,.35);}
.badge-closed{background:rgba(255,255,255,.08);color:var(--text-2);border-color:var(--border);}
.badge-active{background:rgba(34,197,94,.15);color:#86efac;border-color:rgba(34,197,94,.35);}
.badge-sold{background:rgba(255,255,255,.08);color:var(--text-2);}

/* ---- layout helpers ------------------------------------------------------- */
.page{padding:32px 0 80px;flex:1 0 auto;width:100%;}
.page-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px;flex-wrap:wrap;gap:12px;}
.page-head h1{font-size:26px;margin:0;}
.muted{color:var(--text-2);}
.grid{display:grid;gap:18px;}
.grid-cols-4{grid-template-columns:repeat(4,1fr);}
.grid-cols-3{grid-template-columns:repeat(3,1fr);}
.grid-cols-2{grid-template-columns:repeat(2,1fr);}
@media(max-width:900px){.grid-cols-4,.grid-cols-3,.grid-cols-2{grid-template-columns:1fr 1fr;}}
@media(max-width:600px){.grid-cols-4,.grid-cols-3,.grid-cols-2{grid-template-columns:1fr;}}
/* Several dashboard-style pages (wallet, top-up, profile settings, product,
   referrals) set an explicit two-column grid-template-columns as an inline
   style (e.g. "340px 1fr") for desktop layout. Inline styles always beat
   stylesheet rules regardless of media queries, so the responsive rules
   above never reached them — !important is required here to actually force
   a single column on narrow screens. */
@media(max-width:760px){.grid[style*="grid-template-columns"]{grid-template-columns:1fr !important;}}

/* ---- category chips ---------------------------------------------------- */
.chip-row{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:22px;}
.chip{
  padding:9px 16px;border-radius:999px;border:1px solid var(--border);background:var(--glass);
  font-size:14px;font-weight:600;color:var(--text-1);
}
.chip.active,.chip:hover{border-color:var(--purple-1);color:var(--text-0);background:rgba(168,85,247,.15);}

/* ---- listing cards ------------------------------------------------------- */
.listing-card{padding:0;overflow:hidden;display:flex;flex-direction:column;}
.listing-thumb{
  height:150px;background:linear-gradient(135deg,#1a1330,#241a3d);display:flex;align-items:center;justify-content:center;
  border-bottom:1px solid var(--border);
}
.listing-thumb .icon{width:52px;height:52px;color:rgba(255,255,255,.28);}
.empty-state .icon-xl{color:rgba(255,255,255,.3);}
.listing-thumb img{width:100%;height:100%;object-fit:cover;}
.listing-body{padding:16px;display:flex;flex-direction:column;gap:8px;flex:1;}
.listing-title{font-weight:700;font-size:15px;}
.listing-meta{display:flex;align-items:center;justify-content:space-between;font-size:13px;color:var(--text-2);}
.listing-price{font-size:19px;font-weight:800;color:var(--purple-3);}
.seller-row{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text-1);}
.reviews-list{display:flex;flex-direction:column;gap:16px;}
.review-row{display:flex;gap:12px;align-items:flex-start;padding-bottom:16px;border-bottom:1px solid var(--border);}
.review-row:last-child{border-bottom:none;padding-bottom:0;}

/* ---- profile page -------------------------------------------------------- */
.profile-cover{
  height:220px;border-radius:var(--radius-lg);position:relative;overflow:hidden;margin-bottom:20px;
  background-size:cover;background-position:center;
  background-image:linear-gradient(135deg,#1c1330 0%,#2a1a4a 60%,#150f24 100%);
  border:1px solid var(--border);
}
.profile-cover::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(0,0,0,0) 40%,rgba(7,7,12,.85) 100%);
}
.profile-head{display:flex;align-items:flex-end;gap:20px;padding:0 24px;position:relative;z-index:2;}
.profile-info-card{padding:24px;margin-top:20px;}
.stat-pill{text-align:center;padding:14px;border-radius:14px;background:var(--glass);border:1px solid var(--border);}
.stat-pill b{display:block;font-size:20px;}
.stat-pill span{font-size:12px;color:var(--text-2);}
.frame-swatch{width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;border:3px solid var(--border);background:#1c1c2b;font-size:20px;}
.frame-swatch.selected{border-color:var(--purple-1);box-shadow:0 0 14px var(--violet-glow);}
.color-swatch{width:34px;height:34px;border-radius:50%;cursor:pointer;border:2px solid rgba(255,255,255,.2);}
.color-swatch.selected{outline:2px solid #fff;outline-offset:2px;}

/* ---- comments ------------------------------------------------------------- */
.comment{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid var(--border);}
.comment:last-child{border-bottom:none;}

/* ---- chat ------------------------------------------------------------------ */
.chat-layout{display:grid;grid-template-columns:320px 1fr;gap:0;border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;height:70vh;background:var(--glass);backdrop-filter:blur(18px);}
.chat-list{border-right:1px solid var(--border);overflow-y:auto;min-height:0;}
.chat-list-item{display:flex;gap:10px;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border);cursor:pointer;}
.chat-list-item:hover,.chat-list-item.active{background:var(--glass-strong);}
.chat-thread{display:flex;flex-direction:column;height:100%;min-height:0;}
/* Ticket detail pages reuse .chat-messages for the message list, but unlike
   the chat page they aren't inside a fixed-height .chat-layout grid — without
   this wrapper the list has no height/overflow boundary and grows with the
   page instead of scrolling internally (the whole ticket page becomes very
   tall with the composer pushed far down). */
.ticket-thread{display:flex;flex-direction:column;height:70vh;max-height:720px;min-height:0;}
.chat-messages{flex:1;min-height:0;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:12px;}
.msg{max-width:70%;padding:11px 15px;border-radius:16px;font-size:14px;background:var(--glass-strong);border:1px solid var(--border);overflow-wrap:anywhere;word-break:break-word;align-self:flex-start;}
.msg.mine{align-self:flex-end;background:linear-gradient(135deg,var(--purple-1),var(--purple-2));border:none;}
.msg.ai{background:linear-gradient(135deg,rgba(168,85,247,.35),rgba(124,58,237,.25));border:1px solid var(--border-strong);}
/* .msg.ai used to always force align-self:flex-start regardless of which side
   the row actually renders on — correct for the ticket owner's view (AI/
   support replies on the left), but wrong for staff/admin viewing their own
   AI-generated replies, where the row is flipped to the right via
   .msg-row.mine. That mismatch made the bubble hang on the left while its
   avatar/name/time (driven by the row's flex-direction) sat on the right —
   a disconnected, "crooked" layout. This override re-aligns the bubble (and
   its "Сгенерировано ИИ" tag, below) to match the row's actual side. */
.msg-row.mine .msg.ai{align-self:flex-end;}
.msg-time{font-size:11px;color:var(--text-2);margin-top:4px;}
.msg-ai-tag{font-size:11px;color:var(--purple-3);display:flex;align-items:center;gap:4px;margin-top:6px;}
.msg-row.mine .msg-ai-tag{justify-content:flex-end;}
.msg-image{margin-top:8px;}
.msg-image img{max-width:220px;max-height:220px;border-radius:10px;display:block;border:1px solid var(--border-strong);}
.chat-input-row{display:flex;gap:10px;padding:14px;border-top:1px solid var(--border);}
.chat-input-row .input{flex:1;}
.chat-order-box{padding:14px 20px;border-bottom:1px solid var(--border);background:rgba(168,85,247,.06);}
.chat-order-action{margin-top:10px;}

/* ---- tickets (client + admin) --------------------------------------------- */
.ticket-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px;}
.ticket-stat{padding:16px;text-align:center;}
.ticket-stat b{font-size:26px;display:block;}
.ticket-stat span{font-size:12px;color:var(--text-2);}
.support-layout{display:grid;grid-template-columns:360px 1fr;gap:18px;align-items:start;}
.ticket-list{max-height:75vh;overflow-y:auto;padding:8px;}
.ticket-row{display:block;padding:14px;border-radius:14px;margin-bottom:8px;cursor:pointer;border:1px solid transparent;}
.ticket-row:hover{background:var(--glass-strong);}
.ticket-row.active{background:rgba(168,85,247,.14);border-color:var(--purple-1);}
.ticket-row-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;}
.ticket-row-title{font-weight:700;font-size:14px;}
.ticket-row-meta{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--text-2);flex-wrap:wrap;}
.ticket-panel-head{display:flex;justify-content:space-between;align-items:flex-start;padding:18px 22px;border-bottom:1px solid var(--border);}
.ticket-panel-head select{background:var(--glass-strong);color:var(--text-0);border:1px solid var(--border);border-radius:10px;padding:8px 10px;font-size:13px;font-weight:600;}
.waiting-banner{background:rgba(234,179,8,.14);border:1px solid rgba(234,179,8,.35);color:#fde047;padding:10px 16px;border-radius:12px;margin:0 22px 14px;font-size:13px;font-weight:600;}
.ai-suggest-box{margin:0 22px 16px;padding:14px;border-radius:14px;border:1px dashed var(--purple-1);background:rgba(168,85,247,.08);}
.ai-generate-send-btn{
  justify-content:center;border:1px dashed var(--purple-1);background:rgba(168,85,247,.08);color:var(--purple-3);
}
.ai-generate-send-btn:hover{background:rgba(168,85,247,.16);}
.ai-generate-send-btn:disabled{opacity:.6;cursor:wait;}

.msg-sender-name{font-size:11px;font-weight:700;color:var(--text-2);margin:0 2px 3px;}
.msg-row.mine .msg-sender-name{text-align:right;}
.msg-deleted-text{font-style:italic;color:var(--text-2);display:inline-flex;align-items:center;gap:6px;}
.msg[data-manageable],.msg-row[data-manageable]{cursor:context-menu;}

/* ---- generic right-click context menu (chat/ticket messages, chat list) --- */
.app-context-menu{
  position:fixed;z-index:2000;min-width:160px;background:#15111f;border:1px solid var(--border-strong);
  border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.5);padding:6px;display:flex;flex-direction:column;gap:2px;
}
.app-context-menu-item{
  display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:8px;background:none;border:none;
  color:var(--text-0);font-size:13px;text-align:left;cursor:pointer;width:100%;
}
.app-context-menu-item:hover{background:var(--glass-strong);}
.app-context-menu-item.danger{color:#fca5a5;}
.app-context-menu-item svg{width:16px;height:16px;flex-shrink:0;}

/* ---- admin settings: multi-column card grid instead of one long column ---- */
.settings-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;align-items:start;}
.settings-grid .card{margin:0;}
@media (max-width:900px){.settings-grid{grid-template-columns:1fr;}}

/* ---- footer --------------------------------------------------------------- */
.site-footer{border-top:1px solid var(--border);padding:26px 0;margin-top:60px;color:var(--text-2);font-size:13px;flex-shrink:0;}
.footer-inner{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;text-align:center;}
.footer-text{flex:1 1 auto;min-width:200px;}
.footer-links{display:flex;gap:8px;flex-wrap:wrap;}

/* ---- admin sidebar layout --------------------------------------------------- */
.admin-shell{display:grid;grid-template-columns:230px 1fr;min-height:100vh;}
.admin-sidebar{background:rgba(9,9,16,.75);border-right:1px solid var(--border);padding:20px 14px;position:sticky;top:0;height:100vh;backdrop-filter:blur(18px);}
.admin-sidebar .brand{padding:6px 8px 22px;}
.admin-nav a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:10px;color:var(--text-1);font-weight:600;font-size:14px;margin-bottom:2px;}
.admin-nav a:hover,.admin-nav a.active{background:var(--glass-strong);color:#fff;}
.admin-main{padding:26px 30px;}

.empty-state{text-align:center;padding:60px 20px;color:var(--text-2);}
.empty-state .big-icon{font-size:44px;margin-bottom:12px;}

::-webkit-scrollbar{width:10px;height:10px;}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.12);border-radius:8px;}
::-webkit-scrollbar-track{background:transparent;}

/* ==========================================================================
   Icons (inline monochrome SVGs — see app/partials/icons.php)
   ========================================================================== */
.icon{width:1em;height:1em;display:inline-block;vertical-align:-0.15em;flex-shrink:0;stroke-width:2;}
.icon-lg{width:1.4em;height:1.4em;}
.icon-xl{width:2.2em;height:2.2em;}
.brand .dot .icon{width:18px;height:18px;color:#fff;}
.btn .icon{margin-right:2px;}
.admin-nav a .icon{margin-right:4px;}

/* ==========================================================================
   Motion — smooth, subtle transitions across interactive surfaces
   ========================================================================== */
@media (prefers-reduced-motion: no-preference){
  a,button,.btn,.card,.chip,.badge,.input,textarea.input,select.input,
  .avatar,.listing-card,.ticket-row,.chat-list-item,.frame-swatch,.color-swatch,
  .stat-pill,.nav-links a,.admin-nav a,.balance-pill{
    transition:background-color .18s ease, border-color .18s ease, color .18s ease,
               transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, opacity .18s ease;
  }
  .btn:hover{transform:translateY(-1px);}
  .btn:active{transform:translateY(0) scale(.98);}
  .card:hover{transform:translateY(-2px);}
  .listing-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg);}
  .chip:hover{transform:translateY(-1px);}
  .frame-swatch:hover,.color-swatch:hover{transform:scale(1.08);}
  .avatar{transition:box-shadow .2s ease, border-color .2s ease, transform .16s ease;}
  .ticket-row:hover,.chat-list-item:hover{transform:translateX(2px);}

  .page{animation:fadeInUp .35s ease both;}
  .card{animation:fadeIn .3s ease both;}
  .msg{animation:msgIn .22s cubic-bezier(.2,.8,.2,1) both;}
  .alert{animation:fadeInUp .25s ease both;}
  .navbar{animation:fadeIn .25s ease both;}

  .grid.grid-cols-4 > *,.grid.grid-cols-3 > *,.grid.grid-cols-2 > *{animation:fadeInUp .35s ease both;}
  .grid > *:nth-child(1){animation-delay:.02s;} .grid > *:nth-child(2){animation-delay:.05s;}
  .grid > *:nth-child(3){animation-delay:.08s;} .grid > *:nth-child(4){animation-delay:.11s;}
  .grid > *:nth-child(5){animation-delay:.14s;} .grid > *:nth-child(6){animation-delay:.17s;}
  .grid > *:nth-child(7){animation-delay:.20s;} .grid > *:nth-child(8){animation-delay:.23s;}
}

@keyframes fadeInUp{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);}}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
@keyframes msgIn{from{opacity:0;transform:translateY(6px) scale(.98);}to{opacity:1;transform:translateY(0) scale(1);}}
@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}
.spin{animation:spin 1s linear infinite;}

/* ==========================================================================
   Support chat message avatars (fixes the old "raw emoji" look)
   ========================================================================== */
.msg-row{display:flex;gap:10px;align-items:flex-start;max-width:100%;}
.msg-avatar{margin-top:2px;}
.msg-row.mine{flex-direction:row-reverse;}
.msg-avatar{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--glass-strong);border:1px solid var(--border-strong);color:var(--text-1);}
.msg-avatar.support{background:linear-gradient(135deg,var(--purple-1),var(--purple-2));color:#fff;border:none;}
.msg-avatar.ai-avatar{background:linear-gradient(135deg,#c084fc,#7c3aed);color:#fff;border:none;}
.msg-group{display:flex;flex-direction:column;gap:2px;max-width:70%;}
.msg-row.mine .msg-group{align-items:flex-end;}

/* ---- star ratings ---------------------------------------------------------- */
.stars-row{display:inline-flex;gap:2px;color:var(--text-2);}
.stars-row .star-filled{color:#eab308;}
.stars-row .star-empty{color:rgba(255,255,255,.18);}

/* ---- order escrow steps ---------------------------------------------------- */
.order-steps{display:flex;align-items:center;gap:6px;margin:18px 0;flex-wrap:wrap;}
.order-step{display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;background:var(--glass);border:1px solid var(--border);font-size:13px;font-weight:600;color:var(--text-2);}
.order-step.done{color:#86efac;border-color:rgba(34,197,94,.4);background:rgba(34,197,94,.1);}
.order-step.current{color:var(--purple-3);border-color:var(--purple-1);background:rgba(168,85,247,.14);}
.order-step-sep{width:26px;height:2px;background:var(--border);}
.order-step-sep.done{background:rgba(34,197,94,.5);}

/* ---- mobile responsive pass ------------------------------------------------
   Covers the navbar, chat/ticket split layouts, and the admin sidebar shell,
   which previously had no small-screen behaviour at all (fixed side columns
   would overflow horizontally on phones). */
@media (max-width:900px){
  .chat-layout{grid-template-columns:minmax(0,1fr);height:auto;}
  .chat-layout > *{min-width:0;}
  .chat-list{max-height:220px;border-right:none;border-bottom:1px solid var(--border);}
  .chat-thread{height:60vh;}
  .support-layout{grid-template-columns:minmax(0,1fr);}
  .support-layout > *{min-width:0;}
  .ticket-list{max-height:260px;}
  .ticket-thread{height:60vh;}
  .admin-shell{grid-template-columns:minmax(0,1fr);}
  .admin-shell > *{min-width:0;}
  .admin-sidebar{position:static;height:auto;padding:12px 14px;}
  .admin-sidebar .brand{padding:4px 0 10px;}
  .admin-nav{display:flex;flex-direction:row;flex-wrap:wrap;gap:6px;min-width:0;}
  .admin-nav a{white-space:nowrap;font-size:13px;padding:8px 10px;flex:0 1 auto;margin-bottom:0;}
  .admin-nav hr{display:none;}
  .admin-main{padding:18px 16px;}
  /* Generic safety net: any grid/flex row that still uses fixed side columns
     on this breakpoint should not force its children past the viewport. */
  .grid,.flex,.order-steps,.ticket-panel-head,.page-head{min-width:0;}
}
@media (max-width:720px){
  .navbar-inner{flex-wrap:wrap;gap:10px;padding:12px 16px;}
  .nav-links{order:3;flex:0 0 100%;overflow-x:auto;gap:2px;}
  .nav-links a{white-space:nowrap;padding:8px 10px;font-size:13px;}
  .nav-search{order:2;flex:0 0 100%;max-width:none;}
  .nav-right{order:1;margin-left:auto;}
  .container{padding:0 14px;}
  .page{padding:20px 0 60px;}
  .page-head h1{font-size:21px;}
  .msg-group,.msg{max-width:85%;}
  .ticket-stats{grid-template-columns:repeat(2,1fr);}
  .ticket-panel-head{flex-wrap:wrap;}
  .ticket-panel-head > div:last-child{flex-wrap:wrap;}
  .ticket-meta-form{flex-wrap:wrap;}
}
