:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211b;
  background: #f3f7f4;
  font-size: 16px;
  --green: #176b45;
  --green-dark: #0d4e31;
  --green-soft: #e5f4eb;
  --border: #dce6df;
  --muted: #68766e;
  --surface: #ffffff;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f7f4; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #dcefe4 0, transparent 34%), linear-gradient(145deg, #f8fbf9, #eaf2ed); }
.login-card { width: min(100%, 430px); display: grid; gap: 20px; padding: 38px; background: rgba(255,255,255,.94); border: 1px solid rgba(23,107,69,.12); border-radius: 24px; box-shadow: 0 24px 70px rgba(29,64,45,.12); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: white; background: var(--green); font-weight: 800; font-size: 1.3rem; box-shadow: 0 8px 20px rgba(23,107,69,.22); }
.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.8rem, 6vw, 2.35rem); letter-spacing: -.04em; }
h2 { margin-bottom: 7px; font-size: 2rem; letter-spacing: -.04em; }
h3 { margin-bottom: 0; font-size: 1.45rem; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 7px; color: #34443a; font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: 12px 13px; color: #17211b; background: #fff; border: 1px solid #cfdcd3; border-radius: 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,69,.12); }
textarea { resize: vertical; }
.primary, .secondary, .ghost, .icon-button { min-height: 42px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 750; }
.primary { color: white; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--green-dark); background: white; border-color: #cddbd2; }
.secondary:hover, .ghost:hover { background: #eef5f0; }
.ghost { color: #435148; background: transparent; border-color: transparent; }
.error { min-height: 1.3em; margin: 0; color: var(--danger); font-size: .88rem; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px clamp(20px, 5vw, 72px); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.brand { display: flex; gap: 12px; align-items: center; }
.brand strong, .brand span { display: block; }
.brand div > span { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.content { width: min(1500px, 100%); margin: auto; padding: 42px clamp(18px, 5vw, 72px) 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading p:last-child { margin-bottom: 0; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 28px 0 18px; }
.stats article { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: 0 8px 24px rgba(31,67,46,.04); }
.stats span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.stats strong { font-size: 1.8rem; letter-spacing: -.04em; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 220px; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 15px 15px 0 0; }
.toolbar label span { font-size: .76rem; }
.table-card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 15px 15px; box-shadow: 0 12px 30px rgba(31,67,46,.05); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1120px; }
th { padding: 13px 15px; color: #66736b; background: #f8faf8; border-bottom: 1px solid var(--border); text-align: left; font-size: .75rem; letter-spacing: .03em; text-transform: uppercase; }
td { padding: 14px 15px; border-bottom: 1px solid #edf2ee; vertical-align: middle; font-size: .88rem; }
tbody tr:hover { background: #fbfdfb; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
td a { color: var(--green-dark); text-decoration: none; font-weight: 700; }
.date { color: #4e5e54; white-space: nowrap; }
.source { display: inline-flex; padding: 5px 9px; color: #315241; background: #eef5f0; border-radius: 999px; font-size: .77rem; font-weight: 750; }
.status { min-width: 130px; padding: 9px 30px 9px 10px; font-size: .82rem; font-weight: 750; }
.status-novo { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.status-contatado { color: #6941c6; background: #f4f3ff; border-color: #d9d6fe; }
.status-negociacao { color: #b54708; background: #fffaeb; border-color: #fedf89; }
.status-convertido { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.status-perdido { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.notes { min-width: 230px; padding: 9px 10px; font-size: .82rem; }
.save-row { min-height: 36px; padding: 7px 12px; font-size: .8rem; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 13px 16px; background: #fbfcfb; }
.pagination span { color: var(--muted); font-size: .82rem; }
.empty { display: grid; justify-items: center; gap: 7px; padding: 70px 20px; color: var(--muted); }
.empty strong { color: #304137; }

dialog { width: min(92vw, 500px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 28px 80px rgba(20,43,29,.25); }
dialog::backdrop { background: rgba(14,30,20,.54); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 17px; padding: 26px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.icon-button { min-height: 36px; padding: 3px 10px; color: #59675e; background: transparent; font-size: 1.7rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 360px; padding: 13px 17px; color: white; background: #173b29; border-radius: 10px; box-shadow: 0 12px 30px rgba(19,54,35,.25); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error-toast { background: #8f241c; }

@media (max-width: 760px) {
  .login-card { padding: 28px 22px; }
  .content { padding-top: 28px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .heading-actions button { flex: 1; }
  .stats { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  h2 { font-size: 1.7rem; }
}
