/* crm.css — CRM web des demandes : sobre, lisible, clair et sombre. */
:root { --bg: #f6f5f1; --card: #fff; --line: #e3e0d8; --txt: #1d1b18; --mut: #6f6a60; --acc: #a4472c; --ok: #2f6b3e; --warn: #9a6a00; --bad: #a02a2a; --r: 10px; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --bg: #14130f; --card: #1d1c18; --line: #33302a; --txt: #ece9e1; --mut: #a29d92; --acc: #e08a6c; --ok: #7fc28f; --warn: #e0b54a; --bad: #e57c7c; } }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--txt); }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--card); padding: 6px 12px; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
input, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--card); width: 100%; }
a { color: var(--acc); }
.muted { color: var(--mut); }
.error { color: var(--bad); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(360px, 100%); padding: 28px; display: grid; gap: 12px; }
.login-card h1 { margin: 0; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 4px; }

.app { display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 2; }
.top .brand { font-size: 16px; }
.top input { max-width: 420px; }
.top #me { margin-left: auto; }
.sections { padding: 12px 8px; border-right: 1px solid var(--line); display: grid; align-content: start; gap: 2px; }
.sections button { border: 0; background: transparent; text-align: left; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.sections button.on { background: var(--card); font-weight: 600; box-shadow: inset 3px 0 0 var(--acc); }
.sections button span:first-child { min-width: 0; }
.count { align-self: center; flex: none; line-height: 18px; background: var(--acc); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.count.zero { background: transparent; color: var(--mut); font-weight: 400; }
.list { padding: 12px 16px; overflow: auto; }
.statuses { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.statuses button.on { background: var(--txt); color: var(--bg); border-color: var(--txt); }
table.leads { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.leads th, .leads td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.leads th { font-size: 12px; color: var(--mut); font-weight: 600; }
.leads tbody tr { cursor: pointer; }
.leads tbody tr:hover, .leads tbody tr.on { background: color-mix(in srgb, var(--acc) 8%, transparent); }
.leads td.sum { max-width: 420px; }
.leads td.when, .leads .tel { white-space: nowrap; }
.badge { display: inline-block; border-radius: 99px; padding: 1px 8px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.s-new { color: var(--acc); } .s-called, .s-reached { color: var(--warn); } .s-quoted { color: var(--txt); } .s-signed { color: var(--ok); } .s-lost { color: var(--mut); }
#more { margin-top: 10px; }

.detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--card); border-left: 1px solid var(--line); padding: 18px 20px; overflow: auto; z-index: 3; box-shadow: -8px 0 24px rgb(0 0 0 / .12); }
.detail h2 { margin: 4px 0; }
.detail .close { position: absolute; top: 10px; right: 10px; font-size: 20px; border: 0; }
.contact a { margin-right: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.actions.lost { padding: 8px; border: 1px dashed var(--line); border-radius: 8px; }
.actions button.done { border-color: var(--acc); }
.note { display: grid; gap: 6px; margin: 14px 0; }
.events { list-style: none; padding-left: 0; margin: 0; }
.events li { border-left: 2px solid var(--line); padding-left: 10px; }
.events li { margin-bottom: 6px; }
.events .note-text { white-space: pre-wrap; display: block; }
pre { white-space: pre-wrap; font: 12px/1.45 ui-monospace, Menlo, monospace; background: var(--bg); padding: 10px; border-radius: 8px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sections { grid-auto-flow: column; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .leads th:nth-child(2), .leads td:nth-child(2), .leads th:nth-child(6), .leads td:nth-child(6) { display: none; }
  .top #me { display: none; }
}
