/* ============================================================
   RFPFill — app.css  |  Shared shell styles
   Fonts loaded via <link> in each HTML page
   ============================================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F6F3EF;
  --white: #FFFFFF;
  --stone: #EDE8E1;
  --warm: #FFF6EF;
  --ink: #18090A;
  --ink2: #5A3820;
  --ink3: #9C7054;
  --border: #E2D8CE;
  --sb: #0E0600;
  --sb2: #1C0A00;
  --sbbd: rgba(255,255,255,.07);
  --o: #F97316;
  --od: #EA580C;
  --olt: #FFF3EA;
  --amber: #F59E0B;
  --green: #16A34A;
  --red: #DC2626;
  --blue: #3B82F6;
  --violet: #7C3AED;
  --grad: linear-gradient(135deg,#F97316,#EA580C);
  --ff-h: 'Bricolage Grotesque', sans-serif;
  --ff-b: 'Instrument Sans', sans-serif;
  --sw: 264px;
  --th: 60px;
  --rad: 12px;
  --shadow: 0 1px 4px rgba(24,9,10,.06), 0 4px 16px rgba(24,9,10,.04);
  --shadow-lg: 0 8px 32px rgba(24,9,10,.12);
}

html, body { height: 100%; }
body {
  font-family: var(--ff-b);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sb {
  width: var(--sw);
  min-width: var(--sw);
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sb);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 200;
  transition: transform .25s ease;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  text-decoration: none;
  flex-shrink: 0;
}

.sb-mark {
  width: 32px;
  height: 32px;
  background: var(--grad);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-mark svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.sb-brand {
  font-family: var(--ff-h);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}

.sb-group {
  padding: 0 10px;
  flex-shrink: 0;
}

.sb-group-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
  padding: 10px 6px 4px;
}

.sb-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sb-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  transition: background .15s, color .15s;
  position: relative;
}

.sb-nav a svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .15s;
}

.sb-nav a:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}

.sb-nav a:hover svg { opacity: 1; }

.sb-nav a.active {
  background: rgba(249,115,22,.15);
  color: #FB923C;
}

.sb-nav a.active svg {
  opacity: 1;
  fill: #FB923C;
}

.sb-chip {
  margin-left: auto;
  background: var(--o);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 7px;
  line-height: 18px;
}

.sb-chip.new {
  background: var(--violet);
}

.sb-sep {
  height: 1px;
  background: var(--sbbd);
  margin: 8px 18px;
  flex-shrink: 0;
}

/* Spacer to push bottom section down */
.sb-spacer { flex: 1; }

.sb-bottom {
  padding: 10px;
  flex-shrink: 0;
  position: relative;
}

/* Trial bar */
.trial-bar {
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.trial-progress {
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 6px;
}

.trial-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 2px;
  transition: width .4s ease;
}

.trial-days {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
}

.trial-upgrade {
  font-size: .72rem;
  font-weight: 600;
  color: #FB923C;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-top: -18px;
}

.trial-upgrade:hover { color: #FDBA74; }

/* User row */
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}

.sb-user:hover {
  background: rgba(255,255,255,.06);
  border-color: var(--sbbd);
}

.sb-ava {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sb-uname {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.sb-urole {
  font-size: .7rem;
  color: rgba(255,255,255,.35);
}

.sb-signout {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.3);
  padding: 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
}

.sb-signout:hover {
  color: #FCA5A5;
  background: rgba(220,38,38,.1);
}

/* Overlay (mobile) */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

/* ============================================================
   PROFILE DROPDOWN
   ============================================================ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px;
  right: 10px;
  background: #1A0C00;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  overflow: hidden;
  z-index: 300;
  padding: 4px;
}

.user-menu.open {
  display: block;
  animation: slideUp .18s ease;
}

.um-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: .84rem;
  color: rgba(255,255,255,.55);
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, color .12s;
  user-select: none;
}

.um-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.um-item.danger:hover {
  background: rgba(220,38,38,.1);
  color: #FCA5A5;
}

.um-sep {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 0;
}

.um-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Topbar */
.topbar {
  height: var(--th);
  min-height: var(--th);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--ink2);
  border-radius: 8px;
  transition: background .15s;
  flex-shrink: 0;
}

.burger:hover { background: var(--stone); }
.burger svg { width: 20px; height: 20px; fill: currentColor; display: block; }

.search-box {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
}

.search-box svg {
  width: 15px;
  height: 15px;
  fill: var(--ink3);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--ff-b);
  font-size: .85rem;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}

.search-box input::placeholder { color: var(--ink3); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Icon button */
.ib {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink2);
  transition: background .15s, border-color .15s;
  text-decoration: none;
  flex-shrink: 0;
}

.ib:hover { background: var(--stone); border-color: var(--border); }

.ib svg { width: 16px; height: 16px; fill: currentColor; }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 36px;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--ff-b);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(249,115,22,.25);
  flex-shrink: 0;
}

.btn-primary:hover { opacity: .92; box-shadow: 0 4px 16px rgba(249,115,22,.35); }
.btn-primary svg { width: 15px; height: 15px; fill: currentColor; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 36px;
  background: var(--white);
  color: var(--ink2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--ff-b);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}

.btn-ghost:hover { background: var(--stone); border-color: #D4C8BC; }
.btn-ghost svg { width: 15px; height: 15px; fill: currentColor; }

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 36px;
  background: var(--olt);
  color: var(--od);
  border: 1px solid rgba(249,115,22,.25);
  border-radius: 8px;
  font-family: var(--ff-b);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}

.btn-upload:hover { background: #FFE4CC; }
.btn-upload svg { width: 15px; height: 15px; fill: currentColor; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge.answered   { background: #DCFCE7; color: #15803D; }
.badge.review     { background: #FEF9C3; color: #A16207; }
.badge.progress   { background: #DBEAFE; color: #1D4ED8; }
.badge.draft      { background: var(--stone); color: var(--ink3); }
.badge.processing { background: #F3E8FF; color: #6D28D9; }
.badge.error      { background: #FEE2E2; color: #B91C1C; }
.badge.active     { background: #DCFCE7; color: #15803D; }
.badge.invited    { background: #DBEAFE; color: #1D4ED8; }
.badge.ready      { background: #DCFCE7; color: #15803D; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  overflow: hidden;
}

.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.card-title {
  font-family: var(--ff-h);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.card-sub {
  font-size: .78rem;
  color: var(--ink3);
  margin-top: 2px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-icon {
  width: 18px;
  height: 18px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg { width: 11px; height: 11px; fill: #fff; }

/* ============================================================
   SKELETON / SHIMMER
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.sk {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--stone) 25%, var(--border) 50%, var(--stone) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  display: inline-block;
}

/* ============================================================
   PAGE SHELL
   ============================================================ */
.page {
  padding: 28px 32px 48px;
  width: 100%;
  flex: 1;
  min-width: 0;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: var(--ff-b);
  font-size: .875rem;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field-input:focus {
  border-color: var(--o);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}

.field-select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: var(--ff-b);
  font-size: .875rem;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239C7054' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}

.field-select:focus {
  border-color: var(--o);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}

/* ============================================================
   RESPONSIVE — Mobile sidebar
   ============================================================ */
@media (max-width: 768px) {
  body { display: block; }

  .sb {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    height: 100vh;
    z-index: 200;
  }

  .sb.open { transform: translateX(0); }

  .sb-overlay.open { display: block; }

  .main { min-height: 100vh; }

  .burger { display: flex; }

  .page { padding: 20px 16px 40px; }

  .topbar { padding: 0 16px; }
}
