/* Clyo — marca (violeta, coral, tinta, lavanda; Outfit + Inter) com superfícies de vidro fosco sóbrias */
:root {
  --brand: #5b3df5; --brand-d: #4a2ee0; --brand-l: #f0edff; --coral: #ff6b4a; --lav: #f6f5ff;
  --bg: #f3f2fa; --card: rgba(255,255,255,.74); --solid: #fff; --text: #17172b; --muted: #55556b; --line: #eeecf7;
  --glass-b: rgba(255,255,255,.85); --blur: saturate(160%) blur(18px);
  --side: #17172b; --side-t: #3a3a50; --side-h: rgba(255,255,255,.75);
  --ok: #18864b; --warn: #c2620a; --bad: #d92d20; --info: #2f5bd3;
  --r: 18px; --r-sm: 12px;
  --sh: 0 1px 2px rgba(23,23,43,.04), 0 8px 24px -6px rgba(23,23,43,.10);
  --sh-lg: 0 24px 60px -12px rgba(23,23,43,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(91,61,245,.10), transparent 60%),
    radial-gradient(800px 600px at 100% 10%, rgba(255,107,74,.06), transparent 60%),
    radial-gradient(700px 500px at 60% 100%, rgba(91,61,245,.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font: 700 26px/1.2 Outfit, Inter, sans-serif; margin: 0; letter-spacing: -.5px; }
h2 { font: 600 17px/1.3 Outfit, Inter, sans-serif; margin: 0 0 14px; letter-spacing: -.2px; }

/* Superfície de vidro (base comum) */
.card, .kpi, #sidebar, .topbar, .login-card, .kcol, .dropdown, .search-results {
  background: var(--card); border: 1px solid var(--glass-b);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--sh);
}

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(700px 500px at 20% 20%, rgba(91,61,245,.28), transparent 60%),
              radial-gradient(700px 500px at 80% 80%, rgba(255,107,74,.22), transparent 60%), #f6f5ff; }
.login-card p.muted { text-align: center; margin: 0 0 8px; }
.login-card { padding: 34px; border-radius: 24px; width: 100%; max-width: 390px; box-shadow: var(--sh-lg); background: rgba(255,255,255,.72); }
.login-card label { display: block; margin: 14px 0; font-weight: 550; font-size: 13px; }
.login-card input { margin-top: 6px; }

/* Layout */
#app { display: flex; min-height: 100%; gap: 0; }
#sidebar { width: 236px; flex-shrink: 0; position: sticky; top: 12px; height: calc(100vh - 24px); margin: 12px 0 12px 12px;
  overflow-y: auto; border-radius: 22px; padding: 6px 10px 14px; color: var(--side-t); scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 10px; color: var(--text); }
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.brand span { font: 600 26px/1 Outfit, Inter, sans-serif; letter-spacing: -.6px; }
.brand.big { justify-content: center; padding: 0 0 6px; }
.brand.big svg { width: 40px; height: 40px; }
.brand.big span { font-size: 36px; }
#nav a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin: 2px 0; color: var(--side-t); border-radius: 12px; font-weight: 500; transition: background .15s, color .15s; }
#nav a span { width: 20px; text-align: center; }
#nav a:hover { background: rgba(255,255,255,.8); color: var(--text); text-decoration: none; }
#nav a.active { background: var(--side); color: #fff; box-shadow: 0 6px 16px -4px rgba(23,23,43,.45); }
#nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding: 16px 12px 4px; color: #8995a3; font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; margin: 12px 12px 0 16px; border-radius: 18px; position: sticky; top: 12px; z-index: 20; }
#menuBtn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { border-radius: 99px; padding: 9px 16px 9px 38px; background: rgba(255,255,255,.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2355556b' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center; }
.search-results { position: absolute; top: 46px; left: 0; right: 0; border-radius: var(--r-sm); background: rgba(255,255,255,.95); box-shadow: var(--sh-lg); max-height: 400px; overflow: auto; padding: 6px; }
.search-results a { display: block; padding: 8px 12px; color: var(--text); border-radius: 8px; }
.search-results a:hover { background: var(--brand-l); text-decoration: none; }
.search-results small { color: var(--muted); margin-left: 6px; }
.user { margin-left: auto; position: relative; }
.user-btn { background: rgba(255,255,255,.7); border: 1px solid var(--glass-b); border-radius: 99px; padding: 4px 14px 4px 4px; cursor: pointer; display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 550; color: var(--text); }
.user-btn:hover { background: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 12px; }
.dropdown { position: absolute; right: 0; top: 46px; border-radius: var(--r-sm); background: rgba(255,255,255,.95); box-shadow: var(--sh-lg); min-width: 210px; overflow: hidden; padding: 6px; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; background: none; border: 0; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: rgba(23,23,43,.05); text-decoration: none; }
#view { padding: 22px 12px 28px 16px; max-width: 1420px; width: 100%; }

/* Componentes */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(23,23,43,.10); background: rgba(255,255,255,.85); color: var(--text); padding: 8px 16px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(23,23,43,.05); transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: #fff; box-shadow: 0 4px 12px -4px rgba(23,23,43,.18); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(91,61,245,.6), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: #fdeceb; }
.btn.sm { padding: 4px 12px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; margin-top: 8px; }
.icon-btn { background: rgba(255,255,255,.7); border: 1px solid var(--glass-b); width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--text); }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid rgba(23,23,43,.14); border-radius: 10px; font: inherit; background: rgba(255,255,255,.9); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,61,245,.18); background: #fff; }
textarea { min-height: 90px; resize: vertical; }
.error { color: var(--bad); min-height: 20px; margin: 6px 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { max-width: 280px; border-radius: 99px; padding-left: 16px; }
.toolbar select { width: auto; border-radius: 99px; padding: 9px 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; background: rgba(23,23,43,.035); cursor: pointer; user-select: none; white-space: nowrap; border-bottom: 0; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; transition: background .1s; }
tbody tr.click:hover { background: rgba(91,61,245,.05); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(23,23,43,.07); color: #3f4b5b; white-space: nowrap; }
.b-ok { background: #e1f4e8; color: var(--ok); }
.b-warn { background: #fdf0dc; color: var(--warn); }
.b-bad { background: #fde8e6; color: var(--bad); }
.b-info { background: #e5ecfd; color: var(--info); }
.b-brand { background: var(--brand-l); color: var(--brand-d); }

/* Painel */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; border-radius: var(--r); padding: 16px 18px; border-top: 0 solid var(--brand); transition: transform .15s, box-shadow .15s; }
/* a cor de cada indicador vem do style inline (border-top-color) e aparece como um traço no topo */
.kpi::before { content: ""; display: block; width: 28px; border-top: 4px solid; border-top-color: inherit; border-radius: 4px; margin-bottom: 10px; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(23,23,43,.22); }
.kpi .v { font: 700 28px/1.2 Outfit, Inter, sans-serif; margin-top: 4px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 550; }
.kpi a { color: inherit; display: block; }
.kpi a:hover { text-decoration: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 12px; color: var(--muted); }
.bars .bar i { display: block; width: 100%; max-width: 44px; background: var(--brand); border-radius: 10px 10px 4px 4px; min-height: 3px; box-shadow: 0 6px 14px -6px rgba(91,61,245,.5); }
.bars .bar span { margin-top: 6px; }
.bars .bar b { font-size: 11px; color: var(--text); margin-bottom: 4px; font-weight: 600; }
.hbar { margin: 10px 0; }
.hbar .t { display: flex; justify-content: space-between; font-size: 13px; }
.hbar .track { height: 8px; background: rgba(23,23,43,.07); border-radius: 9px; overflow: hidden; margin-top: 4px; }
.hbar .track i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.list-plain li:last-child { border-bottom: 0; }
.progress { height: 6px; background: rgba(23,23,43,.08); border-radius: 9px; overflow: hidden; min-width: 80px; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }

/* Formulário */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { font-weight: 550; font-size: 13px; display: block; }
.form-grid label > input, .form-grid label > select, .form-grid label > textarea { margin-top: 5px; font-weight: 400; }
.req { color: var(--bad); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.items-table input { padding: 6px 8px; }
.items-table td { padding: 6px; }
.totals { margin-left: auto; max-width: 320px; margin-top: 10px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 17px; font-weight: 700; border-top: 2px solid var(--line); padding-top: 8px; }

/* Detalhes */
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; }
.details .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.details .v { margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.details .full { grid-column: 1 / -1; }
.tabs { display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 14px; overflow-x: auto; max-width: 100%; background: rgba(23,23,43,.05); border-radius: 99px; }
.tabs button { background: none; border: 0; padding: 7px 14px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; border-radius: 99px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); background: #fff; box-shadow: 0 2px 8px -2px rgba(23,23,43,.2); }
.thread .msg { border: 1px solid var(--line); background: rgba(255,255,255,.6); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.thread .msg header { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.thread .msg.first { background: var(--brand-l); border-color: rgba(91,61,245,.15); }
.thread .msg p { margin: 0; white-space: pre-wrap; }

/* Kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { background: rgba(246,245,255,.85); border-radius: var(--r); min-width: 260px; width: 260px; flex-shrink: 0; padding: 10px; }
.kcol h3 { font-size: 13px; margin: 4px 6px 10px; display: flex; justify-content: space-between; font-weight: 650; }
.kcol.over { outline: 2px dashed var(--brand); outline-offset: -2px; }
.kcard { background: rgba(255,255,255,.92); border: 1px solid #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(23,23,43,.06), 0 4px 10px -4px rgba(23,23,43,.12); cursor: grab; transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: 0 10px 24px -8px rgba(23,23,43,.25); transform: translateY(-1px); }
.kcard .t { font-weight: 600; }
.kcard .s { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }
.kdrop { min-height: 40px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: rgba(23,23,43,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--sh-lg); z-index: 100; max-width: 360px; }
.toast.err { background: var(--bad); }

/* Histórico de atividades e follow-ups */
.fu { font-weight: 600; white-space: nowrap; }
.fu-late { color: var(--bad); }
.fu-today { color: var(--warn); background: #fdf0dc; padding: 1px 8px; border-radius: 99px; }
.fu-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#fupCard { border-left: 4px solid var(--brand); }
.logform { background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.logform textarea { min-height: 70px; }
.logform .quick { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 2px; }
.linkbtn:hover { color: var(--bad); }

/* Sem suporte a desfoque: superfícies opacas para manter a leitura */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --card: #fff; }
}

@media (max-width: 860px) {
  #sidebar { position: fixed; left: -260px; top: 8px; margin: 0; height: calc(100vh - 16px); z-index: 50; transition: left .2s; background: rgba(255,255,255,.95); }
  #sidebar.open { left: 8px; box-shadow: var(--sh-lg); }
  #menuBtn { display: block; }
  #view { padding: 16px; }
  .topbar { margin: 8px 8px 0; top: 8px; }
  .user-btn { padding: 3px; }
  .user-btn .name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Multiempresa: nome da empresa sob o nome do usuário */
.user-btn .name small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1.1; }

/* Histórico de atividades e follow-ups */
.fu { font-weight: 600; white-space: nowrap; }
.fu-late { color: var(--bad); }
.fu-today { color: var(--warn); background: #fff3dc; padding: 1px 8px; border-radius: 99px; }
.fu-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#fupCard { border-left: 4px solid var(--brand); }
.logform { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 16px; }
.logform textarea { min-height: 70px; }
.logform .quick { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 2px; }
.linkbtn:hover { color: var(--bad); }

/* Funil de vendas: previsão, relatórios e motivo da perda */
.kcol .ksub { font-size: 12px; color: var(--muted); margin: -6px 0 8px; }
.kcard .late { color: var(--bad); font-weight: 600; }
.track.bad i { background: var(--bad); }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.toolbar label.inline input { width: auto; }
tfoot td { background: #fafbfc; border-top: 2px solid var(--line); }
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 420px; margin: 0; }

/* Planos */
.plan-info { background: rgba(91,61,245,.06); border: 1px solid rgba(91,61,245,.15); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.plan-card { border-left: 4px solid var(--brand); }
.plan-card p { margin: 6px 0 0; }
.plan-locked h2 { margin: 8px 0; }
.plan-locked p { margin: 6px auto; max-width: 520px; }
