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

:root {
  --bg-0: #080808;
  --bg-1: #111111;
  --bg-2: #181818;
  --bg-3: #212121;
  --bg-hover: #262626;
  --border: rgba(255,255,255,0.07);
  --border-mid: rgba(255,255,255,0.12);
  --border-strong: rgba(255,255,255,0.18);
  --text-1: #f0f0f0;
  --text-2: #a0a0a0;
  --text-3: #606060;
  --gold: #C8A96E;
  --gold-dim: rgba(200,169,110,0.15);
  --gold-glow: rgba(200,169,110,0.08);
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96,165,250,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 240px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }

/* ─── LAYOUT ─────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-1);
}
.sidebar-logo .tagline {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  margin-top: 3px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}
.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
  transition: all var(--transition);
  user-select: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active { background: var(--gold-dim); color: var(--gold); }
.nav-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px 24px;
  border-top: 1px solid var(--border);
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--text-1); }
.user-role { font-size: 11px; color: var(--text-3); }

/* ─── MAIN CONTENT ─────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── TOP BAR ─────────────────────────────── */
.topbar {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.topbar-title { font-size: 15px; font-weight: 500; color: var(--text-1); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  outline: none;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); border-color: var(--border-strong); }

.btn-primary {
  background: var(--gold);
  color: #000;
  border: 1px solid var(--gold);
  font-weight: 600;
}
.btn-primary:hover { background: #d4b47a; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-3); color: var(--text-1); }

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

/* ─── PAGE BODY ─────────────────────────── */
.page { padding: 36px 32px; max-width: 1100px; }

/* ─── SECTION TITLE ─────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ─── WELCOME HERO ─────────────────────────── */
.welcome-hero {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.welcome-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(200,169,110,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-text h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
  margin-bottom: 8px;
}
.welcome-text h1 span { color: var(--gold); }
.welcome-text p { font-size: 14px; color: var(--text-2); max-width: 360px; }
.welcome-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
}
.status-chip.active {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.2);
}
.status-chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.welcome-date { font-size: 12px; color: var(--text-3); }

/* ─── STATS ROW ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-mid); }
.stat-label { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-1); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.stat-accent { color: var(--gold); }
.stat-green { color: var(--green); }

/* ─── TWO-COL GRID ─────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ─── CARD ─────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  padding: 20px 22px 0;
}
.card-body {
  padding: 16px 22px 22px;
}
.card-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* ─── PROGRESS SECTION ─────────────────────── */
.progress-list { display: flex; flex-direction: column; gap: 0; }
.progress-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.progress-item:last-child { border-bottom: none; }
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.progress-name { font-size: 14px; font-weight: 500; color: var(--text-1); }
.progress-info { display: flex; align-items: center; gap: 10px; }
.progress-pct { font-size: 13px; font-weight: 600; color: var(--gold); }
.progress-deadline { font-size: 11px; color: var(--text-3); }
.progress-stage {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
}
.stage-active { background: var(--green-dim); color: var(--green); }
.stage-review { background: var(--gold-dim); color: var(--gold); }
.stage-pending { background: var(--bg-3); color: var(--text-3); }
.stage-done { background: rgba(96,165,250,0.12); color: var(--blue); }

.bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-3);
  border-radius: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--gold), #e8c87a);
  transition: width 0.6s ease;
}
.bar-fill.blue { background: linear-gradient(90deg, var(--blue), #93c5fd); }
.bar-fill.green { background: linear-gradient(90deg, var(--green), #86efac); }

/* ─── DOCS SECTION ─────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.doc-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.doc-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-mid);
  transform: translateY(-2px);
}
.doc-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.doc-icon.welcome { background: var(--gold-dim); }
.doc-icon.contract { background: rgba(96,165,250,0.1); }
.doc-icon.invoice { background: var(--green-dim); }
.doc-label { font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.3; }
.doc-sublabel { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.doc-download {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-top: auto;
}

/* ─── DELIVERABLES ─────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 0; }
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.file-item:last-child { border-bottom: none; }
.file-thumb {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.file-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.tag-new { background: var(--gold-dim); color: var(--gold); }
.tag-final { background: var(--green-dim); color: var(--green); }
.tag-draft { background: var(--bg-3); color: var(--text-3); }
.file-btn {
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.file-btn:hover { background: var(--bg-3); color: var(--text-1); }

/* ─── CHAT ─────────────────────────────────── */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 320px;
}
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.msg.from-agency { flex-direction: row; }
.msg.from-client { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.msg.from-agency .msg-avatar { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(200,169,110,0.2); }
.msg.from-client .msg-avatar { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); }
.msg-content { max-width: 75%; display: flex; flex-direction: column; gap: 4px; }
.msg.from-client .msg-content { align-items: flex-end; }
.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.msg.from-agency .bubble {
  background: var(--bg-3);
  border-bottom-left-radius: 4px;
  color: var(--text-1);
}
.msg.from-client .bubble {
  background: var(--gold-dim);
  border: 1px solid rgba(200,169,110,0.2);
  border-bottom-right-radius: 4px;
  color: var(--text-1);
}
.msg-time { font-size: 10px; color: var(--text-3); padding: 0 4px; }
.msg.from-client .msg-time { text-align: right; }

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.chat-input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--transition);
  resize: none;
  height: 40px;
}
.chat-input:focus { border-color: var(--gold); }
.chat-input::placeholder { color: var(--text-3); }
.chat-send {
  background: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
  flex-shrink: 0;
}
.chat-send:hover { background: #d4b47a; }
.chat-send:active { transform: scale(0.95); }

/* ─── FULL WIDTH BOTTOM SECTION ─────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  margin-bottom: 20px;
}

/* ─── MOBILE OVERLAY ─────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 240px; }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 20px; }
  .page { padding: 24px 20px; }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .docs-grid { grid-template-columns: 1fr 1fr; }
  .welcome-hero { flex-direction: column; align-items: flex-start; }
  .welcome-meta { align-items: flex-start; }
  .welcome-text h1 { font-size: 22px; }
  .page { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 380px) {
  .docs-grid { grid-template-columns: 1fr; }
}