/* Smart Campaign Dashboard — lean local CSS (no build step) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --danger: #dc2626;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --control-h: 48px;
  --control-radius: 10px;
  --control-pad-x: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100dvh;
}

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

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

button,
input {
  font: inherit;
  margin: 0;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

input {
  -webkit-appearance: none;
  appearance: none;
}

/* ——— Auth ——— */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #99f6e4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #bae6fd 0%, transparent 50%),
    var(--bg);
}

.auth-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand), #0284c7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  line-height: 1;
}

.auth-brand__text {
  min-width: 0;
}

.auth-brand__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.auth-brand__sub {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-card .lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

.field {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.field-control {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input {
  display: block;
  padding: 0 var(--control-pad-x);
}

.field-input:focus,
.field-password:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.field-password {
  display: flex;
  align-items: center;
  padding: 0 4px 0 0;
  overflow: hidden;
}

.field-password input {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  padding: 0 8px 0 var(--control-pad-x);
}

.eye-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 40px;
  padding: 0;
}

.eye-btn:hover,
.eye-btn:focus-visible {
  background: var(--bg);
  color: var(--ink);
}

.eye-btn .eye-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.eye-btn .eye-icon.is-hidden {
  display: none !important;
}

.alert {
  border-radius: var(--control-radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 16px;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  border: 0;
  border-radius: var(--control-radius);
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
}

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

.btn-primary.btn-sm {
  width: auto;
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.auth-form .btn-primary {
  margin-top: 8px;
}

/* ——— App shell ——— */
.app {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #0b1220;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.sidebar__brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), #0284c7);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.85rem;
}

.sidebar__name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 0.95rem;
}

.sidebar__nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.925rem;
  font-weight: 500;
}

.nav-link-btn {
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #f8fafc;
}

.nav-link.is-active {
  background: rgba(13, 148, 136, 0.22);
  color: #5eead4;
}

.sidebar__foot {
  padding: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.page-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.user-menu {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.7rem 0.3rem 0.3rem;
  cursor: pointer;
  max-width: 220px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-chip__meta {
  min-width: 0;
  text-align: left;
}

.user-chip__name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip__role {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  width: 210px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  display: none;
  z-index: 50;
}

.dropdown.is-open {
  display: block;
}

.dropdown a,
.dropdown button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.7rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
}

.dropdown a:hover,
.dropdown button:hover {
  background: var(--bg);
}

.dropdown .danger {
  color: var(--danger);
}

.content {
  padding: 1.25rem;
  flex: 1;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
}

.card-soft {
  box-shadow: none;
  margin: 0;
}

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

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.stat-value {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-trend {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--brand-dark);
}

.panel-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.panel-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.panel-sub--flush {
  margin: 0;
}

.profile-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.925rem;
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row dt {
  color: var(--muted);
  margin: 0;
}

.profile-row dd {
  margin: 0;
  font-weight: 600;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 35;
}

body.sidebar-open .overlay {
  display: block;
}

@media (max-width: 1100px) {
  .grid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-105%);
  }

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

  .main {
    margin-left: 0;
  }

  .menu-btn {
    display: grid;
  }

  .user-chip__meta {
    display: none;
  }

  .user-chip {
    padding: 0.25rem;
    border-radius: 999px;
  }

  .content {
    padding: 1rem;
  }

  .profile-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (max-width: 520px) {
  .grid-stats {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
