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

:root {
  --sb-width:        248px;
  --sb-width-col:     64px;
  --sb-bg:          #ffffff;
  --sb-hover:       #f4f4f5;
  --sb-active-bg:   #eef2ff;
  --sb-text:        #52525b;
  --sb-text-active: #3730a3;
  --tb-height:      60px;
  --tb-bg:          #ffffff;
  --primary:        #4f46e5;
  --primary-dark:   #4338ca;
  --primary-soft:   #eef2ff;
  --accent:         #4f46e5;
  --gray-950:       #0a0a0b;
  --gray-800:       #27272a;
  --gray-600:       #52525b;
  --gray-500:       #71717a;
  --gray-400:       #a1a1aa;
  --gray-200:       #e4e4e7;
  --gray-100:       #f4f4f5;
  --gray-50:        #fafafa;
  --bg-body:        #fafafa;
  --border:         #e4e4e7;
  --ink:            #18181b;
  --card-shadow:    0 1px 2px rgba(0,0,0,.04);
  --radius:         8px;
  --font-display:   'Inter', system-ui, -apple-system, sans-serif;
  --font-body:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

:root[data-theme="dark"] {
  --sb-bg:          #18181b;
  --sb-hover:       #27272a;
  --sb-active-bg:   #312e81;
  --sb-text:        #a1a1aa;
  --sb-text-active: #c7d2fe;

  --tb-bg:          #18181b;

  --primary:        #6366f1;
  --primary-dark:   #818cf8;
  --primary-soft:   #312e81;

  --gray-950:       #f4f4f5;
  --gray-800:       #e4e4e7;
  --gray-600:       #d4d4d8;
  --gray-500:       #a1a1aa;
  --gray-400:       #71717a;
  --gray-200:       #3f3f46;
  --gray-100:       #27272a;
  --gray-50:        #202023;

  --bg-body:        #0f0f11;
  --border:         #2f2f33;
  --ink:            #f4f4f5;
  --card-shadow:    0 1px 2px rgba(0,0,0,.3);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .notif-dropdown {
  background: var(--sb-bg);
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select {
  background: var(--gray-50);
  color: var(--ink);
}

:root[data-theme="dark"] .table thead.table-light th,
:root[data-theme="dark"] .table > :not(caption) > * > th {
  background: var(--gray-50);
}

:root[data-theme="dark"] .bg-success-subtle  { background: #052e1a !important; }
:root[data-theme="dark"] .text-success        { color: #4ade80 !important; }
:root[data-theme="dark"] .border-success-subtle { border-color: #166534 !important; }

:root[data-theme="dark"] .bg-warning-subtle  { background: #451a03 !important; }
:root[data-theme="dark"] .text-warning        { color: #fbbf24 !important; }
:root[data-theme="dark"] .border-warning-subtle { border-color: #92400e !important; }

:root[data-theme="dark"] .bg-danger-subtle   { background: #450a0a !important; }
:root[data-theme="dark"] .text-danger         { color: #f87171 !important; }
:root[data-theme="dark"] .border-danger-subtle { border-color: #991b1b !important; }

:root[data-theme="dark"] .alert-danger  { background: #450a0a; border-color: #991b1b; color: #fca5a5; }
:root[data-theme="dark"] .alert-success { background: #052e1a; border-color: #166534; color: #86efac; }
:root[data-theme="dark"] .alert-warning { background: #451a03; border-color: #92400e; color: #fcd34d; }

:root[data-theme="dark"] .text-muted { color: var(--gray-500) !important; }
:root[data-theme="dark"] .text-body-secondary { color: var(--gray-500) !important; }

:root[data-theme="dark"] .dash-fila-item,
:root[data-theme="dark"] .stat-card-lg {
  background: var(--sb-bg);
}

:root[data-theme="dark"] .dash-tudo-certo {
  background: #052e1a;
  border-color: #166534;
  color: #4ade80;
}

:root[data-theme="dark"] .notif-icon.notif-prioridade-alta {
  background: #451a03;
  color: #fbbf24;
}

/* ── Botão de tema no dropdown do usuário ────────────────── */
.theme-toggle-icon-dark  { display: none; }
:root[data-theme="dark"] .theme-toggle-icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle-icon-dark  { display: inline-block; }

/* ── Reset básico ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); color: var(--ink); }
a { text-decoration: none; }

h1, h2, h3, h4, h5, h6,
.fw-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.01em;
}

.font-mono, .valor-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.text-subtle { color: var(--gray-500) !important; }
.btn { border-radius: 6px; font-weight: 500; letter-spacing: 0; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-primary:active { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.btn-check:checked + .btn-primary,
.btn-primary:disabled { background: var(--primary); border-color: var(--primary); }

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-outline-secondary {
  color: var(--gray-600);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--ink);
}

.btn-outline-warning { color: #92400e; border-color: #fcd34d; }
.btn-outline-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }

.btn-outline-success { color: #15803d; border-color: #86efac; }
.btn-outline-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }

.btn-outline-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-link { color: var(--primary); }
.btn-link:hover { color: var(--primary-dark); }

.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Badges de status ─────────────────────────────────────── */
.badge {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
  font-size: .72rem;
  padding: .32em .6em;
  border-radius: 5px;
}

.bg-success-subtle { background: #dcfce7 !important; }
.text-success       { color: #15803d !important; }
.border-success-subtle { border-color: #86efac !important; }

.bg-secondary-subtle { background: var(--gray-100) !important; }
.text-secondary       { color: var(--gray-600) !important; }
.border-secondary-subtle { border-color: var(--gray-200) !important; }

.bg-warning-subtle { background: #fef3c7 !important; }
.text-warning        { color: #92400e !important; }
.border-warning-subtle { border-color: #fcd34d !important; }

.bg-danger-subtle { background: #fee2e2 !important; }
.text-danger        { color: #b91c1c !important; }
.border-danger-subtle { border-color: #fca5a5 !important; }
.card {
  border-radius: var(--radius);
  border-color: var(--border);
}
.card.shadow-sm { box-shadow: var(--card-shadow) !important; }
.card-header { font-weight: 600; font-size: .85rem; }
.table thead.table-light th,
.table > :not(caption) > * > th {
  background: var(--gray-50);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 1px solid var(--border);
}
.table-hover > tbody > tr:hover > * { background: var(--gray-50); }
.table > :not(caption) > * > td { border-color: var(--border); }
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 6px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-label { font-size: .85rem; font-weight: 500; }
.input-group-text { background: var(--gray-50); border-color: var(--border); color: var(--gray-500); }
.alert { border-radius: var(--radius); border-width: 1px; }
.alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-success { background: #dcfce7; border-color: #86efac; color: #15803d; }
.alert-warning { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.page-link { color: var(--primary-dark); border-color: var(--border); }
.page-link:hover { background: var(--primary-soft); color: var(--primary-dark); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.dropdown-menu { border-color: var(--border); border-radius: var(--radius); }
.dropdown-item:active { background: var(--primary); }
.dropdown-item.text-danger:hover { background: #fee2e2; }

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-body);
  overflow-x: hidden;
}
.auth-grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--gray-50);
  background-image:
    radial-gradient(560px circle at var(--mx, 50%) var(--my, 40%), rgba(79,70,229,.06), transparent 60%),
    linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 100% 100%, 42px 42px, 42px 42px;
  background-position: 0 0, center, center;
}

.auth-grid-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 40%), transparent 0%, rgba(250,250,250,.2) 45%, rgba(250,250,250,.75) 85%);
}
.auth-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.75rem 2.25rem 2.25rem;
  box-shadow: 0 24px 60px -18px rgba(24,24,27,.14), 0 1px 2px rgba(24,24,27,.05);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2.25rem;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1.1rem;
  border-radius: 12px;
  background: linear-gradient(155deg, var(--primary), #4338ca);
  box-shadow: 0 6px 20px -6px rgba(99,102,241,.6);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.02em;
  color: #fff;
}

.auth-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  margin-bottom: .2rem;
}

.auth-subtitle {
  font-size: .85rem;
  color: var(--gray-500);
}
.auth-floating {
  position: relative;
  margin-bottom: 1.25rem;
}

.auth-floating .form-control {
  height: 50px;
  padding: 1.3rem .9rem .4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--gray-50);
  color: var(--ink);
  font-size: .92rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.auth-floating .form-control::placeholder {
  color: transparent;
}

.auth-floating .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.14);
  background: #fff;
  outline: none;
  color: var(--ink);
}

.auth-floating .floating-label {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .9rem;
  color: var(--gray-500);
  pointer-events: none;
  transition: all .2s cubic-bezier(.22, .68, 0, 1);
  font-weight: 500;
}

.auth-floating .form-control:focus ~ .floating-label,
.auth-floating .form-control:not(:placeholder-shown) ~ .floating-label {
  top: .5rem;
  transform: translateY(0);
  font-size: .68rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: .02em;
}
.auth-floating .input-group {
  position: relative;
}

.auth-floating .input-group .form-control {
  border-radius: 0 8px 8px 0;
}

.auth-floating .input-group .input-group-text {
  border-radius: 8px 0 0 8px;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--gray-50);
  color: var(--gray-500);
  padding-left: 1rem;
  padding-right: .5rem;
  transition: border-color .2s, background .2s;
}

.auth-floating .input-group:focus-within .input-group-text {
  border-color: var(--primary);
  background: #fff;
}

.auth-floating .input-group .btn-outline-secondary {
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border);
  border-left: none;
  background: var(--gray-50);
  color: var(--gray-500);
  transition: border-color .2s, background .2s, color .2s;
}

.auth-floating .input-group:focus-within .btn-outline-secondary {
  border-color: var(--primary);
  background: #fff;
}

.auth-floating .input-group .btn-outline-secondary:hover {
  color: var(--ink);
  background: var(--gray-100);
}

/* Floating label com input-group: sobe sempre que o input não está placeholder-shown */
.auth-floating .input-group .floating-label {
  left: 3.2rem;
}

.auth-floating .input-group .form-control:focus ~ .floating-label,
.auth-floating .input-group .form-control:not(:placeholder-shown) ~ .floating-label {
  top: .5rem;
  transform: translateY(0);
  font-size: .68rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: .02em;
}
.btn-entrar {
  background: var(--primary);
  border: none;
  font-weight: 600;
  letter-spacing: 0;
  padding: .75rem;
  border-radius: 8px;
  font-size: .95rem;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 18px -4px rgba(99,102,241,.5);
}

.btn-entrar:hover {
  background: var(--primary-dark);
}

.btn-entrar:active {
  transform: scale(.98);
}

.btn-entrar:disabled {
  opacity: .7;
  cursor: not-allowed;
}
.btn-entrar .spinner-border {
  width: 1.1rem;
  height: 1.1rem;
  border-width: .15em;
  vertical-align: -.15em;
}
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.auth-options .form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding-left: 0;
  min-height: auto;
}

.auth-options .form-check-input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 !important;
  flex-shrink: 0;
  float: none;
  background-color: #fff;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}

.auth-options .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.auth-options .form-check-label {
  font-size: .82rem;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.auth-forgot {
  font-size: .82rem;
  color: var(--gray-500);
  text-decoration: none;
  transition: color .2s;
  font-weight: 500;
}

.auth-forgot:hover {
  color: var(--primary);
}

/* ── Footer ─────────────────────────────────────────────── */
.auth-footer {
  position: relative;
  z-index: 1;
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 2rem;
  text-align: center;
}
@media (max-width: 480px) {
  .auth-card  { padding: 2.25rem 1.5rem 1.75rem; }
  .auth-brand { font-size: 1.2rem; }
  .auth-options { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

.app-body {
  min-height: 100vh;
  background: var(--bg-body);
  display: flex;
}
.sidebar {
  width: var(--sb-width);
  min-height: 100vh;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1050;
  transition: width .25s ease, transform .25s ease;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.sb-header {
  height: var(--tb-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: .6rem;
}

.sb-logo-abbr {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.sb-logo-full {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s;
}

.sb-nav {
  list-style: none;
  padding: .75rem .5rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-200) transparent;
}

.sb-item { margin-bottom: 1px; position: relative; }

.sb-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .875rem;
  border-radius: 8px;
  color: var(--sb-text);
  font-size: .95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background .15s, color .15s;
  cursor: pointer;
  position: relative;
}

.sb-link i { font-size: 1.25rem; flex-shrink: 0; width: 20px; text-align: center; }

.sb-link:hover { background: var(--sb-hover); color: var(--ink); }

.sb-link.active {
  background: var(--sb-active-bg);
  color: var(--sb-text-active);
  font-weight: 600;
}

/* Itens de topo (fora dos submenus) em formato de card */
.sb-nav > .sb-item { margin-bottom: .5rem; }

.sb-nav > .sb-item > .sb-link {
  background: var(--sb-bg);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  padding: .85rem 1rem;
}

.sb-nav > .sb-item > .sb-link i { font-size: 1.4rem; width: 22px; }

.sb-nav > .sb-item > .sb-link:hover {
  border-color: var(--sb-active-bg);
}

.sb-nav > .sb-item > .sb-link.active {
  border-color: var(--sb-text-active);
}

.sb-link.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.sb-section {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 1rem .875rem .3rem;
}

.sb-group-toggle .sb-group-chevron {
  margin-left: auto;
  font-size: .75rem;
  width: auto;
  flex-shrink: 0;
  transition: transform .2s;
}

.sb-group-toggle[aria-expanded="true"] .sb-group-chevron { transform: rotate(180deg); }

.sb-subnav {
  list-style: none;
  padding: .15rem 0 .25rem;
  margin: 0;
}

.sb-subnav .sb-link {
  padding-left: 2.35rem;
  font-size: .82rem;
}

.sb-subnav .sb-link i {
  font-size: 1.15rem;
}

.sb-footer {
  padding: .75rem .5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.main-wrap {
  margin-left: var(--sb-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.topbar {
  height: var(--tb-height);
  background: var(--tb-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
  gap: .75rem;
}

.tb-toggle { color: var(--gray-500); padding: .25rem .5rem; flex-shrink: 0; }

.tb-breadcrumb .breadcrumb {
  margin: 0;
  font-size: .82rem;
}
.tb-breadcrumb .breadcrumb-item a { color: var(--gray-500); }
.tb-breadcrumb .breadcrumb-item.active { color: var(--ink); font-weight: 500; }

.tb-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.tb-datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1rem;
}
.tb-datetime-time {
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tb-datetime-date {
  font-size: .7rem;
  color: var(--gray-500);
  line-height: 1;
}

.tb-user-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  font-size: .85rem;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: background .15s;
}
.tb-user-btn:hover { background: var(--gray-100); }

.avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .85rem;
  flex-shrink: 0;
}
.main-content { flex: 1; padding: 1.75rem 1.5rem; }

.main-footer {
  padding: .75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--tb-bg);
  font-size: .78rem;
}
.stat-card {
  border-radius: var(--radius) !important;
  box-shadow: var(--card-shadow) !important;
  border: 1px solid var(--border) !important;
  background: #fff;
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.08) !important;
}

.stat-card .card-body { padding: 1.25rem 1.35rem; }

.stat-card .stat-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-500);
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -.02em;
}

.stat-card .stat-meta {
  font-size: .8rem;
  color: var(--gray-500);
}

.stat-level {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--gray-100);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--sb-active-bg);
  color: var(--sb-text-active);
  flex-shrink: 0;
}
.stat-icon.warn   { background: #fef3c7; color: #b45309; }
.stat-icon.danger { background: #fee2e2; color: #b91c1c; }
:root[data-theme="dark"] .stat-icon.warn   { background: rgba(180,83,9,.2);  color: #fbbf24; }
:root[data-theme="dark"] .stat-icon.danger { background: rgba(185,28,28,.2); color: #f87171; }
.stat-level > span {
  display: block;
  height: 100%;
  background: var(--primary);
}
.stat-level.warn > span   { background: #d97706; }
.stat-level.danger > span { background: #dc2626; }

/* ── Badge "Em breve" ─────────────────────────────────────── */
.badge-breve {
  font-size: .62rem;
  font-weight: 600;
  padding: .15rem .4rem;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-400);
  letter-spacing: .03em;
  margin-left: auto;
  flex-shrink: 0;
}
@media (min-width: 769px) {
  .sidebar.collapsed              { width: var(--sb-width-col); }
  .sidebar.collapsed .sb-logo-full,
  .sidebar.collapsed .sb-link span,
  .sidebar.collapsed .sb-section,
  .sidebar.collapsed .sb-subnav,
  .sidebar.collapsed .sb-group-chevron,
  .sidebar.collapsed .badge-breve { display: none; }
  .sidebar.collapsed .sb-logo-abbr { margin: 0 auto; }
  .sidebar.collapsed .sb-link     { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar.collapsed .sb-link i   { width: auto; }
  .main-wrap.collapsed                        { margin-left: var(--sb-width-col); }
  .main-wrap.collapsed .nav-skeleton-overlay  { left: var(--sb-width-col); }
}
@media (max-width: 768px) {
  .sidebar {
    width: 280px !important;
    transform: translateX(-100%);
  }
  .sidebar.open         { transform: translateX(0); }
  .main-wrap            { margin-left: 0; }
  .main-content         { padding: 1.25rem 1rem; }
  .nav-skeleton-overlay { left: 0; padding: 1.25rem 1rem; }
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1040;
  pointer-events: none;
  transition: background .25s ease;
}
.sb-overlay.show {
  display: block;
  background: rgba(0,0,0,.4);
  pointer-events: auto;
}
.dash-clock {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.dash-date {
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  margin-top: .2rem;
}
.dash-section-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dash-fila {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .6rem;
}

.dash-fila-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.dash-fila-item:hover {
  box-shadow: var(--card-shadow);
  transform: translateY(-1px);
}

.dash-fila-item--urgente {
  border-left-color: #dc2626;
}
.dash-fila-item--urgente .dash-fila-icon {
  background: #fef2f2;
  color: #dc2626;
  animation: dash-pulso 1.8s ease-in-out infinite;
}

@keyframes dash-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.dash-fila-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.dash-fila-texto {
  flex: 1;
  font-size: .85rem;
  font-weight: 500;
}

.dash-fila-seta {
  flex-shrink: 0;
  color: var(--gray-400);
  font-size: .8rem;
}

.dash-tudo-certo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  color: #15803d;
  font-size: .85rem;
}
.dash-tudo-certo i { font-size: 1.1rem; }
.stat-card-lg {
  border-radius: var(--radius) !important;
  box-shadow: var(--card-shadow) !important;
  border: 1px solid var(--border) !important;
  background: #fff;
}

.stat-value-lg {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1;
}

.dash-status-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gray-100);
}
.dash-status-seg { display: block; height: 100%; }

.dash-status-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}
.dash-status-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--gray-600);
  text-decoration: none;
}
.dash-status-item:hover { color: var(--ink); }
.dash-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.dash-status-recebido, .dash-status-em_analise { background: #a1a1aa; }
.dash-status-aguardando_orcamento, .dash-status-aguardando_aprovacao { background: #d97706; }
.dash-status-aguardando_pecas { background: #dc2626; }
.dash-status-em_manutencao, .dash-status-em_testes { background: var(--primary); }
.dash-status-finalizado, .dash-status-pronto_retirada { background: #16a34a; }
.dash-atividade-lista {
  max-height: 420px;
  overflow-y: auto;
}

.dash-atividade-item {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.dash-atividade-item:last-child { border-bottom: none; }

.dash-atividade-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  margin-top: .1rem;
}

.dash-atividade-texto {
  font-size: .82rem;
  color: var(--ink);
  line-height: 1.35;
}

.dash-atividade-meta {
  font-size: .72rem;
  color: var(--gray-500);
  margin-top: .1rem;
}
.tb-notif-btn {
  position: relative;
  color: var(--gray-500);
  padding: .4rem .6rem;
  border-radius: 6px;
  transition: background .15s;
}
.tb-notif-btn:hover { background: var(--gray-100); }
.tb-notif-btn::after { display: none; }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notif-sino-shake { animation: notif-sino-shake .6s ease-in-out; }

@keyframes notif-sino-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(18deg); }
  30% { transform: rotate(-16deg); }
  45% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
}

.notif-dropdown {
  width: 340px;
  max-width: 90vw;
  padding: 0;
  overflow: hidden;
}
.notif-header {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
}
.notif-lista {
  max-height: 360px;
  overflow-y: auto;
}
.notif-item {
  display: block;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.notif-nao-lida { background: var(--primary-soft); }
.notif-item-topo { display: flex; align-items: center; gap: .6rem; }
.notif-item-msg { font-size: .82rem; line-height: 1.35; color: var(--ink); }
.notif-item-meta {
  margin-top: .15rem;
  margin-left: 2.15rem;
  font-size: .72rem;
  color: var(--gray-500);
}
.notif-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  background: var(--primary-soft);
  color: var(--primary);
}
.notif-icon.notif-prioridade-alta { background: #fef3c7; color: #b45309; }
.notif-vazio { font-size: .8rem; }

.notif-footer {
  display: block;
  padding: .55rem .9rem;
  text-align: center;
  font-size: .78rem;
  font-weight: 500;
  color: var(--primary);
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}
.notif-footer:hover { background: var(--primary-soft); }

@media (max-width: 768px) {
  .notif-dropdown { width: 300px; }
}

.skeleton-line,
.skeleton-circle,
.skeleton-block {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
}

.skeleton-line {
  display: block;
  height: .7rem;
  margin-bottom: .5rem;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-100 { width: 100%; }

.skeleton-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-block {
  border-radius: var(--radius);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-circle, .skeleton-block {
    animation: none;
  }
}
.skeleton-notif-item {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem .9rem;
}
.skeleton-notif-item .skeleton-notif-body { flex: 1; }
.nav-skeleton-overlay {
  position: fixed;
  top: var(--tb-height);
  left: var(--sb-width);
  right: 0;
  bottom: 0;
  z-index: 1040;
  background: var(--bg-body);
  padding: 1.75rem 1.5rem;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: left .25s ease, opacity .12s ease;
}

.nav-skeleton-overlay.show {
  opacity: 1;
}

.nav-skeleton-overlay .skeleton-line.title {
  height: 1.3rem;
  width: 220px;
  margin-bottom: 1.5rem;
}

.nav-skeleton-overlay .skeleton-block.card {
  height: 90px;
  margin-bottom: 1rem;
}

.nav-skeleton-overlay .skeleton-block.row {
  height: 2.5rem;
  margin-bottom: .6rem;
}

/* ── Tabelas → layout compacto em linha (mobile) ─────────────────── */
@media (max-width: 767.98px) {
  table.table-cards-mobile {
    border: 0;
  }
  table.table-cards-mobile thead {
    display: none;
  }
  table.table-cards-mobile tbody,
  table.table-cards-mobile tr,
  table.table-cards-mobile td {
    display: block;
    width: 100%;
  }
  table.table-cards-mobile tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .5rem;
    padding: .6rem;
    box-shadow: var(--card-shadow);
    position: relative;
  }
  table.table-cards-mobile tr:last-child { margin-bottom: 0; }

  table.table-cards-mobile td {
    border: 0;
    padding: .25rem 0;
    text-align: left !important;
    font-size: .75rem;
  }
  table.table-cards-mobile td:empty { display: none; }

  /* Título com avatar */
  table.table-cards-mobile td.tcm-title {
    padding: 0 0 .4rem 0 !important;
    border-bottom: 1px solid var(--border);
    margin-bottom: .4rem;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-weight: 600;
    font-size: .8rem;
  }
  table.table-cards-mobile td.tcm-title .avatar {
    width: 24px !important;
    height: 24px !important;
    font-size: .6rem;
    flex-shrink: 0;
  }
  table.table-cards-mobile td.tcm-title .overflow-hidden {
    flex: 1;
    min-width: 0;
  }
  table.table-cards-mobile td.tcm-title .fw-semibold {
    font-size: .75rem;
    line-height: 1.2;
  }
  table.table-cards-mobile td.tcm-title .text-muted {
    display: none;
  }
  table.table-cards-mobile td.tcm-title .badge {
    display: none;
  }

  /* Status badge flutuante pequeno */
  table.table-cards-mobile td.tcm-status {
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: 0 !important;
  }
  table.table-cards-mobile td.tcm-status .badge {
    font-size: .6rem;
    padding: .2rem .35rem;
  }

  /* Dados extras — uma linha cada */
  table.table-cards-mobile td[data-label] {
    display: flex !important;
    flex-direction: column;
    padding: .15rem 0 !important;
  }
  table.table-cards-mobile td[data-label]::before {
    content: attr(data-label);
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--gray-400);
    margin-bottom: .05rem;
  }

  /* Botões compactos em linha */
  table.table-cards-mobile td.tcm-action-inline {
    border-top: 1px solid var(--border);
    padding-top: .4rem !important;
    margin-top: .3rem;
    text-align: right;
    display: flex !important;
    gap: .2rem;
    justify-content: flex-end;
  }
  table.table-cards-mobile td.tcm-action-inline .btn {
    padding: .2rem .3rem;
    font-size: .6rem;
    height: 26px;
    width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  table.table-cards-mobile td.tcm-action-inline .btn i {
    font-size: .6rem;
  }
}

/* ── Matriz de permissões (usuários) → cards em mobile ────── */
@media (max-width: 767.98px) {
  #permissoesTabela thead { display: none; }
  #permissoesTabela, #permissoesTabela tbody { display: block; width: 100%; }
  #permissoesTabela tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem .75rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: .85rem .9rem;
  }
  #permissoesTabela tbody tr > td:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
    padding-bottom: .5rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--border);
  }
  #permissoesTabela td { border: 0; padding: 0; text-align: left; }
  #permissoesTabela td.tcm-perm-cell { padding: .25rem 0; }
  .tcm-perm-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    cursor: pointer;
  }
  .tcm-perm-text { font-size: .82rem; color: var(--ink); }
}

/* ── Stat cards: reduzir densidade em telas muito pequenas ─── */
@media (max-width: 575.98px) {
  .stat-card .card-body,
  .stat-card-lg .card-body {
    padding: .9rem 1rem;
  }
  .stat-card .stat-value,
  .stat-card-lg .stat-value-lg {
    font-size: 1.7rem;
  }
  .stat-card .stat-label {
    font-size: .74rem;
  }
  .stat-card .stat-meta {
    font-size: .72rem;
  }
  .modal-footer { gap: .5rem; }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* ── Ações de tabela: área de toque adequada em mobile ────── */
@media (max-width: 767.98px) {
  .table td .btn-sm,
  .table-cards-mobile td .btn-sm {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .4rem .6rem;
  }
}

/* ── Telas de escolha (hub): cards grandes de navegação ───── */
.escolha-col {
    flex: 1 1 260px;
    max-width: 340px;
}

.escolha-card {
    display: block;
    position: relative;
    height: 100%;
    padding: 2.5rem 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    background: var(--sb-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    animation: escolhaEntrada .45s ease forwards;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease;
}

.escolha-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 120px at 50% -10%, var(--primary-soft), transparent 70%);
    opacity: 0;
    transition: opacity .3s ease;
}

.escolha-card:hover,
.escolha-card:focus-visible {
    transform: translateY(-6px) scale(1.015);
    border-color: var(--primary);
    box-shadow: 0 1.25rem 2.5rem -1rem rgba(79, 70, 229, .35);
}

.escolha-card:hover::before,
.escolha-card:focus-visible::before {
    opacity: 1;
}

.escolha-icone {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.65rem;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .25s ease, color .25s ease;
}

.escolha-card:hover .escolha-icone,
.escolha-card:focus-visible .escolha-icone {
    transform: scale(1.1) rotate(-6deg);
    background: var(--primary);
    color: #fff;
}

.escolha-titulo {
    position: relative;
    font-weight: 700;
    margin-bottom: .35rem;
}

.escolha-desc {
    position: relative;
    color: var(--gray-500);
    font-size: .875rem;
    margin-bottom: 0;
}

.escolha-seta {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--gray-400);
    opacity: 0;
    transform: translate(-4px, 4px);
    transition: opacity .25s ease, transform .25s ease;
}

.escolha-card:hover .escolha-seta,
.escolha-card:focus-visible .escolha-seta {
    opacity: 1;
    transform: translate(0, 0);
    color: var(--primary);
}

.escolha-card .badge-contagem {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
}

@keyframes escolhaEntrada {
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .escolha-card { animation: none; opacity: 1; transform: none; }
    .escolha-card, .escolha-icone, .escolha-seta { transition: none; }
}

/* ── Formulários de ordem (produção/serviço): seções numeradas ───── */
.form-secao-header {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}
.form-secao-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .8rem;
    font-weight: 700;
}
.form-secao-titulo { font-weight: 700; margin-bottom: .1rem; }
.form-secao-sub { color: var(--gray-500); font-size: .8rem; margin-bottom: 0; }

/* Trilha de etapas: mais peso visual que badges soltos */
.etapas-preview {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px dashed var(--border);
}
.etapas-trilha {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.etapa-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .7rem .35rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    border: 1px solid;
}
.etapa-pill .etapa-seq {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,.6);
    font-size: .65rem;
}
.etapa-normal { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.etapa-aprovacao { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.etapa-seta { color: var(--gray-400); font-size: .85rem; }

/* Item selecionado (cliente/produto): chip de confirmação */
.cliente-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .5rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: .8rem;
    font-weight: 600;
}

/* Botão de submit com destaque no hover */
.btn-abrir-ordem {
    position: relative;
    overflow: hidden;
    transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
}
.btn-abrir-ordem:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 .5rem 1rem -0.25rem rgba(79, 70, 229, .45);
}

@media (prefers-reduced-motion: reduce) {
    .btn-abrir-ordem { transition: none; }
}

/* ── Listagens de ordem/OS: badge pulsante para aguardando ação ───── */
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, .4); }
    50%       { box-shadow: 0 0 0 5px rgba(255, 193, 7, 0); }
}
.badge-pulse {
    animation: badgePulse 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .badge-pulse { animation: none; }
}

/* Mais respiro vertical nas linhas de listagens de ordem/OS */
.table-ordens > :not(caption) > * > td,
.table-ordens > :not(caption) > * > th {
    padding-top: .85rem;
    padding-bottom: .85rem;
}
