:root {
  --bg: #0f1220; --panel: #1a1f36; --panel2: #232a4a; --line: #2f3860;
  --text: #e7eaf6; --muted: #9aa3c7; --brand: #6c8cff; --brand2: #8a6cff;
  --ok: #33c98f; --warn: #ffb020; --danger: #ff5c7a;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2340 0, transparent 60%), var(--bg);
  color: var(--text);
}
a { color: var(--brand); }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: rgba(20,24,44,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.logo { font-weight: 800; letter-spacing: .3px; font-size: 18px; }
.logo span { background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
.nav { margin-left: auto; display: flex; gap: 8px; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; }
.nav a.active, .nav a:hover { background: var(--panel2); color: var(--text); }

.wrap { max-width: 1100px; margin: 22px auto; padding: 0 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { cursor: pointer; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); }
.tab.active { color: var(--text); background: var(--panel2); border-color: var(--brand); }
.hidden { display: none; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-family: inherit;
}
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
button {
  cursor: pointer; border: none; border-radius: 9px; padding: 9px 14px; font-weight: 600; font-size: 14px;
  background: linear-gradient(90deg, var(--brand), var(--brand2)); color: white;
}
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.danger { background: var(--danger); }
button.sm { padding: 5px 10px; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 120px; }

.stat { text-align: center; }
.stat .n { font-size: 28px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.badge.open { background: #1e3a5f; color: #8fc0ff; }
.badge.handoff { background: #5a3a1e; color: #ffcf8f; }
.badge.closed { background: #333; color: #aaa; }
/* order status badges */
.badge.new { background: #1e3a5f; color: #8fc0ff; }
.badge.packed { background: #4a3a1e; color: #ffd98f; }
.badge.shipped { background: #1e4a3a; color: #8fffca; }
.badge.done { background: #333; color: #aaa; }
.muted { color: var(--muted); }

/* Toast */
#toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--ok); color: var(--text); padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); animation: slidein .2s ease; max-width: 320px; }
.toast.err { border-left-color: var(--danger); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
select.status-sel { width: auto; padding: 4px 8px; font-size: 12px; }

/* Chat simulator */
.chat-shell { max-width: 460px; margin: 30px auto; }
.chat-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand2)); }
.chat-log { height: 460px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.msg.customer { align-self: flex-end; background: var(--brand); color: white; border-bottom-right-radius: 4px; }
.msg.agent { align-self: flex-start; background: var(--panel2); border-bottom-left-radius: 4px; }
.msg.meta { align-self: center; font-size: 11px; color: var(--muted); background: transparent; padding: 2px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }
