/* ============================================================================
   ReviewLoop — design system
   ----------------------------------------------------------------------------
   Branding goal: a calm, trustworthy utility. Confident enough that a seller
   believes it works; restrained enough that it never feels like a marketing
   funnel. One accent colour (teal), generous spacing, honest microcopy.
   No external dependencies — works offline, renders identically anywhere.
   ============================================================================ */

:root {
  --ink:        #0f172a;   /* primary text  */
  --ink-soft:   #334155;   /* secondary text */
  --muted:      #64748b;   /* labels, hints  */
  --line:       #e2e8f0;   /* borders        */
  --line-soft:  #eef2f6;
  --bg:         #f6f8fa;   /* app background */
  --surface:    #ffffff;
  --brand:      #0d9488;   /* teal — trust + growth, not Amazon-orange */
  --brand-dark: #0f766e;
  --brand-soft: #f0fdfa;
  --success:    #16a34a;
  --success-bg: #f0fdf4;
  --warn:       #d97706;
  --warn-bg:    #fffbeb;
  --danger:     #dc2626;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow-sm:  0 1px 2px rgba(15, 23, 42, .04);
  --shadow:     0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Brand lockup ─────────────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.brand-name .loop { color: var(--brand); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: 13px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.input, .select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 11px 13px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}
.input::placeholder { color: #94a3b8; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px 24px; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Pills / badges ───────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill-active  { background: var(--success-bg); color: #15803d; }
.pill-active .dot { background: var(--success); }
.pill-paused  { background: var(--warn-bg); color: #b45309; }
.pill-paused .dot { background: var(--warn); }
.pill-muted   { background: #f1f5f9; color: var(--muted); }
.pill-muted .dot { background: #94a3b8; }

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .18s;
}
.switch .track::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ============================================================================
   AUTH SCREEN
   ============================================================================ */
.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-aside {
  background: linear-gradient(160deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%);
  color: #fff; padding: 56px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside .brand-name, .auth-aside .brand-name .loop { color: #fff; }
.auth-aside h1 { font-size: 30px; line-height: 1.25; font-weight: 700; letter-spacing: -0.025em; margin-top: 48px; max-width: 420px; }
.auth-aside .sub { font-size: 15.5px; color: rgba(255,255,255,.86); margin-top: 16px; max-width: 410px; }
.auth-points { margin-top: 34px; display: flex; flex-direction: column; gap: 14px; }
.auth-point { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: rgba(255,255,255,.95); }
.auth-point svg { flex: 0 0 18px; }
.auth-foot { font-size: 13px; color: rgba(255,255,255,.7); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 384px; }
.auth-card > .brand { margin-bottom: 26px; }
.auth-tabs { display: flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 10px; margin-bottom: 26px; }
.auth-tab {
  flex: 1; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 9px; border-radius: 7px; cursor: pointer; transition: all .15s; border: none; background: none; font-family: inherit;
}
.auth-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.auth-desc { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth-trust { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.7; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 6px 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ink-soft);
  padding: 10px 11px; border-radius: var(--radius-sm); border: none; background: none;
  cursor: pointer; text-align: left; transition: background .12s, color .12s;
}
.nav-item svg { flex: 0 0 18px; color: var(--muted); }
.nav-item:hover { background: #f8fafc; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-item.active svg { color: var(--brand); }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--line-soft); min-width: 0; }
.sidebar-user {
  font-size: 13px; color: var(--ink-soft); font-weight: 600;
  overflow-wrap: anywhere; /* long emails wrap instead of overrunning the sidebar */
}
.sidebar-user .email { font-weight: 400; color: var(--muted); font-size: 12.5px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .topbar-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }

.content { padding: 28px 32px 48px; max-width: 920px; }
.view { display: none; }
.view.active { display: block; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { padding: 18px 20px; }
.stat .label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; }
.stat .delta { font-size: 12.5px; color: var(--success); font-weight: 600; margin-top: 6px; }
.stat .delta.muted { color: var(--muted); font-weight: 500; }

/* ── Chart ────────────────────────────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.bar { width: 100%; max-width: 26px; background: var(--brand); border-radius: 5px 5px 2px 2px; opacity: .85; }
.bar-col:last-child .bar { opacity: 1; }
.bar-col .day { font-size: 10.5px; color: var(--muted); }

.chart-tooltip {
  position: absolute; transform: translate(-50%, -100%);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow); z-index: 10;
}
.chart-tooltip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}

/* ── Activity / tables ────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: none; }
.row .row-main { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.row .row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row .row-right { font-size: 13px; color: var(--muted); text-align: right; }

/* ── Settings rows ────────────────────────────────────────────────────────── */
.set-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); }
.set-row:last-child { border-bottom: none; }
.set-row .set-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.set-row .set-desc { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 460px; }
.set-row .set-control { flex: 0 0 auto; display: flex; align-items: center; }
.set-control .input, .set-control .select { width: 120px; }
.marketplace-checks { display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.marketplace-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }
.marketplace-check input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ── Banners ──────────────────────────────────────────────────────────────── */
.banner { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.55; }
.banner svg { flex: 0 0 18px; margin-top: 1px; }
.banner-info { background: var(--brand-soft); color: #115e59; border: 1px solid #ccfbf1; }
.banner-info a { color: #115e59; font-weight: 600; text-decoration: underline; }
.banner-warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.banner-warn a { color: #92400e; font-weight: 700; text-decoration: underline; }

.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 30px 0 12px; }
.help-foot { margin-top: 16px; font-size: 13px; color: var(--muted); }

.mb-16 { margin-bottom: 16px; }
.mb-22 { margin-bottom: 22px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ============================================================================
   DOC PAGES — Terms, Privacy, setup guide, security. Standalone pages reached
   from links on the auth/connection screens, not part of the signed-in shell.
   ============================================================================ */
.doc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; border-bottom: 1px solid var(--line); background: #fff;
}
.doc-wrap { max-width: 720px; margin: 0 auto; padding: 48px 24px 80px; }
.doc-wrap h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.doc-meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.doc-notice {
  display: flex; gap: 10px; margin: 20px 0 32px; padding: 14px 16px;
  background: var(--warn-bg); border: 1px solid #fde68a; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.6; color: #92400e;
}
.doc-notice svg { flex: 0 0 18px; margin-top: 2px; }
.doc-wrap h2 { font-size: 17px; font-weight: 700; margin: 32px 0 10px; letter-spacing: -0.01em; }
.doc-wrap p { font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 14px; }
.doc-wrap ul, .doc-wrap ol { margin: 0 0 14px 22px; }
.doc-wrap li { font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 6px; }
.doc-wrap code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.doc-step {
  display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line-soft);
}
.doc-step:last-child { border-bottom: none; }
.doc-step .num {
  flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.doc-step .body h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.doc-step .body p { margin-bottom: 0; }

/* Inline form error (auth screen) */
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* ============================================================================
   RESPONSIVE — desktop-first; collapse gracefully so the dashboard is usable
   on a phone (stats stack, sidebar becomes a scrollable top bar).
   ============================================================================ */
@media (max-width: 760px) {
  /* Auth: single column, hide the marketing panel */
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 28px 20px; }

  /* App shell: sidebar becomes a horizontal top bar */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; overflow-y: visible;
    flex-direction: row; align-items: center; gap: 6px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line); padding: 10px 12px;
  }
  .sidebar .brand { padding: 0 6px 0 2px; flex: 0 0 auto; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0 4px; border-top: none; flex: 0 0 auto; }
  .sidebar-user { display: none; }

  /* Content: stack the stat cards, tighten padding */
  .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 14px 16px; }
  .topbar .topbar-meta { display: none; }
  .set-row { flex-direction: column; gap: 12px; }
}
