/* ==========================================================================
   Efata ERP — design system (espelha o Church Pro)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --background: 220 16% 96%;
  --foreground: 224 71% 4%;
  --card: 0 0% 100%;
  --card-foreground: 224 71% 4%;
  --popover: 0 0% 100%;
  --popover-foreground: 224 71% 4%;
  --primary: 250 70% 56%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 14% 96%;
  --secondary-foreground: 224 71% 4%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 9% 46%;
  --accent: 250 70% 96%;
  --accent-foreground: 250 70% 46%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 250 70% 56%;
  --radius: .625rem;
  --sidebar-background: 230 25% 9%;
  --sidebar-foreground: 220 10% 75%;
  --sidebar-primary: 250 70% 64%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 230 20% 15%;
  --sidebar-accent-foreground: 220 10% 90%;
  --sidebar-border: 230 15% 16%;
  --success: 152 69% 41%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --info: 199 89% 48%;
  --info-foreground: 0 0% 100%;
  --chart-1: 250 70% 56%;
  --chart-2: 152 69% 41%;
  --chart-3: 38 92% 50%;
  --chart-4: 199 89% 48%;
  --chart-5: 0 72% 51%;
  --gradient-primary: linear-gradient(135deg, hsl(250 70% 56%), hsl(280 70% 56%));
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / .04), 0 1px 2px -1px rgb(0 0 0 / .04);
  --shadow-card-hover: 0 4px 6px -1px rgb(0 0 0 / .07), 0 2px 4px -2px rgb(0 0 0 / .05);
  --shadow-elevated: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .04);
  --sidebar-width: 270px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --background: 224 50% 6%;
  --foreground: 210 40% 98%;
  --card: 224 50% 9%;
  --card-foreground: 210 40% 98%;
  --popover: 224 50% 9%;
  --popover-foreground: 210 40% 98%;
  --primary: 250 70% 64%;
  --primary-foreground: 0 0% 100%;
  --secondary: 224 33% 14%;
  --secondary-foreground: 210 40% 98%;
  --muted: 224 33% 14%;
  --muted-foreground: 215 20% 60%;
  --accent: 250 30% 18%;
  --accent-foreground: 250 70% 78%;
  --destructive: 0 63% 41%;
  --destructive-foreground: 210 40% 98%;
  --border: 224 25% 15%;
  --input: 224 25% 15%;
  --ring: 250 70% 64%;
  --sidebar-background: 224 50% 5%;
  --sidebar-foreground: 220 10% 70%;
  --sidebar-primary: 250 70% 64%;
  --sidebar-accent: 250 20% 12%;
  --sidebar-accent-foreground: 220 10% 92%;
  --sidebar-border: 224 25% 12%;
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / .4), 0 1px 2px -1px rgb(0 0 0 / .4);
  --shadow-card-hover: 0 4px 8px -1px rgb(0 0 0 / .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Plus Jakarta Sans', Inter, sans-serif; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.font-display { font-family: 'Plus Jakarta Sans', Inter, sans-serif; }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-destructive { color: hsl(var(--destructive)); }
.text-success { color: hsl(var(--success)); }
.text-warning { color: hsl(var(--warning)); }
.text-info { color: hsl(var(--info)); }
.w-full { width: 100%; }
.d-none { display: none !important; }
.mt-0 { margin-top: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 40px; padding: 0 1rem; border-radius: 6px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 1; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap; vertical-align: middle;
}
.btn:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: hsl(var(--primary)); color: #fff; }
.btn-primary:hover { background: hsl(250 70% 50%); }
.btn-outline { background: hsl(var(--card)); color: hsl(var(--foreground)); border-color: hsl(var(--input)); }
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(220 14% 91%); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-destructive { background: hsl(var(--destructive)); color: #fff; }
.btn-destructive:hover { filter: brightness(.95); }
.btn-sm { height: 34px; padding: 0 .75rem; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 1.5rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn i { font-size: 17px; }
.btn-primary i, .btn-destructive i { color: currentColor; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-width);
  display: flex; flex-direction: column; background: hsl(var(--sidebar-background));
  color: hsl(var(--sidebar-foreground)); border-right: 1px solid hsl(var(--sidebar-border));
  transition: width .3s ease, transform .3s ease;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-head {
  height: var(--header-height); flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid hsl(var(--sidebar-border));
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--primary)); color: #fff; font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 13px; letter-spacing: .02em; box-shadow: 0 1px 2px rgb(0 0 0 / .3);
}
.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 17px;
  letter-spacing: -.02em; color: hsl(var(--sidebar-primary-foreground)); white-space: nowrap;
}
.sidebar-org { padding: 12px 16px; border-bottom: 1px solid hsl(var(--sidebar-border)); flex: 0 0 auto; }
.sidebar-org .label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .15em;
  color: hsl(var(--sidebar-foreground) / .3); margin: 0;
}
.sidebar-org .name {
  font-size: 14px; font-weight: 600; color: hsl(var(--sidebar-accent-foreground));
  margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 12px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: hsl(var(--sidebar-border)); border-radius: 4px; }
.nav-section { margin-bottom: 4px; }
.nav-section-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: 0; padding: 8px 12px; cursor: pointer;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .15em;
  color: hsl(var(--sidebar-foreground) / .3); transition: color .15s;
}
.nav-section-toggle:hover { color: hsl(var(--sidebar-foreground) / .55); }
.nav-section-toggle i { font-size: 12px; transition: transform .2s; }
.nav-section.collapsed .nav-section-toggle i { transform: rotate(-90deg); }
.nav-items { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.nav-section.collapsed .nav-items { display: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: hsl(var(--sidebar-foreground) / .6); transition: background .2s, color .2s;
}
.nav-item i { font-size: 17px; flex: 0 0 auto; color: hsl(var(--sidebar-foreground) / .4); }
.nav-item:hover { background: hsl(var(--sidebar-accent) / .6); color: hsl(var(--sidebar-accent-foreground)); }
.nav-item:hover i { color: hsl(var(--sidebar-foreground) / .7); }
.nav-item.active { background: hsl(var(--sidebar-primary) / .12); color: hsl(var(--sidebar-primary)); font-weight: 600; }
.nav-item.active i { color: hsl(var(--sidebar-primary)); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: hsl(var(--sidebar-primary));
}
.sidebar-foot { flex: 0 0 auto; border-top: 1px solid hsl(var(--sidebar-border)); padding: 12px; }
.sidebar-user {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  margin-bottom: 4px; transition: background .15s;
}
.sidebar-user:hover { background: hsl(var(--sidebar-accent) / .6); }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: hsl(var(--sidebar-primary) / .15); color: hsl(var(--sidebar-primary));
  font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.sidebar-user .u-name { font-size: 13px; font-weight: 500; color: hsl(var(--sidebar-accent-foreground)); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .u-sub { font-size: 11px; color: hsl(var(--sidebar-foreground) / .3); margin: 0; }
.logout-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: none; cursor: pointer;
  padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: hsl(var(--sidebar-foreground) / .5); transition: background .15s, color .15s;
}
.logout-btn:hover { background: hsl(var(--destructive) / .10); color: hsl(var(--destructive)); }
.collapse-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; border: 0; background: none;
  cursor: pointer; padding: 8px; border-radius: 8px; color: hsl(var(--sidebar-foreground) / .3);
  margin-top: 4px;
}
.collapse-btn:hover { color: hsl(var(--sidebar-foreground) / .6); background: hsl(var(--sidebar-accent) / .4); }
.sidebar.collapsed .brand-name, .sidebar.collapsed .sidebar-org,
.sidebar.collapsed .nav-section-toggle span, .sidebar.collapsed .nav-section-toggle i,
.sidebar.collapsed .nav-item span, .sidebar.collapsed .sidebar-user .u-info,
.sidebar.collapsed .logout-btn span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .sidebar-head { justify-content: center; padding: 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .logout-btn { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .collapse-btn i { transform: rotate(180deg); }

.main-area { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left .3s ease; display: flex; flex-direction: column; }
.main-area.collapsed { margin-left: var(--sidebar-collapsed); }
.topbar {
  height: var(--header-height); flex: 0 0 auto; position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: hsl(var(--background) / .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.topbar .search { position: relative; width: 100%; max-width: 380px; }
.topbar .search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); font-size: 17px; }
.topbar .search input {
  width: 100%; height: 38px; border: 1px solid hsl(var(--input)); border-radius: 8px;
  background: hsl(var(--card)); color: inherit; padding: 0 12px 0 38px; font-size: 14px;
}
.topbar .search input::placeholder { color: hsl(var(--muted-foreground)); }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 0; background: transparent; color: hsl(var(--muted-foreground));
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.icon-btn i { font-size: 19px; }
.mobile-menu-btn { display: none; }
.page-wrap { flex: 1; padding: 24px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ---------- Page header ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: hsl(var(--muted-foreground)); margin-bottom: 10px; }
.breadcrumb i { font-size: 15px; }
.breadcrumb .sep { opacity: .5; }
.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.page-desc { font-size: 14px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.help-dot { border: 0; background: none; color: hsl(var(--muted-foreground)); cursor: pointer; padding: 2px; }
.help-dot:hover { color: hsl(var(--foreground)); }
.help-dot i { font-size: 17px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-section { margin-top: 24px; }

/* ---------- Cards ---------- */
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-hover { transition: box-shadow .2s; }
.card-hover:hover { box-shadow: var(--shadow-card-hover); }
.card-header { padding: 16px 20px; border-bottom: 1px solid hsl(var(--border)); }
.card-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid hsl(var(--border)); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.stat-card { padding: 20px; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: hsl(var(--muted-foreground)); }
.stat-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; }
.stat-note { font-size: 12px; margin-top: 8px; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.stat-icon i { font-size: 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 17px; font-weight: 600; }
.link-btn { border: 0; background: none; color: hsl(var(--primary)); font-size: 13px; font-weight: 500; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-primary { background: hsl(var(--primary)); color: #fff; }
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-outline { border-color: hsl(var(--border)); color: hsl(var(--foreground)); background: transparent; }
.badge-success { background: hsl(var(--success) / .12); color: hsl(var(--success)); border-color: hsl(var(--success) / .2); }
.badge-warning { background: hsl(var(--warning) / .14); color: hsl(30 90% 38%); border-color: hsl(var(--warning) / .25); }
.badge-danger { background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / .2); }
.badge-info { background: hsl(var(--info) / .12); color: hsl(200 90% 36%); border-color: hsl(var(--info) / .2); }

/* ---------- Forms ---------- */
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-control, .form-select {
  width: 100%; height: 40px; border: 1px solid hsl(var(--input)); border-radius: 6px;
  background: hsl(var(--card)); color: hsl(var(--foreground)); padding: 0 12px; font-size: 14px;
  box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: hsl(var(--muted-foreground)); }
.form-control:focus, .form-select:focus {
  border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / .12); outline: none;
}
textarea.form-control { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.form-group { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-hint { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); font-size: 17px; }
.input-icon .form-control { padding-left: 38px; }
.search-input { position: relative; }
.search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); font-size: 17px; }
.search-input .form-control { padding-left: 38px; background: hsl(var(--card)); }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: hsl(var(--primary)); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search-input { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  height: 44px; padding: 0 16px; text-align: left; font-weight: 500; font-size: 13px;
  color: hsl(var(--muted-foreground)); border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .45); white-space: nowrap; user-select: none;
}
.table thead th.sortable { cursor: pointer; }
.table thead th.sortable:hover { color: hsl(var(--foreground)); }
.table tbody td { padding: 12px 16px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: hsl(var(--muted) / .35); }
.table .cell-main { font-weight: 500; }
.table .cell-sub { font-size: 12px; color: hsl(var(--muted-foreground)); }
.table .actions { display: flex; gap: 2px; justify-content: flex-end; }
.table thead th.text-right, .table tbody td.text-right { text-align: right; }
.table-empty { padding: 40px 16px; text-align: center; color: hsl(var(--muted-foreground)); font-size: 14px; }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid hsl(var(--border)); font-size: 13px; color: hsl(var(--muted-foreground)); }
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; border: 1px solid hsl(var(--input)); background: hsl(var(--card)); border-radius: 6px; color: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.page-btn:hover { background: hsl(var(--accent)); }
.page-btn.active { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }
.per-page { height: 32px; width: 70px; border: 1px solid hsl(var(--input)); border-radius: 6px; background: hsl(var(--card)); color: inherit; padding: 0 8px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; background: hsl(var(--muted)); padding: 4px; border-radius: 8px; width: max-content; max-width: 100%; overflow-x: auto; }
.tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground)); white-space: nowrap;
}
.tab:hover { color: hsl(var(--foreground)); }
.tab.active { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px rgb(0 0 0 / .06); font-weight: 600; }
.tabs-line { display: flex; gap: 20px; border-bottom: 1px solid hsl(var(--border)); overflow-x: auto; }
.tabs-line .tab { border-radius: 0; padding: 10px 2px; border-bottom: 2px solid transparent; }
.tabs-line .tab.active { background: none; box-shadow: none; color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); }

/* ---------- Charts / lists ---------- */
.chart-box { position: relative; width: 100%; height: 300px; }
.chart-box.sm { height: 220px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid hsl(var(--border)); }
.list-item:last-child { border-bottom: 0; }
.list-dot { width: 34px; height: 34px; border-radius: 50%; background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.list-dot i { font-size: 16px; }
.list-title { font-size: 14px; font-weight: 500; }
.list-sub { font-size: 12px; color: hsl(var(--muted-foreground)); }
.list-time { margin-left: auto; font-size: 12px; color: hsl(var(--muted-foreground)); white-space: nowrap; padding-top: 2px; }

/* ---------- Misc components ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: hsl(var(--accent)); }
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: hsl(var(--accent-foreground)); }
.empty-state { padding: 48px 20px; text-align: center; color: hsl(var(--muted-foreground)); }
.empty-state i { font-size: 40px; opacity: .35; display: block; margin-bottom: 12px; }
.alert { padding: 12px 14px; border-radius: 8px; border: 1px solid hsl(var(--border)); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert i { font-size: 18px; flex: 0 0 auto; margin-top: 1px; }
.alert-warning { background: hsl(var(--warning) / .1); border-color: hsl(var(--warning) / .3); color: hsl(30 80% 30%); }
.alert-danger { background: hsl(var(--destructive) / .07); border-color: hsl(var(--destructive) / .25); color: hsl(var(--destructive)); }
.alert-info { background: hsl(var(--info) / .08); border-color: hsl(var(--info) / .25); color: hsl(200 80% 30%); }
.divider { height: 1px; background: hsl(var(--border)); margin: 16px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; }
.kv span:first-child { color: hsl(var(--muted-foreground)); }
.progress { height: 6px; background: hsl(var(--secondary)); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: hsl(var(--primary)); border-radius: 999px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: hsl(var(--input)); border-radius: 999px; cursor: pointer; transition: background .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.switch input:checked + span { background: hsl(var(--primary)); }
.switch input:checked + span::before { transform: translateX(18px); }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid hsl(var(--border)); }
.setting-row:last-child { border-bottom: 0; }
.setting-row h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.setting-row p { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 0; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: hsl(var(--background)); }
.auth-theme { position: fixed; top: 18px; right: 18px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px;
  background: hsl(var(--primary)); color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: .02em;
  box-shadow: 0 10px 25px hsl(var(--primary) / .28);
}
.auth-brand h1 { font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.auth-brand p { color: hsl(var(--muted-foreground)); margin: 4px 0 0; font-size: 14px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px; }
.auth-card h2 { text-align: center; font-size: 21px; font-weight: 700; }
.auth-card .auth-sub { text-align: center; color: hsl(var(--muted-foreground)); font-size: 14px; margin: 4px 0 24px; }
.auth-link { text-align: center; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 18px; }
.auth-link a { color: hsl(var(--primary)); font-weight: 500; }
.auth-terms { text-align: center; font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 14px; line-height: 1.6; }
.auth-terms a { color: hsl(var(--primary)); }
.quick-access {
  width: 100%; max-width: 440px; margin-top: 20px; padding: 16px;
  border: 1px dashed hsl(var(--primary) / .45); border-radius: var(--radius);
  background: hsl(var(--primary) / .04); cursor: pointer; transition: background .15s;
}
.quick-access:hover { background: hsl(var(--primary) / .08); }
.quick-access .qa-head { display: flex; align-items: center; gap: 10px; }
.quick-access .qa-icon { width: 34px; height: 34px; border-radius: 8px; background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); display: flex; align-items: center; justify-content: center; }
.quick-access h4 { font-size: 14px; font-weight: 600; margin: 0; }
.quick-access p { font-size: 12px; color: hsl(var(--muted-foreground)); margin: 0; }
.quick-access .qa-creds { display: flex; justify-content: space-between; font-size: 12px; margin-top: 10px; color: hsl(var(--muted-foreground)); }
.quick-access .qa-creds b { color: hsl(var(--foreground)); font-family: ui-monospace, monospace; font-size: 11px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: hsl(var(--muted-foreground)); cursor: pointer; padding: 4px; }
.password-toggle i { font-size: 17px; }

/* ---------- Modals ---------- */
.modal-content {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
}
.modal-header { padding: 20px 22px 8px; border: 0; }
.modal-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 600; }
.modal-body { padding: 12px 22px 4px; }
.modal-footer { padding: 14px 22px 20px; border: 0; gap: 8px; }
.btn-close { filter: none; opacity: .5; }
.btn-close:hover { opacity: 1; }
.modal-backdrop.show { opacity: .45; }
.modal-dialog { max-width: 560px; }
.modal-dialog.modal-lg { max-width: 760px; }
.modal-dialog.modal-sm { max-width: 420px; }

/* ---------- SweetAlert2 ---------- */
.efata-swal { font-family: Inter, sans-serif !important; border-radius: 12px !important; padding: 24px !important; }
.efata-swal .swal2-title { font-family: 'Plus Jakarta Sans', sans-serif !important; font-size: 19px !important; font-weight: 600 !important; color: hsl(var(--foreground)) !important; }
.efata-swal .swal2-html-container { font-size: 14px !important; color: hsl(var(--muted-foreground)) !important; margin-top: 6px !important; }
.efata-swal .swal2-actions { gap: 8px; margin-top: 20px !important; }
.efata-swal .swal2-confirm, .efata-swal .swal2-cancel { height: 38px; border-radius: 6px; font-size: 14px; font-weight: 500; padding: 0 16px; box-shadow: none !important; }
.efata-swal .swal2-confirm { background: hsl(var(--primary)) !important; }
.efata-swal .swal2-cancel { background: hsl(var(--card)) !important; color: hsl(var(--foreground)) !important; border: 1px solid hsl(var(--input)) !important; }
.efata-toast { font-family: Inter, sans-serif !important; border-radius: 10px !important; padding: 12px 14px !important; box-shadow: var(--shadow-elevated) !important; border: 1px solid hsl(var(--border)) !important; }
.efata-toast .swal2-title { font-family: 'Plus Jakarta Sans', sans-serif !important; font-size: 14px !important; font-weight: 600 !important; color: hsl(var(--foreground)) !important; }
.efata-toast .swal2-html-container { font-size: 12px !important; color: hsl(var(--muted-foreground)) !important; margin: 2px 0 0 !important; }

/* ---------- Calendar ---------- */
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calendar-head h3 { font-size: 18px; font-weight: 600; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid hsl(var(--border)); border-left: 1px solid hsl(var(--border)); }
.calendar-dow { padding: 8px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--muted-foreground)); background: hsl(var(--muted) / .5); border-right: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); }
.calendar-day { min-height: 96px; padding: 8px; border-right: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); cursor: pointer; transition: background .15s; position: relative; }
.calendar-day:hover { background: hsl(var(--accent) / .4); }
.calendar-day.other { color: hsl(var(--muted-foreground) / .55); background: hsl(var(--muted) / .25); }
.calendar-day.today .day-num { background: hsl(var(--primary)); color: #fff; }
.calendar-day.selected { background: hsl(var(--accent)); }
.day-num { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; }
.day-events { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.day-event { font-size: 10px; padding: 2px 5px; border-radius: 4px; background: hsl(var(--primary) / .12); color: hsl(var(--primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-more { font-size: 10px; color: hsl(var(--muted-foreground)); }

/* ---------- Kanban (tarefas) ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 16px; overflow-x: auto; }
.kanban-col { background: hsl(var(--muted) / .45); border: 1px solid hsl(var(--border)); border-radius: var(--radius); min-height: 200px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); font-size: 13px; font-weight: 600; }
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 8px; padding: 12px; box-shadow: var(--shadow-card); cursor: pointer; }
.kanban-card:hover { box-shadow: var(--shadow-card-hover); }
.kanban-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kanban-card p { font-size: 12px; color: hsl(var(--muted-foreground)); margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: hsl(var(--muted-foreground)); }

/* ---------- Self-hosted helpers ---------- */
.scroll-x { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted-sm { font-size: 12px; color: hsl(var(--muted-foreground)); }
.fw-600 { font-weight: 600; }
.gap-8 { gap: 8px; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .kanban { grid-template-columns: repeat(2, minmax(260px,1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-area, .main-area.collapsed { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .page-wrap { padding: 18px; }
  .topbar { padding: 0 16px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / .35); backdrop-filter: blur(2px); }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 21px; }
  .page-actions { width: 100%; }
  .topbar .search { max-width: none; }
  .search-input { flex: 1 1 100%; max-width: none !important; }
  .table thead th, .table tbody td { padding-left: 12px; padding-right: 12px; }
  .calendar-day { min-height: 64px; padding: 4px; }
  .day-event { display: none; }
  .calendar-day.has-events::after { content: ''; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: hsl(var(--primary)); }
}

/* ---------- Dark mode tweaks ---------- */
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }
[data-theme="dark"] .alert-warning { color: hsl(38 92% 80%); }
[data-theme="dark"] .alert-info { color: hsl(199 89% 78%); }
[data-theme="dark"] .table thead th { background: hsl(var(--muted) / .35); }

/* ---------- Print (relatórios) ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .tabs, .pagination-bar, .no-print { display: none !important; }
  .main-area { margin: 0 !important; }
  .page-wrap { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .print-title { display: block !important; margin-bottom: 16px; }
}
.print-title { display: none; }
