/* Studio Conversio — Agency OS — design system próprio (substitui o Tailwind via CDN) */

:root {
  --bg: #0a0a0b;
  --surface: rgba(255, 255, 255, .03);
  --surface-hover: rgba(255, 255, 255, .05);
  --surface-strong: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .08);
  --border-hover: rgba(255, 255, 255, .14);
  --text: #f2f2f3;
  --text-dim: #93949d;
  --text-faint: #55565f;
  --accent: #e6a23c;
  --accent-hover: #f0b25a;
  --accent-ink: #16110a;
  --danger: #e5555c;
  --danger-bg: rgba(229, 85, 92, .1);
  --success: #34b689;
  --success-bg: rgba(52, 182, 137, .1);
  --info: #4d8fe0;
  --info-bg: rgba(77, 143, 224, .1);
  --purple: #8f7de0;
  --purple-hover: #a293e8;
  --purple-bg: rgba(143, 125, 224, .1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 24px 48px -16px rgba(0, 0, 0, .5);
  --shadow-sm: 0 8px 20px -8px rgba(0, 0, 0, .4);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Clash Display', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body { background-image: radial-gradient(800px 420px at 12% -12%, rgba(230, 162, 60, .05), transparent 60%); }

[x-cloak] { display: none !important; }
a { color: inherit; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; opacity: .6; }

/* --- utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden-mobile { display: flex; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

/* --- auth screen (login.php) --- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 40px 36px; text-align: center;
}
.auth-logo { height: 40px; margin-bottom: 30px; opacity: .92; }
.auth-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0 0 26px; letter-spacing: -.01em; }
.auth-error {
  margin-top: 18px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--danger-bg); border: 1px solid rgba(229, 85, 92, .2); color: var(--danger); font-size: 13px; font-weight: 500;
}

/* --- form controls --- */
.field { width: 100%; margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; background: rgba(0, 0, 0, .2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230, 162, 60, .12); }
textarea.input { resize: vertical; }
.select-sm { background: rgba(0, 0, 0, .25); border: 1px solid var(--border); color: var(--text-dim); font-size: 12px; border-radius: var(--radius-sm); padding: 6px 8px; outline: none; }
.select-sm:focus { border-color: var(--accent); }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  padding: 10px 16px; transition: background .15s, border-color .15s, opacity .15s, filter .15s, color .15s;
  white-space: nowrap;
}
.btn:active { filter: brightness(.95); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-purple { background: var(--purple); color: #17132e; }
.btn-purple:hover { background: var(--purple-hover); }
.btn-ghost { background: var(--surface); color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-hover); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 12px; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-faint); padding: 4px; line-height: 1; transition: color .15s, opacity .15s; display: inline-flex; }
.icon-btn:hover { color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.info:hover { color: var(--info); }
.icon-btn.success { background: var(--success-bg); color: var(--success); border-radius: 6px; padding: 5px 9px; font-size: 12px; font-weight: 600; gap: 6px; }
.icon-btn.success:hover { background: rgba(52, 182, 137, .18); }
.icon-btn.success .icon { width: 13px; height: 13px; }

/* --- nav --- */
.nav {
  position: sticky; top: 0; z-index: 40; background: rgba(10, 10, 11, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 1240px; margin: 0 auto; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-brand img { height: 26px; }
.nav-version { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.nav-backup {
  font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--text-dim); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: var(--radius-sm); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.nav-backup:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-hover); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.loader { border: 2px solid var(--surface-strong); border-top: 2px solid var(--accent); border-radius: 50%; width: 14px; height: 14px; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; color: var(--text-faint); font: inherit; font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s; position: relative;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); background: var(--surface-strong); }
.tab-pill { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }

/* --- main / sections --- */
.main { max-width: 1240px; margin: 0 auto; padding: 26px 24px 60px; width: 100%; }
.section-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.section-title .icon { color: var(--accent); width: 18px; height: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

.alert-banner {
  background: var(--danger-bg); border: 1px solid rgba(229, 85, 92, .25); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.alert-banner strong { color: var(--danger); font-size: 14px; font-weight: 600; }
.alert-banner p { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

/* --- stat cards --- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--text-faint); margin: 0; }
.stat-value { font-size: 26px; font-weight: 600; margin: 8px 0 0; letter-spacing: -.01em; }
.stat-value.accent { color: var(--accent); }
.progress-track { width: 100%; height: 5px; background: rgba(0, 0, 0, .3); border-radius: 999px; margin-top: 13px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 24px; }
.chart-card h3 { margin: 0 0 20px; }
.chart-wrap { height: 300px; width: 100%; position: relative; }

/* --- table --- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: rgba(0, 0, 0, .18); }
thead th { padding: 13px 18px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
tbody tr { border-top: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: var(--surface-hover); }
tbody td { padding: 14px 18px; vertical-align: top; }
.empty-row td { text-align: center; color: var(--text-faint); padding: 40px; }
.row-actions { display: flex; justify-content: center; gap: 10px; opacity: .5; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
.chip { background: var(--surface-strong); color: var(--text-dim); border: 1px solid var(--border); font-size: 11px; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }

/* --- toolbar (busca) --- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 240px; min-width: 180px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-box .input { padding-left: 34px; }

/* --- partner ranking --- */
.partner-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.partner-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; position: relative; transition: border-color .15s; }
.partner-card:hover { border-color: var(--border-hover); }
.partner-card:hover .partner-actions { opacity: 1; }
.partner-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; opacity: 0; transition: opacity .15s; }
.partner-trophy { background: rgba(0, 0, 0, .25); border: 1px solid var(--border); border-radius: var(--radius-sm); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.partner-trophy .icon { width: 15px; height: 15px; }
.partner-total-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 0; }
.partner-total { font-size: 20px; font-weight: 600; margin: 5px 0 0; }

/* --- CRM / leads --- */
.lead-alert { background: rgba(229, 85, 92, .04); }
.tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; letter-spacing: .02em; }
.tag-late { background: var(--danger); color: #fff; }
.tag-future { background: var(--info); color: #fff; }
.lead-name { font-weight: 600; font-size: 14px; margin: 0; }
.lead-followup { font-family: ui-monospace, monospace; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); }
.lead-followup .icon { width: 12px; height: 12px; }
.lead-followup.late { border-color: rgba(229, 85, 92, .3); color: var(--danger); background: var(--danger-bg); }
.lead-followup.future { border-color: rgba(77, 143, 224, .3); color: var(--info); background: var(--info-bg); }
.lead-contact-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-dim); }
.lead-contact-row:hover { color: var(--text); }
.lead-contact-row .icon { width: 14px; height: 14px; }
.lead-hook { background: rgba(0, 0, 0, .2); border: 1px solid var(--border); padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }

/* --- modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 4, 5, .7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px;
}
.modal-card {
  width: 420px; max-width: 100%; background: #131315;
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 28px; position: relative;
}
.modal-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0 0 20px; letter-spacing: -.01em; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text-faint); cursor: pointer; display: inline-flex; }
.modal-close:hover { color: var(--text); }
.followup-box { background: rgba(0, 0, 0, .2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.followup-box label { color: var(--text-dim); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.hint { font-size: 11px; color: var(--text-faint); margin: 7px 0 0; }

/* --- notices (restaurar.php) --- */
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 18px; font-size: 13px; }
.notice a { text-decoration: underline; }
.notice-success { background: var(--success-bg); color: var(--success); border-color: rgba(52, 182, 137, .25); }
.notice-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(229, 85, 92, .25); }
.notice-warning { background: rgba(230, 162, 60, .1); color: var(--accent); border-color: rgba(230, 162, 60, .25); }
.danger-box { display: flex; gap: 12px; background: var(--danger-bg); border: 1px solid rgba(229, 85, 92, .22); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 22px; }
.danger-box .icon { color: var(--danger); flex-shrink: 0; margin-top: 2px; }
.danger-box p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.card-panel { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px; }
.file-input { width: 100%; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .partner-grid { grid-template-columns: 1fr; }
  .hidden-mobile { display: none !important; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
}
