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

:root {
  --accent: #a938eb;
  --accent-hover: #9225d1;
  --accent-light: #f3e8fd;
  --accent-glow: rgba(169, 56, 235, 0.15);
  --text: #1e3a4a;
  --text-light: #516d7e;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --border: #e2e6ea;
  --error: #e53e3e;
  --success: #40E3BB;
  --success-dark: #16a34a;
  --warning: #ca8a04;
  --warning-light: #fefce8;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Layout ── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.header-logo img {
  height: 28px;
  width: auto;
}

.header-logo span {
  color: var(--text-light);
  font-weight: 400;
  font-size: 0.95rem;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Navigation tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  padding: 0 4px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-light);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 600;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-alt); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-alt); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
}

td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg-alt); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-draft { background: var(--bg-alt); color: var(--text-light); }
.badge-briefed { background: var(--accent-light); color: var(--accent); }
.badge-in_progress, .badge-in-progress { background: var(--warning-light); color: var(--warning); }
.badge-in_review, .badge-in-review { background: #f3e8fd; color: #7c3aed; }
.badge-approved { background: #e6f9f0; color: var(--success-dark); }
.badge-complete { background: #e6f9f0; color: var(--success-dark); }
.badge-cancelled { background: #fef2f2; color: var(--error); }
.badge-revisions_requested, .badge-revision_requested { background: #fef2f2; color: var(--error); }
.badge-invited { background: var(--warning-light); color: var(--warning); }
.badge-active { background: #e6f9f0; color: var(--success-dark); }
.badge-inactive { background: var(--bg-alt); color: var(--text-light); }
.badge-pending { background: var(--bg-alt); color: var(--text-light); }
.badge-uploaded { background: var(--accent-light); color: var(--accent); }

.badge-low { background: var(--bg-alt); color: var(--text-light); }
.badge-normal { background: var(--accent-light); color: var(--accent); }
.badge-high { background: var(--warning-light); color: var(--warning); }
.badge-urgent { background: #fef2f2; color: var(--error); }

.tag-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
}

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-alt);
}

.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 400px;
}

.auth-card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.auth-card-logo img { height: 26px; width: auto; }

.auth-card-logo span {
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 400;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.auth-card h1 {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.auth-card p {
  color: var(--text-light);
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.88rem;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 11px 20px;
  font-size: 0.92rem;
  margin-top: 4px;
}

/* ── Alerts ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #e6f9f0; color: var(--success-dark); border: 1px solid #bbf7d0; }
.alert-info { background: var(--accent-light); color: var(--accent); border: 1px solid #ddd0f5; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(6px);
}

.modal {
  background: var(--bg);
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

.modal h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Progress bar ── */
.progress-bar {
  background: var(--border);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.3s ease;
}

/* ── Q&A Thread ── */
.qa-thread { display: flex; flex-direction: column; gap: 12px; }

.qa-message {
  padding: 12px 16px;
  border-radius: var(--radius);
  max-width: 85%;
  font-size: 0.88rem;
  line-height: 1.6;
}

.qa-message.vendor { background: var(--accent-light); align-self: flex-start; }
.qa-message.admin { background: var(--bg-alt); align-self: flex-end; }
.qa-meta { font-size: 0.72rem; color: var(--text-light); margin-top: 4px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}

.empty-state h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }

/* ── Utility ── */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.clickable { cursor: pointer; transition: background 0.15s; }
.clickable:hover td { background: var(--accent-light); }

/* ── Landing page ── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-alt);
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.landing-logo img { height: 36px; width: auto; }

.landing-logo span {
  color: var(--text-light);
  font-size: 1.05rem;
  font-weight: 400;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.landing p {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 40px;
  max-width: 480px;
  line-height: 1.7;
}

.landing-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.landing-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 200px;
}

.landing-link:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  text-decoration: none;
}

.landing-link .icon { font-size: 28px; }
.landing-link h2 { font-size: 1rem; font-weight: 600; }
.landing-link p { font-size: 0.82rem; color: var(--text-light); margin-bottom: 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .header-logo span { display: none; }
}
