/* ============================================================
   APE CRM — styles.css
   TecnoPVC branding: #32373c primary, #0073aa accent
   Poppins, dark sidebar, premium SaaS look
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* ── Custom Properties ──────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #0073aa;
  --primary-dark:   #005a87;
  --primary-light:  #e8f4fb;
  --accent:         #0073aa;
  --accent-light:   #e8f4fb;

  /* Neutrals */
  --bg:             #F0F2F5;
  --card:           #FFFFFF;
  --border:         #E4E7EC;
  --border-light:   #F2F4F7;
  --text:           #1A202C;
  --muted:          #718096;
  --faint:          #A0AEC0;
  --navy:           #1C2028;
  --navy-mid:       #252B35;

  /* Layout */
  --sidebar-w:      230px;
  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      14px;

  /* Shadows */
  --shadow:         0 1px 8px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md:      0 4px 20px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.14), 0 4px 16px rgba(0,0,0,.08);

  /* Motion */
  --transition:     .17s ease;
  --transition-md:  .25s ease;
}

/* ── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; border: none; background: none; }

input, select, textarea {
  font-family: inherit;
  font-size: .9rem;
}

/* ── Login Screen ───────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(145deg, #0d1117 0%, #161b24 50%, #0d1520 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  overflow: hidden;
  transition: opacity .45s ease;
}

#login-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Floating animated background circles */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-bg span {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: .06;
  animation: float-circle linear infinite;
}

.login-bg span:nth-child(1) {
  width: 520px; height: 520px;
  top: -140px; left: -120px;
  animation-duration: 20s;
  animation-delay: 0s;
}

.login-bg span:nth-child(2) {
  width: 340px; height: 340px;
  bottom: -90px; right: 4%;
  opacity: .04;
  animation-duration: 26s;
  animation-delay: -7s;
}

.login-bg span:nth-child(3) {
  width: 240px; height: 240px;
  top: 52%; right: 22%;
  opacity: .035;
  animation-duration: 16s;
  animation-delay: -4s;
}

@keyframes float-circle {
  0%   { transform: translateY(0) scale(1);        }
  33%  { transform: translateY(-44px) scale(1.05); }
  66%  { transform: translateY(22px) scale(.96);   }
  100% { transform: translateY(0) scale(1);        }
}

/* Login card */
.login-card {
  position: relative;
  z-index: 1;
  background: #13191f;
  border: 1px solid #1e2832;
  border-radius: var(--radius-lg);
  padding: 48px 44px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 90px rgba(0,0,0,.7), 0 8px 32px rgba(0,0,0,.4);
  border-top: 3px solid var(--primary);
  animation: card-rise .55s cubic-bezier(.22,.68,0,1.2) both;
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.login-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #E2E8F0;
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: -.01em;
}

.login-sub {
  font-size: .8rem;
  color: #5a6882;
  text-align: center;
  margin-bottom: 30px;
}

.login-err {
  display: none;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.28);
  color: #f87171;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: .8rem;
  margin-bottom: 16px;
  animation: err-shake .25s ease;
}

.login-err.visible { display: block; }

@keyframes err-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-7px); }
  75%      { transform: translateX(7px); }
}

.form-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.login-input-wrap { margin-bottom: 16px; }

.login-input {
  width: 100%;
  background: #0f1520;
  border: 1.5px solid #1e2d40;
  border-radius: var(--radius-sm);
  color: #D1D9E6;
  padding: 12px 15px;
  font-size: .88rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,115,170,.18);
}

.login-input::placeholder { color: #2e3e52; }

.login-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  margin-top: 8px;
  cursor: pointer;
  letter-spacing: .3px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.login-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(0,115,170,.40);
  transform: translateY(-1px);
}

.login-btn:active { transform: translateY(0); }

.login-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

/* ── App Layout ─────────────────────────────────────────── */
#app {
  display: none;
  min-height: 100vh;
}

#app.visible {
  display: flex;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform .25s ease;
  border-right: 1px solid rgba(255,255,255,.04);
}

.logo-area {
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.15);
}

/* Nav buttons */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  color: #8A9BB0;
  font-size: .84rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  text-align: left;
  letter-spacing: .01em;
}

.nav-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity var(--transition);
}

.nav-btn:hover {
  color: #D1D9E6;
  background: rgba(255,255,255,.055);
}

.nav-btn:hover svg { opacity: 1; }

.nav-btn.active {
  color: var(--accent, #0073aa);
  border-left-color: var(--accent, #0073aa);
  background: rgba(0,115,170,.12);
  font-weight: 600;
}

.nav-btn.active svg { opacity: 1; color: var(--accent, #0073aa); }

/* Nav section labels */
.nav-section {
  padding: 16px 20px 6px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #384352;
}

/* User area at bottom of sidebar */
.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.2);
}

.logout-btn {
  margin-left: auto;
  color: #4a5568;
  padding: 6px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.logout-btn:hover { color: #fc8181; background: rgba(239,68,68,.1); }

/* Role badges */
.role-badge {
  display: inline-block;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
}

.role-admin    { background: rgba(99,102,241,.2); color: #a5b4fc; }
.role-vendedor { background: rgba(0,115,170,.18); color: #63b3ed; }
.role-instalador { background: rgba(251,191,36,.14); color: #f6ad55; }

/* ── Main Content ───────────────────────────────────────── */
#main {
  flex: 1;
  min-width: 0;
  padding: 28px 28px 56px;
  overflow-y: auto;
  max-height: 100vh;
  overflow-x: hidden;
}

/* ── Views ──────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: fade-in .22s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-sub {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 400;
}

/* ── Metric Cards ───────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--transition-md), transform var(--transition-md);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  opacity: 0;
  transition: opacity var(--transition-md);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.metric-card:hover::before { opacity: 1; }

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg { width: 22px; height: 22px; }

.metric-icon.green  { background: #ECFDF5; color: #059669; }
.metric-icon.blue   { background: #EFF6FF; color: #2563EB; }
.metric-icon.accent { background: var(--primary-light); color: var(--primary); }
.metric-icon.orange { background: #FFF7ED; color: #EA6700; }
.metric-icon.purple { background: #F5F3FF; color: #7C3AED; }
.metric-icon.red    { background: #FEF2F2; color: #DC2626; }
.metric-icon.yellow { background: #FEFCE8; color: #CA8A04; }

.metric-body {}
.metric-label {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.metric-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin: 4px 0 2px;
  letter-spacing: -.02em;
}
.metric-delta { font-size: .74rem; color: var(--muted); font-weight: 500; }
.metric-delta.up   { color: #059669; }
.metric-delta.down { color: #DC2626; }

/* ── Panels ─────────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  background: #FAFBFC;
}

.panel-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.panel-body { padding: 20px; }

/* Two-column grid for panels */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: #F7F8FA;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: #F0F7FF; }

tbody tr:nth-child(even) { background: #FAFBFC; }
tbody tr:nth-child(even):hover { background: #ECF5FF; }

tbody td {
  padding: 12px 14px;
  color: var(--text);
  vertical-align: middle;
}

.td-muted { color: var(--muted); font-size: .8rem; }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }

.form-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}

.form-control {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .88rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,115,170,.12);
}

.form-control::placeholder { color: var(--faint); }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: .72rem; color: var(--faint); margin-top: 2px; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  cursor: pointer;
}

.form-check input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Search input */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,115,170,.10);
}

.search-input::placeholder { color: var(--faint); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .01em;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(0,115,170,.35);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: #F3F4F6;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #E8EAED;
  border-color: #D1D5DB;
  text-decoration: none;
}

.btn-danger {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-danger:hover {
  background: #DC2626;
  color: #fff;
  border-color: #DC2626;
  box-shadow: 0 4px 14px rgba(220,38,38,.3);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover { background: #F3F4F6; color: var(--text); text-decoration: none; }

.btn-sm { font-size: .76rem; padding: 5px 11px; }
.btn-lg { font-size: .95rem; padding: 12px 24px; }

.btn:disabled, .btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: 1.5px solid transparent;
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--bg); color: var(--text); border-color: var(--border); }

/* ── Pills / Badges ─────────────────────────────────────── */
.pill {
  display: inline-block;
  font-size: .69rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .4px;
  white-space: nowrap;
}

/* Stage pills */
.pill-novo         { background: #EFF6FF; color: #1D4ED8; }
.pill-em-andamento { background: #FFF7ED; color: #C2410C; }
.pill-aguardando   { background: #FEFCE8; color: #92400E; }
.pill-aprovado     { background: #ECFDF5; color: #065F46; }
.pill-recusado     { background: #FEF2F2; color: #DC2626; }
.pill-instalacao   { background: #F5F3FF; color: #6D28D9; }
.pill-concluido    { background: #ECFDF5; color: #065F46; }
.pill-cancelado    { background: #F3F4F6; color: #6B7280; }

/* Source pills */
.pill-source {
  background: #EEF2F7;
  color: #4A5568;
  font-weight: 600;
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot-green  { background: #059669; }
.dot-blue   { background: #2563EB; }
.dot-orange { background: #EA6700; }
.dot-red    { background: #DC2626; }
.dot-gray   { background: #9CA3AF; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  font-family: inherit;
  font-size: .83rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  border-radius: 4px 4px 0 0;
}

.tab-btn:hover { color: var(--text); background: rgba(0,0,0,.025); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Avatars ────────────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .5px;
  text-transform: uppercase;
  user-select: none;
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Modal ──────────────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 8000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlay-in .18s ease;
}

#modal-overlay.open { display: flex; }

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  animation: modal-rise .22s cubic-bezier(.22,.68,0,1.15) both;
  border: 1px solid var(--border);
}

@keyframes modal-rise {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1);      }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }

.modal-close {
  color: var(--faint);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #FAFBFC;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Toast / Notifications ──────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1C2028;
  color: #D1D9E6;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  animation: toast-in .22s ease both;
  pointer-events: auto;
  font-weight: 500;
}

.toast.toast-err  { border-left-color: #EF4444; }
.toast.toast-warn { border-left-color: #F59E0B; }
.toast.toast-ok   { border-left-color: #059669; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0);    }
}

/* ── Hamburger / Mobile overlay ─────────────────────────── */
#sb-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--navy);
  color: #C8D0DC;
  padding: 8px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
}

/* ── Empty / Loading states ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--faint);
  text-align: center;
  gap: 12px;
}

.empty-state svg { width: 48px; height: 48px; opacity: .3; }
.empty-state p { font-size: .9rem; max-width: 260px; color: var(--muted); line-height: 1.5; }

.loading-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(0,115,170,.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc helpers ───────────────────────────────────────── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-danger  { color: #DC2626; }
.fw-bold      { font-weight: 700; }
.fw-600       { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.d-none { display: none !important; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Inline key-value info rows */
.info-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .85rem;
}

.info-row:last-child { border-bottom: none; }
.info-key { color: var(--muted); font-weight: 600; font-size: .73rem; text-transform: uppercase; letter-spacing: .5px; min-width: 130px; flex-shrink: 0; }
.info-val { color: var(--text); flex: 1; }

/* Truncate */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Card link */
.card-link {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition-md), transform var(--transition-md), border-color var(--transition-md);
  text-decoration: none;
  color: var(--text);
}

.card-link:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}

/* ── Calendar ───────────────────────────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}

.cal-nav-title {
  font-size: .98rem;
  font-weight: 700;
  color: var(--text);
  min-width: 180px;
  text-align: center;
  letter-spacing: -.01em;
}

.cal-nav-btn {
  padding: 6px 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.cal-nav-btn:hover { background: var(--bg); color: var(--text); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.cal-dow {
  padding: 9px 4px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #F7F8FA;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cal-cell {
  min-height: 100px;
  padding: 6px 6px 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  vertical-align: top;
  transition: background var(--transition);
  position: relative;
}

.cal-cell:hover { background: #F0F7FF; }

.cal-cell-empty {
  background: #F8F9FB;
  cursor: default;
}

.cal-cell-empty:hover { background: #F8F9FB; }

.cal-cell-today {
  background: #EBF5FF;
}

.cal-cell-today:hover { background: #DBEAFE; }

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1;
}

.cal-day-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.73rem;
}

.cal-pills {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-pill {
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.67rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.45;
  transition: opacity .15s, filter .15s;
}

.cal-pill:hover { opacity: .85; filter: brightness(1.08); }

.cal-overflow {
  font-size: 0.65rem;
  color: var(--muted);
  padding: 1px 4px;
  font-weight: 500;
}

@media (max-width: 700px) {
  .cal-cell { min-height: 60px; padding: 4px 3px; }
  .cal-day-num { font-size: 0.7rem; }
  .cal-pill { font-size: 0.6rem; padding: 1px 3px; }
  .cal-nav-title { min-width: 130px; font-size: 0.9rem; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  #sb-hamburger { display: flex; }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  #sidebar.open { transform: translateX(0); }

  #sb-overlay.open { display: block; }

  #main { padding: 16px 14px 48px; padding-top: 60px; }

  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .three-col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card { padding: 36px 22px 30px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  #main { padding: 12px 10px 40px; padding-top: 60px; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  #login-screen, #sidebar, #sb-hamburger, #sb-overlay,
  #modal-overlay, #toast-container, .btn, .nav-btn { display: none !important; }

  #app { display: block !important; }
  #main { padding: 0; max-height: none; }
  .view { display: block !important; }

  body { background: #fff; color: #000; }
  .panel, .metric-card { box-shadow: none; border: 1px solid #ddd; }

  a[href]::after { content: none; }
}

/* ── Pipeline / Kanban ──────────────────────────────────── */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-col {
  min-width: 232px;
  max-width: 232px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.col-header {
  padding: 12px 14px 10px;
  border-top: 3px solid transparent;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: #FAFBFC;
}

.col-title {
  font-weight: 700;
  font-size: .83rem;
  color: var(--text);
  letter-spacing: -.01em;
}

.col-count {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.col-subtotal {
  font-size: .73rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.col-cards {
  padding: 8px;
  overflow-y: auto;
  max-height: 520px;
  min-height: 48px;
  transition: outline .12s ease, background .12s ease;
}

.col-cards.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
  background: var(--primary-light);
  border-radius: 0 0 var(--radius) var(--radius);
}

.kanban-card {
  background: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: border-left-color var(--transition), box-shadow var(--transition-md), opacity var(--transition), transform var(--transition-md);
  user-select: none;
}

.kanban-card:last-child { margin-bottom: 0; }

.kanban-card:hover {
  border-left-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: .35;
  transform: rotate(1.5deg) scale(1.02);
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
}

.card-numero {
  font-size: .7rem;
  font-family: 'Courier New', monospace;
  color: var(--faint);
  margin-bottom: 4px;
  letter-spacing: .02em;
}

.card-cliente {
  font-weight: 700;
  font-size: .83rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.card-total {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
}

.card-date {
  font-size: .7rem;
  color: var(--faint);
}

.card-viewed {
  font-size: .7rem;
  color: #D97706;
  font-weight: 600;
  margin-top: 5px;
}

.kanban-empty {
  text-align: center;
  font-size: .77rem;
  color: var(--faint);
  padding: 20px 8px;
}

/* ── Shim pra classes do dashboard (wpp-agent / wpp-knowledge) ── */
.card { background: var(--surface, #fff); border: 1px solid var(--border, #e0e0e0); border-radius: 10px; padding: 14px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: -.01em; }
.vhead { display: flex; justify-content: space-between; align-items: center; padding: 16px 0 14px; border-bottom: 1px solid var(--border, #e0e0e0); margin-bottom: 16px; }
.vtitle { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.015em; }
.vsub { font-size: 12px; color: var(--muted, #888); margin-top: 2px; }
.btn-primary { background: var(--primary, #25d366); color: #fff; border: none; }
.btn-primary:hover { background: var(--primary-dark, #1da851); }
.btn-outline { background: transparent; border: 1px solid var(--border, #e0e0e0); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.form-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border, #e0e0e0); border-radius: 6px; font-size: 13px; background: #fff; color: var(--text); font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--primary, #25d366); }
.filter { padding: 6px 10px; border: 1px solid var(--border, #e0e0e0); border-radius: 6px; font-size: 13px; background: #fff; }
.modal-box { padding: 20px; }
