:root {
  --b0: #ffffff;
  --b1: #f6f7f9;
  --bg: #f6f7f9;
  --card: rgba(255, 255, 255, 0.85);
  --card-solid: #ffffff;
  --text: #111214;
  --muted: #6c7077;
  --line: rgba(15, 17, 20, 0.12);
  --orange: #f66b19;
  --orange-dark: #cf550f;
  --brand: #f66b19;
  --brand-dark: #cf550f;
  --verde: #b9ce32;
  --verde-dark: #6e8318;
  --verde-claro: #c9dc47;
  --preto: #111214;
  --ok: #6e8318;
  --ok-bg: #f2f7dc;
  --warn: #111214;
  --warn-bg: #edeff2;
  --danger: #dc2626;
  --danger-bg: #fdeaea;
  --info-bg: #fff2e5;
  --radius: 16px;
  --grad: linear-gradient(135deg, #ff8a3d 0%, #f66b19 55%, #cf550f 100%);
  --grad-verde: linear-gradient(135deg, #c9dc47 0%, #b9ce32 50%, #9db529 100%);
  --grad-marca: linear-gradient(100deg, #f66b19 0%, #b9ce32 100%);
  --grad-preto: linear-gradient(135deg, #2a2c30 0%, #131417 100%);
  --shadow: 0 1px 2px rgba(17, 18, 20, 0.05), 0 16px 40px rgba(20, 22, 26, 0.1);
  --glow-cyan: 0 0 20px rgba(246, 107, 25, 0.35);
  --glow-indigo: 0 8px 24px rgba(207, 85, 15, 0.28), 0 0 18px rgba(246, 107, 25, 0.18);
  --glow-verde: 0 6px 18px rgba(110, 131, 24, 0.32);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
}

::selection {
  background: rgba(246, 107, 25, 0.22);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(17, 18, 20, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 18, 20, 0.34);
  background-clip: content-box;
}

/* Fundo de grade técnica (branco/laranja/preto) */
.bg-tech {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(246, 107, 25, 0.12), transparent 60%),
    radial-gradient(800px 420px at -10% 10%, rgba(207, 85, 15, 0.08), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, rgba(17, 18, 20, 0.07), transparent 60%),
    linear-gradient(rgba(17, 18, 20, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 18, 20, 0.045) 1px, transparent 1px);
  background-size: auto, auto, auto, 38px 38px, 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3));
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3));
}

/* Tela de login */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(700px 380px at 85% -10%, rgba(246, 107, 25, 0.14), transparent 60%),
    radial-gradient(600px 380px at -10% 15%, rgba(17, 18, 20, 0.06), transparent 55%),
    linear-gradient(rgba(17, 18, 20, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 18, 20, 0.04) 1px, transparent 1px) #f6f7f9;
  background-size: auto, auto, 38px 38px, 38px 38px, auto;
}

.login-screen[hidden] {
  display: none;
}

.form-login {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 26px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.form-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--grad-marca);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}

.login-logo img {
  height: 58px;
  width: auto;
  object-fit: contain;
}

.login-logo .logo-slogan {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-login h1 {
  margin: 0 0 2px;
  font-size: 21px;
  font-weight: 800;
  background: linear-gradient(90deg, #101113, #45484e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-sub {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-label {
  display: block;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: #4a4d53;
  margin: 14px 0 6px;
}

.form-login input {
  text-align: center;
}

.form-login .btn {
  margin-top: 20px;
}

.login-erro {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
}

.sair-btn {
  padding: 7px 12px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 0 -1px var(--grad-marca);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  height: 48px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-icon::after {
  display: none;
}

.brand-logo {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-text h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #101113, #45484e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .brand-slogan {
  margin: 2px 0 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  white-space: nowrap;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.brand-text .brand-slogan + p {
  margin-top: 3px;
}

/* Relógio */
.side-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.relogio {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  margin-right: 2px;
}

#relogioHora {
  font-size: 19px;
  font-weight: 800;
  color: var(--orange-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(246, 107, 25, 0.28);
}

#relogioData {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: capitalize;
}

.conn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--ok-bg);
  border: 1px solid rgba(110, 131, 24, 0.35);
  color: #5c7014;
  padding: 7px 12px;
  border-radius: 999px;
}

.conn.off {
  background: var(--warn-bg);
  border-color: rgba(17, 18, 20, 0.25);
  color: #3a3d42;
}

.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(110, 131, 24, 0.18), 0 0 10px rgba(110, 131, 24, 0.6);
}

.conn.off .dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(246, 107, 25, 0.14), 0 0 10px rgba(246, 107, 25, 0.4);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

.demo-banner {
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, rgba(246, 107, 25, 0.08), rgba(207, 85, 15, 0.06));
  color: #9a3412;
  border-bottom: 1px solid rgba(246, 107, 25, 0.3);
  padding: 10px 16px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
}

.demo-banner code {
  background: rgba(246, 107, 25, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12.5px;
}

.banner-close {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  line-height: 1;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 130px;
}

/* Estatísticas */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.65));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 107, 25, 0.35);
  box-shadow: var(--glow-indigo);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.s-indigo {
  background: var(--info-bg);
  color: var(--orange-dark);
  box-shadow: 0 0 18px rgba(246, 107, 25, 0.3);
}

.s-emerald {
  background: #eceef2;
  color: var(--preto);
  box-shadow: 0 0 18px rgba(17, 18, 20, 0.2);
}

.s-sky {
  background: #fff8e6;
  color: #d97706;
  box-shadow: 0 0 18px rgba(217, 119, 6, 0.3);
}

.stat-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 2px 14px rgba(246, 107, 25, 0.18);
}

.stat-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Abas */
.tab {
  display: none;
  animation: fade 0.26s ease;
}

.tab.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.card-head p {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Segmento Veículo/Pessoa */
.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(17, 18, 20, 0.05);
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.seg-btn {
  border: 0;
  background: transparent;
  padding: 11px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  border: 0;
  box-shadow: var(--glow-indigo);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #4a4d53;
  margin-bottom: 6px;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1.5px solid rgba(17, 18, 20, 0.16);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
  width: 100%;
  caret-color: var(--orange);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236c7077' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(246, 107, 25, 0.45);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(246, 107, 25, 0.65);
  box-shadow: 0 0 0 4px rgba(246, 107, 25, 0.14);
}

input::placeholder {
  color: #a6a9b0;
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Botões */
.btn {
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 18px;
  transition: transform 0.05s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s, border-color 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn.primary {
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--glow-indigo);
}

.btn.primary:hover {
  box-shadow: 0 0 0 4px rgba(246, 107, 25, 0.16), 0 10px 30px rgba(207, 85, 15, 0.4), 0 0 22px rgba(246, 107, 25, 0.35);
}

.btn.success {
  background: var(--grad-verde);
  color: var(--preto);
  font-weight: 800;
  border: 1px solid rgba(17, 18, 20, 0.18);
  box-shadow: var(--glow-verde);
}

.btn.success:hover {
  box-shadow: 0 6px 20px rgba(110, 131, 24, 0.45);
  border-color: rgba(17, 18, 20, 0.35);
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: #3a3d42;
}

.btn.ghost:hover {
  background: #f6f7f9;
  border-color: rgba(246, 107, 25, 0.4);
  color: #111214;
}

.btn.danger {
  background: var(--danger-bg);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--danger);
}

.btn.danger:hover {
  background: rgba(220, 38, 38, 0.16);
}

.btn.sm {
  padding: 8px 13px;
  font-size: 13px;
  border-radius: 10px;
}

.btn.lg {
  width: 100%;
  padding: 13px 20px;
}

.form-actions {
  margin-top: 2px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.item:hover {
  transform: translateY(-1px);
  border-color: rgba(246, 107, 25, 0.35);
  box-shadow: var(--glow-indigo);
}

.item.with-avatar {
  align-items: center;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 15.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.item-meta {
  margin-top: 6px;
  color: #4a4d53;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--grad-preto);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(17, 18, 20, 0.25);
}

.badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.ok {
  background: var(--ok-bg);
  color: #5c7014;
  border-color: rgba(110, 131, 24, 0.3);
}

.badge.off {
  background: #edeff2;
  color: #3a3d42;
  border-color: rgba(17, 18, 20, 0.15);
}

.badge.info {
  background: var(--info-bg);
  color: var(--orange-dark);
  border-color: rgba(246, 107, 25, 0.3);
}

.badge.warn {
  background: var(--warn-bg);
  color: #3a3d42;
  border-color: rgba(17, 18, 20, 0.2);
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1.1fr 1.2fr;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.filters .field label {
  font-size: 11.5px;
}

.cal-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
}

.cal-top {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cal-field {
  flex: 1;
  min-width: 220px;
  margin: 0;
}

.cal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cal-stat {
  background: rgba(17, 18, 20, 0.03);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 12px;
  padding: 12px 14px;
}

.cal-stat .stat-value {
  font-size: 22px;
}

@media (max-width: 520px) {
  .cal-stats {
    grid-template-columns: 1fr;
  }
}

.search-box {
  margin-bottom: 12px;
}

.empty {
  border: 1.5px dashed rgba(17, 18, 20, 0.25);
  border-radius: var(--radius);
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

.empty strong {
  display: block;
  color: #3a3d42;
  font-size: 15px;
  margin-bottom: 4px;
}

/* Navegação inferior */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--glow-indigo);
  max-width: calc(100vw - 20px);
}

.nav-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  min-width: 62px;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn:hover {
  color: var(--text);
}

.nav-btn.active {
  background: var(--grad-preto);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(17, 18, 20, 0.35), 0 0 16px rgba(246, 107, 25, 0.3);
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(98px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: rgba(17, 18, 20, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(246, 107, 25, 0.55);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 12px 30px rgba(17, 18, 20, 0.3), var(--glow-cyan);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.erro {
  background: rgba(40, 8, 14, 0.96);
  border-color: rgba(248, 113, 113, 0.5);
}

@media (max-width: 760px) {
  .stats {
    gap: 8px;
  }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .stat-icon svg {
    width: 17px;
    height: 17px;
  }

  .stat-value {
    font-size: 21px;
  }

  .stat-label {
    font-size: 10.5px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  .item {
    padding: 14px;
  }

  .item-actions {
    width: 100%;
  }

  .item-actions .btn {
    flex: 1;
  }

  .nav-btn {
    min-width: 54px;
    padding: 8px 10px;
  }
}

@media (max-width: 400px) {
  .brand-text p,
  .brand-text .brand-slogan {
    display: none;
  }

  .brand-icon {
    height: 40px;
  }

  .relogio {
    display: none;
  }

  .sessao-badge {
    display: none;
  }

  .conn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* Espelho semanal */
.semana-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.semana-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}

.semana-info strong {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #3a3d42;
}

.btn.semana-hoje {
  background: var(--info-bg);
  border: 1px solid rgba(246, 107, 25, 0.3);
  color: var(--orange-dark);
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 999px;
}

.filtros-semana {
  margin-bottom: 14px;
}


table.espelho {
  border-collapse: collapse;
  width: 100%;
  min-width: 940px;
  font-size: 12.5px;
}

.espelho th,
.espelho td {
  border: 1px solid rgba(17, 18, 20, 0.1);
  padding: 7px 8px;
  text-align: center;
  white-space: nowrap;
}

/* fundo uniforme do corpo da tabela: a coluna Nome nao pode standout */
.espelho tbody td {
  background: var(--card-solid);
}

.espelho thead th {
  background: rgba(17, 18, 20, 0.04);
  color: #4a4d53;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.espelho thead tr:first-child th {
  background: var(--grad-preto);
  color: #fff;
}

.espelho td.pessoa,
.espelho th.pessoa {
  text-align: left;
  font-weight: 700;
  min-width: 190px;
  white-space: normal;
}

.espelho td.sub,
.espelho th.sub {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  min-width: 120px;
  max-width: 170px;
  white-space: normal;
}

/* Nome, Funcao e Empresa com aparencia identica (celula e campo) */
.espelho td.pessoa,
.espelho td.sub {
  color: #334155;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
}

.espelho td.pessoa .celula-input,
.espelho td.sub .celula-input,
.espelho td.pessoa .celula-input.c-nome,
.espelho td.sub .celula-input.c-funcao,
.espelho td.sub .celula-input.c-empresa {
  color: #334155;
  -webkit-text-fill-color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: normal;
  opacity: 1;
  background: transparent;
}

.espelho td.hora {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 52px;
}

.espelho td.hora.vazio {
  background: #f4f5f7;
  color: #b9bcc2;
}

.espelho td.hora.e {
  color: var(--ok);
  font-weight: 700;
}

.espelho td.hora.s {
  color: var(--orange-dark);
  font-weight: 700;
}

.espelho tbody tr:hover td {
  background: #faf5f0;
}

.espelho tbody tr:hover td.hora.vazio {
  background: #f3f4f6;
}

.espelho tbody tr.grupo-empresa td {
  background: #e9eaee;
  font-weight: 800;
  color: #111214;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#btnImportar {
  border: 1px solid rgba(17, 18, 20, 0.2);
}

@media (max-width: 760px) {
  .semana-bar .btn {
    flex: 1;
  }

  .semana-info {
    order: -1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Registro manual */
.manual-form .full,
.form-grid .full {
  grid-column: 1 / -1;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-entrada {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: var(--ok-bg);
  color: #5c7014;
  border: 1px solid rgba(110, 131, 24, 0.3);
}

.badge-saida {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: #fdecec;
  color: #b42318;
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.nowrap {
  white-space: nowrap;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 22px 0;
}

#tabelaManual th,
#tabelaManual td {
  font-size: 12.5px;
  vertical-align: top;
}

#tabelaManual td {
  white-space: nowrap;
}


.espelho td.hora .hora-btn:hover {
  text-decoration: underline;
}

.espelho td.hora .hora-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.espelho td.hora.s {
  background: #fffaf3;
}

.espelho td.hora .hora-input {
  width: 100%;
  min-width: 62px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--orange-dark);
  padding: 3px 4px;
  text-align: center;
}

.espelho td.hora .hora-input:hover {
  border-color: rgba(17, 18, 20, 0.18);
  background: #fff;
}

.espelho td.hora .hora-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.cal-top-inline {
  margin: 0;
}

.espelho td.hora {
  padding: 2px 3px;
  text-align: center;
  white-space: nowrap;
}

.espelho td.hora.vazio {
  background: #f8fafc;
}

.espelho td.hora.e {
  background: #f4f8e0;
}

.espelho td.hora.s {
  background: #fff8f2;
}

.celula-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 4px 6px;
  min-width: 0;
}

.celula-input:hover {
  border-color: rgba(17, 18, 20, 0.2);
  background: #fff;
}

.celula-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}

/* texto do Registro manual: Nome, Funcao e Empresa visualmente identicos */
.celula-input.c-nome,
.celula-input.c-funcao,
.celula-input.c-empresa {
  font-family: inherit;
  font-size: 12.5px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  color: #334155;
  background: transparent;
  -webkit-text-fill-color: #334155;
  opacity: 1;
}

.celula-input.c-nome {
  min-width: 150px;
}

.celula-input.c-funcao,
.celula-input.c-empresa {
  min-width: 110px;
}

.celula-input.c-nome::placeholder,
.celula-input.c-funcao::placeholder,
.celula-input.c-empresa::placeholder {
  color: #6b7280;
  -webkit-text-fill-color: #6b7280;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
  opacity: 1;
}

/* a linha de cadastro mantem os tres campos com o mesmo tom */
.nova-linha .celula-input.c-nome,
.nova-linha .celula-input.c-funcao,
.nova-linha .celula-input.c-empresa,
.nova-linha .celula-input.c-nome::placeholder,
.nova-linha .celula-input.c-funcao::placeholder,
.nova-linha .celula-input.c-empresa::placeholder {
  color: #334155;
  -webkit-text-fill-color: #334155;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
  opacity: 1;
}

.espelho td.pessoa .celula-input.c-nome,
.espelho td.sub .celula-input.c-funcao,
.espelho td.sub .celula-input.c-empresa {
  color: #334155;
  font-weight: 600;
}

.espelho td.hora .hora-input {
  font-weight: 700;
  padding: 4px 2px;
  text-align: center;
}

.espelho td.hora.s .hora-input {
  color: var(--orange-dark);
}

.espelho td.hora.e .hora-input {
  color: var(--green, #15803d);
}

.nova-linha td {
  border-top: 2px solid var(--brand);
  background: #f8fafc;
  border-bottom: 2px solid var(--brand);
}

.nova-linha .celula-input {
  font-weight: 400;
  border: 1px dashed rgba(17, 18, 20, 0.3);
  background: #fff;
}

.nova-linha .celula-input::placeholder {
  color: #94a3b8;
}


.movement-help {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 8px;
}


.semana-bloco .espelho td.pessoa,
.semana-bloco .espelho th.pessoa {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  min-width: 170px;
}

.semana-bloco .espelho thead th.pessoa {
  z-index: 5;
}

.espelho .grupo-empresa td.pessoa {
  background: #e8eef6;
  font-weight: 700;
  color: #334155;
}

.espelho .nova-linha td.pessoa {
  background: #f8fafc;
}

.espelho th.dia-col {
  text-align: center;
  min-width: 66px;
  font-size: 12px;
  line-height: 1.2;
}

.espelho th.dia-col b {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

/* o dia de hoje usa a mesma cor dos demais dias */
.espelho th.dia-col.hoje,
.espelho th.dia-col.hoje b {
  background: var(--grad-preto);
  color: #ffffff;
}

.espelho th.rot-e,
.espelho th.rot-s {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #94a3b8;
  min-width: 32px;
}

.semana-bloco {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 18px;
}

.semana-bloco.atual {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.semana-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.semana-bloco.atual .semana-head {
  background: var(--brand);
  color: #fff;
}

.tag-atual {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.semana-bloco .espelho-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.semana-bloco .espelho {
  min-width: max-content;
}

.semana-bloco .espelho td.hora {
  width: 32px;
  min-width: 32px;
}

.semana-vazia td {
  padding: 12px 14px;
  color: #94a3b8;
  font-size: 13px;
}


.mes-divisor {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 12px;
}

.mes-divisor::before,
.mes-divisor::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.mes-divisor span {
  font-size: 15px;
  font-weight: 800;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.mes-divisor:first-child {
  margin-top: 4px;
}


.semana-vazia-bloco {
  padding: 18px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

.mes-nota {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.mes-divisor:has(.mes-nota)::after {
  order: 3;
}

#tabelaSemanal td.hora,
#tabelaSemanal th {
  min-width: 46px;
}

#tabelaSemanal td.pessoa {
  min-width: 170px;
}

#tabelaSemanal td.sub {
  min-width: 110px;
  max-width: 160px;
}

#tabelaSemanal .excluir-col,
#tabelaSemanal th.excluir-col {
  min-width: 82px;
  max-width: 82px;
  width: 82px;
  text-align: center;
  background: #f7f8fa;
}

#tabelaSemanal thead tr:first-child th.excluir-col {
  background: var(--grad-preto);
}

#tabelaSemanal tbody tr:hover td.excluir-col {
  background: #f7f8fa;
}

/* =====================celular===================== */
@media (max-width: 860px) {

  body {
    -webkit-text-size-adjust: 100%;
  }

  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-head h2 {
    font-size: 19px;
  }

  .cal-top-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .cal-top-inline .btn {
    flex: 1 1 auto;
    min-width: 118px;
  }

  .movement-help {
    font-size: 12px;
    line-height: 1.45;
  }

  /* tabelas: rolagem horizontal com a primeira coluna fixa */
  .espelho-wrap,
  .semana-bloco .espelho-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  table.espelho {
    min-width: 760px;
    font-size: 12px;
  }

  .espelho th,
  .espelho td {
    padding: 6px 5px;
  }

  .espelho td.pessoa,
  .espelho th.pessoa {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    min-width: 132px;
    max-width: 132px;
    font-size: 11.5px;
  }

  .espelho thead th.pessoa {
    z-index: 5;
    background: var(--grad-preto);
  }

  .espelho td.sub,
  .espelho th.sub {
    min-width: 92px;
    max-width: 110px;
    font-size: 11px;
  }

  .espelho td.hora {
    min-width: 42px;
  }

  .espelho th.dia-col {
    min-width: 42px;
    font-size: 10.5px;
  }

  .espelho th.dia-col b {
    font-size: 13px;
  }

  /* celulas de hora do registro manual: alvo de toque maior */
  .semana-bloco .espelho td.hora {
    width: 44px;
    min-width: 44px;
    padding: 3px 1px;
  }

  .semana-bloco .espelho .celula-input.hora-input {
    font-size: 11px;
    padding: 6px 0;
    text-align: center;
  }

  .semana-bloco .espelho .celula-input.c-nome,
  .semana-bloco .espelho .celula-input.c-funcao,
  .semana-bloco .espelho .celula-input.c-empresa {
    min-width: 96px;
    font-size: 11.5px;
  }

  #tabelaSemanal .excluir-col,
  #tabelaSemanal th.excluir-col {
    min-width: 64px;
    max-width: 64px;
    width: 64px;
  }

  #tabelaSemanal .excluir-col .btn {
    padding: 7px 9px;
    font-size: 10.5px;
  }

  .semana-head {
    flex-wrap: wrap;
    padding: 8px 11px;
    font-size: 12px;
  }

  .semana-bloco {
    margin-bottom: 14px;
  }

  .mes-divisor {
    margin: 20px 0 10px;
  }

  .mes-divisor span {
    font-size: 12.5px;
  }

  .item {
    flex-wrap: wrap;
  }

  .item-actions .btn {
    padding: 10px 12px;
  }
}

@media (max-width: 560px) {

  .bottom-nav {
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bottom-nav .nav-btn {
    flex: 1 0 auto;
    min-width: 58px;
    padding: 7px 6px;
    font-size: 9.5px;
  }

  .bottom-nav .nav-btn svg {
    width: 19px;
    height: 19px;
  }

  table.espelho {
    min-width: 680px;
  }

  .espelho td.pessoa,
  .espelho th.pessoa {
    min-width: 116px;
    max-width: 116px;
  }

  .espelho td.sub,
  .espelho th.sub {
    min-width: 80px;
    max-width: 92px;
  }

  .semana-bloco .espelho td.hora {
    width: 40px;
    min-width: 40px;
  }

  .cal-top-inline .btn {
    min-width: 100%;
  }

  .btn.sm,
  .btn.lg {
    padding: 11px 14px;
  }
}

/* impede que a cor da celula contamine os campos de texto */
.espelho td.pessoa .celula-input,
.espelho td.sub .celula-input {
  color: #334155;
  -webkit-text-fill-color: #334155;
  font-weight: 500;
}

/* preserva o destaque das linhas especiais depois da unificacao */
.espelho tbody tr:hover td.pessoa,
.espelho tbody tr:hover td.sub {
  background: #faf5f0;
}

.espelho .nova-linha td.pessoa,
.espelho .nova-linha td.sub {
  background: #f8fafc;
}

.espelho .grupo-empresa td.pessoa {
  background: #e8eef6;
}

/* cabecalho Nome igual ao de Funcao e Empresa: fundo preto, letras brancas */
.semana-bloco .espelho thead th.pessoa,
.espelho thead th.pessoa,
.espelho thead tr:first-child th.pessoa,
.espelho thead tr:first-child th.sub {
  background: var(--grad-preto);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}
