:root {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-100: #dbeafe;
  --accent: #f59e0b;
  --success: #16a34a;
  --danger: #dc2626;
  --border: #e2e8f0;
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.18);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 88px;
  --header-height: 72px;
  --font-body: "Outfit", sans-serif;
  --font-display: "Outfit", sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 0.95rem;
  --font-size-xs: 0.85rem;
  --font-size-lg: 1.05rem;
  --font-size-xl: 1.25rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body.app-body::before,
body.marketing-body::before {
  content: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--primary);
}

.is-hidden,
.tw-hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.brand--sidebar {
  font-size: 1.5rem;
}

.brand--header {
  font-size: 1.2rem;
  display: none;
}

.app-header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.9rem;
  height: 42px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
}

.nav-link:hover {
  background: var(--bg-surface-alt);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.nav-link.active .nav-icon {
  filter: brightness(0) invert(1);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.sidebar-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 0;
  border-top: 0;
}

.user-profile {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.user-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-value {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

.sidebar-logout {
  display: flex;
  align-items: center;
}

.logout-btn {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.12);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  transform: scale(1.04);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-section-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-caption {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.link-pill {
  font-size: 0.75rem;
  color: var(--primary-600);
  background: var(--primary-100);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-item {
  list-style: none;
}

.group-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.group-link:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: var(--shadow-sm);
}

.group-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.group-name {
  font-weight: 600;
  color: var(--text-main);
}

.group-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.group-chevron {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.sidebar-label {
  transition: opacity 0.2s ease;
}

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed);
  padding: 16px 12px;
  gap: 12px;
}

body.sidebar-collapsed .app-main {
  padding-left: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section-header,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .link-pill,
body.sidebar-collapsed .brand--sidebar {
  display: none;
}

body.sidebar-collapsed .brand--header {
  display: inline-flex;
}

body.sidebar-collapsed .sidebar-footer {
  align-items: center;
  padding-top: 8px;
}

body.sidebar-collapsed .user-profile {
  padding: 8px;
  justify-content: center;
}

body.sidebar-collapsed .user-info {
  display: none;
}

body.sidebar-collapsed .logout-btn {
  width: 36px;
  height: 36px;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0;
  gap: 0;
  width: 42px;
  height: 42px;
  margin: 0 auto;
}

body.sidebar-collapsed .group-link {
  justify-content: center;
  padding: 0.6rem;
}

body.sidebar-collapsed .group-chevron {
  display: none;
}

body.sidebar-collapsed .group-section .page-subtitle {
  display: none;
}


.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: var(--sidebar-width);
  transition: padding-left 0.3s ease;
}

.app-header {
  height: var(--header-height);
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle {
  display: none;
}

.icon-button:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

.header-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.header-search input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface-alt);
  font-size: 0.95rem;
}

.header-search .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.6;
}


.app-content {
  padding: 1rem;
  flex: 1;
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.app-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.alert-stack {
  position: fixed;
  right: 24px;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 50;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-width: 260px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.alert.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.alert-success {
  border-left: 4px solid var(--success);
}

.alert-error {
  border-left: 4px solid var(--danger);
}

.alert-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.alert-text {
  font-size: 0.95rem;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-close {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2vw + 1.1rem, 1.9rem);
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Send SMS page-specific scaling */
.send-sms-page {
  font-size: var(--font-size-sm);
}

.send-sms-page .page-title {
  font-size: clamp(1.35rem, 1vw + 1rem, 1.6rem);
}

.send-sms-page .page-subtitle {
  font-size: var(--font-size-xs);
}

.send-sms-page label {
  font-size: var(--font-size-xs);
}

.send-sms-page input,
.send-sms-page select,
.send-sms-page textarea {
  font-size: var(--font-size-sm);
}

.send-sms-page .field-help {
  font-size: var(--font-size-xs);
}

.send-sms-page .meta-row {
  font-size: var(--font-size-xs);
  gap: 6px;
}

.send-sms-page .meta-row .credit {
  font-size: var(--font-size-sm);
}

.send-sms-page .choice-pill {
  font-size: var(--font-size-xs);
}

.send-sms-page .file-input span {
  font-size: var(--font-size-xs);
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-main);
}

h1 {
  font-size: clamp(1.6rem, 1.3vw + 1.1rem, 2.1rem);
}

h2 {
  font-size: clamp(1.35rem, 1vw + 1rem, 1.7rem);
}

h3 {
  font-size: clamp(1.15rem, 0.7vw + 0.95rem, 1.35rem);
}

.page-subtitle a {
  color: var(--primary);
  font-weight: 600;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--font-size-sm);
  line-height: 1.2;
  height: 42px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn .nav-icon {
  width: 16px;
  height: 16px;
}

.app-sidebar .btn {
  height: 42px;
  padding: 0 0.9rem;
  justify-content: flex-start;
  width: 100%;
}

.app-sidebar .btn .nav-icon {
  width: 20px;
  height: 20px;
}

body.sidebar-collapsed .app-sidebar .btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-600);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.btn-tonal {
  background: var(--primary-100);
  color: var(--primary-600);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.btn-success {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: var(--font-size-xs);
  height: 32px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-flush {
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.card-padding {
  padding: 1.5rem;
}

.card-fill {
  width: 100%;
  /* min-height: calc(100vh - var(--header-height) - 120px); */
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.grid-span-full {
  grid-column: 1 / -1;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.item-title {
  font-weight: 600;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.card-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field-help {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-section {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--bg-surface-alt);
}

.form-section.section-active {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.06);
}

.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.choice-pill.is-active {
  background: var(--primary-100);
  color: var(--primary-600);
  border-color: rgba(37, 99, 235, 0.4);
}

.choice-pill input {
  width: auto;
}

.file-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: #fff;
  cursor: pointer;
}

.file-input span {
  color: var(--text-muted);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.message-header {
  display: grid;
  grid-template-columns: 1.2fr 3fr 1fr;
  gap: 16px;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border);
}

.message-header-cell:last-child {
  text-align: right;
}

.message-row {
  display: grid;
  grid-template-columns: 1.2fr 3fr 1fr;
  gap: 16px;
  padding: 0.85rem 1rem;
  border-radius: 0;
  background: var(--bg-surface);
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.message-row:hover {
  background: var(--bg-surface-alt);
}

.message-row:last-child {
  border-bottom: none;
}

.message-target {
  font-weight: 600;
}

.message-body {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.message-preview {
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary-100);
  color: var(--primary-600);
  width: fit-content;
}

.status-chip.status-failed,
.status-chip.status-disabled,
.status-chip.status-inactive {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.status-chip.status-sent,
.status-chip.status-completed,
.status-chip.status-active {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: var(--bg-surface-alt);
  color: var(--text-muted);
}

.badge-success {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-xs);
  background: var(--bg-surface-alt);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-muted);
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-nowrap {
  white-space: nowrap;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.empty-state {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.empty-text {
  margin-bottom: 1.25rem;
}

.table-container,
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
}

th {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
}

/* Search + filter (from mail-test) */
.filters-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filters-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-width: 280px;
}

.search-icon {
  display: inline-flex;
  color: var(--text-muted);
}

.search-input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text-main);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-clear-btn:hover {
  background: var(--bg-surface-alt);
  color: var(--primary);
}

.filters-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filters-active-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-toggle.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.filter-shell {
  position: relative;
}

.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 900;
  backdrop-filter: blur(2px);
}

.filter-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1000;
}

.filter-modal-card {
  width: min(680px, 92%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(16px);
  transition: transform 0.2s ease, opacity 0.2s ease;
  max-height: 90vh;
  overflow: hidden;
}

.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.filter-modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-main);
}

.filter-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label-sm,
.date-label {
  display: block;
  margin-bottom: 0;
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-select,
.date-input {
  width: 100%;
}

.filter-close {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.filter-close:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.filter-shell.is-open .filter-overlay {
  opacity: 1;
  visibility: visible;
}

.filter-shell.is-open .filter-modal {
  pointer-events: auto;
}

.filter-shell.is-open .filter-modal-card {
  opacity: 1;
  transform: translateY(0);
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
}

th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

th.sortable::after {
  content: '⇅';
  font-size: 0.75rem;
  margin-left: 6px;
  color: var(--text-muted);
}

th.sorted-asc::after {
  content: '↑';
  color: var(--primary);
}

th.sorted-desc::after {
  content: '↓';
  color: var(--primary);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination a {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.pagination a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.filter-item {
  min-width: 180px;
  flex: 1;
}

.filter-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-item input,
.filter-item select {
  width: 100%;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.filter-actions .btn {
  min-width: 120px;
}

.hero {
  padding: 80px 0 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px;
  align-items: center;
}

.hero-media {
  display: flex;
  justify-content: center;
}

.image {
  max-width: 240px;
  animation: float 6s ease-in-out infinite;
}

.image + .image {
  animation-delay: 0.8s;
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-copy p {
  color: var(--text-muted);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.feature-card img {
  border-radius: 12px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.pricing {
  padding: 40px 0 80px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.plan-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.plan-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.plan-card.featured {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-6px);
}

.pricing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.toggle-pill {
  position: relative;
  width: 52px;
  height: 26px;
  background: var(--primary-100);
  border-radius: 999px;
}

.toggle-circle {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  top: 3px;
  left: 4px;
  transition: transform 0.2s ease;
}

.marketing-header {
  padding: 18px 0;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.marketing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.marketing-footer {
  padding: 30px 0 40px;
  text-align: center;
  color: var(--text-muted);
}

.auth-shell {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0 60px;
}

.auth-card {
  width: min(420px, 92%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.reveal {
  animation: fadeUp 0.6s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .app-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    height: auto;
    min-height: 0;
    padding: 16px 24px 0 68px;
    border: 0;
    background: transparent;
    position: relative;
    margin: 0.5rem 0 1.5rem;
  }

  .sidebar-toggle {
    display: inline-flex;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 30;
    box-shadow: var(--shadow-sm);
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
    height: 100dvh;
    overflow-y: hidden;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    transition: transform 0.3s ease, height 0.2s ease, padding-bottom 0.2s ease;
  }

  .sidebar-nav {
    overflow-y: hidden;
    padding-right: 0;
  }

  .sidebar-footer {
    transition: transform 0.2s ease;
  }

  .app-main {
    padding-left: 0;
  }

  .page-header .page-title {
    display: none;
  }

  .page-header {
    /* padding-left: 36px; */
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .header-search {
    display: none;
  }

  .brand--header {
    display: none;
  }
}

/* Billing page styles (ported from mail-test) */
.billing-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.billing-page .page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  /* margin-bottom: 1.5rem; */
  flex-wrap: wrap;
}

.billing-page .page-subtitle {
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.billing-page .stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  margin-top: 0.75rem;
}

.billing-page .stat-pill-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.billing-page .stat-pill-value {
  color: var(--primary);
  font-weight: 700;
}

.billing-page .text-sm {
  font-size: 0.95rem;
}

.billing-page .text-muted {
  color: var(--text-muted);
}

.billing-page .mb-0 {
  margin-bottom: 0 !important;
}

.billing-page .mb-0-5 {
  margin-bottom: 0.5rem !important;
}

.billing-page .mb-1 {
  margin-bottom: 1rem !important;
}

.billing-page .flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.billing-page .flex-wrap {
  flex-wrap: wrap;
}

.billing-page .plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.billing-page .plan-card {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 1.1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.2s ease;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  min-height: 180px;
}

.billing-page .plan-card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.billing-page .plan-card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}

.billing-page .plan-card-desc {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.billing-page .plan-card-price {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--primary);
}

.billing-page .plan-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.billing-page .plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.billing-page .plan-card-actions {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
}

.billing-page .plan-card-actions .btn {
  width: 100%;
}

@media (max-width: 640px) {
  .billing-page .page-header {
    margin-bottom: .15rem;
  }

  .billing-page .plan-card {
    padding: 1rem;
  }

  .billing-page .plan-card-actions {
    flex-direction: column;
  }

  .billing-page .plan-card-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .filters-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-group {
    width: 100%;
  }

  .filters-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .filter-modal {
    align-items: flex-end;
    padding: 0;
  }

  .filter-modal-card {
    width: 100%;
    border-radius: 1rem 1rem 0 0;
    max-height: 80vh;
  }

  .filter-modal-body {
    padding: 1rem;
    max-height: calc(80vh - 120px);
  }
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 15px;
    --font-size-sm: 0.92rem;
    --font-size-xs: 0.82rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.15rem;
  }

  .app-header {
    padding: 16px 20px 0 68px;
  }

  .page-header {
    /* padding-left: 48px; */
  }

  .app-header-title {
    font-size: 1.25rem;
  }

  .marketing-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-actions .btn {
    flex: 1 1 140px;
    justify-content: center;
  }

  .app-content {
      padding: 0 14px 14px;
  }

  .message-row {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .message-header {
    display: none;
  }

  .message-body {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 8px;
  }

  .message-time {
    text-align: left;
  }

  .page-header {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 1rem;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .page-title {
    font-size: clamp(1.4rem, 4vw + 1rem, 1.65rem);
  }

  h1 {
    font-size: clamp(1.45rem, 4vw + 0.9rem, 1.8rem);
  }

  h2 {
    font-size: clamp(1.2rem, 3vw + 0.85rem, 1.5rem);
  }

  h3 {
    font-size: clamp(1.05rem, 2.5vw + 0.8rem, 1.3rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* SweetAlert button sizing/spacing */
.swal2-actions {
  gap: 10px !important;
}

.swal2-actions .btn {
  min-width: 120px;
  justify-content: center;
}
