:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647084;
  --line: #e3e7ee;
  --green: #0f9f6e;
  --blue: #2563eb;
  --red: #dc2626;
  --yellow: #b7791f;
  --shadow: 0 18px 50px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #fff; padding: 22px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--green); font-weight: 800; }
.brand small { display: block; color: #a7b0c0; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; color: #cbd5e1; padding: 10px; border-radius: 8px; font-weight: 650; }
.nav-item span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.08); font-size: 12px; }
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 12px; text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0; font-size: 30px; line-height: 1.1; }
h2 { margin: 0 0 14px; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-pill { padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.metric strong { display: block; font-size: 28px; margin-top: 4px; }
.muted { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; background: var(--green); color: #fff; font-weight: 750; cursor: pointer; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form { margin: 0; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; }
label { font-size: 13px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 11px 8px; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #eef2f7; color: #475569; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 700; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
.conversation { display: grid; gap: 10px; }
.message { max-width: 760px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.message.inbound { border-left: 4px solid var(--green); }
.message.outbound { border-left: 4px solid var(--blue); margin-left: auto; }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .main { padding: 18px; }
  .topbar, .top-actions { align-items: flex-start; flex-direction: column; }
  .grid.cols-2, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

