/* KualoFlow - interface. GotWork Labs. */
:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --muted: #475569;
  --primary: #4F46E5;
  --primary-ink: #FFFFFF;
  --primary-soft: #EEF2FF;
  --primary-text: #3730A3;
  --sidebar: #0F172A;
  --sidebar-text: #CBD5E1;
  --sidebar-active: #1E293B;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --success: #15803D;
  --success-soft: #DCFCE7;
  --warning: #9A3412;
  --warning-soft: #FFEDD5;
  /* cores de temperatura do lead */
  --cold-bg: #FEF9C3; --cold-text: #713F12; --cold-dot: #CA8A04;
  --warm-bg: #FFEDD5; --warm-text: #7C2D12; --warm-dot: #EA580C;
  --hot-bg: #DCFCE7;  --hot-text: #14532D;  --hot-dot: #16A34A;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary-text); }
a:hover { color: #312E81; }
h1 { font-size: 24px; margin: 0; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estrutura ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar {
  flex: 1 1 240px; max-width: 100%;
  background: var(--sidebar); color: var(--sidebar-text);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; color: #fff; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand img { max-height: 32px; max-width: 160px; }
.brand-name { font-weight: 700; font-size: 18px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #94A3B8; padding: 14px 12px 4px; }
.nav-link { color: var(--sidebar-text); text-decoration: none; padding: 9px 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.nav-link:hover { background: var(--sidebar-active); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-soon { font-size: 10.5px; color: #94A3B8; border: 1px solid #334155; border-radius: 999px; padding: 0 6px; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; font-size: 12px; color: #94A3B8; }
.sidebar-foot a { color: #C7D2FE; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.impersonation { background: #7C2D12; color: #fff; padding: 8px 28px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.impersonation button { background: #fff; color: #7C2D12; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn, button {
  font: inherit; font-weight: 600; font-size: 14px;
  min-height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover, button:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #4338CA; color: #fff; }
.btn-danger { color: var(--danger); border-color: #FCA5A5; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-link { border: 0; background: none; padding: 0; min-height: 0; color: var(--primary-text); font-weight: 500; text-decoration: underline; }
.btn-link:hover { background: none; }
form.inline { display: inline; }

label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; }
.field small { color: var(--muted); margin-top: 4px; font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=url], select, textarea {
  font: inherit; font-size: 14px; width: 100%;
  min-height: 42px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
input[disabled] { background: var(--surface-2); color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 0; }
.check input { width: 18px; height: 18px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.span-all { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 10px 14px; background: var(--surface-2); white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid #F1F5F9; vertical-align: middle; }
tr:hover td { background: #FCFCFE; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: #F1F5F9; color: #334155; white-space: nowrap; }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-cold { background: var(--cold-bg); color: var(--cold-text); }
.badge-warm { background: var(--warm-bg); color: var(--warm-text); }
.badge-hot { background: var(--hot-bg); color: var(--hot-text); }

.alert { border-radius: 10px; padding: 12px 16px; border: 1px solid; }
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }
.alert-info { background: var(--primary-soft); border-color: #C7D2FE; color: var(--primary-text); }
.alert-warning { background: #FFF7ED; border-color: #FED7AA; color: #7C2D12; }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: #C7D2FE; color: var(--primary-text); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.user-menu { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: #334155; font-size: 13px; }
.tab.active { background: var(--text); color: #fff; border-color: var(--text); font-weight: 600; }

/* matriz de permissões */
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix select { min-height: 32px; padding: 2px 8px; font-size: 12.5px; width: auto; }
.perm-fns { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.perm-fns label { font-weight: 500; display: flex; gap: 6px; align-items: center; margin: 0; font-size: 13px; }

/* ---------- autenticação ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--sidebar); }
.auth-hero { flex: 1 1 420px; padding: 56px; color: #E2E8F0; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-hero h1 { color: #fff; font-size: 38px; line-height: 1.15; max-width: 520px; }
.auth-hero .temps { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.auth-hero a { color: #C7D2FE; }
.auth-panel { flex: 1 1 460px; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 22px; margin: 0; }
.code-inputs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code-inputs input { text-align: center; font-size: 22px; font-weight: 600; min-height: 52px; padding: 0; }
.progress { height: 6px; background: #F1F5F9; border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width 1s linear; }
.qr { width: 196px; height: 196px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.qr canvas, .qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 14px; }
.secret { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 6px; }

.footer-credit { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

@media (max-width: 720px) {
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 12px 16px; }
  .auth-hero { padding: 32px 20px; }
  .auth-hero h1 { font-size: 28px; }
  .auth-card { padding: 24px; }
}
