:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e6ebf3;
  --shadow:0 8px 24px rgba(15, 23, 42, .06);
  --radius:14px;
  --brand:#0b1220;
  --danger:#b91c1c;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:var(--bg);
}

.container{
  width:min(1280px, calc(100% - 48px));
  margin:0 auto;
}

.page{
  padding:28px 0 64px;
}

.topbar{
  background:var(--card);
  border-bottom:1px solid var(--border);
}

.topbar-inner{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
}

.brand{
  font-weight:800;
  letter-spacing:.2px;
  color:var(--brand);
}

.nav{
  display:flex;
  align-items:center;
  gap:18px;
  flex-wrap:wrap;
}

.nav a{
  text-decoration:none;
  color:var(--muted);
  font-weight:600;
  font-size:14px;
  padding:8px 10px;
  border-radius:10px;
}

.nav a.active{
  background:#eef2ff;
  color:#1e293b;
}

.nav a.danger{
  color:var(--danger);
}

h1{
  margin:6px 0 6px;
  font-size:34px;
  letter-spacing:-.6px;
}

.muted{
  margin:0 0 18px;
  color:var(--muted);
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
}

.card + .card{ margin-top:14px; }

.grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:16px;
  align-items:start;
}

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

.ops-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
}

.ops-table thead th{
  text-align:left;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}

.ops-table tbody td{
  padding:14px 14px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  font-size:14px;
}

.ops-table tbody tr:last-child td{
  border-bottom:none;
}

.ops-table a{
  color:#2563eb;
  font-weight:700;
  text-decoration:none;
}

.ops-table a:hover{
  text-decoration:underline;
}

.badge{
  display:inline-flex;
  align-items:center;
  height:22px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
  background:#f8fafc;
  color:#0f172a;
}

.badge.status-open{ background:#ecfeff; border-color:#a5f3fc; color:#155e75; }
.badge.status-closed{ background:#f1f5f9; border-color:#e2e8f0; color:#334155; }

.badge.plan-lora-lite{ background:#f8fafc; }
.badge.plan-waylora-basics{ background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.badge.plan-waylora-plus{ background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.badge.plan-waylora-premier{ background:#f5f3ff; border-color:#ddd6fe; color:#5b21b6; }

.kv{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:10px 14px;
  margin-top:10px;
}

.kv .k{
  color:var(--muted);
  font-weight:800;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.35px;
}

.kv .v{
  font-weight:650;
  font-size:14px;
}

.form-row{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:12px;
}

label{
  font-size:12px;
  font-weight:900;
  color:var(--muted);
  letter-spacing:.25px;
  text-transform:uppercase;
}

input, select, textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 12px;
  font-size:14px;
  background:#fff;
  outline:none;
}

textarea{
  min-height:140px;
  resize:vertical;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  padding:10px 14px;
  border:1px solid var(--border);
  background:#0b1220;
  color:#fff;
  font-weight:900;
  font-size:14px;
  cursor:pointer;
}

.btn:active{ transform: translateY(1px); }

.btn.secondary{
  background:#fff;
  color:#0b1220;
}

.actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:10px;
}

.empty{
  padding:14px;
  border:1px dashed var(--border);
  border-radius:12px;
  color:var(--muted);
  background:#fff;
}

.thread-msg{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:#fff;
}

.thread-msg + .thread-msg{ margin-top:10px; }

.thread-meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.thread-body{
  font-size:14px;
  line-height:1.5;
  white-space:pre-wrap;
}
