:root{
  --bg1:#070b13;
  --bg2:#0b1630;
  --glass: rgba(255,255,255,.08);
  --glass2: rgba(255,255,255,.12);
  --line: rgba(255,255,255,.12);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.72);
  --primary: #6aa6ff;
  --danger: #ff6a7a;
  --ok: #49d89a;
  --shadow: 0 18px 48px rgba(0,0,0,.38);
  --radius: 18px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 600px at 20% 10%, rgba(106,166,255,.25), transparent 60%),
              radial-gradient(900px 500px at 80% 0%, rgba(73,216,154,.18), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
  min-height:100vh;  padding-top:80px;
}
.bg{
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
  background: radial-gradient(1200px 700px at 20% 10%, rgba(106,166,255,.18), transparent 55%),
              radial-gradient(900px 600px at 80% 0%, rgba(73,216,154,.10), transparent 55%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--text);
}

.bg::before{
  content:"";
  position:fixed; inset:0;
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.06), transparent 35%),
                    radial-gradient(circle at 70% 20%, rgba(255,255,255,.05), transparent 30%);
  pointer-events:none;
  z-index:-1;
}

.glass{
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar{
  position:fixed;
  top:10px;
  left:10px;
  right:10px;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  margin:0;
}

/* Topbar auto-hide (reveals on hover/focus) */
.topbar{transition: opacity .18s ease, transform .18s ease;}
.topbar:not(:hover):not(:focus-within){
  opacity: .20;
  transform: translateY(-14px);
}

.brand{font-weight:800; letter-spacing:.4px}
.top-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.userchip{padding:10px 12px; border-radius:999px; font-weight:600}

.container{max-width:1100px; margin:0 auto; padding:18px}
.page-head{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:10px 0 14px}
.page-head h2{margin:0}
.muted{color:var(--muted)}
.center{text-align:center}
.link{color:var(--primary); text-decoration:none; font-weight:700}
.link:hover{text-decoration:underline}

.card{padding:16px}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  text-decoration:none;
  color:var(--text);
  background: rgba(255,255,255,.06);
  cursor:pointer;
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{background: rgba(255,255,255,.10)}
.btn:active{transform: translateY(1px)}
.btn.primary{background: rgba(106,166,255,.18); border-color: rgba(106,166,255,.35)}
.btn.danger{background: rgba(255,106,122,.16); border-color: rgba(255,106,122,.35)}

.form{display:flex; flex-direction:column; gap:10px; margin-top:10px}
label{font-weight:700}
input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.25);
  color:var(--text);
  outline:none;
}
textarea{resize:vertical}
input::placeholder{color:rgba(234,240,255,.45)}

.alert{
  padding:12px;
  border-radius: 14px;
  background: rgba(255,106,122,.14);
  border: 1px solid rgba(255,106,122,.28);
}
.ok{
  padding:12px;
  border-radius: 14px;
  background: rgba(73,216,154,.12);
  border: 1px solid rgba(73,216,154,.28);
}

.filters{
  display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  margin-bottom:12px;
}
.filters input{max-width:360px}
.filters .select{max-width:180px}

.table-wrap{overflow:auto; border-radius: 16px}
.table{
  width:100%;
  border-collapse: collapse;
  min-width:860px;
}
.table th, .table td{
  padding:12px 10px;
  border-bottom:1px solid rgba(255,255,255,.08);
  text-align:right;
}
.table thead th{color:rgba(234,240,255,.85); font-size:13px}
.table tbody tr:hover{background: rgba(255,255,255,.04)}

.pill{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  border:1px solid rgba(255,255,255,.14);
}
.pill.open{background: rgba(106,166,255,.14); border-color: rgba(106,166,255,.25)}
.pill.closed{background: rgba(73,216,154,.12); border-color: rgba(73,216,154,.22)}
.pill.not_solved{background: rgba(255,196,86,.12); border-color: rgba(255,196,86,.22)}

.pager{display:flex; justify-content:center; align-items:center; gap:12px; margin-top:12px}

.cards{display:none; gap:12px; margin-top:10px}
.tcard{
  display:block;
  padding:14px;
  color:var(--text);
  text-decoration:none;
}
.tcard-top{display:flex; justify-content:space-between; align-items:center; margin-bottom:8px}
.tcard-id{font-weight:900; letter-spacing:.3px}
.tcard-line{margin:6px 0}
.divider{height:1px; background: rgba(255,255,255,.10); margin:12px 0}

.grid2{display:grid; grid-template-columns: 1.2fr .8fr; gap:14px}
.kv{display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.08)}
.kv:last-child{border-bottom:none}
.note{white-space:pre-wrap; color:rgba(234,240,255,.85); background: rgba(0,0,0,.18); border:1px solid rgba(255,255,255,.08); padding:12px; border-radius: 14px}

.results{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.res{
  padding:10px; border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  cursor:pointer;
}
.res:hover{background: rgba(255,255,255,.06)}
.res b{display:block}
.res small{color:rgba(234,240,255,.65)}

.kpis{display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; margin:12px 0}
.kpi{padding:14px; text-align:center}
.kpi-num{font-size:28px; font-weight:1000}
.kpi-label{color:rgba(234,240,255,.7); font-weight:700}

.sub{padding:14px}
.sub h3{margin:0 0 10px}
.list .row{display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.08)}
.list .row:last-child{border-bottom:none}

.bullets{margin:10px 0; padding:0 18px; color:rgba(234,240,255,.8)}

.center .card{max-width:460px; margin: 22px auto}
.hint{margin-top:12px; color:rgba(234,240,255,.7); font-size:13px}

/* mobile */
@media (max-width: 860px){
  .container{padding:14px}
  .grid2{grid-template-columns: 1fr}
  .kpis{grid-template-columns: repeat(2, 1fr)}
  .table-wrap{display:none}
  .cards{display:flex; flex-direction:column}
  .top-actions{gap:8px}
}

.pre{background:rgba(0,0,0,.25);padding:12px;border-radius:14px;overflow:auto;direction:ltr;text-align:left}


/* --- Mobile top menu (hamburger) --- */
.brand-wrap{display:flex; align-items:center; gap:12px; width:100%;}
.nav-toggle{
  display:none;
  width:42px; height:42px;
  border:1px solid rgba(255,255,255,.15);
  border-radius:14px;
  background:rgba(255,255,255,.06);
  color:inherit;
  cursor:pointer;
  margin-left:auto; /* in RTL this pushes it to the left side */
  font-size:18px;
}
.notif-btn{width:42px; height:42px; padding:0; border-radius:14px;}

@media (max-width: 720px){
  .topbar{padding:14px 14px;}
  .nav-toggle{display:inline-flex; align-items:center; justify-content:center;}
  .top-actions{
    position:fixed;
    top:78px;
    left:12px;
    right:12px;
    z-index:50;
    display:none;
    flex-wrap:wrap;
    gap:10px;
    padding:12px;
    border-radius:18px;
    background:rgba(10, 14, 22, .55);
    backdrop-filter: blur(14px);
  }
  .top-actions.open{display:flex;}
  .top-actions a.btn, .top-actions button.btn{flex:1 1 calc(33% - 10px);}
  .top-actions .userchip{flex:1 1 100%;}
}



.btn-wa{display:inline-block;margin-inline-start:8px;padding:6px 10px;border-radius:12px;background:rgba(37,211,102,.15);border:1px solid rgba(37,211,102,.35);color:#e9fff1;text-decoration:none;font-size:12px;}
.btn-wa:hover{filter:brightness(1.08);}


/* WhatsApp quick button */
.btn.wa{margin-inline-start:10px; padding:6px 10px; font-size:12px;}


/* Auto-hide topbar (requested) */
.topbar.auto-hide{
  position:fixed;
  opacity:.35;
  transform: translateY(-46px);
  transition: transform .2s ease, opacity .2s ease;
}
.topbar.auto-hide:hover,
.topbar.auto-hide:focus-within{
  opacity:1;
  transform: translateY(0);
}
.topbar.auto-hide::after{
  content:"";
  position:absolute;
  left:0; right:0;
  bottom:-14px;
  height:14px; /* hover handle */
}
.topbar .btn{padding:12px 16px; font-size:15px}
.topbar .userchip{padding:12px 14px; font-size:15px}

/* WhatsApp-like chat layout */
.wa-wrap{display:grid; grid-template-columns: 360px 1fr; gap:14px; align-items:stretch}
@media (max-width: 980px){
  .wa-wrap{grid-template-columns: 1fr}
  .wa-left{order:2}
  .wa-main{order:1}
}
.wa-left-head{display:flex; align-items:baseline; justify-content:space-between; gap:12px}
.wa-actions{display:flex; gap:10px; margin-top:10px; flex-wrap:wrap}
.wa-list{margin-top:10px; display:flex; flex-direction:column; gap:10px; max-height:70vh; overflow:auto; padding-right:2px}
.wa-thread{width:100%; text-align:right; border:1px solid var(--line); background:var(--glass); color:var(--text); border-radius:16px; padding:12px; cursor:pointer}
.wa-thread.active{outline:2px solid rgba(106,166,255,.35)}
.wa-thread-title{font-weight:800}
.wa-thread-last{margin-top:6px; font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.wa-thread-meta{margin-top:8px; display:flex; align-items:center; justify-content:space-between; gap:10px}
.badge{min-width:24px; height:24px; display:inline-flex; align-items:center; justify-content:center; border-radius:999px; background:rgba(106,166,255,.25); border:1px solid rgba(106,166,255,.35); font-weight:800}
.wa-main{display:flex; flex-direction:column; min-height:70vh}
.wa-main-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.wa-messages{margin-top:12px; flex:1; overflow:auto; padding:10px; border:1px solid var(--line); border-radius:16px; background:rgba(255,255,255,.04)}
.wa-bubble{max-width:72%; padding:10px 12px; border-radius:16px; border:1px solid var(--line); background:var(--glass); margin:6px 0}
.wa-bubble.mine{margin-left:auto; background:rgba(106,166,255,.10); border-color:rgba(106,166,255,.25)}
.wa-bubble.theirs{margin-right:auto}
.wa-bubble-text{white-space:pre-wrap; line-height:1.5}
.wa-bubble-meta{margin-top:6px; font-size:12px; color:var(--muted)}
.wa-compose{display:flex; gap:10px; margin-top:12px; align-items:flex-end}
.wa-compose textarea{flex:1; resize:none}

/* simple modal */
.modal{position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:10000; display:flex; align-items:center; justify-content:center; padding:18px}
.modal-card{width:min(520px, 96vw)}
