/* LuxMex Agent Portal — shared theme (mirrors Osiris design tokens). */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --background: hsl(220 20% 97%);
  --foreground: hsl(220 30% 10%);
  --card: hsl(0 0% 100%);
  --card-fg: hsl(220 30% 10%);
  --muted: hsl(220 15% 94%);
  --muted-fg: hsl(220 10% 46%);
  --border: hsl(220 15% 90%);
  --input: hsl(220 15% 90%);
  --accent: hsl(42 70% 55%);
  --accent-fg: hsl(220 25% 10%);
  --accent-dark: hsl(42 60% 40%);
  --accent-light: hsl(42 80% 75%);
  --navy: hsl(220 25% 14%);
  --navy-light: hsl(220 20% 22%);
  --emerald: hsl(160 60% 40%);
  --emerald-light: hsl(160 50% 90%);
  --coral: hsl(12 80% 60%);
  --coral-light: hsl(12 70% 92%);
  --destructive: hsl(0 72% 51%);
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: 'Playfair Display', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }

/* ──────────── App shell ──────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--navy); color: hsl(220 15% 90%);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid hsl(220 25% 10%);
  z-index: 30;
}

.sidebar-brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid hsl(220 22% 18%);
}
.sidebar-brand .logo {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  color: var(--accent); letter-spacing: 5px;
}
.sidebar-brand .tagline {
  font-size: 10px; color: hsl(220 15% 55%);
  text-transform: uppercase; letter-spacing: 2px;
  margin-top: 4px;
}

.sidebar-nav { padding: 14px 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px;
  color: hsl(220 12% 72%);
  text-decoration: none; font-size: 13px; font-weight: 500;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  position: relative;
}
.nav-link:hover { background: hsl(220 22% 18%); color: white; }
.nav-link.active {
  background: hsl(220 22% 18%);
  color: white;
  border-left-color: var(--accent);
}
.nav-link.active .nav-icon { color: var(--accent); }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; color: hsl(220 12% 60%); }
.nav-link:hover .nav-icon { color: hsl(220 12% 90%); }

.sidebar-footer {
  padding: 16px 22px; border-top: 1px solid hsl(220 22% 18%);
  font-size: 12px;
}
.sidebar-footer .me-name { color: white; font-weight: 500; font-size: 13px; }
.sidebar-footer .me-sub  { color: hsl(220 12% 65%); font-size: 11px; margin-top: 2px; }
.sidebar-footer .me-tier {
  margin: 10px 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: hsl(220 22% 18%); padding: 5px 10px; border-radius: 999px;
  font-size: 11px;
}
.sidebar-footer .me-tier .pct { color: var(--accent); font-weight: 700; }
.sidebar-footer .me-tier .name { color: hsl(220 12% 78%); }
.sidebar-footer a.signout {
  display: inline-flex; align-items: center; gap: 6px;
  color: hsl(220 12% 65%); text-decoration: none; font-size: 12px;
  font-weight: 500;
}
.sidebar-footer a.signout:hover { color: var(--accent); }

/* ──────────── Mobile sidebar drawer ──────────── */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 25; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.sidebar-overlay.on { opacity: 1; pointer-events: auto; }

.menu-btn {
  display: none;
  background: none; border: none; padding: 8px;
  cursor: pointer; color: var(--foreground);
  border-radius: var(--radius); margin-right: 4px;
}
.menu-btn:hover { background: var(--muted); }
.menu-btn svg { width: 22px; height: 22px; display: block; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    height: 100dvh;
    width: 84%; max-width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; align-items: center; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5; gap: 14px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 22px; line-height: 1.2; }
.crumb { font-size: 12px; color: var(--muted-fg); margin-bottom: 2px; }
.crumb a { color: var(--accent-dark); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 24px 28px 60px; max-width: 1400px; margin: 0 auto; width: 100%; }

@media (max-width: 700px) {
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 16px 16px 40px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn-sm { padding: 5px 8px; font-size: 11px; }
}

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: 0 0 0 2px hsl(42 70% 55% / 0.3); }
.stat-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-fg); margin-bottom: 6px; font-weight: 500; }
.stat-card .value { font-size: 22px; font-weight: 700; color: var(--foreground); font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 11px; color: var(--muted-fg); margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); }
.btn-accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: white; }
.btn-outline { background: var(--card); color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--foreground); border-color: transparent; }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Form inputs */
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-fg); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; background: var(--card);
  border: 1px solid var(--input); border-radius: var(--radius);
  font-family: inherit; font-size: 13px; color: var(--foreground);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px hsl(42 70% 55% / .15);
}
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted-fg); font-weight: 500; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: hsl(220 15% 98%);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: hsl(220 15% 98%); }
.tab-num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Pills/badges */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.pill-navy { background: var(--navy); color: white; }
.pill-gold { background: var(--accent); color: var(--accent-fg); }
.pill-emerald { background: var(--emerald-light); color: var(--emerald); }
.pill-coral { background: var(--coral-light); color: var(--coral); }
.pill-muted { background: var(--muted); color: var(--muted-fg); }

/* Utility */
.hr { height: 1px; background: var(--border); border: none; margin: 16px 0; }
.muted { color: var(--muted-fg); }
.flex { display: flex; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }

/* Loading */
.spin { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 80px 20px; text-align: center; color: var(--muted-fg); }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--navy); color: white; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow); transform: translateY(8px); opacity: 0; transition: transform .2s, opacity .2s; pointer-events: none; }
.toast.on { transform: translateY(0); opacity: 1; }

/* Errors / warnings */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; border: 1px solid; }
.alert-warn { background: hsl(42 80% 95%); border-color: hsl(42 70% 75%); color: hsl(40 60% 30%); }
.alert-err { background: hsl(0 80% 96%); border-color: hsl(0 60% 80%); color: hsl(0 60% 35%); }
.alert-info { background: var(--emerald-light); border-color: hsl(160 50% 70%); color: var(--emerald); }

/* ──────────── Mobile-specific tweaks ──────────── */
@media (max-width: 700px) {
  body { font-size: 13px; }
  h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .value { font-size: 19px; }
  .card-pad { padding: 16px; }
  thead th, tbody td { padding: 9px 10px; font-size: 12px; }
  /* Wrap tables in a scroller */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .btn-sm { padding: 6px 9px; font-size: 11px; }
}
