:root {
  --bg: #eef2f6;
  --bg-deep: #0b1f2a;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --line: #d7dee7;
  --text: #102033;
  --muted: #667689;
  --accent: #0c9f6e;
  --accent-2: #1177dd;
  --accent-3: #d59a1a;
  --danger: #d64545;
  --warn: #c98512;
  --success: #0c9f6e;
  --info: #1177dd;
  --shadow: 0 10px 30px rgba(16, 32, 51, 0.08);
  --radius: 14px;
  --sidebar: 280px;
  --font: "Be Vietnam Pro", sans-serif;
  --display: "Sora", "Be Vietnam Pro", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(12, 159, 110, 0.12), transparent 55%),
    radial-gradient(900px 400px at 90% 0%, rgba(17, 119, 221, 0.10), transparent 50%),
    linear-gradient(180deg, #f4f7fb 0%, var(--bg) 40%, #e8eef5 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #0d2431 0%, #102b3a 55%, #0b1f2a 100%);
  color: #e8eef4;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #12b886, #1177dd);
  font-family: var(--display); font-weight: 700; font-size: 20px;
  box-shadow: 0 8px 20px rgba(18, 184, 134, 0.35);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-sub { color: #90a4b5; font-size: 12px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; flex: 1; }
.nav-label {
  margin: 14px 10px 6px; color: #7f93a5; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; color: #c7d4df;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; transform: translateX(2px); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(18,184,134,0.22), rgba(17,119,221,0.12));
  color: #fff; box-shadow: inset 3px 0 0 #12b886;
}
.nav-ico { width: 20px; opacity: .9; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 8px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-role { color: #91a5b6; font-size: 12px; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 28px 8px; position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(10px); background: rgba(238,242,246,0.75);
}
.page-title {
  margin: 0; font-family: var(--display); font-size: 28px; letter-spacing: -0.03em;
  animation: rise .45s ease both;
}
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; gap: 8px; }

.content { padding: 12px 28px 40px; animation: fade .4s ease both; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(16,32,51,.12); }
.stat::after {
  content: ""; position: absolute; inset: auto -20% -40% auto; width: 120px; height: 120px;
  border-radius: 50%; background: radial-gradient(circle, rgba(12,159,110,.16), transparent 70%);
}
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-value { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.stat-foot { margin-top: 10px; font-size: 12px; color: var(--muted); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, var(--panel-soft));
}
.panel-head h2 { margin: 0; font-size: 16px; font-family: var(--display); }
.panel-body { padding: 16px 18px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8edf3; text-align: left; font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #fafcfd; }
tr:hover td { background: #f7fbf9; }

.btn, .ghost-btn, .icon-btn {
  border: 0; cursor: pointer; border-radius: 10px; padding: 10px 14px;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn {
  background: linear-gradient(135deg, #12b886, #0c9f6e); color: #fff; font-weight: 600;
  box-shadow: 0 8px 18px rgba(12,159,110,.25);
}
.btn:hover { transform: translateY(-1px); }
.btn-secondary { background: linear-gradient(135deg, #2b8cff, #1177dd); box-shadow: 0 8px 18px rgba(17,119,221,.25); }
.btn-danger { background: linear-gradient(135deg, #e85d5d, #d64545); box-shadow: 0 8px 18px rgba(214,69,69,.25); }
.ghost-btn { background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.ghost-btn:hover { background: #f4f8fc; }
.icon-btn { background: #fff; border: 1px solid var(--line); width: 40px; height: 40px; padding: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  background: #fff; color: var(--text); outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #12b886; box-shadow: 0 0 0 3px rgba(18,184,134,.15);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-success { background: #e6f8f1; color: #0a7a55; }
.badge-warn { background: #fff5df; color: #9a6a0b; }
.badge-danger { background: #fdecec; color: #b42323; }
.badge-info { background: #e8f2ff; color: #0f5fad; }
.badge-muted { background: #eef1f5; color: #5d6b7a; }

.alert {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid;
  animation: slide .35s ease both;
}
.alert-success { background: #e9f9f2; border-color: #b7ebd4; color: #0a6b4a; }
.alert-error { background: #fdecec; border-color: #f3c1c1; color: #9f2424; }
.alert-info { background: #eaf3ff; border-color: #c5dbf8; color: #0f5fad; }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    linear-gradient(135deg, rgba(11,31,42,.92), rgba(16,43,58,.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
  width: min(440px, 100%); background: rgba(255,255,255,0.96);
  border-radius: 20px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,.28);
  animation: rise .5s ease both;
}
.login-card h1 {
  margin: 0 0 6px; font-family: var(--display); font-size: 30px; letter-spacing: -0.03em;
}
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-hints { margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.6; background: #f4f8f6; border-radius: 12px; padding: 12px; }

.chat-layout { display: grid; grid-template-columns: 280px 1fr; min-height: 560px; }
.chat-rooms { border-right: 1px solid var(--line); background: #f8fafc; }
.chat-room {
  display: block; padding: 14px 16px; border-bottom: 1px solid #e8edf3;
  transition: background .2s ease;
}
.chat-room:hover, .chat-room.is-active { background: #eaf7f2; }
.chat-room strong { display: block; margin-bottom: 4px; }
.chat-room span { color: var(--muted); font-size: 12px; }
.chat-thread { display: flex; flex-direction: column; }
.chat-messages { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow: auto; background:
  linear-gradient(180deg, #fbfdff, #f4f8fb); }
.msg {
  max-width: 72%; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line);
  animation: rise .3s ease both;
}
.msg.mine { align-self: flex-end; background: #e8f8f2; border-color: #c6ebd9; }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chat-compose { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--line); }

.notif-item {
  display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #eef2f6;
}
.notif-item.unread { background: linear-gradient(90deg, rgba(18,184,134,.06), transparent); padding-left: 10px; border-radius: 10px; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--accent); flex: 0 0 auto; }
.notif-item.read .notif-dot { background: #c5ced8; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.split { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; }
.mobile-only { display: none; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split, .chat-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-105%);
    width: min(86vw, 300px); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; }
  .mobile-only { display: inline-grid; place-items: center; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .form-grid, .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .page-title { font-size: 22px; }
}
