/* Marcela Freire — Sistema de Parcerias (mockup CRM) */
:root {
  --ivory: #F3EDE4;
  --paper: #FAF7F2;
  --ink: #2B2520;
  --ink-soft: rgba(43, 37, 32, 0.68);
  --ink-faint: rgba(43, 37, 32, 0.45);
  --taupe: #A38B73;
  --taupe-dk: #86705A;
  --sand: #D9CBB8;
  --line: rgba(163, 139, 115, 0.38);
  --line-soft: rgba(163, 139, 115, 0.22);
  --spark: #C9A877;
  --ok: #5a7a5a;
  --warn: #9a6b3a;
  --muted: #8a7e72;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --side: 248px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

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

/* ── Login ─────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(201, 168, 119, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(163, 139, 115, 0.12), transparent 50%),
    linear-gradient(165deg, var(--paper), var(--ivory) 45%, #EFE8DC);
}

.login-card {
  width: min(420px, 100%);
  padding: 40px 36px 32px;
  background: rgba(250, 247, 242, 0.82);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand img {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  object-fit: contain;
}

.login-brand h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
}

.login-brand p {
  margin-top: 6px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--taupe-dk);
}

.login-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--taupe-dk);
}

.login-form input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.login-form input:focus {
  outline: none;
  border-color: var(--taupe-dk);
}

.login-error {
  display: none;
  margin-bottom: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: #7a3b2e;
  background: rgba(122, 59, 46, 0.08);
  border: 1px solid rgba(122, 59, 46, 0.2);
}
.login-error.is-on { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn-solid {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}
.btn-solid:hover { background: var(--taupe-dk); border-color: var(--taupe-dk); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--taupe-dk); color: var(--taupe-dk); }

.btn-wa {
  background: #1f6b46;
  color: #f5faf7;
  border: 1px solid #1f6b46;
}
.btn-wa:hover { background: #185536; border-color: #185536; }

.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 8px 12px; font-size: 0.68rem; letter-spacing: 0.1em; }

.login-hint {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.55;
}
.login-hint code {
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--taupe-dk);
  background: rgba(163, 139, 115, 0.12);
  padding: 1px 6px;
}

.login-badge {
  margin-top: 18px;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── App shell ─────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 28px 20px;
  background: rgba(43, 37, 32, 0.96);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(217, 203, 184, 0.22);
}

.side-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: brightness(1.05);
}

.side-brand strong {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
}

.side-brand span {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sand);
}

.nav-list { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-btn {
  text-align: left;
  padding: 11px 12px;
  color: rgba(250, 247, 242, 0.72);
  font-size: 0.84rem;
  border-left: 2px solid transparent;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-btn:hover { color: var(--paper); background: rgba(255,255,255,0.04); }
.nav-btn.is-active {
  color: var(--paper);
  border-left-color: var(--spark);
  background: rgba(201, 168, 119, 0.12);
}

.side-foot {
  padding-top: 14px;
  border-top: 1px solid rgba(217, 203, 184, 0.22);
  font-size: 0.74rem;
  color: rgba(250, 247, 242, 0.55);
}
.side-foot .user { color: var(--sand); margin-bottom: 10px; }
.side-foot .btn-ghost {
  color: var(--paper);
  border-color: rgba(217, 203, 184, 0.35);
  width: 100%;
}
.side-foot .btn-ghost:hover {
  border-color: var(--sand);
  color: var(--sand);
}

.main {
  padding: 28px clamp(18px, 3vw, 36px) 40px;
  background:
    radial-gradient(ellipse 60% 35% at 100% 0%, rgba(201, 168, 119, 0.1), transparent 50%),
    var(--ivory);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--taupe-dk);
  margin-bottom: 8px;
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--taupe);
}

.topbar h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.015em;
}

.topbar p {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--ink-faint);
}

.demo-pill {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe-dk);
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: rgba(250, 247, 242, 0.7);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Form modal */
.form-backdrop {
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.form-panel {
  width: min(560px, 100%);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px 22px 26px;
  animation: fade-up 0.28s var(--ease);
}
@keyframes fade-up {
  from { transform: translateY(10px); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}
.form-hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: -6px 0 16px;
  line-height: 1.45;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.form-grid label {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--taupe-dk);
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid input,
.form-grid select,
.form-grid textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--ivory);
  color: var(--ink);
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}
.form-grid textarea { resize: vertical; min-height: 72px; }
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--taupe-dk);
}
.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-transform: none !important;
  letter-spacing: 0.02em !important;
  font-size: 0.86rem !important;
  font-weight: 400 !important;
  color: var(--ink-soft) !important;
  margin-top: 4px;
}
.check-row input {
  width: auto !important;
  margin: 0 !important;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.kpi {
  padding: 18px 16px;
  border-top: 1px solid var(--line);
  background: rgba(250, 247, 242, 0.55);
}
.kpi span {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe-dk);
  margin-bottom: 8px;
}
.kpi strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1;
}
.kpi small {
  display: block;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.search {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.search:focus { outline: none; border-color: var(--taupe-dk); }

.select {
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  min-width: 150px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  padding: 7px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line-soft);
  color: var(--ink-soft);
  background: transparent;
}
.chip.is-on {
  border-color: var(--taupe);
  color: var(--taupe-dk);
  background: rgba(163, 139, 115, 0.12);
}

/* Table / list */
.panel {
  border: 1px solid var(--line-soft);
  background: rgba(250, 247, 242, 0.65);
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }

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

th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe-dk);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: rgba(243, 237, 228, 0.7);
}

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
tbody tr {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
tbody tr:hover { background: rgba(163, 139, 115, 0.08); }

.company {
  font-weight: 500;
  color: var(--ink);
}
.company-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 300;
  color: var(--ink-faint);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-novo { color: var(--taupe-dk); background: rgba(201, 168, 119, 0.15); }
.badge-contato { color: #3d5a6c; background: rgba(61, 90, 108, 0.1); border-color: rgba(61, 90, 108, 0.25); }
.badge-proposta { color: var(--warn); background: rgba(154, 107, 58, 0.1); border-color: rgba(154, 107, 58, 0.28); }
.badge-negociacao { color: #5a4a7a; background: rgba(90, 74, 122, 0.1); border-color: rgba(90, 74, 122, 0.25); }
.badge-fechado { color: var(--ok); background: rgba(90, 122, 90, 0.12); border-color: rgba(90, 122, 90, 0.28); }
.badge-perdido { color: var(--muted); background: rgba(138, 126, 114, 0.12); }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot-yes { background: var(--ok); }
.dot-no { background: var(--sand); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions .btn { white-space: nowrap; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

/* Dashboard extras */
.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-top: 8px;
}

.block {
  border: 1px solid var(--line-soft);
  background: rgba(250, 247, 242, 0.55);
  padding: 18px 16px;
}
.block h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.feed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.84rem;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item strong { font-weight: 500; }
.feed-item span {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.pipe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.8rem;
}
.pipe-row .label { flex: 0 0 110px; color: var(--ink-soft); }
.pipe-bar {
  flex: 1;
  height: 6px;
  background: rgba(163, 139, 115, 0.15);
  overflow: hidden;
}
.pipe-bar i {
  display: block;
  height: 100%;
  background: var(--taupe);
}
.pipe-row .n {
  flex: 0 0 28px;
  text-align: right;
  font-weight: 500;
  color: var(--ink);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(43, 37, 32, 0.45);
  display: none;
  align-items: stretch;
  justify-content: flex-end;
}
.modal-backdrop.is-open { display: flex; }

.drawer {
  width: min(440px, 100%);
  height: 100%;
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: 24px 22px 32px;
  overflow-y: auto;
  animation: slide-in 0.28s var(--ease);
}

@keyframes slide-in {
  from { transform: translateX(16px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-head h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
}
.drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-soft);
}
.drawer-close:hover { border-color: var(--taupe-dk); color: var(--ink); }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.meta-item span {
  display: block;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe-dk);
  margin-bottom: 4px;
}
.meta-item strong {
  font-weight: 400;
  font-size: 0.9rem;
}

.notes {
  margin: 16px 0;
  padding: 14px;
  background: rgba(243, 237, 228, 0.7);
  border: 1px solid var(--line-soft);
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.history { margin-top: 8px; }
.history li {
  position: relative;
  padding: 10px 0 10px 16px;
  border-left: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.history li::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--spark);
}
.history time {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-bottom: 2px;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 16px;
  background: rgba(43, 37, 32, 0.96);
  color: var(--paper);
  align-items: center;
  justify-content: space-between;
}
.mobile-bar strong {
  font-family: var(--serif);
  font-weight: 400;
}

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease);
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-bar { display: flex; }
  .side-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(43, 37, 32, 0.4);
  }
  .side-overlay.is-on { display: block; }
}
