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

:root {
  --navy: #0f172a;
  --navy2: #1e293b;
  --navy3: #334155;
  --orange: #f97316;
  --orange2: #ea580c;
  --green: #10b981;
  --green2: #059669;
  --red: #ef4444;
  --red2: #dc2626;
  --amber: #f59e0b;
  --amber2: #d97706;
  
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  
  --border: #d1d9e3;
  --border2: #b6c0cc;
  
  --text: #0b1220;
  --text2: #1f2a3a;
  --text3: #475569;
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-float: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme {
  --navy: #f8fafc;
  --navy2: #f1f5f9;
  --navy3: #e2e8f0;
  
  --bg: #0b1220;
  --bg2: #131c2e;
  --bg3: #1d273e;
  
  --border: #2a3852;
  --border2: #475569;
  
  --text: #ffffff;
  --text2: #e6ecf5;
  --text3: #b8c4d6;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --shadow-float: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { cursor: pointer; font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(249,115,22,0.10), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(245,158,11,0.08), transparent 55%),
    linear-gradient(135deg, #0b1220 0%, #1a1f2e 100%);
  padding: 20px;
}
.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow:
    0 25px 70px -10px rgba(0,0,0,0.55),
    0 10px 30px -5px rgba(0,0,0,0.35),
    0 0 0 1px rgba(249,115,22,0.15);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
body.dark-theme .login-card {
  background: var(--bg2);
  box-shadow:
    0 25px 70px -10px rgba(0,0,0,0.75),
    0 10px 30px -5px rgba(0,0,0,0.55),
    0 0 0 1px rgba(249,115,22,0.25);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-header {
  background: #0f172a;
  padding: 36px 28px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--amber));
}
.login-logo-svg {
  width: 180px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(249,115,22,0.25));
}
.login-logo-svg .login-logo-text { fill: #ffffff; }
.login-body { padding: 32px; }
.login-error {
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: none;
  border: 1px solid #fecaca;
  animation: shake 0.4s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* App Layout */
.app { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.hidden { display: none !important; }

/* Sidebar */
.sidebar {
  width: 180px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 10;
  transition: width 0.3s ease;
}
.logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.logo .logo-net { font-size: 22px; }
.sidebar .nav-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { padding: 12px; }
.sidebar-footer button { padding: 8px 10px; font-size: 11px; }
.sidebar-footer .theme-icon-btn {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-right: 8px;
}
.sidebar-footer .theme-icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-footer .footer-row { display: flex; align-items: center; gap: 6px; }
.sidebar-footer .footer-row .btn-sair { flex: 1; margin: 0; }
.logo-net {
  font-size: 26px;
  font-weight: 800;
  color: #f97316;
  letter-spacing: -1px;
  text-shadow: 0 1px 4px rgba(249,115,22,0.25);
}
.logo-net span { color: #f97316; }
.logo-sub {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
}
.sidebar-user {
  padding: 16px 20px;
  color: var(--text3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .user-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}
.sidebar-user .user-info { display: flex; flex-direction: column; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user .user-setor { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: capitalize; }
.sb-setor-switch {
  padding: 10px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sb-setor-switch-lbl {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sb-setor-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sb-setor-btns button {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  transition: all .12s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-setor-btns button::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.sb-setor-btns button.active::before {
  background: #fb923c;
  box-shadow: 0 0 6px rgba(251,146,60,0.6);
}
.sb-setor-btns button:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sb-setor-btns button.active {
  background: rgba(249,115,22,0.18);
  border-color: rgba(249,115,22,0.5);
  color: #fb923c;
}
.sb-setor-btns button:disabled {
  opacity: 0.6;
  cursor: progress;
}
.nav-label {
  padding: 20px 20px 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(249,115,22,0.15) 0%, transparent 100%);
  color: var(--orange);
  border-left-color: var(--orange);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: auto;
}
.sidebar-footer button {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.sidebar-footer button:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

/* Main Content Area */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.topbar {
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}
.topbar-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.topbar .btn {
  font-size: 12px;
  padding: 6px 10px;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.topbar .btn .ico { font-size: 13px; line-height: 1; }
.topbar .theme-icon-btn {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.topbar .theme-icon-btn:hover { background: var(--orange); color: #fff; border-color: var(--orange); }
.topbar-icon {
  color: var(--orange);
  display: flex;
  background: rgba(249,115,22,0.1);
  padding: 8px;
  border-radius: 8px;
}
.topbar-icon svg { width: 20px; height: 20px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.topbar-date { font-size: 13px; color: var(--text2); font-weight: 500; }
.topbar > .topbar-date:first-of-type { margin-left: auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--bg3); border-color: var(--border); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange2); border-color: var(--orange2); color: #fff; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: var(--green2); border-color: var(--green2); color: #fff; }
.btn-red { background: var(--red); color: #fff; border-color: var(--red); }
.btn-red:hover { background: var(--red2); border-color: var(--red2); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-amber:hover { background: var(--amber2); border-color: var(--amber2); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text2); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); transform: none; box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; background: var(--bg3); color: var(--text3); border-color: var(--border); box-shadow: none; transform: none; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { background: var(--bg3); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow); }
.icon-btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.icon-btn svg { width: 16px; height: 16px; }

/* Date Panel (Left side of content) */
.content { display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.date-panel {
  width: 168px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 2;
}
.date-panel-hdr {
  padding: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mes-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}
.mes-nav button {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.mes-nav button:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.mes-nav button { cursor: pointer; }
#date-list, .date-list { flex: 1; overflow-y: auto; min-height: 0; }
.date-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.date-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--orange); transform: scaleY(0); transition: transform 0.2s ease;
}
.date-item:hover { background: var(--bg); }
.date-item.active { background: var(--bg); }
.date-item.active::before { transform: scaleY(1); }
.date-item .dt { font-size: 14px; font-weight: 600; color: var(--navy); }
.date-item .ds { font-size: 11px; color: var(--text3); margin-top: 4px; font-weight: 500; text-transform: uppercase; }
.date-item.today .dt { color: var(--orange); }
.cnt-badge {
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.date-item.active .cnt-badge { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Table Area */
.table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agenda-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.table-container {
  background: var(--bg2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
}
.table-empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 15px;
  font-weight: 500;
}
.table-empty svg { width: 48px; height: 48px; display: block; margin: 0 auto 16px; color: var(--border2); }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th {
  background: var(--bg);
  padding: 8px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
tbody tr.concluido { opacity: 0.85; }
tbody tr.concluido td { text-decoration: line-through; text-decoration-color: var(--text3); }
body.dark-theme tbody tr.concluido { opacity: 1; background: rgba(255,255,255,.03); }
td { padding: 8px 8px; vertical-align: middle; font-size: 12px; color: var(--text); }
.td-name { font-weight: 600; color: var(--navy); display: block; margin-bottom: 2px; }
.td-sm { color: var(--text2); font-size: 12px; }
.grp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.per-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.per-manha { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.per-tarde { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.per-comercial { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.status-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-pendente { background: #fefce8; color: #92400e; border: 1px solid #fde68a; }
.status-concluido { background: #ecfdf5; color: #166534; border: 1px solid #a7f3d0; }
body.dark-theme .status-pendente { background: #3b2a07; color: #fbbf24; border-color: #7c5b14; }
body.dark-theme .status-concluido { background: #0a2e1d; color: #4ade80; border-color: #166534; }
body.dark-theme .per-manha { background: #0a1d3d; color: #93c5fd; border-color: #1e40af; }
body.dark-theme .per-tarde { background: #2d1a06; color: #fcd34d; border-color: #92400e; }
body.dark-theme .per-comercial { background: #2d0a1c; color: #f9a8d4; border-color: #9d174d; }
body.dark-theme .per-badge.per-restricao { background: #3b2406; color: #fbbf24; border-color: #b45309; }
.action-btns { display: flex; gap: 8px; }

/* Modals */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.overlay.open { display: flex; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-sm { max-width: 500px; }
.modal-md { max-width: 800px; }
.modal-lg { max-width: 1200px; }
.modal-xl { max-width: 1600px; }

.mhdr {
  background: var(--bg);
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mhdr h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mhdr h3 svg { width: 20px; height: 20px; color: var(--orange); }
.mclose {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.mclose:hover { background: var(--red); color: #fff; border-color: var(--red); }

.mbody { padding: 24px; overflow-y: auto; flex: 1; }
.mfooter {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Agendamento Flow */
.ag-layout { display: grid; grid-template-columns: 240px 1fr; height: 500px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ag-left { background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; }
.ag-right { background: var(--bg2); overflow-y: auto; padding: 24px; position: relative; }
.ag-sec {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  padding: 16px 16px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grp-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.grp-item:hover { background: var(--bg3); }
.grp-item.active {
  background: #fff8f1;
  border-left-color: var(--orange);
}
.grp-item .gname { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.grp-item .regs { font-size: 11px; color: var(--text3); }
.gdot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,0.8); }

/* Calendar in Modal */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cal-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.cal-nbtn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.cal-nbtn:hover { background: var(--orange); color: #fff; border-color: var(--orange); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  padding: 8px 0;
  text-transform: uppercase;
}
.cal-day {
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg2);
}
.cal-day:hover:not(.nc):not(.emp):not(.bq) { border-color: var(--orange); background: #fff8f1; transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.cal-day.sel { background: #0f172a !important; border-color: #0f172a !important; color: #fff !important; }
body.dark-theme .cal-day.sel { background: #f97316 !important; border-color: #f97316 !important; color: #0f172a !important; }
.cal-day.sel .cnum { color: #fff; }
.cal-day.tod { border-color: var(--orange); }
.cal-day.nc, .cal-day.bq { opacity: 0.5; cursor: not-allowed; background: var(--bg3); }
.cal-day.emp { border: none; background: transparent; }
.cal-day.bq { background: #fef2f2; border-color: #fecaca; }
.cnum { font-size: 14px; font-weight: 600; color: var(--navy); }
.cvag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.vok { background: #dcfce7; color: #15803d; }
.vwarn { background: #fef3c7; color: #b45309; }
.vfull { background: #fee2e2; color: #b91c1c; }
.vbq { background: #fecaca; color: #b91c1c; font-size: 9px; }

/* Turno Cards */
.turno-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.tc {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg2);
}
.tc:hover:not(.tcdis) { border-color: var(--orange); background: #fff8f1; transform: translateY(-2px); box-shadow: var(--shadow); }
.tc.tcdis { opacity: 0.5; cursor: not-allowed; background: var(--bg3); }
.tc-icon { font-size: 32px; margin-bottom: 12px; }
.tc-name { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.tc-hrs { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.tc-vag { font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 20px; display: inline-block; }
.vdisp { background: #dcfce7; color: #15803d; }
.vzero { background: #fee2e2; color: #b91c1c; }

/* OS Steps / Validation */
.steps { display: flex; align-items: center; margin-bottom: 24px; }
.stp { font-size: 13px; color: var(--text3); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stp.done { color: var(--green); }
.stp.cur { color: var(--navy); font-weight: 700; }
.stp-n { width: 24px; height: 24px; border-radius: 50%; border: 2px solid currentColor; font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; }
.stp.done .stp-n { background: var(--green); border-color: var(--green); color: #fff; }
.stp-ln { flex: 1; height: 2px; background: var(--border); margin: 0 12px; }
.os-row { display: flex; gap: 12px; margin-bottom: 16px; }
.os-row input { flex: 1; padding: 12px 16px; border: 2px solid var(--border2); border-radius: var(--radius-sm); font-size: 16px; font-weight: 600; color: var(--text); font-family: inherit; transition: var(--transition); }
.os-row input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.hub-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.hub-hdr { font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.hub-hdr::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hdatum { background: var(--bg2); border-radius: var(--radius-sm); padding: 12px 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.hdatum.full { grid-column: span 2; }
.hdatum .lbl { font-size: 11px; font-weight: 600; color: var(--text3); margin-bottom: 4px; text-transform: uppercase; }
.hdatum .val { font-size: 14px; font-weight: 700; color: var(--navy); }
.val-list .vrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.val-list .vrow:last-child { border: none; }
.vd { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.vd-ok { background: var(--green); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.vd-err { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }

/* Form Elements */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg2);
  transition: var(--transition);
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 100px 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 100px; gap: 12px; }
select.form-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px; }

/* Alerts */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  margin: 12px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  font-weight: 500;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.a-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.a-ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.a-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.a-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* Dashboard Cards */
.dash-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.dash-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.dash-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border2); }
.dash-card-icon { font-size: 32px; margin-bottom: 12px; }
.dash-card-value { font-size: 32px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.dash-card-label { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.dash-panel-hdr {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}
.dash-panel-body { padding: 20px; max-height: 300px; overflow-y: auto; }

/* Dashboard Bars & Charts */
.barra-ocupacao { margin-bottom: 16px; }
.barratop { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.barra-nome { font-weight: 600; color: var(--navy); }
.barra-valor { color: var(--text2); font-weight: 500; }
.barrabg { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }
.barrafill { height: 100%; border-radius: 4px; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.barrafill.baixa { background: var(--green); }
.barrafill.media { background: var(--amber); }
.barrafill.alta { background: var(--red); }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 16px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.chart-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar { width: 100%; max-width: 40px; background: linear-gradient(180deg, var(--orange) 0%, var(--orange2) 100%); border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.5s ease; box-shadow: var(--shadow-sm); }
.chart-bar-item:hover .chart-bar { background: var(--navy); }
.chart-bar-valor { font-size: 11px; font-weight: 700; color: var(--navy); }
.chart-bar-label { font-size: 10px; color: var(--text3); text-align: center; font-weight: 600; }
.perf-table { width: 100%; font-size: 12px; }
.perf-table th { background: var(--bg3); padding: 10px 12px; text-align: left; font-size: 11px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.perf-table td { padding: 12px; border-bottom: 1px solid var(--border); font-weight: 500; }
.perf-rate { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.perf-rate.alta { background: #dcfce7; color: #15803d; }
.perf-rate.media { background: #fef3c7; color: #b45309; }
.perf-rate.baixa { background: #fee2e2; color: #b91c1c; }

/* Config Section */
.cfg-layout { display: grid; grid-template-columns: 260px 1fr; height: 600px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cfg-left { background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.cfg-left-hdr { padding: 16px; border-bottom: 1px solid var(--border); background: var(--bg2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text2); }
.cfg-grp-list { overflow-y: auto; flex: 1; }
.cfg-grp-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); background: var(--bg2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cfg-grp-item:hover { background: var(--bg3); }
.cfg-grp-item.active { background: #fff8f1; border-left: 4px solid var(--orange); }
.cfg-grp-item.active .gname span { color: #1e293b !important; }
body.dark-theme .cfg-grp-item.active { background: rgba(249,115,22,0.18); border-left: 4px solid var(--orange); }
body.dark-theme .cfg-grp-item.active .gname span { color: #f8fafc !important; }
body.dark-theme .cfg-grp-item { color: var(--text); }
body.dark-theme .cfg-grp-item .gname span { color: var(--text); }
.cfg-right { overflow-y: auto !important; padding: 24px; display: flex; flex-direction: column; gap: 20px; background: var(--bg2); }
.cfg-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cfg-sec-hdr { padding: 12px 16px; background: #0f172a; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
body.dark-theme .cfg-sec-hdr { background: #1e293b; color: #f1f5f9; }
.cfg-sec-body { padding: 16px; max-height: 300px; overflow-y: auto; }

/* Utility Classes & Animations */
.rtimer { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--amber2); font-weight: 700; padding: 10px 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius-sm); margin-bottom: 16px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } }

/* Popup */
#popup { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 1000; max-width: 400px; width: 90%; background: #0f172a; color: #fff; padding: 16px 24px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 500; text-align: center; display: none; animation: popDown 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
body.dark-theme #popup { background: #1e293b; color: #f1f5f9; }
@keyframes popDown { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Agenda table: cabe na tela sem scroll horizontal */
.agenda-table {
  width: 100%;
  min-width: 0;
  table-layout: auto !important;
}
.agenda-table th,
.agenda-table td {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text);
}
.agenda-table tbody tr { border-bottom: 1px solid var(--border); }
.agenda-table tbody tr:hover { background: var(--bg3); }
body.dark-theme .agenda-table tbody tr:hover { background: rgba(255,255,255,.06); }
body.dark-theme .agenda-table tbody tr { border-bottom-color: #243149; }
/* Colunas com badge/numero: nao quebrar linha */
.agenda-table td.nw,
.agenda-table th.nw { white-space: nowrap; }
/* Colunas textuais longas: pode quebrar */
.agenda-table td.wrap { white-space: normal; word-break: break-word; }
.agenda-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  box-shadow: inset 0 -2px 0 0 var(--border);
}
.agenda-table tr.restricao-horario {
  background: #fff7ed !important;
  box-shadow: inset 3px 0 0 0 #d97706;
}
.agenda-table tr.restricao-horario:hover { background: #ffedd5 !important; }
body.dark-theme .agenda-table tr.restricao-horario {
  background: rgba(217,119,6,.15) !important;
  box-shadow: inset 3px 0 0 0 #f59e0b;
}
body.dark-theme .agenda-table tr.restricao-horario:hover {
  background: rgba(217,119,6,.25) !important;
}
.per-badge.per-restricao {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-weight: 700;
  animation: pulseAlert 2s infinite;
}
@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,.35); }
  50% { box-shadow: 0 0 0 4px rgba(217,119,6,0); }
}

/* Resumo do rodapé da agenda - fixo embaixo da tabela */
.agenda-resumo {
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  display: flex; flex-direction: column; gap: 2px;
  flex: 0 0 auto;
}
.agenda-resumo-row {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.agenda-resumo-lbl {
  font-size: 10px; color: var(--text2); font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  min-width: 55px;
}

/* Fix table resize */
table { table-layout: auto !important; }
thead th { min-width: 0; }

/* Responsive adjustments */
@media(max-width: 900px) {
  .sidebar { width: 70px; }
  .logo-net { font-size: 18px; text-align: center; }
  .sidebar .logo-sub, .sidebar .nav-label, .sidebar .nav-item span, .sidebar-user .user-info, .sidebar-footer button span { display: none; }
  .nav-item { justify-content: center; padding: 16px 0; }
  .sidebar-user { justify-content: center; }
  .dash-cards { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .ag-layout, .cfg-layout { grid-template-columns: 1fr; height: auto; }
}

/* Configuração do botão de gerenciar bairros e outros no Config section */
.periodo-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 500; }
.periodo-row:last-child { border: none; }
.dia-tag { width: 45px; font-weight: 700; color: var(--navy); flex-shrink: 0; font-size: 11px; }
.per-tag { width: 70px; flex-shrink: 0; }
.per-hrs { color: var(--text2); flex: 1; font-size: 11px; min-width: 80px; }
.per-lim { font-weight: 800; width: 40px; text-align: center; flex-shrink: 0; font-size: 12px; color: var(--navy); }
.per-setor { width: 75px; flex-shrink: 0; font-size: 10px; text-transform: uppercase; font-weight: 600; color: var(--text3); }
.per-actions { display: flex; gap: 4px; flex-shrink: 0; }
.badge-bloq { background: #fee2e2; color: #b91c1c; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.badge-ativ { background: #dcfce7; color: #15803d; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.bloq-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.bloq-row:last-child { border: none; }
.bloq-data { font-weight: 700; width: 90px; flex-shrink: 0; color: var(--navy); }
.bloq-motivo { flex: 1; color: var(--text2); font-weight: 500; }
.regiao-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; font-size: 11px; margin: 2px; font-weight: 600; color: var(--navy); }
.regiao-nome-btn { background: transparent; border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.regiao-nome-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Users & Logs */
.user-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.user-row:last-child { border: none; }
.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-name { font-weight: 700; color: var(--navy); }
.user-email { font-size: 11px; color: var(--text2); font-weight: 500; }
.user-tags { display: flex; gap: 6px; align-items: center; }

.logs-table { width: 100%; font-size: 12px; }
.logs-table th { background: var(--bg3); color: var(--text2); padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.logs-table td { padding: 12px; border-bottom: 1px solid var(--border); font-weight: 500; color: var(--text); }
.logs-pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px; }
.logs-pagination button { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg2); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text2); transition: var(--transition); }
.logs-pagination button:hover { background: var(--bg3); color: var(--navy); }
.logs-pagination button.active { background: var(--orange); color: #fff; border-color: var(--orange); }

.color-pick { display: flex; align-items: center; gap: 8px; }
.color-pick input[type=color] { width: 36px; height: 36px; border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 2px; cursor: pointer; background: var(--bg2); }