/* ═══════════════════════════════════════════
   IMOVELFLOW — STYLESHEET
   Design: Refined Dark Professional
═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap');

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --bg4: #252d40;
  --surface: #1a2035;
  --surface2: #202840;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);

  --accent: #4f7cff;
  --accent2: #7c5cfc;
  --accent-glow: rgba(79,124,255,0.25);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --text: #e8ecf4;
  --text2: #9aa3bc;
  --text3: #5e6a84;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --sidebar-w: 230px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

  /* Sector colors */
  --col-adm: #4f7cff;
  --col-fin: #22c55e;
  --col-ven: #f59e0b;
  --col-loc: #a855f7;
  --col-ges: #06b6d4;
  --col-jur: #ef4444;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ─── UTILS ─── */
.hidden { display: none !important; }
.active { display: flex !important; }

/* ─── PAGES ─── */
.page { min-height: 100vh; }
#page-login { display: flex; }
#page-gerencia, #page-operacional { display: none; }
#page-gerencia.active, #page-operacional.active { display: block; }

/* ═══════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════ */
#page-login {
  background: var(--bg);
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, #0d1520 0%, #1a1f35 50%, #0f1825 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 50px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -120px; left: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(79,124,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-left::after {
  content: '';
  position: absolute;
  bottom: -100px; right: -80px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,92,252,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.login-brand {
  margin-bottom: 48px;
}
.brand-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 24px rgba(79,124,255,0.5));
}
.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 2.8rem;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 10px;
}
.login-logo {
  height: 200px;
  width: auto;
  margin-bottom: 28px;
}
.brand-tagline {
  font-size: 1rem;
  color: var(--text2);
  max-width: 320px;
  line-height: 1.6;
}

.login-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text2);
  font-size: 0.9rem;
  font-weight: 400;
}
.feat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--accent-glow);
}

.login-left-footer {
  position: absolute;
  bottom: 30px; left: 50px;
  color: var(--text3);
  font-size: 0.75rem;
}

/* Login Right */
.login-right {
  width: 460px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  border-left: 1px solid var(--border);
}

.login-panel {
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  text-align: center;
}
.login-sub {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 28px;
  text-align: center;
}

.access-type-row {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.access-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 0.85rem;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.access-btn .access-icon { font-size: 1.5rem; }
.access-btn:hover { border-color: var(--accent); color: var(--text); }
.access-btn.active {
  border-color: var(--accent);
  background: rgba(79,124,255,0.12);
  color: var(--text);
  box-shadow: 0 0 20px rgba(79,124,255,0.2);
}

.login-form { display: flex; flex-direction: column; gap: 18px; }

.field-group { display: flex; flex-direction: column; gap: 7px; }
.field-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="email"], input[type="text"], input[type="password"], textarea, select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: 'Sora', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.15);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 80px; }


.btn-primary, .btn-secondary, .btn-danger, .btn-sm, .btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  padding: 11px 20px;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(79,124,255,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(79,124,255,0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 9px 16px;
  font-size: 0.85rem;
}
.btn-secondary:hover { background: var(--bg4); color: var(--text); border-color: var(--border2); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 9px 16px;
  font-size: 0.85rem;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm {
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 12px;
  font-size: 0.78rem;
}
.btn-sm:hover { color: var(--text); border-color: var(--border2); }

.btn-login { width: 100%; padding: 14px; font-size: 0.95rem; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  padding: 8px 14px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  width: 100%;
  margin-top: 8px;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.login-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text3);
}

/* ═══════════════════════════════════════════
   APP SHELL / SIDEBAR
═══════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 20px 0;
}
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }
.sidebar.collapsed .nav-group-label { display: none; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}
.sidebar.collapsed .nav-item span:not(.nav-icon):not(.badge):not(.nav-sector-dot) { display: none; }
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .user-chip {
  justify-content: center;
  padding: 8px 0;
}
.sidebar.collapsed .logout-label { display: none; }
.sidebar.collapsed .btn-logout {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  margin: 8px auto 0;
  border-radius: 50%;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.brand-icon-sm { font-size: 1.4rem; flex-shrink: 0; }
.brand-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  flex-shrink: 0;
}
.sidebar-toggle {
  margin-left: auto;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  font-size: 0.6rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.25s ease;
}
.sidebar-toggle:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 8px;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.nav-group {
  margin-bottom: 6px;
}
.nav-group-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1px;
  padding: 10px 12px 4px;
  text-transform: uppercase;
}
.sidebar-nav-extra {
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  background: rgba(79,124,255,0.15);
  color: var(--accent);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 1rem; flex-shrink: 0; }
.nav-sector-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.badge:empty { display: none; }

.sidebar-bottom {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  margin-bottom: 0;
  overflow: hidden;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.7rem;
  color: var(--text3);
  white-space: nowrap;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px;
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}

/* ═══════════════════════════════════════════
   GERÊNCIA SECTIONS
═══════════════════════════════════════════ */
.gerencia-section { display: none; flex-direction: column; }
.gerencia-section.active { display: flex; }

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1 0 auto;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { font-size: 1.3rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.75rem; color: var(--text2); }

.usuarios-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color 0.2s;
}
.user-row:hover { border-color: var(--border2); }
.user-row-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.9rem; color: #fff;
  flex-shrink: 0;
}
.user-row-info { flex: 1; min-width: 180px; }
.user-row-name { font-weight: 500; font-size: 0.9rem; }
.user-row-email { font-size: 0.78rem; color: var(--text2); }
.user-row-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.chip.accent { background: rgba(79,124,255,0.15); color: var(--accent); border-color: rgba(79,124,255,0.3); }
.chip.success { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.25); }
.chip.warning { background: rgba(245,158,11,0.12); color: var(--warning); border-color: rgba(245,158,11,0.25); }
.chip.danger { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.25); }
.chip.muted { color: var(--text3); }

.user-row-actions { display: flex; gap: 8px; margin-left: auto; }

.setores-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.sector-card-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  flex: 1 0 auto;
}
.sector-card-info-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sector-card-info-count { font-size: 0.78rem; color: var(--text2); }

/* ═══════════════════════════════════════════
   GERENCIAR — SECTOR CONFIG
═══════════════════════════════════════════ */
.gerenciar-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Sector selector */
.sector-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sector-selector-card {
  padding: 12px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text2);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
  position: relative;
  min-width: 110px;
  justify-content: center;
}
.sector-selector-card:hover {
  border-color: var(--accent);
  color: var(--text);
}
.sector-selector-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  background: rgba(79,124,255,0.08);
  color: var(--text);
}
.sector-selector-card .sec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sector-selector-card.dirty::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
}

/* Unsaved bar */
.unsaved-bar {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--warning);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Config panels */
.config-panels {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.config-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.config-panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.config-panel-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.config-panel-body {
  padding: 6px;
}

.config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.config-item:hover {
  background: var(--bg3);
}
.config-item .color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}
.config-item .item-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.config-item .item-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}
.config-item .item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.config-item .item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--text3);
  transition: background 0.15s, color 0.15s;
}
.config-item .item-actions button:hover {
  background: var(--bg4);
  color: var(--text);
}
.config-item .item-actions button.btn-icon-edit:hover {
  color: var(--accent);
  background: rgba(79,124,255,0.12);
}
.config-item .item-actions button.btn-icon-del:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.12);
}
.config-panel-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.config-panel-footer button {
  background: none;
  border: 1px dashed var(--border2);
  color: var(--text3);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: 'Sora', sans-serif;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  width: 100%;
}
.config-panel-footer button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79,124,255,0.06);
}

/* Config empty state inside panel */
.config-empty {
  text-align: center;
  padding: 20px;
  color: var(--text3);
  font-size: 0.82rem;
}

/* ═══════════════════════════════════════════
   OPERATIONAL SECTIONS
═══════════════════════════════════════════ */
.op-section { display: none; flex-direction: column; }
.op-section.active { display: flex; }

.ponto-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1a2332, #1e2a3d);
  border: 1px solid rgba(79,124,255,0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ponto-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(79,124,255,0.15);
}
.ponto-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.ponto-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ponto-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.ponto-sub {
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 2px;
}
.ponto-arrow {
  font-size: 1.2rem;
  color: var(--text3);
  transition: transform 0.2s, color 0.2s;
}
.ponto-card:hover .ponto-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

.sector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.sector-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
}
.sector-sub { font-size: 0.82rem; color: var(--text2); margin-top: 2px; }
.sector-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tab-btn { padding: 8px 16px; font-size: 0.83rem; }
.tab-btn.active {
  background: rgba(79,124,255,0.15);
  color: var(--accent);
  border-color: rgba(79,124,255,0.3);
}

.tab-content { display: none; flex-direction: column; }
.tab-content.active { display: flex; }

/* ─── KANBAN ─── */
.kanban-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.kanban-toolbar input {
  max-width: 260px;
  padding: 9px 14px;
}

/* Filter toggle button */
.filter-toggle-btn { transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s; }
.filter-toggle-btn.active {
  background: rgba(79,124,255,0.12);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Gerencia Kanban Views */
.gerencia-kanban-views {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gerencia-kanban-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gerencia-kanban-toolbar input {
  max-width: 260px;
  padding: 9px 14px;
}

.views-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gerencia-kanban-view {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.gerencia-kanban-view.active { display: flex; }

.gerencia-kanban-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
  padding: 4px 0;
}

.gerencia-kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.gerencia-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gerencia-card:hover {
  border-color: var(--border2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.gerencia-card .card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.gerencia-card .card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gerencia-card .card-meta {
  font-size: 0.76rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.gerencia-card .card-meta .sector-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gerencia-card .card-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text2);
}
.gerencia-card .card-type-tag {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text2);
}
.gerencia-card .card-date {
  font-size: 0.73rem;
  color: var(--text3);
}

/* Filter bar */
.kanban-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  flex-wrap: wrap;
  overflow-x: auto;
  animation: slideDown 0.2s ease;
}
.kanban-filters.hidden { display: none; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-group .filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.filter-group select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 28px 7px 10px;
  font-size: 0.8rem;
  font-family: 'Sora', sans-serif;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  min-width: 130px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%235e6a84'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.filter-group select:hover { border-color: var(--border2); }
.filter-group select:focus { border-color: var(--accent); }

.filter-date-group { flex: 1; min-width: 200px; }
.filter-date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-date-inputs input[type="date"] {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: 'Sora', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
  width: 140px;
  color-scheme: dark;
}
.filter-date-inputs input[type="date"]:focus { border-color: var(--accent); }
.filter-date-inputs input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}
.filter-date-sep {
  color: var(--text3);
  font-size: 0.8rem;
}

.filter-clear-btn {
  flex-shrink: 0;
  color: var(--text3);
  border-color: var(--border);
  margin-left: auto;
}
.filter-clear-btn:hover {
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.08);
}

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 400px;
  align-items: flex-start;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: var(--bg3); border-radius: 3px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

.kanban-col {
  min-width: 280px;
  width: 280px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
  flex-shrink: 0;
}
.kanban-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.col-name {
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.col-count {
  background: var(--bg4);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--text2);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* ─── CARDS ─── */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  animation: cardIn 0.25s ease;
}
.kanban-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.kanban-card.is-mine {
  border-left: 3px solid var(--accent);
  background: rgba(79,124,255,0.05);
}
.kanban-card.priority-alta { border-top: 2px solid var(--danger); }
.kanban-card.priority-media { border-top: 2px solid var(--warning); }
.kanban-card.priority-baixa { border-top: 2px solid var(--success); }

/* ─── DRAG & DROP ─── */
.kanban-card {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card.origin-hidden {
  opacity: 0.15 !important;
  transform: scale(0.95) !important;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.kanban-col.drag-over {
  border-color: var(--accent);
  background: rgba(79,124,255,0.06);
  box-shadow: inset 0 0 0 2px rgba(79,124,255,0.2);
  animation: pulseGlow 1s ease-in-out infinite;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.kanban-col.drag-over .kanban-cards {
  min-height: 80px;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(79,124,255,0.1); }
  50%      { box-shadow: inset 0 0 0 3px rgba(79,124,255,0.3); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.card-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}
.priority-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}
.priority-badge.alta { background: rgba(239,68,68,0.15); color: var(--danger); }
.priority-badge.media { background: rgba(245,158,11,0.15); color: var(--warning); }
.priority-badge.baixa { background: rgba(34,197,94,0.12); color: var(--success); }

.card-client { font-size: 0.77rem; color: var(--text2); margin-bottom: 8px; }
.client-type { font-weight: 500; }
.client-type[data-type="Locador"] { color: var(--col-ges); }
.client-type[data-type="Locatário"] { color: var(--col-loc); }
.card-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.card-type-tag.type--chamado   { background: rgba(79,124,255,0.12); color: var(--col-adm); }
.card-type-tag.type--contrato  { background: rgba(34,197,94,0.12); color: var(--col-fin); }
.card-type-tag.type--pendencia { background: rgba(245,158,11,0.12); color: var(--col-ven); }
.card-type-tag.type--processo  { background: rgba(168,85,247,0.12); color: var(--col-loc); }
.card-type-tag.type--demanda   { background: rgba(6,182,212,0.12); color: var(--col-ges); }
.card-type-tag.type--cliente   { background: rgba(239,68,68,0.12); color: var(--col-jur); }
.card-type-tag.type--outros    { background: rgba(148,163,184,0.15); color: var(--text2); }
.card-contract {
  font-size: 0.72rem;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.card-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border);
}
.card-tag.shared { background: rgba(124,92,252,0.12); color: #a78bfa; border-color: rgba(124,92,252,0.25); }
.card-tag.mentioned { background: rgba(6,182,212,0.12); color: var(--info); border-color: rgba(6,182,212,0.25); }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.card-responsible {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text2);
}
.resp-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 600; color: #fff;
}
.card-date { font-size: 0.72rem; color: var(--text3); }
.card-time-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.card-time-badge--green {
  background: rgba(34,197,94,0.12);
  color: var(--success);
}
.card-time-badge--yellow {
  background: rgba(245,158,11,0.12);
  color: var(--warning);
}
.card-time-badge--red {
  background: rgba(239,68,68,0.12);
  color: var(--danger);
}
.mine-label {
  display: block;
  text-align: right;
  background: rgba(79,124,255,0.2);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── TASKS ─── */
.tasks-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tasks-column {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  overflow: hidden;
}
.tasks-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.tasks-col-header h3 { font-size: 0.9rem; font-weight: 600; }
.task-list-inner {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  animation: cardIn 0.2s ease;
}
.task-item:hover { border-color: var(--border2); }
.task-item.done { opacity: 0.55; }
.task-item.done .task-title { text-decoration: line-through; color: var(--text3); }
.task-item.designated { border-left: 3px solid var(--warning); }
.task-item.recurring { border-left: 3px solid var(--info); }
.task-item.overdue { border-left: 3px solid var(--danger); }

.task-check {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border2);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  margin-top: 1px;
}
.task-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 3px; }
.task-meta { font-size: 0.72rem; color: var(--text3); }
.task-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.task-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
}
.task-badge.designated { background: rgba(245,158,11,0.12); color: var(--warning); }
.task-badge.recurring { background: rgba(6,182,212,0.1); color: var(--info); }
.task-badge.overdue { background: rgba(239,68,68,0.12); color: var(--danger); }

/* ─── MY TASKS LAYOUT (Minhas Tarefas) ─── */
.my-tasks-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.my-tasks-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.my-tasks-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.my-tasks-card-header h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.my-tasks-count {
  background: var(--bg4);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  color: var(--text2);
  min-width: 24px;
  text-align: center;
}
.my-tasks-card-body {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}

/* ─── COLLAPSIBLE PERIOD SECTIONS ─── */
.period-section {
  border-bottom: 1px solid var(--border);
}
.period-section:last-child {
  border-bottom: none;
}
.period-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}
.period-section-header:hover {
  background: var(--bg3);
}
.period-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  flex: 1;
}
.period-section-count {
  background: var(--bg4);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 0.68rem;
  color: var(--text3);
  min-width: 20px;
  text-align: center;
}
.period-section-arrow {
  font-size: 0.65rem;
  color: var(--text3);
  transition: transform 0.2s ease;
}
.period-section.open .period-section-arrow {
  transform: rotate(0deg);
}
.period-section-body {
  padding: 0 4px 4px;
}
.period-section-body .task-list-inner {
  max-height: none;
  padding: 4px;
}

/* ─── SECTOR PERIOD CARDS ─── */
.sector-tasks-periods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}
.sector-period-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sector-period-card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.sector-period-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.sector-period-card-count {
  background: var(--bg4);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.7rem;
  color: var(--text2);
}
.sector-period-card .task-list-inner {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

/* ─── MENTIONS & NOTIFICATIONS ─── */
.mentions-list, .notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mention-item, .notif-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  align-items: flex-start;
}
.mention-item:hover, .notif-item:hover { border-color: var(--border2); }
.notif-item.unread { border-left: 3px solid var(--accent); background: rgba(79,124,255,0.04); }

.notif-item.unread[data-type="mention"]         { border-left-color: #4f7cff; }
.notif-item.unread[data-type="task_designated"] { border-left-color: #f59e0b; }
.notif-item.unread[data-type="card_update"]     { border-left-color: #22c55e; }
.notif-item.unread[data-type="task_incomplete"] { border-left-color: #ef4444; }
.notif-item.unread[data-type="card_stale"]      { border-left-color: #a855f7; }

.notif-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.88rem; font-weight: 500; margin-bottom: 4px; }
.notif-msg { font-size: 0.8rem; color: var(--text2); margin-bottom: 6px; }
.notif-time { font-size: 0.72rem; color: var(--text3); }
.notif-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.notif-mark {
  flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
}
.notif-mark:hover { color: var(--text); }
.notif-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
  line-height: 1;
  filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(7484%) hue-rotate(356deg) brightness(94%) contrast(117%);
}
.notif-delete:hover {
  opacity: 1;
  background: rgba(239,68,68,0.15);
}

/* ═══════════════════════════════════════════
   CARD DRAWER
═══════════════════════════════════════════ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  justify-content: flex-end;
}
.drawer.hidden { display: none; }

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.drawer-panel {
  position: relative;
  width: 580px;
  max-width: 95vw;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  animation: slideInRight 0.25s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title-area { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.sector-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg3);
  color: var(--text2);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}
.drawer-close:hover { background: var(--bg3); color: var(--text); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.props-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.prop-item { display: flex; flex-direction: column; gap: 3px; }
.prop-label { font-size: 0.72rem; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.prop-value { font-size: 0.85rem; color: var(--text); font-weight: 500; }

.history-list { display: flex; flex-direction: column; gap: 0; }
.history-entry {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.history-entry:last-child { border-bottom: none; }
.history-dot {
  width: 8px; height: 8px;
  background: var(--bg4);
  border: 2px solid var(--border2);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.history-entry-text { color: var(--text2); line-height: 1.5; }
.history-entry-text strong { color: var(--text); }
.history-entry-time { color: var(--text3); font-size: 0.72rem; margin-top: 2px; }

.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.comment-author { font-size: 0.8rem; font-weight: 600; }
.comment-sector { font-size: 0.72rem; color: var(--text3); }
.comment-time { font-size: 0.72rem; color: var(--text3); margin-left: auto; }
.comment-text { font-size: 0.83rem; color: var(--text2); line-height: 1.5; }
.comment-attach { font-size: 0.75rem; color: var(--info); margin-top: 4px; }

.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea { font-size: 0.85rem; }
.comment-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.comment-item-actions { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.comment-btn { background: none; border: none; cursor: pointer; padding: 2px 6px; font-size: .75rem; border-radius: 4px; opacity: 0.4; transition: opacity .15s; }
.comment-btn:hover { opacity: 1; background: var(--bg4); }
.comment-btn.save:hover { background: rgba(34,197,94,0.12); }
.comment-btn.cancel:hover { background: rgba(239,68,68,0.12); }
.comment-edit-textarea { width: 100%; font-size: .83rem; padding: 6px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); resize: vertical; box-sizing: border-box; }

.drawer-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-box::-webkit-scrollbar { width: 4px; }
.modal-box::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.modal-content-inner {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }

.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text2);
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.checkbox-item:hover { background: var(--bg3); color: var(--text); }
.checkbox-item input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.sectors-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 260px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
  pointer-events: all;
  font-size: 0.85rem;
  color: var(--text);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast-out { animation: toastOut 0.2s ease forwards; }
.toast-icon { font-size: 1rem; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ═══════════════════════════════════════════
   SCROLLBAR GLOBAL
═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (min-width: 901px) {
  .sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }
}

@media (max-width: 900px) {
  #page-login { flex-direction: column; }
  .login-left { display: none; }
  .login-right { width: 100%; }

  .sidebar { width: 64px; }
  .sidebar .brand-text,
  .sidebar .nav-item span:not(.nav-icon):not(.badge):not(.nav-sector-dot),
  .sidebar .user-info,
  .sidebar .btn-logout { display: none; }
  .sidebar-toggle { display: flex; }
  .sidebar.expanded {
    width: var(--sidebar-w);
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 300;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.expanded .brand-text,
  .sidebar.expanded .nav-item span:not(.nav-icon):not(.badge):not(.nav-sector-dot),
  .sidebar.expanded .user-info,
  .sidebar.expanded .btn-logout { display: flex; }

  .tasks-layout { grid-template-columns: 1fr; }
  .my-tasks-layout { grid-template-columns: 1fr; }
  .sector-tasks-periods { grid-template-columns: 1fr; }
  .kanban-col { min-width: 260px; width: 260px; }
  .form-row { grid-template-columns: 1fr; }
  .props-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .drawer-panel { width: 100%; }
  .modal-box { max-width: 100%; border-radius: var(--radius); }
}

/* ─── MISC ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 0.85rem;
  text-align: center;
}
.empty-icon { font-size: 2.5rem; opacity: 0.5; }

.color-adm { color: var(--col-adm); }
.color-fin { color: var(--col-fin); }
.color-ven { color: var(--col-ven); }
.color-loc { color: var(--col-loc); }
.color-ges { color: var(--col-ges); }
.color-jur { color: var(--col-jur); }

.bg-adm { background: rgba(79,124,255,0.12); border-color: rgba(79,124,255,0.25) !important; color: var(--col-adm) !important; }
.bg-fin { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.25) !important; color: var(--col-fin) !important; }
.bg-ven { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25) !important; color: var(--col-ven) !important; }
.bg-loc { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.25) !important; color: var(--col-loc) !important; }
.bg-ges { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.25) !important; color: var(--col-ges) !important; }
.bg-jur { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25) !important; color: var(--col-jur) !important; }

/* Switch toggle */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text2);
  cursor: pointer;
}
.switch {
  position: relative;
  width: 38px; height: 22px;
  background: var(--bg4);
  border-radius: 20px;
  border: 1px solid var(--border2);
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--text3);
  border-radius: 50%;
  transition: left 0.2s ease, background 0.2s ease;
}
.switch.on { background: rgba(79,124,255,0.3); border-color: var(--accent); }
.switch.on::after { left: 19px; background: var(--accent); }

/* No results / Loading */
.loading { color: var(--text3); font-size: 0.85rem; padding: 20px; text-align: center; }

/* Login error */
.login-error {
  color: var(--danger);
  font-size: .85rem;
  min-height: 1.1em;
  margin: -.25rem 0 .25rem;
}
input.error { border-color: var(--danger); }

/* ═══════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
