@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --text: #202334;
  --muted: #85899b;
  --line: #eaebf1;
  --primary: #6558e8;
  --primary-dark: #5145cf;
  --green: #20a779;
  --red: #d64b58;
  --shadow: 0 12px 40px rgba(35, 39, 70, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.65; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, #e8e5ff 0, transparent 30%),
    radial-gradient(circle at 85% 85%, #e0f3ef 0, transparent 30%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  padding: 42px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(38, 42, 75, .1);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: linear-gradient(135deg, #8276ff, #5547d6);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 8px 20px #6558e844;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 15px;
}

.eyebrow {
  margin: 24px 0 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.login-card h1 {
  margin: 0;
  font: 800 30px 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -1.2px;
}

.login-card > .muted { font-size: 13px; margin: 12px 0 30px; }

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 9px;
}

.password-wrap { position: relative; }

.password-wrap input {
  width: 100%;
  padding: 15px 65px 15px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fafaff;
}

.password-wrap input:focus,
.search-box:focus-within,
.date-filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #6558e81a;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.primary-btn {
  border: 0;
  color: white;
  background: var(--primary);
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 700;
  transition: .2s;
}

.primary-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.primary-btn:disabled { opacity: .6; cursor: wait; }
.full-btn { width: 100%; margin-top: 18px; }

.status-message { min-height: 18px; font-size: 12px; color: var(--red); }
.login-foot { text-align: center; font-size: 11px; color: #a1a4b2; margin: 24px 0 0; }

.dashboard { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  background: white;
  border-right: 1px solid var(--line);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  padding: 0 8px 36px;
}
.brand strong { display: block; font: 800 15px 'Plus Jakarta Sans'; }
.brand small { display: block; margin-top: 4px; font-size: 9px; letter-spacing: 1.4px; color: var(--muted); }

.side-label {
  padding: 0 12px;
  margin-bottom: 12px;
  color: #a2a5b3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.nav-link {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 13px 14px;
  margin: 3px 0;
  border-radius: 11px;
  text-decoration: none;
  color: #777b8c;
  font-size: 12px;
  font-weight: 600;
}
.nav-link.active, .nav-link:hover { color: var(--primary); background: #f0efff; }
.nav-icon { font-size: 17px; }

.sidebar-bottom { margin-top: auto; }
.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 5px;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: #eeedff;
  font-weight: 800;
}
.admin-profile strong { display: block; font-size: 11px; }
.admin-profile small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }

.logout-btn {
  width: 100%;
  padding: 11px;
  border: 1px solid #f1e1e3;
  border-radius: 10px;
  color: var(--red);
  background: #fffafb;
  font-size: 12px;
  font-weight: 700;
}
.logout-btn:hover { background: #fff0f1; }

.main-area { margin-left: 250px; min-height: 100vh; }
.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  background: rgba(255,255,255,.8);
  border-bottom: 1px solid var(--line);
}
.topbar .eyebrow { margin: 0 0 5px; font-size: 9px; }
.topbar h1 { margin: 0; font: 800 21px 'Plus Jakarta Sans'; letter-spacing: -.6px; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #20b982; box-shadow: 0 0 0 4px #20b9821b; }

.content { max-width: 1400px; margin: auto; padding: 34px 42px; }
.welcome-row, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.welcome-row h2, .panel-heading h2 { margin: 0; font: 800 17px 'Plus Jakarta Sans'; }
.welcome-row p, .panel-heading p { margin: 7px 0 0; font-size: 11px; }

.secondary-btn, .export-btn, .clear-btn {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: #5d6072;
  font-size: 11px;
  font-weight: 700;
}
.secondary-btn:hover, .clear-btn:hover { border-color: #c9c5ff; color: var(--primary); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin: 25px 0; }
.stat-card {
  padding: 21px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat-top { display: flex; justify-content: space-between; align-items: center; color: #777b8b; font-size: 11px; font-weight: 600; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; font-size: 16px; }
.purple { color: #6558e8; background: #f0efff; }
.blue { color: #3689dc; background: #eaf4ff; }
.green { color: #1da779; background: #e8f8f1; }
.stat-card > strong { display: block; margin: 16px 0 5px; font: 800 27px 'Plus Jakarta Sans'; }
.stat-card > small { color: #a0a3b0; font-size: 10px; }

.messages-panel {
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.export-btn { color: var(--green); border-color: #d7f0e6; background: #f4fcf8; }
.export-btn:hover { background: #e8f8f1; }

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 18px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1 1 210px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #999;
}
.search-box input { width: 100%; padding: 11px 0; border: 0; outline: none; font-size: 11px; background: transparent; }
.date-filter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.date-filter input { width: 130px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: #646879; font-size: 10px; }
.clear-btn { background: transparent; }

.message-list { display: grid; gap: 11px; }
.message-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.message-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.message-number { color: var(--primary); font-size: 10px; font-weight: 800; }
.message-date { color: #a0a3b0; font-size: 10px; }
.message-body { margin: 0; color: #45495b; font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-id { margin-top: 12px; color: #b1b3bd; font-size: 9px; overflow-wrap: anywhere; }

.empty-state, .error-state { padding: 35px 15px; text-align: center; color: #9699a8; font-size: 12px; }
.error-state { color: var(--red); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 20px; margin-top: 15px; border-top: 1px solid var(--line); color: #999cab; font-size: 10px; }
.page-controls { display: flex; align-items: center; gap: 12px; }
.page-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #686b7b; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.dashboard-footer { padding: 25px 0 5px; text-align: center; color: #a5a8b5; font-size: 10px; }
.dashboard-footer span { padding: 0 5px; }

@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .main-area { margin-left: 205px; }
  .content { padding: 28px 22px; }
  .topbar { padding: 0 22px; }
  .stats-grid { gap: 10px; }
}

@media (max-width: 650px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 16px; display: block; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .side-label, .sidebar-bottom, .nav-link { display: none; }
  .main-area { margin-left: 0; }
  .topbar { height: 75px; padding: 0 18px; }
  .content { padding: 22px 14px; }
  .welcome-row { align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .messages-panel { padding: 16px 12px; }
  .panel-heading { align-items: flex-start; }
  .panel-heading h2 { font-size: 14px; }
  .filters { align-items: stretch; }
  .search-box { flex-basis: 100%; }
  .date-filter { flex: 1; justify-content: space-between; }
  .date-filter input { width: 65%; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .login-card { padding: 30px 23px; }
}
