:root {
  --bg: #eef8f6;
  --surface: #ffffff;
  --surface-soft: #f7fbfa;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dce8e5;
  --primary: #14b8a6;
  --primary-dark: #0f766e;
  --primary-soft: #ccfbf1;
  --dark: #08111d;
  --dark-2: #0f172a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #16a34a;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.13);
  --shadow-soft: 0 16px 45px rgba(15, 23, 42, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.24), transparent 36rem),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.1), transparent 32rem),
    linear-gradient(135deg, #f8fffe 0%, #eaf8f5 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.12fr) minmax(300px, 460px);
  gap: 28px;
  align-items: stretch;
  padding: 38px;
}

.brand-card,
.login-card,
.panel-card,
.stat-card,
.modal-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 232, 229, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-card {
  min-height: 560px;
  border-radius: 36px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(135deg, rgba(8, 17, 29, 0.95), rgba(15, 23, 42, 0.88)),
    radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.32), transparent 25rem);
  color: #ffffff;
}

.brand-card::before,
.brand-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.brand-card::before {
  width: 340px;
  height: 340px;
  right: -120px;
  top: -90px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.28), transparent 65%);
}

.brand-card::after {
  width: 260px;
  height: 260px;
  right: -90px;
  bottom: -100px;
  border: 1px solid rgba(45, 212, 191, 0.2);
  background: rgba(20, 184, 166, 0.08);
}

.brand-logo,
.hero-copy-wrap,
.brand-points {
  position: relative;
  z-index: 1;
}

.brand-logo {
  width: min(330px, 100%);
  min-height: 58px;
  display: flex;
  align-items: center;
}

.brand-logo img {
  width: 100%;
  max-width: 330px;
  height: auto;
  display: block;
}

.login-logo-row {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.logo-mark {
  display: flex;
  align-items: center;
  width: 220px;
  max-width: 100%;
  min-height: 46px;
  border-radius: 18px;
  padding: 11px 14px;
  background: #0f172a;
  overflow: hidden;
}

.logo-mark img {
  width: 100%;
  height: auto;
  display: block;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 900;
}

.brand-card .eyebrow {
  color: #5eead4;
}

h1,
h2,
p {
  margin-top: 0;
}

.brand-card h1 {
  max-width: 680px;
  margin-bottom: 18px;
  font-size: clamp(46px, 6.2vw, 82px);
  line-height: 0.92;
  letter-spacing: -0.085em;
}

.brand-copy {
  max-width: 600px;
  margin-bottom: 0;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1.75;
}

.brand-points {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-points span {
  border: 1px solid rgba(45, 212, 191, 0.24);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 10px 14px;
  color: #ecfeff;
  font-weight: 800;
  font-size: 14px;
}

.login-card {
  border-radius: 32px;
  padding: 36px;
  align-self: center;
}

.login-card h2,
.topbar h1,
.panel-header h2 {
  margin-bottom: 8px;
  letter-spacing: -0.045em;
}

.login-card h2 {
  font-size: 32px;
}

.muted {
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-top: 20px;
  color: #334155;
  font-size: 14px;
  font-weight: 900;
}

.login-card input,
.filters input,
.filters select,
.modal-card select {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.login-card input:focus,
.filters input:focus,
.filters select:focus,
.modal-card select:focus {
  border-color: rgba(20, 184, 166, 0.75);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.primary-btn,
.secondary-btn,
.logout-btn,
.danger-btn {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  font-weight: 900;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.action-link:hover,
.logout-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  width: 100%;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 14px 28px rgba(20, 184, 166, 0.22);
}

.secondary-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.danger-btn {
  background: #fee2e2;
  color: var(--danger);
}

.error-text {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 800;
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
  transition: grid-template-columns 0.22s ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 15px;
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.18), transparent 18rem),
    linear-gradient(180deg, #08111d, #0f172a 70%);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: padding 0.22s ease;
}

.sidebar-brand {
  /* display: flex; */
  flex-direction: column;
  gap: 14px;
  margin-bottom: 34px;
}

.sidebar-brand-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.sidebar-logo {
  width: 220px;
  max-width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  transition: width 0.22s ease, height 0.22s ease;
}

.sidebar-logo img {
  width: 220px;
  max-width: none;
  height: auto;
  display: block;
}

.sidebar-toggle-btn {
  flex: 0 0 auto;
  align-self: flex-end;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  color: #d1fae5;
  display: inline-grid;
  place-items: center;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.sidebar-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 234, 212, 0.38);
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle-btn span {
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.22s ease;
}

.sidebar-brand h2,
.sidebar-brand p {
  margin: 0;
}

.sidebar-brand h2 {
  font-size: 24px;
  letter-spacing: -0.04em;
}

.sidebar-brand-copy {
  margin-top: -22px;
}

.sidebar-brand p {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 800;
  transition: opacity 0.16s ease;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-item,
.logout-btn {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  color: #cbd5e1;
  background: transparent;
  font-weight: 900;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.nav-icon,
.logout-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #5eead4;
  font-size: 0;
  position: relative;
}

.nav-icon::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 9px 0 0 currentColor, 0 9px 0 currentColor, 9px 9px 0 currentColor;
}

.logout-icon::before {
  content: "";
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 2px;
}

.logout-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  width: 11px;
  height: 2px;
  background: currentColor;
  box-shadow: -3px -3px 0 -1px currentColor, -3px 3px 0 -1px currentColor;
}

.logout-icon {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-help {
  margin-top: auto;
  margin-bottom: 18px;
  padding: 16px;
  
 
  
}

.sidebar-help strong,
.sidebar-help span {
  display: block;
}

.sidebar-help strong {
  font-size: 14px;
  margin-bottom: 7px;
}

.sidebar-help span {
  color: #a7f3d0;
  font-size: 12px;
  line-height: 1.55;
}

.logout-btn {
  margin-top: 0;
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

@media (min-width: 981px) {
  .dashboard.sidebar-collapsed {
    grid-template-columns: 88px 1fr;
  }

  .dashboard.sidebar-collapsed .sidebar {
    padding: 26px 14px;
  }

  .dashboard.sidebar-collapsed .sidebar-brand {
    align-items: center;
  }

  .dashboard.sidebar-collapsed .sidebar-brand-top {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .dashboard.sidebar-collapsed .sidebar-logo {
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .dashboard.sidebar-collapsed .sidebar-logo img {
    display: none;
  }

  .dashboard.sidebar-collapsed .sidebar-logo::before {
    content: "";
    width: 34px;
    height: 34px;
    background: url("/assets/logo.png") left center / auto 34px no-repeat;
  }

  .dashboard.sidebar-collapsed .sidebar-brand-copy,
  .dashboard.sidebar-collapsed .sidebar-help {
    display: none;
  }

  .dashboard.sidebar-collapsed .sidebar-toggle-btn span {
    transform: rotate(135deg);
  }

  .dashboard.sidebar-collapsed .sidebar-toggle-btn {
    align-self: center;
    margin-top: 0;
  }

  .dashboard.sidebar-collapsed .nav-item,
  .dashboard.sidebar-collapsed .logout-btn {
    width: 60px;
    min-height: 54px;
    justify-self: center;
    justify-content: center;
    padding: 13px;
    gap: 0;
    font-size: 0;
  }

  .dashboard.sidebar-collapsed .logout-btn {
    margin-top: auto;
  }

  .dashboard.sidebar-collapsed .sidebar-text {
    display: none;
  }
}

.content {
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: clamp(34px, 4vw, 48px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 96px;
  right: -38px;
  bottom: -48px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
}

.total-card {
  background: linear-gradient(135deg, #0f172a, #115e59);
  color: #fff;
}

.total-card span {
  color: #a7f3d0 !important;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 36px;
  letter-spacing: -0.06em;
}

.panel-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.panel-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}

.panel-header > div:first-child {
  flex: 0 0 220px;
  min-width: 0;
}

.filters {
  display: grid;
  flex: 1 1 auto;
  width: min(100%, 920px);
  margin-left: auto;
  grid-template-columns: minmax(250px, 1.55fr) minmax(140px, 0.75fr) repeat(2, minmax(145px, 0.8fr)) minmax(96px, auto);
  gap: 14px;
  align-items: end;
}

.state-text {
  padding: 18px 24px 0;
  color: var(--muted);
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: #1f2937;
  font-size: 14px;
}

.lead-name {
  font-weight: 950;
}

.subtext {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 950;
  text-transform: capitalize;
}

.status-new {
  background: #ccfbf1;
  color: #0f766e;
}

.status-read {
  background: #fef3c7;
  color: #92400e;
}

.status-replied {
  background: #dcfce7;
  color: #166534;
}

.action-link {
  border: 0;
  background: #ecfdf5;
  color: var(--primary-dark);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 950;
  transition: transform 0.18s ease, background 0.18s ease;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  border-radius: 28px;
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: 28px;
  line-height: 1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.detail-grid div,
.message-box {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-soft);
}

.detail-grid span,
.message-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-grid strong {
  display: block;
  word-break: break-word;
}

.message-box p {
  margin: 0;
  color: #334155;
  line-height: 1.65;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.modal-actions .primary-btn {
  width: auto;
  margin: 0;
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .login-screen,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .login-screen {
    padding: 22px;
  }

  .brand-card {
    min-height: 420px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-brand {
    flex-direction: row;
    align-items: center;
  }

  .sidebar-logo,
  .sidebar-logo img {
    width: 180px;
  }

  .sidebar-help {
    margin-top: 18px;
  }

  .panel-header,
  .topbar {
    flex-direction: column;
  }

  .panel-header > div:first-child {
    flex: 0 1 auto;
  }

  .filters {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login-screen,
  .content {
    padding: 16px;
  }

  .brand-card,
  .login-card,
  .modal-card {
    padding: 22px;
    border-radius: 24px;
  }

  .brand-card h1 {
    font-size: 46px;
  }

  .brand-copy {
    font-size: 15px;
  }

  .stats-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 34px;
  }

  th,
  td {
    padding: 14px 16px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* Better lead inbox UI + pagination */
.filters {
  width: min(100%, 920px);
  grid-template-columns: minmax(250px, 1.55fr) minmax(140px, 0.75fr) repeat(2, minmax(145px, 0.8fr)) minmax(96px, auto);
  gap: 14px;
  align-items: end;
}

.filter-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.filter-field label {
  color: #334155;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-field:focus-within label {
  color: var(--primary-dark);
}

.filters input,
.filters select {
  height: 46px;
  margin-top: 0;
  border-radius: 14px;
  background-color: #fff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

.filters input::placeholder {
  color: #94a3b8;
}

.filters select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.filters input[type="date"] {
  color: #334155;
  min-width: 0;
}

.filters input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.62;
}

.filters input[type="date"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

.filter-clear-btn {
  align-self: end;
  height: 46px;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 20px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: #0f172a;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.filter-clear-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.42);
  background: #ecfdf5;
  box-shadow: 0 12px 26px rgba(20, 184, 166, 0.14);
}

@media (max-width: 1180px) and (min-width: 981px) {
  .panel-header {
    flex-direction: column;
  }

  .panel-header > div:first-child {
    flex: 0 1 auto;
  }

  .filters {
    width: 100%;
    margin-left: 0;
  }
}

.table-toolbar {
  min-height: 66px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(255, 255, 255, 0.92));
  border-bottom: 1px solid var(--border);
}

.table-toolbar strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  font-weight: 950;
}

.table-toolbar span {
  display: inline-flex;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.table-toolbar .state-text {
  padding: 0;
  min-width: 180px;
  text-align: right;
}

.table-wrap tbody tr {
  transition: background 0.16s ease, transform 0.16s ease;
}

.table-wrap tbody tr:hover {
  background: #f8fffd;
}

.lead-contact,
.subject-title {
  display: block;
  font-weight: 900;
}

.subject-cell {
  min-width: 260px;
}

.pagination-bar {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
}

.pagination-btn,
.page-number {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  font-weight: 950;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pagination-btn {
  padding: 0 14px;
}

.page-number {
  width: 40px;
  padding: 0;
}

.pagination-btn:hover:not(:disabled),
.page-number:hover:not(.active) {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.48);
  background: #ecfdf5;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 7px;
}

.page-number.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.22);
}

.pagination-dots {
  color: var(--muted);
  font-weight: 950;
  padding: 0 2px;
}

.page-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  margin-left: 4px;
}

@media (max-width: 980px) {
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-toolbar .state-text {
    text-align: left;
  }

  .pagination-bar {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .pagination-btn,
  .page-number {
    min-height: 38px;
  }

  .pagination-btn {
    flex: 1 1 120px;
  }

  .page-info {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .filters {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 1fr;
  }
}


/* Mobile-first admin fixes: appbar, drawer, cards table */
.mobile-appbar,
.sidebar-backdrop,
.sidebar-mobile-head {
  display: none;
}

@media (max-width: 980px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .dashboard {
    display: block;
    min-height: 100vh;
  }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 68px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .mobile-brand img {
    width: 172px;
    max-width: 100%;
    height: auto;
    display: block;
  }

  .mobile-menu-btn,
  .mobile-logout-btn,
  .sidebar-close-btn {
    border: 0;
    font-weight: 950;
  }

  .mobile-menu-btn {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #0f172a;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  }

  .mobile-menu-btn span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
  }

  .mobile-logout-btn {
    min-height: 40px;
    border-radius: 14px;
    padding: 0 12px;
    color: #b91c1c;
    background: #fee2e2;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    pointer-events: none;
    opacity: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(5px);
    transition: opacity 0.22s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    pointer-events: auto;
    opacity: 1;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(86vw, 330px);
    height: 100dvh;
    padding: 18px;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    overflow-y: auto;
    border-radius: 0 28px 28px 0;
    box-shadow: 18px 0 60px rgba(2, 6, 23, 0.34);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }

  .sidebar-close-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 28px;
    line-height: 1;
  }

  .sidebar-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
  }

  .sidebar-brand-top {
    width: 100%;
  }

  .sidebar-toggle-btn {
    display: none;
  }

  .sidebar-logo,
  .sidebar-logo img {
    width: 205px;
  }

  .content {
    padding: 18px;
  }

  .topbar {
    padding: 18px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-soft);
  }

  .topbar h1 {
    margin-bottom: 6px;
    font-size: clamp(30px, 8vw, 42px);
  }

  .secondary-btn,
  .filter-clear-btn {
    width: 100%;
  }

  .stats-grid {
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
    border-radius: 20px;
  }

  .stat-card strong {
    font-size: 30px;
  }

  .panel-card {
    border-radius: 24px;
  }

  .panel-header {
    padding: 18px;
  }

  .filters {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-left: 0;
  }

  .filters input,
  .filters select,
  .filter-clear-btn {
    height: 48px;
    margin-top: 0;
  }

  .filter-clear-btn {
    align-self: stretch;
  }

  .table-toolbar {
    min-height: auto;
    padding: 14px 18px;
  }

  .pagination-bar {
    padding: 16px 18px 18px;
  }
}

@media (max-width: 720px) {
  body {
    background: linear-gradient(180deg, #f8fffe 0%, #eaf8f5 100%);
  }

  .login-screen {
    min-height: 100dvh;
    padding: 14px;
    gap: 14px;
  }

  .brand-card {
    min-height: auto;
    padding: 22px;
    border-radius: 26px;
  }

  .brand-logo {
    width: 230px;
    min-height: 44px;
  }

  .brand-card h1 {
    margin-top: 18px;
    margin-bottom: 12px;
    font-size: clamp(38px, 12vw, 52px);
    letter-spacing: -0.07em;
  }

  .brand-copy {
    font-size: 14px;
    line-height: 1.62;
  }

  .brand-points {
    margin-top: 18px;
    gap: 8px;
  }

  .brand-points span {
    padding: 8px 10px;
    font-size: 12px;
  }

  .login-card {
    padding: 22px;
    border-radius: 24px;
  }

  .login-logo-row {
    margin-bottom: 18px;
  }

  .logo-mark {
    width: 190px;
    border-radius: 16px;
  }

  .login-card h2 {
    font-size: 28px;
  }
}

@media (max-width: 620px) {
  .mobile-appbar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 62px;
    padding: 9px 12px;
  }

  .mobile-menu-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .mobile-brand img {
    width: 148px;
  }

  .mobile-logout-btn {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .content {
    padding: 14px;
  }

  .topbar,
  .panel-card,
  .stat-card {
    border-radius: 20px;
  }

  .topbar,
  .panel-header {
    padding: 16px;
  }

  .topbar .muted,
  .panel-header .muted {
    font-size: 13px;
    line-height: 1.55;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 112px;
    padding: 16px;
  }

  .stat-card span {
    font-size: 12px;
  }

  .stat-card strong {
    font-size: 28px;
  }

  .table-wrap {
    overflow: visible;
    padding: 0 14px 4px;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr {
    display: block;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody {
    display: grid;
    gap: 12px;
    padding: 14px 0 4px;
  }

  .table-wrap tr {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .table-wrap tbody tr:hover {
    background: #fff;
    transform: none;
  }

  .table-wrap td {
    position: relative;
    min-height: 58px;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    font-size: 13px;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .table-wrap td:nth-child(1)::before { content: "Name"; }
  .table-wrap td:nth-child(2)::before { content: "Contact"; }
  .table-wrap td:nth-child(3)::before { content: "Subject"; }
  .table-wrap td:nth-child(4)::before { content: "Status"; }
  .table-wrap td:nth-child(5)::before { content: "Date"; }
  .table-wrap td:nth-child(6)::before { content: "Action"; }

  .subject-cell {
    min-width: 0;
  }

  .subtext {
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .lead-name,
  .lead-contact,
  .subject-title {
    overflow-wrap: anywhere;
  }

  .action-link {
    width: 100%;
    min-height: 42px;
  }

  .pagination-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .page-numbers {
    grid-column: 1 / -1;
    justify-content: center;
    order: -1;
    flex-wrap: wrap;
  }

  .page-info {
    grid-column: 1 / -1;
    margin: 0;
    text-align: center;
  }

  .pagination-btn,
  .page-number {
    min-height: 40px;
    border-radius: 13px;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 28px 28px 0 0;
    padding: 22px 18px 18px;
  }

  .modal-close {
    top: 14px;
    right: 14px;
  }
}

@media (max-width: 420px) {
  .mobile-brand img {
    width: 128px;
  }

  .mobile-logout-btn {
    padding: 0 8px;
  }

  .content,
  .login-screen {
    padding-left: 10px;
    padding-right: 10px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 25px;
  }

  .table-wrap td {
    grid-template-columns: 78px minmax(0, 1fr);
    padding: 12px;
  }
}
