/* UGC Labs brand book tokens (Cobalt / Sky / Ice / Ink / White) — same palette
   for every brand subdomain; a tenant's own brand book only supplies its sidebar
   header image + avatar, nothing else here (see layout.html). */
:root {
  --brand-blue: #246BFD;    /* Cobalt, primary */
  --sky: #70C9FF;
  --deep-blue: #1A4FD1;     /* darker shade for secondary/hover accents */
  --deep-blue-hover: #15409E;
  --brand-blue-hover: #1857DE;
  --ink: #102A43;           /* UGC Labs Ink, not generic black */
  --white: #FFFFFF;

  --text-primary: var(--ink);
  --text-secondary: rgba(16, 42, 67, 0.72);
  --text-tertiary: rgba(16, 42, 67, 0.46);
  --border: rgba(16, 42, 67, 0.09);
  --border-strong: rgba(16, 42, 67, 0.14);
  --bg-app: #EDF7FF;        /* Ice */
  --bg-panel: #FFFFFF;
  --sidebar-bg: var(--ink);

  /* semantic (state) colors — kept separate from brand identity colors on purpose */
  --success-bg: #E5F8EC; --success-text: #12B857;
  --warning-bg: #FFF4E0; --warning-text: #FC5415;
  --error-bg: #FDE9EA;   --error-text: #E0245E;
}

* { box-sizing: border-box; }

html {
  background: var(--bg-app);
}

body {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
}

h1, h2, h3 { font-family: 'Rubik', system-ui, sans-serif; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
a { color: var(--deep-blue); text-decoration: none; }
a:hover { color: var(--deep-blue-hover); }
table.list a:visited { color: var(--deep-blue); }

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

/* Sidebar */
.sidebar {
  width: 248px; flex-shrink: 0;
  background:
    radial-gradient(360px 280px at 0% 0%, rgba(36,107,253,0.22), transparent 60%),
    var(--sidebar-bg);
  display: flex; flex-direction: column; padding: 24px 16px; position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.sidebar-brand { padding: 4px 8px 8px 8px; }
/* A brand's logo image is designed for a light background (not transparent), so
   it sits on its own white chip rather than directly on the dark sidebar. */
.sidebar-brand-chip { display: inline-flex; background: #fff; border-radius: 10px; padding: 8px 14px; }
.sidebar-brand-chip img { display: block; height: 22px; width: auto; }
.sidebar-brand-sub {
  font-size: 11px; font-weight: 500; color: rgba(237,247,255,0.45); text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0 8px 24px 8px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
  color: rgba(237,247,255,0.62); font-size: 14px; font-weight: 500;
}
.sidebar-link svg { flex-shrink: 0; }
.sidebar-link.active { background: linear-gradient(100deg, rgba(36,107,253,0.28), rgba(112,201,255,0.16)); color: var(--white); font-weight: 600; border-left: 2px solid var(--sky); padding-left: 10px; }
.sidebar-link:hover { color: var(--white); }
.sidebar-footer {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-avatar {
  width: 34px; height: 34px; aspect-ratio: 1; flex-shrink: 0; border-radius: 50%; background: var(--brand-blue);
  display: flex; align-items: center; justify-content: center; font-family: 'Rubik', sans-serif;
  font-weight: 700; font-size: 13px; color: var(--white); overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.3; }
.sidebar-user-points { font-size: 11.5px; color: rgba(237,247,255,0.62); line-height: 1.3; margin-top: 1px; }
.sidebar-logout { font-size: 11.5px; color: rgba(237,247,255,0.62); margin-left: auto; }
.sidebar-logout:hover { color: var(--white); }
.sidebar-socials { display: flex; justify-content: center; gap: 18px; padding: 14px 8px 4px; }
.sidebar-socials a { color: rgba(237,247,255,0.45); display: flex; }
.sidebar-socials a:hover { color: var(--white); }

.sidebar-powered-by {
  display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 12px 8px 4px;
  border-top: 1px solid rgba(255,255,255,0.08); text-decoration: none;
  color: rgba(237,247,255,0.45); font-size: 12px; transition: color .15s ease;
}
.sidebar-powered-by:hover { color: rgba(237,247,255,0.8); }
.sidebar-powered-by svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-powered-by strong { font-weight: 700; color: inherit; }

/* Main content */
.main { flex: 1; padding: 36px 40px; min-width: 0; }
.page-header { margin-bottom: 26px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { font-size: 14px; color: var(--text-tertiary); margin-top: 5px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px;
}
.stat-card-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.stat-card-value { font-family: 'Rubik', sans-serif; font-size: 30px; font-weight: 700; }

/* Card / table */
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.card-header { padding: 22px 22px 14px 22px; font-size: 15px; font-weight: 600; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left; padding: 13px 22px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.list td { padding: 16px 22px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 9px;
  border-radius: 7px; font-size: 12px; font-weight: 600;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 5px 11px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.campaign-logo {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-family: 'Rubik', sans-serif; font-weight: 700; font-size: 13px;
}
.campaign-logo img { width: 60%; height: 60%; object-fit: contain; }
.campaign-title { font-size: 14.5px; font-weight: 600; }
.campaign-brand { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }

.progress-track { height: 8px; border-radius: 5px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand-blue); }

/* Buttons */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 700;
  border: none; cursor: pointer; text-align: center;
}
.btn-primary { background: linear-gradient(100deg, var(--brand-blue), var(--deep-blue) 130%); color: var(--white); box-shadow: 0 6px 16px rgba(36,107,253,0.26); transition: box-shadow .15s ease, transform .15s ease; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(36,107,253,0.34); transform: translateY(-1px); }
.btn-secondary { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-secondary); }
.btn-approve { background: var(--success-text); color: white; }
.btn-reject { background: var(--error-text); color: white; }
.btn-small { padding: 6px 14px; font-size: 13px; border-radius: 6px; }

.error { color: var(--error-text); margin-top: 10px; }
.empty { color: var(--text-tertiary); font-size: 14px; padding: 20px 22px; }

textarea, input[type=text], input[type=password], input[type=number], input[type=date], select, textarea.field {
  width: 100%; padding: 10px 12px; font-size: 14px; box-sizing: border-box;
  border: 1.5px solid var(--border-strong); border-radius: 9px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand-blue); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.field-group { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Auth pages (login / admin login / pending) */
.auth-page {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(112,201,255,0.28), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(36,107,253,0.16), transparent 45%),
    var(--bg-app);
}
.auth-powered-by {
  display: flex; align-items: center; gap: 7px; text-decoration: none;
  color: var(--text-tertiary); font-size: 12.5px; transition: color .15s ease;
}
.auth-powered-by:hover { color: var(--text-secondary); }
.auth-powered-by svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-powered-by strong { font-weight: 700; color: inherit; }
.auth-card {
  position: relative;
  width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: 0 30px 60px rgba(14,16,17,0.10), 0 4px 14px rgba(14,16,17,0.05);
  padding: 44px 40px; text-align: center; box-sizing: border-box;
}
.icon-btn {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-tertiary);
  background: transparent; transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--bg-app); color: var(--text-primary); }
.icon-btn-inline {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; color: var(--text-tertiary);
  background: transparent; cursor: pointer; padding: 0; transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn-inline:hover { background: var(--bg-app); color: var(--brand-blue); }
.auth-logo { height: 56px; width: auto; margin-bottom: 28px; }
.auth-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-tertiary); margin-bottom: 28px;
}
.auth-card .auth-eyebrow:has(+ .auth-title) { margin-bottom: 10px; }
.auth-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 10px; }
.auth-subtitle { font-size: 14px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 28px; }
.auth-card form { text-align: left; }

.x-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px; font-size: 15px; font-weight: 600; background: #000; color: white;
  border: none; border-radius: 12px; cursor: pointer; text-decoration: none; box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.x-btn:hover { background: #1a1a1a; color: white; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,0.18); }

/* Modal-style campaign detail */
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  padding: 26px 26px 20px 26px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 22px 26px; }
.modal-footer { display: flex; gap: 10px; padding: 18px 26px; border-top: 1px solid var(--border); }
.reward-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.reward-box { background: var(--bg-app); border-radius: 11px; padding: 14px 16px; }
.reward-box-label { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 6px; }
.reward-box-value { font-size: 16px; font-weight: 700; }
.requirement-item { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; margin-bottom: 8px; }

/* Mobile topbar + sidebar drawer (hidden on desktop) */
.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 90;
  background: var(--sidebar-bg); align-items: center; gap: 14px; padding: 0 16px;
}
.mobile-menu-btn {
  background: none; border: none; color: var(--white); padding: 8px; margin: -8px;
  display: flex; align-items: center; cursor: pointer; flex-shrink: 0;
}
.mobile-topbar-logo { height: 18px; width: auto; display: block; }
.mobile-topbar-logo-chip { background: #fff; border-radius: 8px; padding: 6px 10px; display: inline-flex; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 95; }
.sidebar-backdrop.open { display: block; }
.sidebar-close-btn {
  display: none; background: none; border: none; color: rgba(237,247,255,0.62); align-self: flex-end;
  margin-bottom: 4px; padding: 6px; margin-right: -6px; cursor: pointer;
}

/* Responsive breakpoints */
@media (max-width: 860px) {
  .mobile-topbar { display: flex; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; z-index: 100; width: 260px;
    transform: translateX(-100%); transition: transform 0.25s ease; box-sizing: border-box;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; }
  .main { padding: 76px 18px 28px; }

  .stat-grid { grid-template-columns: 1fr !important; }
  .reward-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .field-row { grid-template-columns: 1fr; }

  .card:has(table.list) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.list { min-width: 560px; }
  table.list th, table.list td { padding: 12px 14px; }

  .page-title { font-size: 21px; }
  .modal-header { padding: 20px 18px 16px; }
  .modal-body { padding: 18px; }
}

@media (max-width: 420px) {
  .auth-page { padding: 14px; }
  .auth-card { padding: 32px 22px; }
  .stat-card-value { font-size: 24px; }
}
