/* ============================================================
   main.css — Design system compartilhado
   ============================================================ */

/* -- Reset & Base -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 15px; line-height: 1.6; color: #0f172a; background: #f8fafc; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* -- CSS Variables -- */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #0f172a;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #06b6d4;
  --purple: #8b5cf6;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --sidebar-w: 260px;
}

/* -- Typography -- */
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
.text-muted { color: var(--muted); }
.color-green { color: var(--success); }
.color-red { color: var(--error); }

/* -- Form elements -- */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: #374151; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.input-disabled { background: #f1f5f9 !important; color: var(--muted) !important; }
.input-password-wrap { position: relative; }
.input-password-wrap input { padding-right: 2.8rem; }
.toggle-pass { position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); padding: .25rem; }
.form-row-flex { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: .5rem; }
.grid-2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.span-2 { grid-column: 1/-1; }
.checkbox-list { display: flex; flex-direction: column; gap: .4rem; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem; }

/* -- Buttons -- */
.btn-primary { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.2rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; transition: background .15s, transform .1s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.btn-lg { padding: .8rem 1.8rem; font-size: 1rem; }
.btn-submit { width: 100%; padding: .75rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem; transition: background .15s; }
.btn-submit:hover { background: var(--primary-dark); }
.btn-submit:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-outline-sm { display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-weight: 500; font-size: .85rem; background: #fff; transition: border-color .15s, background .15s; }
.btn-outline-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary-sm { display: inline-flex; padding: .45rem .9rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-weight: 600; font-size: .85rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; background: #f1f5f9; color: var(--text); transition: background .15s; }
.btn-icon:hover { background: var(--border); }
.btn-icon.btn-edit    { background: #eff6ff; color: var(--primary); }
.btn-icon.btn-warn    { background: #fffbeb; color: var(--warning); }
.btn-icon.btn-danger  { background: #fef2f2; color: var(--error); }
.btn-icon.btn-success { background: #f0fdf4; color: var(--success); }
.btn-danger-outline { display: inline-flex; justify-content: center; padding: .7rem; border: 1.5px solid var(--error); color: var(--error); border-radius: var(--radius-sm); font-weight: 600; }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-sm { padding: .35rem .8rem; font-size: .82rem; font-weight: 600; border-radius: 5px; color:#fff; border: none; cursor:pointer; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #dc2626; }
.btn-link { background: none; border: none; color: var(--primary); font-size: .82rem; cursor: pointer; text-decoration: underline; }

/* -- Badges -- */
.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.2; text-transform: capitalize; white-space: nowrap; }
.badge-success  { background: #dcfce7; color: #166534; }
.badge-error    { background: #fee2e2; color: #991b1b; }
.badge-purple   { background: #f5f3ff; color: #5b21b6; }
.badge-warning  { background: #fef9c3; color: #92400e; }
.badge-info     { background: #cffafe; color: #155e75; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }
.badge-admin    { background: #dbeafe; color: #1d4ed8; }
.badge-gestor   { background: #e0f2fe; color: #0369a1; }
.badge-colaborador { background: #f1f5f9; color: #475569; }
.badge-required { background: #fee2e2; color: #991b1b; font-size:.68rem; }
.badge-optional { background: #f1f5f9; color: #475569; font-size:.68rem; }
.badge-tipo-entrada  { background:#dcfce7; color:#166534; }
.badge-tipo-pausa    { background:#fef9c3; color:#854d0e; }
.badge-tipo-retorno  { background:#dbeafe; color:#1d4ed8; }
.badge-tipo-saida    { background:#fee2e2; color:#991b1b; }

/* -- Alerts -- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: .75rem; }
.alert-success { background: #dcfce7; color: #166534; border-left: 3px solid var(--success); }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--error); }
.alert-warning { background: #fef9c3; color: #854d0e; border-left: 3px solid var(--warning); }
.alert-info    { background: #cffafe; color: #155e75; border-left: 3px solid var(--info); }

/* -- Toast -- */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .75rem; padding: .75rem 1.2rem; min-width: 260px; max-width: 90vw; background: #1e293b; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 10000; animation: toastIn .25s ease; font-size: .9rem; }
.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }
.toast-warning { background: #92400e; }
.toast-info    { background: #155e75; }
.toast-close   { margin-left: auto; background: none; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; opacity: .7; }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(10px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* -- Cards -- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: .97rem; font-weight: 700; }
.card-body { padding: 1.1rem; }
.card-body.p0 { padding: 0; }
.section-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
.section-card-title { font-size: .93rem; font-weight: 700; margin-bottom: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* -- Modal -- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(2px); }
.modal-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; animation: modalIn .2s ease; }
.modal-card.modal-lg { max-width: 620px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close { font-size: 1.5rem; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-card .auth-form { padding: 1.2rem; }
@keyframes modalIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

/* -- Tables -- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: #f8fafc; padding: .7rem .9rem; text-align: left; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: .7rem .9rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.td-empty { text-align: center; color: var(--muted); padding: 2rem; }
.td-user { display: flex; align-items: center; gap: .5rem; }
.td-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.td-actions { display: flex; gap: .3rem; align-items: center; }
.td-foto-thumb { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; cursor: pointer; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.toolbar-filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar-filters input, .toolbar-filters select { padding: .45rem .75rem; font-size: .86rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* -- Pagination -- */
.pagination { display: flex; gap: .35rem; justify-content: center; padding: 1rem; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--card); border: 1.5px solid var(--border); font-size: .88rem; font-weight: 600; transition: background .12s; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--bg); }

/* -- Tabs -- */
.tabs-nav { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-link { padding: .6rem 1rem; font-size: .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab-link.active { color: var(--primary); border-color: var(--primary); }
.tab-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--error); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; padding: 0 4px; margin-left: .3rem; }

/* -- Timeline -- */
.timeline { display: flex; flex-direction: column; gap: .1rem; padding: .25rem 0; }
.timeline-item { display: flex; align-items: flex-start; gap: .65rem; position: relative; padding: .35rem 0 .35rem .1rem; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: .35rem; }
.timeline-entrada .tl-dot  { background: var(--success); }
.timeline-pausa   .tl-dot  { background: var(--warning); }
.timeline-retorno .tl-dot  { background: var(--primary); }
.timeline-saida   .tl-dot  { background: var(--error); }
.tl-content { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.tl-tipo { font-weight: 700; font-size: .88rem; text-transform: capitalize; }
.tl-hora { font-size: .82rem; color: var(--muted); }
.tl-local { font-size: .78rem; color: var(--muted); }
.tl-foto { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; cursor: pointer; }
.timeline.timeline-sm .tl-dot { width: 8px; height: 8px; }

/* -- Notifications -- */
.notif-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: #f1f5f9; color: var(--muted); transition: background .15s; }
.notif-btn:hover { background: var(--border); }
.notif-badge { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; background: var(--error); color: #fff; border-radius: 50%; font-size: .62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-panel { position: fixed; top: 56px; right: 12px; width: 320px; max-height: 480px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 500; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--border); animation: modalIn .15s ease; }
.notif-panel-admin { top: 56px; right: 12px; }
.notif-panel-header { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; font-weight: 700; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background .12s; }
.notif-item:hover { background: #f8fafc; }
.notif-item.nao-lida { background: #eff6ff; }
.notif-item .notif-titulo { font-size: .88rem; font-weight: 600; }
.notif-item .notif-msg   { font-size: .82rem; color: var(--muted); }
.notif-item .notif-data  { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .88rem; }
.notif-overlay { position: fixed; inset: 0; z-index: 499; }

/* -- Auth forms -- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: #0f172a; }
.auth-wide .auth-card { max-width: 520px; }
.auth-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; width: 100%; max-width: 400px; }
.auth-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.auth-logo h1 { font-size: 1.4rem; font-weight: 800; }
.auth-form { display: flex; flex-direction: column; }
.auth-footer-text { text-align: center; font-size: .88rem; color: var(--muted); margin-top: 1rem; }
.auth-footer-text a { color: var(--primary); font-weight: 600; }
.auth-desc { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.demo-hint { margin-top: 1rem; padding: .65rem 1rem; background: #f8fafc; border-radius: var(--radius-sm); font-size: .82rem; color: var(--muted); text-align: center; border: 1px dashed var(--border); }
.link-small { font-size: .82rem; color: var(--primary); }

/* -- Wizard steps -- */
.wizard-steps { display: flex; align-items: center; margin-bottom: 1.5rem; }
.wstep { display: flex; align-items: center; gap: .4rem; }
.wstep-num { width: 26px; height: 26px; border-radius: 50%; background: var(--border); font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.wstep.active .wstep-num { background: var(--primary); color: #fff; }
.wstep.done .wstep-num { background: var(--success); color: #fff; }
.wstep-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.wstep.active .wstep-label { color: var(--text); }
.wstep-line { flex: 1; height: 2px; background: var(--border); margin: 0 .5rem; }

/* -- Chips -- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; background: #f1f5f9; border-radius: 999px; font-size: .82rem; }
.chip-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.chip-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-sm { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .55rem; background: #f1f5f9; border-radius: 999px; font-size: .78rem; }
.chip-avatar-xs { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.chip-orange { background: #fff7ed; color: #c2410c; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem 1.1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; transition: background .15s, transform .1s; cursor: pointer; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-warning { background: #f59e0b; color: #fff; border: none; }
.btn-warning:hover { background: #d97706; }
.btn-warning:disabled { background: #fcd34d; cursor: not-allowed; }

/* -- Empty state -- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.empty-msg { color: var(--muted); font-size: .9rem; padding: 1rem; }
.span-all { grid-column: 1 / -1; }

/* -- Progress bar -- */
.progress-bar-wrap { display: flex; align-items: center; gap: .5rem; }
.progress-bar { height: 6px; background: var(--primary); border-radius: 3px; flex-shrink: 0; max-width: 80px; }
.progress-bar-wrap > span { font-size: .82rem; color: var(--muted); }

/* -- Code block -- */
.code-block { background: #1e293b; color: #93c5fd; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .82rem; word-break: break-all; font-family: 'Courier New', monospace; margin: .75rem 0; }

/* -- Not found -- */
.not-found-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: #0f172a; }
.not-found-card { text-align: center; color: #fff; }
.not-found-num { font-size: clamp(5rem, 20vw, 10rem); font-weight: 800; color: #3b82f6; line-height: 1; }
.not-found-card h1 { font-size: 1.5rem; margin: .5rem 0; }
.not-found-card p { color: #94a3b8; margin-bottom: 1.5rem; }

/* -- Responsive helpers -- */
@media (max-width: 640px) {
  .grid-2-cols { grid-template-columns: 1fr; }
  .span-2 { grid-column: unset; }
}

/* Garantir que [hidden] funcione mesmo quando a classe define display:flex */
.modal-overlay[hidden], .notif-panel[hidden] { display: none !important; }
