:root {
  /* Tema claro (Figma) */
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --foreground: #1A1D23;
  --text: #1A1D23;
  --text-soft: #6B7280;
  --text-dim: #9AA1AD;
  --border: rgba(0, 0, 0, .08);
  --border-solid: #E5E8EF;
  --muted: #E5E8EF;
  --muted-2: #F3F4F6;

  --primary: #2563EB;
  --primary-dark: #1E40AF;
  --primary-light: #3B82F6;
  --secondary: #EEF2FF;

  /* Sidebar escura */
  --sidebar: #1B2137;
  --sidebar-accent: #252E47;
  --sidebar-hover: #1E2845;
  --sidebar-fg: #CBD5E1;
  --sidebar-muted: #64748B;

  --radius: .75rem;
  --shadow: 0 1px 4px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .12);

  --prio-alta: #DC2626;
  --prio-media: #D97706;
  --prio-baixa: #059669;

  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  font-family: var(--font);
}

/* ===== Tema escuro ===== */
html.dark {
  --bg: #0E1421;
  --bg-soft: #131A29;
  --surface: #18202F;
  --foreground: #E7ECF5;
  --text: #E7ECF5;
  --text-soft: #94A3B8;
  --text-dim: #64748B;
  --border: rgba(255, 255, 255, .08);
  --border-solid: #2A3446;
  --muted: #242E40;
  --muted-2: #1C2536;

  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --secondary: rgba(59, 130, 246, .18);

  --sidebar: #0B0F1A;
  --sidebar-accent: #1C2536;
  --sidebar-hover: #161E2C;

  --shadow: 0 1px 4px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
}
html { transition: none; }
body, .topbar, .sidebar, .card, .panel, .svc-card, .stat-box, .kcard, .modal, .cal-day { transition: background .25s ease, border-color .25s ease, color .25s ease; }

/* Alternância do ícone sol/lua */
.ic-sun { display: none; }
.ic-moon { display: block; }
html.dark .ic-sun { display: block; }
html.dark .ic-moon { display: none; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.15rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0; font-weight: 700; }
h3 { font-size: .95rem; margin: 0; font-weight: 600; }
.muted { color: var(--text-soft); margin: .2rem 0 0; font-size: .85rem; }
.mono { font-family: var(--mono); }
.section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); font-weight: 700; margin: 0 0 .8rem; }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid transparent; cursor: pointer;
  padding: .55rem 1rem; border-radius: 10px;
  font-size: .85rem; font-weight: 600; font-family: inherit; white-space: nowrap;
  transition: all .15s;
}
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .35); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.primary:active { transform: scale(.97); }
.btn.ghost { background: transparent; border-color: var(--border-solid); color: var(--text-soft); }
.btn.ghost:hover { border-color: var(--text-soft); color: var(--text); background: var(--muted-2); }
.btn.light { background: #fff; color: var(--primary); }
.btn.light:hover { background: #f1f5ff; }
.btn.glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.glass:hover { background: rgba(255, 255, 255, .26); }

/* ===== Layout / Sidebar ===== */
.layout { display: flex; height: 100vh; width: 100%; overflow: hidden; }
.sidebar {
  width: 68px; flex-shrink: 0; height: 100%;
  background: var(--sidebar); border-right: 1px solid rgba(255, 255, 255, .06);
  display: flex; flex-direction: column; align-items: center; padding: 1.1rem 0; gap: .5rem;
}
.side-logo {
  width: 38px; height: 38px; border-radius: 11px; margin-bottom: .9rem;
  background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0;
}
.side-logo svg { width: 18px; height: 18px; }
.side-nav { display: flex; flex-direction: column; gap: .3rem; width: 100%; padding: 0 .75rem; flex: 1; }
.side-link {
  position: relative; width: 100%; height: 42px; border: none; background: transparent;
  border-radius: 10px; cursor: pointer; color: var(--sidebar-muted);
  display: grid; place-items: center; transition: all .15s;
}
.side-link svg { width: 19px; height: 19px; }
.side-link:hover { background: var(--sidebar-hover); color: var(--sidebar-fg); }
.side-link.active { background: var(--sidebar-accent); color: #fff; }
.side-link.active::before {
  content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px;
  background: var(--primary); border-radius: 0 3px 3px 0;
}
.side-badge {
  position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; padding: 0 3px;
  background: var(--primary); color: #fff; font-family: var(--mono); font-size: .58rem; font-weight: 700;
  border-radius: 999px; display: grid; place-items: center;
}
.side-bottom { display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 100%; padding: 0 .75rem; }
.side-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); color: #fff;
  font-size: .78rem; font-weight: 700; box-shadow: 0 0 0 2px var(--primary);
}

/* ===== Main / Topbar ===== */
.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.topbar-head { flex: 1; min-width: 0; }
.crumb { display: flex; align-items: center; gap: .35rem; font-size: .72rem; color: var(--text-soft); }
.crumb svg { width: 12px; height: 12px; }
.crumb-current { font-weight: 600; color: var(--text); }
#page-title { margin-top: .05rem; }

.topbar-search { position: relative; flex: 1; max-width: 340px; }
.topbar-search svg { width: 15px; height: 15px; position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.topbar-search input {
  width: 100%; padding: .55rem .8rem .55rem 2.2rem; font-size: .85rem; font-family: inherit;
  border: 1px solid var(--border-solid); border-radius: 10px; background: var(--muted-2); color: var(--text);
  transition: all .15s;
}
.topbar-search input::placeholder { color: var(--text-soft); }
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.icon-action {
  position: relative; width: 38px; height: 38px; border: 1px solid var(--border-solid); background: var(--surface);
  border-radius: 10px; color: var(--text-soft); cursor: pointer; display: grid; place-items: center; transition: all .15s;
}
.icon-action svg { width: 17px; height: 17px; }
.icon-action:hover { background: var(--muted-2); color: var(--text); }
.icon-action.on { color: var(--primary); border-color: var(--primary); }
.action-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--prio-alta); }

/* ===== Content / Views ===== */
.content { flex: 1; overflow-y: auto; padding: 1.5rem; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { margin-bottom: 1.25rem; }

/* ===== Stats row (Serviços) ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat-box { background: var(--surface); border: 1px solid var(--border-solid); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat-box .s-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; color: var(--text-soft); }
.stat-box .s-value { font-family: var(--mono); font-size: 1.75rem; font-weight: 600; line-height: 1.1; margin-top: .25rem; }
.stat-box .s-delta { font-size: .72rem; font-weight: 600; margin-top: .3rem; }
.stat-box .s-delta.up { color: var(--prio-baixa); }
.stat-box .s-delta.down { color: var(--prio-alta); }

/* ===== Filter bar ===== */
.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.pills { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.pill {
  border: none; cursor: pointer; font-family: inherit; font-size: .78rem; font-weight: 600;
  padding: .4rem .8rem; border-radius: 9px; color: var(--text-soft); background: transparent; transition: all .15s;
}
.pill:hover { background: var(--muted-2); color: var(--text); }
.pill.active { color: #fff; background: var(--primary); }
.pill.active[data-tone] { color: var(--tone); background: var(--tone-bg); }
.result-count { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--text-soft); }
.result-count svg { width: 13px; height: 13px; }

/* ===== Service cards grid ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.svc-card {
  background: var(--surface); border: 1px solid var(--border-solid); border-radius: var(--radius);
  padding: 1.15rem; display: flex; flex-direction: column; gap: 1rem; cursor: pointer;
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; position: relative;
}
.svc-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.svc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.svc-prio {
  font-family: var(--mono); font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  padding: .12rem .45rem; border-radius: 5px;
}
.svc-prio.alta  { color: var(--prio-alta);  background: #FEE2E2; }
.svc-prio.media { color: var(--prio-media); background: #FEF3C7; }
.svc-prio.baixa { color: var(--prio-baixa); background: #D1FAE5; }
.svc-name { font-size: .9rem; font-weight: 600; line-height: 1.3; margin: .5rem 0 .1rem; }
.svc-sub { font-size: .76rem; color: var(--text-soft); }
.svc-actions { display: flex; gap: .2rem; opacity: 0; transition: opacity .15s; }
.svc-card:hover .svc-actions { opacity: 1; }
.svc-actions button {
  width: 26px; height: 26px; border: none; background: transparent; border-radius: 7px; cursor: pointer;
  color: var(--text-soft); display: grid; place-items: center; transition: all .15s;
}
.svc-actions button svg { width: 14px; height: 14px; }
.svc-actions button:hover { background: var(--muted-2); color: var(--text); }
.svc-actions .del:hover { background: #FEE2E2; color: var(--prio-alta); }

.svc-tags { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600;
  padding: .18rem .55rem; border-radius: 999px;
}
.badge svg { width: 11px; height: 11px; }
.chip { font-size: .7rem; color: var(--text-soft); background: var(--muted); padding: .18rem .55rem; border-radius: 999px; }

.svc-billing { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; background: var(--muted-2); border-radius: 9px; }
.svc-billing .bill-value { font-family: var(--mono); font-size: .95rem; font-weight: 700; color: var(--text); }

.svc-progress { display: flex; align-items: center; gap: .8rem; }
.svc-prog-main { flex: 1; }
.svc-prog-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; font-size: .72rem; color: var(--text-soft); }
.svc-prog-label .mono { font-weight: 600; color: var(--text); }
.prog-track { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.prog-fill { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.svc-ring { flex-shrink: 0; transform: rotate(-90deg); }

.svc-foot { display: flex; align-items: center; justify-content: space-between; padding-top: .65rem; border-top: 1px solid var(--border-solid); }
.svc-assignee { display: flex; align-items: center; gap: .45rem; font-size: .76rem; color: var(--text-soft); }
.svc-deadline { display: flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--text-soft); }
.svc-deadline svg { width: 12px; height: 12px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); color: #fff;
  font-size: .66rem; font-weight: 700; display: grid; place-items: center;
}

/* ===== Empty ===== */
.empty { text-align: center; padding: 4rem 1rem; }
.empty-ic { width: 48px; height: 48px; border-radius: 50%; background: var(--muted); color: var(--text-soft); display: grid; place-items: center; margin: 0 auto .8rem; }
.empty-ic svg { width: 20px; height: 20px; }
.empty-title { font-size: .9rem; font-weight: 600; margin: 0; }
.empty-sub { font-size: .8rem; color: var(--text-soft); margin: .3rem 0 0; }

/* ===== Dashboard cards / hero ===== */
.hero {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  padding: 1.75rem 2rem; margin-bottom: 1.5rem; border-radius: 18px;
  background: radial-gradient(600px 240px at 90% -30%, rgba(255, 255, 255, .22), transparent 60%), linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 10px 30px rgba(37, 99, 235, .3);
}
.hero-content { position: relative; z-index: 1; max-width: 520px; }
.hero-eyebrow { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: rgba(255, 255, 255, .18); padding: .28rem .65rem; border-radius: 999px; margin-bottom: .8rem; }
.hero-title { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.1; margin: 0 0 .5rem; font-weight: 700; }
.hero-sub { color: rgba(255, 255, 255, .85); font-size: .92rem; margin: 0 0 1.2rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-stat { position: relative; z-index: 1; display: flex; align-items: center; gap: 1.4rem; }
.ring {
  --pct: 0; width: 116px; height: 116px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--primary) 78%, transparent 79% 100%), conic-gradient(#fff calc(var(--pct) * 1%), rgba(255, 255, 255, .25) 0);
  transition: background .6s ease;
}
.ring-value { font-family: var(--mono); font-size: 1.4rem; font-weight: 600; color: #fff; line-height: 1; }
.ring-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .8); margin-top: .15rem; }
.hero-total { display: flex; flex-direction: column; }
.hero-total-num { font-family: var(--mono); font-size: 2.2rem; font-weight: 600; line-height: 1; }
.hero-total-lbl { font-size: .8rem; color: rgba(255, 255, 255, .8); margin-top: .25rem; }

.cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius); padding: 1.1rem; display: flex; flex-direction: column; gap: .35rem;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card-label { color: var(--text-soft); font-size: .78rem; font-weight: 500; }
.card-value { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; line-height: 1; }
.card.stat { border-top: 3px solid var(--c, var(--primary)); }
.card.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--c) 45%, var(--border-solid)); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stat-icon { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c) 14%, transparent); }
.stat-icon svg { width: 17px; height: 17px; }

/* ===== Panel ===== */
.panel { background: var(--surface); border: 1px solid var(--border-solid); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-head.wrap { flex-wrap: wrap; gap: .75rem; }

/* ===== Bars ===== */
.bars { display: flex; flex-direction: column; gap: .85rem; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 64px; align-items: center; gap: .75rem; }
.bar-name { font-size: .82rem; font-weight: 500; color: var(--text-soft); }
.bar-track { height: 12px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.bar-val { font-size: .82rem; font-weight: 700; text-align: right; font-family: var(--mono); }
.bar-val small { color: var(--text-dim); font-weight: 500; font-size: .72rem; }

/* ===== Kanban ===== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; align-items: start; padding-bottom: .5rem; }
.column { background: var(--bg); border: 1px solid var(--border-solid); border-radius: var(--radius); display: flex; flex-direction: column; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem .6rem; }
.column-title { font-weight: 700; font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.column-dot { width: 9px; height: 9px; border-radius: 50%; }
.column-count { background: var(--muted); color: var(--text-soft); font-family: var(--mono); font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; }
.column-body { padding: .25rem .7rem 1rem; display: flex; flex-direction: column; gap: .65rem; min-height: 80px; }
.column-body.drag-over { background: rgba(37, 99, 235, .07); outline: 2px dashed rgba(37, 99, 235, .4); outline-offset: -4px; border-radius: 10px; }

.kcard {
  background: var(--surface); border: 1px solid var(--border-solid); border-left: 4px solid var(--text-dim);
  border-radius: 11px; padding: .85rem; box-shadow: var(--shadow); cursor: grab; transition: box-shadow .15s, transform .1s;
}
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard.prio-alta  { border-left-color: var(--prio-alta); }
.kcard.prio-media { border-left-color: var(--prio-media); }
.kcard.prio-baixa { border-left-color: var(--prio-baixa); }
.kcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.kcard-title { font-weight: 600; font-size: .86rem; line-height: 1.3; }
.kcard-dept { display: inline-block; font-size: .68rem; font-weight: 600; color: var(--primary); background: var(--secondary); padding: .12rem .5rem; border-radius: 6px; margin-bottom: .45rem; }
.kcard-desc { font-size: .78rem; color: var(--text-soft); line-height: 1.45; margin-bottom: .6rem; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kcard-resp { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: var(--text-soft); }
.kcard-actions { display: flex; gap: .25rem; }
.kcard-actions button { border: none; background: none; cursor: pointer; padding: .15rem; color: var(--text-dim); font-size: .9rem; line-height: 1; border-radius: 5px; }
.kcard-actions button:hover { color: var(--primary); background: var(--muted-2); }
.kcard-actions .del:hover { color: var(--prio-alta); }

.prio { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.prio::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.prio.alta  { background: #FEE2E2; color: var(--prio-alta); }
.prio.media { background: #FEF3C7; color: var(--prio-media); }
.prio.baixa { background: #D1FAE5; color: var(--prio-baixa); }

/* ===== Follow-up no card ===== */
.kcard-followup { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .65rem; padding-top: .6rem; border-top: 1px dashed var(--border-solid); }
.kf-label { font-size: .68rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.kf-toggle { display: inline-flex; background: var(--muted-2); border: 1px solid var(--border-solid); border-radius: 8px; padding: 2px; }
.kf-opt { border: none; background: none; cursor: pointer; font-family: inherit; font-size: .74rem; font-weight: 700; color: var(--text-soft); padding: .2rem .55rem; border-radius: 6px; transition: all .15s; }
.kf-opt:hover { color: var(--text); }
.kf-opt.sim.active { background: #D1FAE5; color: var(--prio-baixa); }
.kf-opt.nao.active { background: #FEE2E2; color: var(--prio-alta); }
.kf-create { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; margin-top: .55rem; padding: .5rem; cursor: pointer; font-family: inherit; font-size: .78rem; font-weight: 600; color: var(--primary); background: var(--secondary); border: 1px solid rgba(37, 99, 235, .25); border-radius: 9px; transition: all .15s; }
.kf-create:hover { background: #e0e7ff; }
.kf-create svg { width: 14px; height: 14px; }

/* ===== Toggle de pagamento (modal) ===== */
.pay-toggle { display: inline-flex; width: 100%; background: var(--muted-2); border: 1px solid var(--border-solid); border-radius: 9px; padding: 3px; }
.pay-opt { flex: 1; border: none; background: none; cursor: pointer; font-family: inherit; font-size: .82rem; font-weight: 600; color: var(--text-soft); padding: .5rem .55rem; border-radius: 7px; transition: all .15s; }
.pay-opt:hover { color: var(--text); }
.pay-opt.sim.active { background: #D1FAE5; color: var(--prio-baixa); }
.pay-opt.nao.active { background: #FEE2E2; color: var(--prio-alta); }
html.dark .pay-opt.sim.active { background: rgba(5, 150, 105, .22); }
html.dark .pay-opt.nao.active { background: rgba(220, 38, 38, .22); }

/* ===== Faturamento ===== */
/* Hero específico da aba (gradiente índigo) */
.bill-hero { background: radial-gradient(600px 240px at 90% -30%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, #1d2d50 0%, #1a237e 55%, #283593 100%); box-shadow: 0 10px 30px rgba(26, 35, 126, .35); }

/* Barra de período (semana / mês / ano) */
.period-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.period-seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border-solid); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.period-seg button { border: none; background: none; cursor: pointer; font-family: inherit; font-size: .8rem; font-weight: 600; color: var(--text-soft); padding: .45rem .9rem; border-radius: 7px; transition: all .15s; }
.period-seg button:hover { color: var(--text); }
.period-seg button.active { background: var(--primary); color: #fff; }
.period-nav { display: flex; align-items: center; gap: .4rem; }
.period-label { min-width: 150px; text-align: center; font-size: .85rem; font-weight: 600; color: var(--text); text-transform: capitalize; }
.period-custom { display: flex; align-items: center; gap: .5rem; }
.period-date { border: 1px solid var(--border-solid); background: var(--surface); color: var(--text); border-radius: 9px; padding: .4rem .6rem; font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.period-date:hover { border-color: var(--primary); }
.period-custom-sep { font-size: .8rem; font-weight: 600; color: var(--text-soft); }

/* Cards-resumo */
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.card.bill .card-value { font-size: 1.3rem; }
.card-foot { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; }
.card-foot .cf-count { font-size: .74rem; color: var(--text-soft); }
.card-foot .cf-trend { display: inline-flex; align-items: center; gap: .2rem; font-size: .72rem; font-weight: 700; color: var(--prio-baixa); }
.card-foot .cf-trend svg { width: 12px; height: 12px; }

/* Toolbar */
.billing-panel { padding: 0; overflow: hidden; }
.billing-toolbar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border-solid); }
.bill-search { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 200px; background: var(--bg); border: 1px solid var(--border-solid); border-radius: 9px; padding: .5rem .75rem; transition: border-color .15s, box-shadow .15s; }
.bill-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.bill-search svg { width: 15px; height: 15px; color: var(--text-soft); flex-shrink: 0; }
.bill-search input { flex: 1; border: none; background: none; outline: none; font-family: inherit; font-size: .85rem; color: var(--text); }
.bill-search input::placeholder { color: var(--text-soft); }
.bill-filter { display: flex; align-items: center; gap: .4rem; }
.bill-filter-ic { width: 14px; height: 14px; color: var(--text-soft); flex-shrink: 0; }
.bill-sort { display: flex; align-items: center; gap: .4rem; background: var(--bg); border: 1px solid var(--border-solid); border-radius: 9px; padding: .15rem .55rem; }
.bill-sort svg { width: 14px; height: 14px; color: var(--text-soft); flex-shrink: 0; }
.sort-select { font-family: inherit; font-size: .8rem; color: var(--text); background: transparent; border: none; padding: .35rem .15rem; cursor: pointer; }
.sort-select:focus { outline: none; }

/* Tabela */
.table-wrap { overflow-x: auto; }
.billing-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.billing-table thead th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; color: var(--text-soft); padding: .8rem 1.1rem; border-bottom: 1px solid var(--border-solid); white-space: nowrap;
}
.billing-table th.num, .billing-table td.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.billing-table th.center, .billing-table td.center { text-align: center; }
.billing-table tbody td { padding: .8rem 1.1rem; border-bottom: 1px solid var(--border-solid); vertical-align: middle; }
.billing-table tbody tr:last-child td { border-bottom: none; }
.billing-table tbody tr { transition: background .15s; }
.billing-table tbody tr:hover { background: var(--muted-2); }
.bill-name { font-weight: 600; color: var(--text); }
.bill-dept { font-size: .72rem; color: var(--text-soft); margin-top: .1rem; }
.bill-proto { display: inline-block; font-family: var(--mono); font-size: .74rem; color: var(--text-soft); background: var(--muted-2); padding: .15rem .45rem; border-radius: 6px; }
.bill-resp { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.bill-resp .avatar { width: 26px; height: 26px; font-size: .62rem; }
.bill-value { font-weight: 700; color: var(--text); }
.bill-pay { color: var(--text-soft); }
.bill-venc.late { color: var(--prio-alta); font-weight: 600; }

/* Badge de status de pagamento (clicável) */
.pay-badge {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700;
  padding: .28rem .65rem; border-radius: 999px; cursor: pointer; border: 1px solid transparent; transition: all .15s; font-family: inherit;
}
.pay-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.pay-badge.pago     { color: #059669; background: #D1FAE5; }       .pay-badge.pago .dot     { background: #059669; }
.pay-badge.pendente { color: #B45309; background: #FEF3C7; }       .pay-badge.pendente .dot { background: #D97706; }
.pay-badge.atraso   { color: #DC2626; background: #FEE2E2; }       .pay-badge.atraso .dot   { background: #DC2626; }
.pay-badge:hover { filter: brightness(.97); border-color: currentColor; }
html.dark .pay-badge.pago     { color: #34D399; background: rgba(16, 185, 129, .15); }
html.dark .pay-badge.pendente { color: #FBBF24; background: rgba(245, 158, 11, .15); }
html.dark .pay-badge.atraso   { color: #F87171; background: rgba(244, 63, 94, .15); }

/* Rodapé da tabela */
.billing-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-top: 1px solid var(--border-solid); }
.billing-foot .bf-count { font-size: .78rem; color: var(--text-soft); }
.billing-foot .bf-total { font-size: .82rem; font-weight: 600; color: var(--text); }
.billing-foot .bf-total strong { font-family: var(--mono); color: var(--primary); font-weight: 700; margin-left: .25rem; }

@media (max-width: 1100px) { .cards-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .cards-4 { grid-template-columns: 1fr; } }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .5); display: grid; place-items: center; padding: 1rem; animation: fade .2s ease; }
.modal { background: var(--surface); border: 1px solid var(--border-solid); border-radius: 16px; width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.5rem; border-bottom: 1px solid var(--border-solid); }
.modal-close { border: none; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--text-soft); }
.modal-close:hover { color: var(--text); }
#service-form, #event-form { padding: 1.25rem 1.5rem 1.5rem; }
.field { margin-bottom: 1rem; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: .58rem .7rem; border: 1px solid var(--border-solid); border-radius: 9px;
  font-size: .88rem; font-family: inherit; color: var(--text); background: var(--muted-2); resize: vertical; transition: all .15s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-soft); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.field .invalid { border-color: var(--prio-alta); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }

[hidden] { display: none !important; }

/* ===== Agenda / Calendário ===== */
.agenda-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.agenda-head-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.agenda-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; align-items: start; }
.calendar-panel { padding: 1.25rem; }
.calendar-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.calendar-nav { display: flex; gap: .35rem; }
.cal-btn { border: 1px solid var(--border-solid); background: var(--surface); color: var(--text-soft); border-radius: 9px; padding: .4rem .7rem; cursor: pointer; font-family: inherit; font-size: .82rem; font-weight: 600; transition: all .15s; }
.cal-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--secondary); }
#cal-title { font-size: 1.05rem; text-transform: capitalize; margin-right: auto; }
.calendar-legend { display: flex; gap: .8rem; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; font-size: .7rem; color: var(--text-soft); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.calendar-weekdays span { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day { min-height: 92px; border: 1px solid var(--border-solid); border-radius: 10px; background: var(--muted-2); padding: .4rem; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; gap: .25rem; transition: border-color .15s, background .15s; }
.cal-day:hover { border-color: var(--primary); background: var(--secondary); }
.cal-day.muted-day { opacity: .45; }
.cal-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-daynum { font-family: var(--mono); font-size: .74rem; font-weight: 600; color: var(--text-soft); align-self: flex-end; }
.cal-day.today .cal-daynum { color: var(--primary); }
.cal-event { display: flex; align-items: center; gap: .3rem; font-size: .66rem; font-weight: 600; padding: .12rem .35rem; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.cal-event .ev-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.cal-more { font-size: .64rem; color: var(--text-dim); font-weight: 600; padding-left: .2rem; }

.agenda-side { display: flex; flex-direction: column; gap: 1.25rem; }
.event-list { display: flex; flex-direction: column; gap: .6rem; }
.event-item { display: flex; gap: .7rem; align-items: flex-start; padding: .65rem .7rem; border: 1px solid var(--border-solid); border-radius: 10px; background: var(--muted-2); cursor: pointer; transition: border-color .15s, transform .12s; }
.event-item:hover { border-color: var(--primary); transform: translateX(2px); }
.event-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.event-ic svg { width: 16px; height: 16px; }
.event-body { min-width: 0; flex: 1; }
.event-title { font-size: .84rem; font-weight: 600; }
.event-meta { font-size: .72rem; color: var(--text-soft); margin-top: .15rem; }
.event-empty { color: var(--text-dim); font-size: .85rem; text-align: center; padding: 1.25rem 0; }

.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.tl-item { display: flex; gap: .7rem; padding-bottom: 1rem; position: relative; cursor: pointer; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 26px; bottom: 0; width: 2px; background: var(--border-solid); }
.tl-marker { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; z-index: 1; }
.tl-marker svg { width: 15px; height: 15px; }
.tl-body { min-width: 0; flex: 1; }
.tl-title { font-size: .83rem; font-weight: 600; }
.tl-meta { font-size: .72rem; color: var(--text-soft); margin-top: .1rem; }
.tl-desc { font-size: .77rem; color: var(--text-dim); margin-top: .2rem; }

/* ===== Toast ===== */
.toast-wrap { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 120; display: flex; flex-direction: column; gap: .6rem; }
.toast { display: flex; gap: .7rem; align-items: flex-start; width: 320px; max-width: calc(100vw - 2.5rem); background: var(--surface); border: 1px solid var(--primary); border-radius: 12px; padding: .8rem .9rem; box-shadow: var(--shadow-lg); animation: toastIn .3s cubic-bezier(.2,.7,.3,1); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast-ic { color: var(--primary); flex-shrink: 0; }
.toast-ic svg { width: 20px; height: 20px; }
.toast-title { font-weight: 700; font-size: .86rem; }
.toast-msg { font-size: .77rem; color: var(--text-soft); margin-top: .15rem; }
.toast-close { margin-left: auto; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.1rem; line-height: 1; }

/* ===== Login ===== */
.login-screen { position: fixed; inset: 0; z-index: 100; display: flex; background: var(--bg); }

/* Painel de branding (esquerda) */
.login-brand {
  position: relative; overflow: hidden; flex: 0 0 52%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem;
  background: var(--sidebar); color: #fff;
}
.lb-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2.25rem; max-width: 34rem; }
.lb-img { display: block; width: 100%; max-width: 440px; height: auto; }
.lb-phrase { font-size: 1.2rem; line-height: 1.6; font-weight: 500; color: #94A3B8; margin: 0; }
.lb-phrase span { color: #fff; font-weight: 600; }
.lb-glow { position: absolute; border-radius: 50%; pointer-events: none; }
.lb-glow-1 { top: -6rem; left: -6rem; width: 24rem; height: 24rem; background: radial-gradient(circle, #2563EB, transparent 70%); opacity: .1; }
.lb-glow-2 { bottom: 0; right: 0; width: 31rem; height: 31rem; transform: translate(30%, 30%); background: radial-gradient(circle, #2563EB, transparent 65%); opacity: .07; }

.lb-logo { display: flex; align-items: center; gap: .75rem; position: relative; z-index: 1; }
.lb-logo-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.lb-logo-mark svg { width: 19px; height: 19px; }
.lb-name { font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.1; }
.lb-tag { font-size: .7rem; margin: .1rem 0 0; color: var(--sidebar-muted); }

.lb-copy { position: relative; z-index: 1; }
.lb-copy h2 { font-size: 2.5rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 .9rem; }
.lb-copy h2 span { color: #60A5FA; }
.lb-sub { font-size: .9rem; line-height: 1.6; max-width: 24rem; color: #94A3B8; margin: 0 0 1.6rem; }
.lb-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.lb-stat { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); border-radius: 12px; padding: 1rem; }
.lb-stat-n { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; margin: 0; }
.lb-stat-l { font-size: .68rem; color: var(--sidebar-muted); margin: .25rem 0 0; }

.lb-quote { position: relative; z-index: 1; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07); border-radius: 12px; padding: 1.25rem; }
.lb-quote-text { font-size: .82rem; line-height: 1.6; font-style: italic; color: #CBD5E1; margin: 0; }
.lb-quote-author { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.lb-quote-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.lb-quote-name { font-size: .76rem; font-weight: 600; margin: 0; }
.lb-quote-role { font-size: .7rem; color: var(--sidebar-muted); margin: .1rem 0 0; }

/* Formulário (direita) */
.login-form-side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--bg); overflow-y: auto; }
.login-mobile-logo { display: none; align-items: center; gap: .6rem; margin-bottom: 2rem; }
.login-mobile-logo .lb-logo-mark { width: 36px; height: 36px; }
.login-mobile-logo p { font-weight: 700; font-size: .95rem; margin: 0; }
.login-box { width: 100%; max-width: 380px; }
.login-head { margin-bottom: 2rem; }
.login-head h1 { font-size: 1.65rem; letter-spacing: -.01em; margin-bottom: .25rem; }

.field-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.field-label-row label { margin-bottom: 0; }
.link-btn { background: none; border: none; cursor: pointer; font-family: inherit; font-size: .76rem; font-weight: 600; color: var(--primary); padding: 0; }
.link-btn:hover { text-decoration: underline; }

.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-soft); pointer-events: none; transition: color .15s; }
.input-icon input { padding-left: 2.4rem !important; padding-top: .65rem; padding-bottom: .65rem; border-radius: 11px; background: var(--surface); }
.input-icon input:focus + .pass-toggle, .input-icon:focus-within > svg { color: var(--primary); }
.pass-toggle { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-soft); padding: .2rem; display: grid; place-items: center; }
.pass-toggle svg { width: 15px; height: 15px; }
.pass-toggle:hover { color: var(--text); }

.login-error { display: flex; align-items: center; gap: .5rem; color: var(--prio-alta); background: #FEE2E2; font-size: .8rem; font-weight: 600; padding: .6rem .75rem; border-radius: 9px; margin: 0 0 .25rem; }
.login-error svg { width: 14px; height: 14px; flex-shrink: 0; }

.login-check { display: flex; align-items: center; gap: .6rem; cursor: pointer; margin: 1rem 0; font-size: .78rem; color: var(--text-soft); user-select: none; }
.login-check input { display: none; }
.login-check .check-box { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--border-solid); background: var(--surface); display: grid; place-items: center; transition: all .15s; flex-shrink: 0; }
.login-check .check-box svg { width: 9px; height: 7px; opacity: 0; }
.login-check input:checked + .check-box { background: var(--primary); border-color: var(--primary); }
.login-check input:checked + .check-box svg { opacity: 1; }

.login-submit { width: 100%; padding: .8rem; font-size: .9rem; justify-content: center; }
.login-arrow { width: 15px; height: 15px; }

.login-divider { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-solid); }
.login-divider span { font-size: .72rem; color: var(--text-soft); }

.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .65rem; border-radius: 11px; cursor: pointer; font-family: inherit; font-size: .82rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-solid); box-shadow: var(--shadow); transition: background .15s; }
.btn-google:hover { background: var(--muted-2); }

.login-signup { text-align: center; font-size: .78rem; color: var(--text-soft); margin: 1.5rem 0 0; }
.login-signup span { font-weight: 600; color: var(--primary); cursor: pointer; }
.login-signup span:hover { text-decoration: underline; }
.login-secure { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: 2rem; color: var(--text-dim); font-size: .7rem; }
.login-secure svg { width: 12px; height: 12px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } .stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 960px) { .agenda-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .topbar-search { order: 3; max-width: none; flex-basis: 100%; }
  .cards, .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .field-row { flex-direction: column; gap: 0; }
  .bar-row { grid-template-columns: 100px 1fr 56px; }
  .hero-stat { width: 100%; justify-content: space-between; }
}
@media (max-width: 980px) {
  .login-brand { display: none; }
  .login-mobile-logo { display: flex; }
}
@media (max-width: 520px) { .cards, .cards-3, .stats-row { grid-template-columns: 1fr; } }
