:root{
  --bg:#050505;
  --bg-soft:#0d0d0f;
  --bg-card:#111214;
  --bg-card-2:#16171b;
  --text:#f5f7fb;
  --muted:#9da3af;
  --border:#25272d;
  --red:#d10f1f;
  --red-dark:#6d0911;
  --green:#16a34a;
  --yellow:#facc15;
  --yellow-text:#111827;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --radius:22px;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  background:
    radial-gradient(circle at top left, rgba(209,15,31,.12), transparent 26%),
    radial-gradient(circle at top right, rgba(209,15,31,.08), transparent 20%),
    linear-gradient(180deg,#050505 0%, #090909 100%);
  color:var(--text);
  font-family:Arial,Helvetica,sans-serif;
  min-height:100%;
}

body{
  padding:16px;
}

#app{
  max-width:1600px;
  margin:0 auto;
}

.app-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  padding:18px 20px;
  border:1px solid var(--border);
  border-radius:24px;
  background:linear-gradient(180deg, rgba(209,15,31,.08), rgba(255,255,255,0) 60%), var(--bg-soft);
  box-shadow:var(--shadow);
  margin-bottom:16px;
}

.app-header h1{
  margin:0;
  font-size:40px;
  line-height:1;
  font-weight:800;
  letter-spacing:-0.03em;
}

.app-header p{
  margin:8px 0 0;
  color:var(--muted);
  font-size:16px;
}

.admin-pill{
  padding:12px 18px;
  border-radius:999px;
  background:rgba(209,15,31,.12);
  border:1px solid rgba(209,15,31,.35);
  font-weight:700;
  color:#fff;
  white-space:nowrap;
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:16px;
}

.stat-card{
  background:linear-gradient(180deg,var(--bg-card-2),var(--bg-card));
  border:1px solid var(--border);
  border-radius:24px;
  padding:18px 20px;
  box-shadow:var(--shadow);
}

.stat-card span{
  display:block;
  color:var(--muted);
  font-size:14px;
  margin-bottom:10px;
}

.stat-card strong{
  font-size:52px;
  line-height:1;
  font-weight:800;
  color:#fff;
}

.filters{
  display:flex;
  gap:12px;
  margin-bottom:16px;
  flex-wrap:wrap;
}

.input{
  background:#0f1013;
  color:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px 16px;
  font-size:16px;
  min-width:220px;
  outline:none;
}

.input:focus{
  border-color:rgba(209,15,31,.75);
  box-shadow:0 0 0 3px rgba(209,15,31,.16);
}

.btn{
  border:none;
  border-radius:16px;
  padding:14px 18px;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
}

.btn-red{
  background:linear-gradient(180deg,#ff1a2f,#d10f1f);
  color:#fff;
}

.btn-green{
  background:linear-gradient(180deg,#22c55e,#16a34a);
  color:#fff;
}

.btn-yellow{
  background:linear-gradient(180deg,#fde047,#facc15);
  color:var(--yellow-text);
}

.btn-dark{
  background:#1b1d22;
  color:#fff;
  border:1px solid var(--border);
}

.main-layout{
  display:grid;
  grid-template-columns:380px 1fr;
  gap:16px;
  min-height:72vh;
}

.tickets-panel,
.details-panel{
  background:linear-gradient(180deg,var(--bg-soft),#090a0d);
  border:1px solid var(--border);
  border-radius:28px;
  padding:18px;
  box-shadow:var(--shadow);
}

.section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
}

.section-head h2{
  margin:0;
  font-size:34px;
  font-weight:800;
  letter-spacing:-0.03em;
}

.ticket-list{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.ticket-card{
  background:linear-gradient(180deg, rgba(209,15,31,.08), rgba(255,255,255,0) 40%), #0e0f12;
  border:1px solid #2a2d34;
  border-radius:22px;
  padding:16px;
  cursor:pointer;
  transition:all .15s ease;
}

.ticket-card:hover{
  transform:translateY(-1px);
  border-color:#5b0f18;
}

.ticket-card.active{
  border-color:var(--red);
  box-shadow:0 0 0 1px rgba(209,15,31,.25) inset;
}

.ticket-title{
  font-size:24px;
  font-weight:800;
  margin-bottom:10px;
  line-height:1.15;
}

.ticket-time{
  color:var(--muted);
  font-size:13px;
  margin-bottom:10px;
}

.ticket-preview{
  color:#d7dce3;
  font-size:16px;
  line-height:1.4;
  margin-top:10px;
  word-break:break-word;
}

.badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:7px 12px;
  font-size:12px;
  font-weight:800;
}

.badge-route{
  background:rgba(209,15,31,.16);
  border:1px solid rgba(209,15,31,.45);
  color:#fff;
}

.badge-reg{
  background:#172554;
  border:1px solid #2563eb;
  color:#dbeafe;
}

.badge-status-new{
  background:#1f2937;
  border:1px solid #4b5563;
  color:#f9fafb;
}

.badge-status-open{
  background:#052e16;
  border:1px solid #15803d;
  color:#dcfce7;
}

.badge-status-waiting{
  background:#3f2b00;
  border:1px solid #ca8a04;
  color:#fef3c7;
}

.badge-status-closed{
  background:#1f2937;
  border:1px solid #6b7280;
  color:#e5e7eb;
}

.unread-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:#ff3448;
  display:inline-block;
  margin-left:8px;
}

.empty-state{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:60vh;
  text-align:center;
  color:var(--muted);
  font-size:18px;
}

.ticket-detail-wrap{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.detail-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  flex-wrap:wrap;
}

.detail-title{
  font-size:42px;
  font-weight:900;
  line-height:1;
  margin:0 0 8px;
  letter-spacing:-0.03em;
}

.info-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
}

.info-card{
  background:#0f1013;
  border:1px solid var(--border);
  border-radius:20px;
  padding:14px;
}

.info-label{
  font-size:13px;
  color:var(--muted);
  margin-bottom:8px;
}

.info-value{
  font-size:22px;
  font-weight:800;
  line-height:1.15;
  word-break:break-word;
}

.detail-body{
  display:grid;
  grid-template-columns:minmax(320px, 1fr) 340px;
  gap:16px;
}

.chat-section{
  background:#0f1013;
  border:1px solid var(--border);
  border-radius:24px;
  padding:16px;
}

.chat-section h3,
.actions-section h3{
  margin:0 0 14px;
  font-size:28px;
  font-weight:800;
}

.chat-box{
  height:540px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding-right:6px;
}

.msg{
  max-width:78%;
  border-radius:20px;
  padding:14px 16px;
  line-height:1.45;
  font-size:18px;
  word-break:break-word;
}

.msg-client{
  background:#1a1c21;
  border:1px solid #2a2d34;
  align-self:flex-start;
}

.msg-admin{
  background:rgba(209,15,31,.1);
  border:1px solid rgba(209,15,31,.35);
  align-self:flex-end;
}

.msg-meta{
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
}

.actions-section{
  background:#0f1013;
  border:1px solid var(--border);
  border-radius:24px;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.action-card{
  background:#12141a;
  border:1px solid var(--border);
  border-radius:20px;
  padding:14px;
}

.action-card h4{
  margin:0 0 12px;
  font-size:16px;
  color:#fff;
}

.action-card .input,
.action-card textarea{
  width:100%;
  min-width:0;
  margin-bottom:10px;
}

.action-card textarea{
  min-height:140px;
  resize:vertical;
  background:#0f1013;
  color:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px 16px;
  font-size:16px;
  outline:none;
}

.action-card textarea:focus{
  border-color:rgba(209,15,31,.75);
  box-shadow:0 0 0 3px rgba(209,15,31,.16);
}

.full-width{
  width:100%;
}

@media (max-width: 1200px){
  .main-layout{
    grid-template-columns:1fr;
  }

  .detail-body{
    grid-template-columns:1fr;
  }
}

@media (max-width: 820px){
  body{
    padding:10px;
  }

  .app-header{
    flex-direction:column;
    align-items:flex-start;
  }

  .app-header h1{
    font-size:32px;
  }

  .stats-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .info-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .ticket-title{
    font-size:20px;
  }

  .detail-title{
    font-size:32px;
  }

  .info-value{
    font-size:18px;
  }

  .chat-box{
    height:400px;
  }

  .msg{
    max-width:92%;
    font-size:16px;
  }
}

@media (max-width: 540px){
  .stats-grid,
  .info-grid{
    grid-template-columns:1fr;
  }

  .filters{
    flex-direction:column;
  }

  .input,
  .btn{
    width:100%;
  }

  .section-head h2{
    font-size:28px;
  }

  .detail-title{
    font-size:28px;
  }
}
