/* ReviewFlow shared design system
   Signature device: the "star meter" — a horizontal 1-5 gradient bar
   used everywhere a rating appears, instead of generic donut charts.
   Palette is grounded in the product's own subject matter: ink for
   trust/authority, a warm gold reserved ONLY for ratings/stars so it
   stays meaningful, teal for resolved/positive, brick for alerts.
*/

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #14181f;
  --ink-soft: #4b515c;
  --canvas: #f5f6f4;
  --surface: #ffffff;
  --primary: #2b3a67;
  --primary-soft: #3d4f86;
  --gold: #d9a02a;
  --gold-soft: #f2d78a;
  --positive: #3d7a5c;
  --positive-bg: #e7f2ec;
  --negative: #c1432a;
  --negative-bg: #fbe9e5;
  --border: #e2e4df;
  --border-strong: #cbcec7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.04), 0 4px 16px rgba(20, 24, 31, 0.04);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

code, .mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--primary); }

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--ink);
  color: #dfe2e8;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 17px; padding: 6px 10px 22px;
}
.sidebar .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #b7bcc6; text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .foot { font-size: 12px; color: #767c88; padding: 10px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar h1 { font-size: 18px; }
.content { padding: 24px; flex: 1; overflow-y: auto; }

/* ── Cards / KPIs ── */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .sidebar { display: none; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card.kpi .label { font-size: 12.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.card.kpi .value { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; margin-top: 6px; }
.card.kpi .delta { font-size: 12.5px; margin-top: 4px; }
.card.kpi .delta.up { color: var(--positive); }
.card.kpi .delta.down { color: var(--negative); }

/* ── Star meter — the signature component ── */
.star-meter { display: flex; align-items: center; gap: 8px; }
.star-meter .track {
  flex: 1; height: 6px; border-radius: 4px; background: var(--border);
  position: relative; overflow: hidden; min-width: 60px;
}
.star-meter .fill {
  position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(90deg, #c1432a 0%, var(--gold) 50%, #3d7a5c 100%);
  transform-origin: left; transition: transform 0.4s ease;
}
.star-meter .num { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; color: var(--ink); min-width: 28px; text-align: right; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; border: 1px solid transparent;
  padding: 9px 16px; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-soft); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--canvas); }
.btn-danger { background: var(--negative-bg); color: var(--negative); }
.btn-danger:hover { background: #f6d9d1; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--canvas); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ── Forms ── */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 36px; height: 20px; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th { color: var(--ink-soft); font-weight: 500; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--canvas); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-positive { background: var(--positive-bg); color: var(--positive); }
.badge-negative { background: var(--negative-bg); color: var(--negative); }
.badge-neutral { background: var(--canvas); color: var(--ink-soft); border: 1px solid var(--border); }
.badge-gold { background: #fbf1dc; color: #8a6314; }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs button { background: none; border: none; padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,24,31,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }

/* ── Auth screens ── */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 20px; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 36px; width: 100%; max-width: 380px; }
.auth-card .brand { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 19px; margin-bottom: 26px; }
.auth-card .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow); animation: toast-in 0.2s ease; }
.toast.error { background: var(--negative); }
.toast.success { background: var(--positive); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
