:root {
  --navy-950: #0d1b2e;
  --navy-900: #142842;
  --navy-800: #1c3557;
  --paper: #f6f4ef;
  --paper-raised: #ffffff;
  --ink: #16233a;
  --ink-soft: #5b6b85;
  --line: #e2ddd1;
  --gold: #b8894f;
  --gold-soft: #f2e6d3;
  --teal: #2f6f5e;
  --teal-soft: #e2efe9;
  --rust: #b3452f;
  --rust-soft: #f5e3dd;
  --slate: #6d7a92;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.01em; margin: 0; }

a { color: inherit; text-decoration: none; }

.shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--navy-950);
  color: #dfe6f2;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(145deg, var(--gold), #8f6a38);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; color: var(--navy-950);
}
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 17px; color: #fff; }
.nav-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-links a {
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: #aab8cf; transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-links a.active { background: rgba(184,137,79,0.16); color: var(--gold); }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.me-name { font-size: 13px; font-weight: 600; color: #fff; }
.me-role { font-size: 11.5px; color: #8493ac; }
.logout { font-size: 12px; color: #8493ac; border: 1px solid rgba(255,255,255,0.15); padding: 5px 10px; border-radius: 6px; }
.logout:hover { color: #fff; border-color: rgba(255,255,255,0.35); }

/* Content */
.content { flex: 1; min-width: 0; }
.content-inner { max-width: 1180px; margin: 0 auto; padding: 34px 40px 60px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p.eyebrow { color: var(--gold); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  font-family: inherit; transition: transform 0.1s, box-shadow 0.15s;
}
.btn-primary { background: var(--navy-950); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(13,27,46,0.28); }
.btn-gold { background: var(--gold); color: #221605; }
.btn-gold:hover { box-shadow: 0 4px 14px rgba(184,137,79,0.35); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-soft); }
.btn-danger { background: var(--rust-soft); color: var(--rust); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* Cards */
.card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.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: 2fr 1fr; }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-card { padding: 18px 20px; }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--slate); margin-top: 4px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-link:hover { background: #fbfaf7; cursor: pointer; }

/* Badges (pipeline stages) */
.badge { display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-new { background: #e7ecf5; color: #3a538c; }
.badge-contacted { background: #eaf0e0; color: #5a7a2e; }
.badge-followup { background: #fbeed9; color: #a2660f; }
.badge-meeting { background: #e6e9fb; color: #4b4fbf; }
.badge-proposal { background: var(--gold-soft); color: #8a5c1f; }
.badge-negotiation { background: #fbe4ea; color: #b03361; }
.badge-won { background: var(--teal-soft); color: var(--teal); }
.badge-lost { background: var(--rust-soft); color: var(--rust); }

/* Forms */
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy-950); }
.login-card { width: 360px; background: var(--paper-raised); border-radius: 14px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-error { background: var(--rust-soft); color: var(--rust); padding: 9px 12px; border-radius: 7px; font-size: 12.5px; margin-bottom: 14px; }
.login-hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 16px; text-align: center; }

/* Activity timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex-shrink: 0; }
.timeline-meta { font-size: 11.5px; color: var(--slate); margin-bottom: 2px; }
.timeline-type { font-weight: 700; color: var(--navy-900); }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin-bottom: 12px; }

.pill-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.pill { padding: 6px 13px; border-radius: 100px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-soft); }
.pill.active { background: var(--navy-950); color: #fff; border-color: var(--navy-950); }

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

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { max-width: 260px; }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(13,27,46,0.5); align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: 92vw; max-height: 88vh; overflow-y: auto; padding: 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close { cursor: pointer; color: var(--ink-soft); font-size: 20px; line-height: 1; border: none; background: none; }

.text-soft { color: var(--ink-soft); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
