:root{
  --bg:#0f0f10;
  --panel:#171718;
  --panel-2:#1d1d1f;
  --line:#2a2a2d;
  --text:#f3f3f4;
  --muted:#9e9ea3;
  --accent:#c01f2d;
  --accent-soft: rgba(192,31,45,.16);
  --success:#2dc36a;
  --danger:#e45a66;
  --radius:16px;
  --shadow:0 8px 28px rgba(0,0,0,.35);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif}
body{min-height:100vh}
#app{display:grid;grid-template-columns:320px 1fr;min-height:100vh}
.sidebar{
  border-right:1px solid var(--line);
  background:linear-gradient(180deg,#111 0%,#0f0f10 100%);
  padding:22px;
  position:sticky; top:0; height:100vh; overflow:auto;
}
.brand{margin-bottom:20px}
.brand-logo{
  width:72px; height:72px; border-radius:14px; background:#2a2a2c;
  display:flex; align-items:center; justify-content:center; overflow:hidden;
  border:1px solid #3a3a3d;
}
.brand-logo img{width:100%;height:100%;object-fit:cover}
.brand-title{font-size:24px;letter-spacing:.08em;margin-top:12px}
.brand-subtitle{color:var(--muted);font-size:12px;letter-spacing:.18em;text-transform:uppercase}
.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow);
  margin-bottom:14px;
}
.card h3{margin:0 0 12px 0;font-size:16px}
label{font-size:12px;color:var(--muted);display:block;margin-bottom:6px}
input, textarea, button{
  font:inherit;
}
input, textarea{
  width:100%;
  background:var(--panel-2);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  margin-bottom:10px;
}
textarea{resize:vertical; min-height:72px}
.btn{
  background:var(--accent);
  color:white;
  border:none;
  border-radius:12px;
  padding:11px 14px;
  cursor:pointer;
  transition:.15s ease;
  width:100%;
}
.btn:hover{filter:brightness(1.06)}
.btn-outline{
  background:transparent;
  border:1px solid var(--accent);
  color:var(--text);
}
.btn-ghost{
  margin-top:8px;
  background:transparent;
  border:1px solid var(--line);
}
.hint{color:var(--muted);font-size:12px;margin:.4rem 0 0}
.style-note{
  margin-top:16px;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}
.accent{color:var(--accent)}
.content{padding:20px}
.topbar{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:14px; margin-bottom:18px;
}
.topbar h1{margin:0;font-weight:600;font-size:26px}
.topbar p{margin:6px 0 0;color:var(--muted)}
.pill{
  border:1px solid var(--line);
  background:var(--panel);
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.tabs{
  display:flex;
  gap:10px;
  margin-top:10px;
}

.tab{
  background:#141416;
  color:rgba(255,255,255,.75);
  border:1px solid var(--line);
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
}

.tab.active{
  color:#fff;
  border-color:var(--accent);
  box-shadow:0 0 0 1px rgba(229,57,53,.3);
}
.grid{display:grid;grid-template-columns:360px 1fr;gap:16px;align-items:start}
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.panel-header{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  padding:16px;
  border-bottom:1px solid var(--line);
}
.panel-header h2{margin:0;font-size:16px}
.panel-header input{margin:0;max-width:240px}
.panel .list{
  max-height:calc(100vh - 210px);
  overflow:auto;
}
.user-item{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  cursor:pointer;
  transition:.12s ease;
}
.user-item:hover{background:#1b1b1d}
.user-item.active{background:var(--accent-soft); border-left:3px solid var(--accent); padding-left:13px}
.user-item .phone{font-weight:600}
.user-item .meta{color:var(--muted);font-size:12px;margin-top:5px}
.panel-detail{min-height:700px}
.hidden{display:none !important}
.empty{color:var(--muted);padding:18px}
#detailContent{padding:16px}
.muted{color:var(--muted);font-size:13px}
.split{
  display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px;
}
.subpanel{
  background:var(--panel-2);
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
}
.subpanel h3{margin:0 0 10px 0;font-size:15px}
.subpanel h4{margin:0 0 8px 0;font-size:13px;color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:8px}
.item-card{
  background:#141416;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px;
}
.item-card .row{display:flex;justify-content:space-between;gap:10px}
.item-card .title{font-weight:600}
.item-card .meta{font-size:12px;color:var(--muted);margin-top:4px}
.badge{
  display:inline-flex; align-items:center; gap:6px;
  border-radius:999px; padding:4px 8px; font-size:11px;
  border:1px solid var(--line); background:#111;
}
.badge.active{color:#fff;background:#181818}
.badge.paid{color:#cff7de;border-color:#245f3d;background:#12311f}
.badge.overdue{color:#ffd7da;border-color:#7e2934;background:#34161b}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.mini-form{
  margin-top:10px;
  padding-top:10px;
  border-top:1px dashed #333;
}
.chat-list{
  height:260px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:6px;
  background:#101011;
  border:1px solid var(--line);
  border-radius:12px;
}
.chat-bubble{
  max-width:85%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#1a1a1c;
}
.chat-bubble.user{align-self:flex-end;background:#222327}
.chat-bubble.manager{align-self:flex-start;background:#161619}
.chat-bubble .meta{font-size:11px;color:var(--muted);margin-top:4px}
.chat-form{margin-top:8px}
.success-toast, .error-toast{
  position:fixed; right:18px; bottom:18px; z-index:9999;
  padding:10px 12px; border-radius:12px; border:1px solid var(--line);
  box-shadow:var(--shadow);
}
.success-toast{background:#13261c;color:#d9f9e6;border-color:#245f3d}
.error-toast{background:#2d1418;color:#ffd7da;border-color:#7e2934}
@media (max-width: 1200px){
  #app{grid-template-columns:1fr}
  .sidebar{position:static;height:auto;border-right:none;border-bottom:1px solid var(--line)}
  .grid{grid-template-columns:1fr}
  .panel .list{max-height:340px}
  .split{grid-template-columns:1fr}
}
