@use 'sass:color';

/* Variáveis */
$primary: #1c38c9;
$primary-hover: #152ca0;
$danger: #ef4444;
$warning: #f59e0b;
$success: #10b981;
$text-main: #111827;
$text-muted: #6b7280;
$bg-light: #f9fafb;
$border-color: #e5e7eb;
$logo-primary-blue-light: #004dcc;
$logo-primary-purple-dark: #6a0dad;
$logo-secondary-grey: #757575;

/* Utils */
* { box-sizing: border-box; }
.custom-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* HEADER PRINCIPAL */
.app-header {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
  padding: 14px 0; background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05); transition: all 0.3s ease;
  &.scrolled { padding: 10px 0; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
}

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logged-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; }
.left-logged { display: flex; align-items: center; gap: 16px; }

.btn-icon {
  background: transparent; border: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; transition: background 0.2s; color: $text-main;
  &:hover { background: rgba(0,0,0,0.04); }
  i { font-size: 20px; }
}

.logo-area {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: #111827; min-width: 0;
}

.logo-symbol {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 14px rgba(106, 13, 173, 0.2));
}

.lg-wordmark {
  display: inline-flex;
  flex-direction: column;
  line-height: 0.92;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  min-width: 0;
  --scale: 0.34;
}

.lg-wordmark__line {
  font-family: 'Poppins', 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 800;
  font-size: calc(96px * var(--scale));
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: linear-gradient(
    180deg,
    #c8c3ff 0%,
    #7a6cff 26%,
    #4b3fe6 52%,
    #2b21c8 74%,
    #120a78 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.12);
}

.lg-wordmark__movel {
  font-family: 'Poppins', 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 700;
  font-size: calc(34px * var(--scale));
  letter-spacing: -0.01em;
  white-space: nowrap;
  margin-left: calc(0.33em * var(--scale));
  margin-top: calc(-6px * var(--scale));
  background: linear-gradient(
    180deg,
    #6f7f96 0%,
    #4b5b72 48%,
    #2f3d52 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.12);
}

.nav-links { display: flex; align-items: center; justify-content: center; gap: 22px; flex: 1; }
.nav-links .nav-link {
  display: inline-flex; align-items: center; gap: 6px; color: $text-main; text-decoration: none; font-weight: 600; font-size: 14px; transition: color 0.2s;
  &:hover { color: $primary; }
}
.header-actions { display: flex; align-items: center; margin-left: auto; justify-content: flex-end; flex: 0 0 auto; }
.btn-login-header {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 99px;
  border: 1px solid rgba(28, 56, 201, 0.18); background: #fff; color: $primary; font-weight: 700; font-size: 13px; text-decoration: none; transition: all 0.2s;
  white-space: nowrap;
  &:hover { transform: translateY(-1px); background: rgba(28, 56, 201, 0.04); box-shadow: 0 4px 12px rgba(28, 56, 201, 0.15); }
}

@media (max-width: 900px) { .nav-links { display: none; } }
.logged-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.client-header-context {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: min(390px, 38vw);
  padding-right: 2px;
}

.client-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(28, 56, 201, 0.2);
  background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 55%, #eef2ff 100%);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.client-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.1);
}

.client-chip__icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2653d9 0%, #6a0dad 100%);
  box-shadow: 0 4px 10px rgba(38, 83, 217, 0.28);
  font-size: 12px;
}

.client-chip__name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  max-width: min(290px, 27vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1200px) {
  .header-inner.container {
    max-width: none;
    width: 100%;
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* DROPDOWNS */
.notifications-menu, .options-menu { position: relative; }
.notifications-dropdown, .options-dropdown {
  position: absolute; top: calc(100% + 12px); right: -10px; width: 340px; background: #fff; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05); z-index: 1200; transform-origin: top right;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1); overflow: hidden;
}
.options-dropdown { width: 220px; right: 0; padding: 6px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.user-trigger {
  display: flex; align-items: center; gap: 8px; padding: 4px; background: #fff; border: 1px solid $border-color; border-radius: 99px; cursor: pointer; transition: all 0.2s;
  &:hover, &[aria-expanded="true"] { border-color: $primary; box-shadow: 0 0 0 2px rgba(28, 56, 201, 0.1); }
  .user-avatar { width: 32px; height: 32px; background: $bg-light; border-radius: 50%; display: grid; place-items: center; color: $text-muted; }
  .chevron { font-size: 10px; color: $text-muted; margin: 0 6px 0 2px; }
}
.options-item {
  width: 100%; text-align: left; padding: 10px 12px; background: transparent; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; color: $text-main; display: flex; align-items: center; gap: 10px; cursor: pointer;
  &:hover { background: $bg-light; }
  &.danger { color: $danger; &:hover { background: rgba($danger, 0.05); } }
}
.divider { height: 1px; background: $border-color; margin: 4px 0; }

/* NOTIFICAÇÕES */
.btn-bell {
  position: relative;

  &.has-unread { color: $primary; background: rgba(28, 56, 201, 0.06); }
  .badge-pulse {
    position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; background: $danger; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 0 rgba($danger, 0.7); animation: pulse 2s infinite;
  }
}
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba($danger, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba($danger, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba($danger, 0); } }
.notifications-head {
  padding: 16px;
  border-bottom: 1px solid $border-color;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .head-title {
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    flex-shrink: 0;
  }

  .head-btn {
    border: 1px solid rgba(28, 56, 201, 0.18);
    background: #fff;
    color: $primary;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;

    i { font-size: 12px; }

    .spinner-border {
      width: 10px;
      height: 10px;
      border-width: 2px;
    }

    &:hover:not(:disabled) {
      background: rgba(28, 56, 201, 0.04);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(28, 56, 201, 0.12);
    }

    &:disabled {
      opacity: 0.55;
      cursor: default;
    }
  }

  .see-all {
    font-size: 11px;
    color: $primary;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
  }
}

.notifications-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid $border-color;
  background: #fff;
}

.notif-tab {
  border: 1px solid $border-color;
  background: #f8fafc;
  color: $text-muted;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;

  &:hover { background: $bg-light; color: $text-main; }

  &.active {
    background: rgba(28, 56, 201, 0.08);
    border-color: rgba(28, 56, 201, 0.25);
    color: $primary;
  }
}

.notifications-body { max-height: 360px; overflow-y: auto; }
.notifications-empty { padding: 32px; text-align: center; color: $text-muted; .empty-icon { font-size: 24px; margin-bottom: 8px; } }
.notifications-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(28, 56, 201, 0.14);
  background: rgba(28, 56, 201, 0.06);
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;

  i {
    font-size: 14px;
    color: $primary;
  }

  .spinner-border {
    width: 14px;
    height: 14px;
    border-width: 2px;
  }

  &.loading {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
  }

  &.info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;

    .notifications-truncate-copy {
      display: inline-flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 4px;
      font-weight: 600;
      color: #1e3a8a;

      strong {
        padding: 1px 6px;
        border-radius: 999px;
        border: 1px solid #93c5fd;
        background: #dbeafe;
        color: #1d4ed8;
        font-weight: 800;
        line-height: 1.2;
      }
    }
  }

  &.warn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;

    i {
      color: #c2410c;
    }
  }
}

.notification-item {
  display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid $border-color; cursor: pointer;
  &:hover { background: $bg-light; }
  &.unread { background: rgba(28, 56, 201, 0.03); .notif-title { font-weight: 700; } .status-dot { width: 6px; height: 6px; background: $primary; border-radius: 50%; } }
  .icon-circle {
    width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #f3f4f6; color: $text-muted; font-size: 16px;
    &.danger { background-color: #fee2e2; color: #dc2626; }
    &.warn { background-color: #fef3c7; color: #d97706; }
  }
  .notif-content { flex: 1; }
  .notif-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
  .notif-title-line { font-weight: 700; color: $text-main; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .notif-line { font-weight: 800; flex: 0 0 auto; }
  .notif-sep { color: $text-muted; flex: 0 0 auto; }
  .notif-client { font-weight: 600; color: $text-muted; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
  .notif-desc { margin: 2px 0 6px; font-size: 12px; color: $text-muted; line-height: 1.3; display: flex; align-items: center; gap: 4px; }
  .notif-verb { font-weight: 600; color: $text-muted; }
  .notif-date-strong { font-weight: 800; color: $text-main; }
  .notif-date-strong.warn { color: #d97706; }
  .notif-date-strong.danger { color: #dc2626; }
  .notif-meta-lines { display: flex; flex-direction: column; gap: 4px; }
  .notif-meta-line { display: flex; gap: 6px; font-size: 12px; color: $text-muted; }
  .meta-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
  .meta-value { font-weight: 600; color: $text-main; }
  .notif-restore-btn {
    margin-left: auto;
    align-self: center;
    border: 1px solid rgba(28, 56, 201, 0.2);
    background: #fff;
    color: $primary;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: rgba(28, 56, 201, 0.06);
      border-color: rgba(28, 56, 201, 0.35);
    }
  }
}

/* MODAIS GERAIS */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); z-index: 1400; animation: fadeIn 0.2s; }
.modal-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(500px, calc(100vw - 32px)); background: #fff; border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); z-index: 1450; display: flex; flex-direction: column; animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid $border-color; h3 { margin: 0; font-size: 16px; font-weight: 600; color: $text-main; } }
.close-x { width: 32px; height: 32px; border-radius: 6px; &:hover { background: #f3f4f6; } }
.modal-body { padding: 20px; }
.modal-actions { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 10px; background: $bg-light; border-radius: 0 0 16px 16px; }

.form-field {
  display: grid; gap: 6px; margin-bottom: 16px;
  label { font-size: 13px; font-weight: 500; color: $text-main; }
  input, select { width: 100%; height: 40px; border-radius: 8px; border: 1px solid #d1d5db; padding: 0 12px; font-size: 14px; transition: all 0.2s; &:focus { outline: none; border-color: $primary; box-shadow: 0 0 0 3px rgba(28, 56, 201, 0.1); } }
}
.field-error { font-size: 12px; color: $danger; margin-top: 2px; }
.form-alert {
  padding: 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
  &.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
  &.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
  ul { margin: 4px 0 0; padding-left: 16px; }
}
.btn-primary, .btn-secondary, .btn-ghost { height: 38px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: $primary; color: #fff; &:hover:not(:disabled) { background: $primary-hover; } &:disabled { opacity: 0.7; cursor: not-allowed; } }
.btn-secondary { background: #fff; border: 1px solid $border-color; color: $text-main; &:hover { background: $bg-light; } }
.btn-ghost { background: transparent; color: $text-muted; &:hover { background: rgba(0,0,0,0.05); color: $text-main; } }

/* ==========================================================================
   MODAL EDITAR USUÁRIO - LAYOUT FINAL
   ========================================================================== */
.modal-card.manage-users-modal {
  width: min(1200px, 95vw);
  height: min(650px, 90vh);
}

.manage-body {
  padding: 0;
  display: grid;
  grid-template-columns: 50% 50%;
  height: 100%;
  overflow: hidden;
}

/* Lado Esquerdo */
.manage-left {
  display: flex; flex-direction: column;
  border-right: 1px solid $border-color;
  background: #fff;
  min-width: 0;
}
.manage-search {
  padding: 12px 16px; border-bottom: 1px solid $border-color;
  .search-input-wrapper {
    position: relative;
    i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: $text-muted; }
    input { width: 100%; height: 36px; padding-left: 36px; padding-right: 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: $bg-light; font-size: 13px; &:focus { background: #fff; border-color: $primary; outline: none; } }
  }
}

.manage-table-wrap {
  flex: 1; overflow-y: auto; position: relative; overflow-x: hidden;
}

.manage-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  
  thead {
    position: sticky; top: 0; background: #fff; z-index: 10;
    th {
      font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
      color: $text-muted; font-weight: 600; padding: 10px 16px;
      border-bottom: 1px solid $border-color; background: #f9fafb;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      /* Classes de alinhamento no TH */
      &.text-center { text-align: center; }
      &.text-end { text-align: right; }
    }
  }
  tbody tr {
    border-bottom: 1px solid $border-color; transition: background 0.15s; cursor: pointer;
    &:hover { background: #f9fafb; }
    &.selected { background: rgba(28, 56, 201, 0.04); border-left: 3px solid $primary; }
    td {
      padding: 12px 16px; vertical-align: middle;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      
      /* Classes de alinhamento no TD */
      &.text-center { text-align: center; overflow: visible; }
      &.text-end { text-align: right; overflow: visible; }
    }
  }
}

.user-cell {
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  .avatar-mini {
    width: 32px; height: 32px; min-width: 32px;
    background: $primary; color: #fff; border-radius: 50%;
    display: grid; place-items: center; font-weight: 600; font-size: 12px;
  }
  .user-info {
    display: flex; flex-direction: column; min-width: 0;
    .u-name { font-size: 13px; font-weight: 500; color: $text-main; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .u-email { font-size: 11px; color: $text-muted; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  }
}

.badge-role { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; background: #eef2ff; color: $primary; border: 1px solid rgba(28, 56, 201, 0.1); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: $success; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); &.off { background: $text-muted; box-shadow: none; opacity: 0.5; } }

.actions-group {
  display: flex; gap: 4px; 
  /* Centraliza os botões quando a célula é text-center */
  justify-content: center; 
  
  .btn-action {
    width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; color: $text-muted; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; cursor: pointer;
    &:hover { background: #e5e7eb; color: $text-main; }
    &.edit:hover { color: $primary; background: rgba(28, 56, 201, 0.1); }
    &.delete:hover { color: $danger; background: rgba(239, 68, 68, 0.1); }
  }
}

.empty-state-list { padding: 40px 20px; text-align: center; color: $text-muted; i { font-size: 24px; opacity: 0.5; display: block; margin-bottom: 8px; } p { font-size: 13px; margin: 0; } }
.loading-state { padding: 40px; text-align: center; }
.list-footer {
  padding: 10px 16px; border-top: 1px solid $border-color; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: $text-muted; background: #fff;
  .pagination { display: flex; gap: 4px; }
  .icon-only { width: 28px; height: 28px; padding: 0; }
}

/* Lado Direito */
.manage-right-wrapper { background: #fff; display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
.manage-right { padding: 32px 40px; flex: 1; display: flex; flex-direction: column; }
.edit-header-info {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
  .avatar-large { width: 56px; height: 56px; background: linear-gradient(135deg, $primary, #4f46e5); color: #fff; font-size: 20px; font-weight: 600; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2); }
  .info-text h4 { margin: 0; font-size: 18px; color: $text-main; }
  .info-text span { font-size: 13px; color: $text-muted; }
}

/* AQUI: Placeholder CORRIGIDO */
.manage-right.placeholder {
  align-items: center; justify-content: center; text-align: center; height: 100%; padding: 32px;
  background: #fff; /* Fundo branco explícito */
  cursor: default;  /* Remove qualquer cursor de loading herdado */

  .placeholder-content {
    max-width: 320px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;

    .placeholder-icon {
        font-size: 64px;
        color: $text-muted;
        opacity: 0.2; /* Estilo marca d'água */
        margin-bottom: 16px;
    }
    
    h3 {
        font-size: 16px;
        font-weight: 600;
        color: $text-main;
        margin-bottom: 8px;
    }

    p { 
        font-size: 14px; 
        color: $text-muted; 
        line-height: 1.5; 
        font-weight: 400; 
        margin: 0;
    }
  }
}

.refined-form { display: flex; flex-direction: column; gap: 16px; .form-row { display: flex; gap: 16px; &.two-col { display: grid; grid-template-columns: 1fr 1fr; } &.align-end { align-items: end; } } }
.toggle-wrapper { display: flex; align-items: center; gap: 12px; height: 40px; .toggle-status { font-size: 13px; color: $text-muted; font-weight: 500; &.active { color: $success; } } }
.switch {
  position: relative; display: inline-block; width: 44px; height: 24px;
  input { opacity: 0; width: 0; height: 0; }
  .slider { position: absolute; cursor: pointer; inset: 0; background-color: #e5e7eb; transition: .4s; &.round { border-radius: 24px; } &.round:before { border-radius: 50%; } }
  .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
  input:checked + .slider { background-color: $success; }
  input:checked + .slider:before { transform: translateX(20px); }
}
.manage-actions-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid $border-color; display: flex; justify-content: flex-end; gap: 12px; }
.manage-actions-footer .btn-delete-permanent-left { margin-right: auto; }
.manage-actions-footer .btn-delete-permanent-left {
  background: #ef4444;
  color: #fff;
  border: 1px solid #dc2626;
}
.manage-actions-footer .btn-delete-permanent-left:hover:not(:disabled) {
  background: #dc2626;
  border-color: #b91c1c;
}
.manage-actions-footer .btn-delete-permanent-left:disabled {
  background: #fecaca;
  border-color: #fecaca;
  color: #7f1d1d;
}

@media (max-width: 900px) {
  .manage-body { grid-template-columns: 1fr; overflow-y: auto; }
  .manage-left { height: 40%; border-right: none; border-bottom: 1px solid $border-color; }
  .manage-right-wrapper { height: 60%; }
  .manage-right { padding: 20px; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .manage-table-wrap { overflow-x: auto; }
}

@media (max-width: 1200px) {
  .modal-card.manage-users-modal {
    width: min(980px, 92vw);
    height: min(600px, 86vh);
  }
  .modal-card {
    width: min(460px, 92vw);
  }
}

@media (max-width: 900px) {
  .modal-card.manage-users-modal {
    width: min(720px, 92vw);
    height: min(560px, 86vh);
  }
  .modal-card {
    width: min(420px, 92vw);
  }
}

@media (max-width: 640px) {
  .modal-card.manage-users-modal {
    width: min(520px, 94vw);
    height: min(520px, 84vh);
  }
  .modal-card {
    width: min(360px, 94vw);
  }
}

/* ==========================================================================
   AJUSTES PARA NOTEBOOKS / TELAS MENORES (SOLICITADO)
   ========================================================================== */
/* Adicionado max-width: 1440px e max-height: 800px para pegar notebooks padrão */
@media (max-width: 1440px), (max-height: 800px) {
  /* Modal Genérico (Novo Usuário) - Compacto */
  .modal-card {
    /* Limita a altura para não sair da tela e habilita scroll interno */
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 12px 16px;
    h3 { font-size: 15px; }
  }

  .modal-body {
    padding: 16px;
    /* Essencial para que o conteúdo não estoure o modal quando encolhido */
    overflow-y: auto;
  }

  .modal-actions {
    padding: 12px 16px;
  }

  /* Compactar formulários */
  .form-field {
    margin-bottom: 12px;
    label { font-size: 12px; }
    input, select {
      height: 36px;
      font-size: 13px;
    }
  }

  .form-alert {
    padding: 10px;
    margin-bottom: 12px;
    font-size: 12px;
  }

  /* Modal de Gestão (Editar Usuário) - MUITO COMPACTO (Solicitado) */
  .modal-card.manage-users-modal {
    /* Reduzido consideravelmente */
    height: min(500px, 80vh);
    width: min(900px, 92vw);
  }

  .manage-right {
    padding: 24px;
  }

  .edit-header-info {
    margin-bottom: 16px;
    .avatar-large {
      width: 48px;
      height: 48px;
      font-size: 16px;
    }
    .info-text h4 {
      font-size: 16px;
    }
  }
  
  .refined-form {
    gap: 12px;
  }
}


/* SIDE MENU */
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1050; }
.side-menu {
  position: fixed; top: 0; left: 0; height: 100vh; width: 280px; background: #fff; box-shadow: 4px 0 20px rgba(0,0,0,0.1); transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1100; display: flex; flex-direction: column;
  &.open { transform: translateX(0); }
}
.side-menu-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid $border-color; }
.close-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: $text-main;
  transition: color 0.2s ease;
  &:hover { color: $primary; }
}
.side-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: $text-main;
  min-width: 0;
}

.side-logo-symbol {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 9px rgba(106, 13, 173, 0.2));
}

.side-wordmark {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
  min-width: 0;
  --scale: 0.23;
}

.side-wordmark__line {
  font-family: 'Poppins', 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 800;
  font-size: calc(92px * var(--scale));
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: linear-gradient(
    180deg,
    #c8c3ff 0%,
    #7a6cff 26%,
    #4b3fe6 52%,
    #2b21c8 74%,
    #120a78 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.side-wordmark__movel {
  font-family: 'Poppins', 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 800;
  font-size: calc(92px * var(--scale));
  letter-spacing: -0.012em;
  white-space: nowrap;
  margin-left: 0;
  margin-top: 0;
  background: linear-gradient(
    180deg,
    #aeb8c7 0%,
    #6b778d 50%,
    #3f4b60 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  position: relative;
  top: 0;
}
.side-menu-body { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.side-item {
  padding: 10px 12px; border-radius: 8px; color: $text-main; text-decoration: none; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px;
  &:hover { background: $bg-light; }
  &.active { background: rgba(28, 56, 201, 0.08); color: $primary; }
}

/* ==========================================================================
   RESPONSIVIDADE MOBILE/TABLET (HEADER, NOTIFICAÇÕES E MODAIS DO TOPO)
   ========================================================================== */
@media (max-width: 900px) {
  .app-header {
    padding: 10px 0;
  }

  .header-inner {
    gap: 12px;
  }

  .logged-header {
    gap: 10px;
  }

  .left-logged {
    gap: 10px;
    min-width: 0;
  }

  .logo-area {
    min-width: 0;
  }

  .lg-wordmark {
    --scale: 0.29;
  }

  .logo-symbol {
    width: 42px;
    height: 42px;
  }

  .logged-actions {
    gap: 8px;
  }

  .client-header-context {
    max-width: min(310px, 34vw);
  }

  .client-chip {
    gap: 8px;
    padding: 5px 10px 5px 6px;
  }

  .client-chip__icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 11px;
  }

  .client-chip__name {
    font-size: 13px;
    max-width: min(240px, 24vw);
  }

  .side-wordmark {
    --scale: 0.21;
  }

  .notifications-dropdown {
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .options-dropdown {
    right: 0;
    width: min(260px, calc(100vw - 24px));
  }

  .notifications-head {
    align-items: flex-start;

    .head-title {
      min-width: 0;
      flex-wrap: wrap;
    }

    .head-actions {
      margin-left: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
  }

  .notifications-body {
    max-height: min(52vh, 420px);
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 8px 0;
  }

  .app-header.scrolled {
    /* Mobile: não muda a altura do header ao rolar (evita "vão" no topo ao voltar) */
    padding: 8px 0;
  }

  .header-inner {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .logged-header {
    gap: 8px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;

    i {
      font-size: 18px;
    }
  }

  .btn-bell .badge-pulse {
    top: 8px;
    right: 8px;
  }

  .left-logged {
    gap: 8px;
    flex: 1 1 auto;
  }

  .logo-area {
    gap: 8px;
    min-width: 0;
  }

  .logo-symbol {
    width: 36px;
    height: 36px;
  }

  .lg-wordmark {
    --scale: 0.22;
  }

  /* Header público (Home/Login/Register): mantém logo visível e CTA fixo à direita */
  .header-inner > .logo-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-inner > .logo-area .lg-wordmark {
    display: block;
    white-space: nowrap;
  }

  .header-inner > .logo-area .lg-wordmark {
    --scale: 0.2;
  }

  .header-inner > .header-actions {
    margin-left: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .header-inner > .header-actions .btn-login-header {
    padding: 7px 10px;
    gap: 4px;
    font-size: 12px;
  }

  /* Header logado: mantém nome visível, porém menor para smartphone */
  .left-logged .logo-area .lg-wordmark {
    --scale: 0.2;
  }

  .client-header-context {
    display: none;
  }

  .logged-actions {
    gap: 6px;
  }

  .user-trigger {
    padding: 2px;

    .user-avatar {
      width: 30px;
      height: 30px;
    }
  }

  .notifications-dropdown {
    position: fixed;
    top: calc(var(--app-header-offset, 76px) + 8px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    border-radius: 16px;
    transform-origin: top center;
    z-index: 1250;
  }

  .options-dropdown {
    position: fixed;
    top: calc(var(--app-header-offset, 76px) + 8px);
    right: 8px;
    width: min(228px, calc(100vw - 16px));
    padding: 4px;
    border-radius: 12px;
    z-index: 1250;
  }

  .options-dropdown .options-item {
    padding: 8px 10px;
    font-size: 12px;
    gap: 8px;
    border-radius: 7px;
  }

  .options-dropdown .divider {
    margin: 3px 0;
  }

  .notifications-head {
    padding: 12px;
    flex-wrap: wrap;
    gap: 10px;

    .head-title {
      width: 100%;
      justify-content: space-between;
      gap: 8px;
      font-size: 13px;
    }

    .head-actions {
      width: 100%;
      margin-left: 0;
      justify-content: space-between;
      gap: 6px;
    }

    .head-btn {
      font-size: 10px;
      padding: 5px 7px;
      gap: 4px;
    }

    .see-all {
      margin-left: auto;
      font-size: 11px;
    }
  }

  .notifications-tabs {
    padding: 8px 12px;
    flex-direction: column;
    gap: 8px;
  }

  .notif-tab {
    width: 100%;
    padding: 9px 10px;
    text-align: center;
  }

  .notifications-state {
    margin: 8px 12px 6px;
    padding: 8px 9px;
    font-size: 11px;
  }

  .notifications-body {
    max-height: calc(100dvh - 220px);
  }

  .notifications-empty {
    padding: 20px 12px;
  }

  .notification-item {
    gap: 10px;
    padding: 12px;
    align-items: flex-start;

    .notif-content {
      min-width: 0;
    }

    .notif-title-line {
      white-space: normal;
      flex-wrap: wrap;
      row-gap: 2px;
    }

    .notif-client {
      max-width: 100%;
    }

    .notif-desc {
      flex-wrap: wrap;
      align-items: baseline;
    }

    .notif-meta-line {
      flex-wrap: wrap;
      row-gap: 2px;
    }

    .notif-restore-btn {
      margin-left: 0;
      margin-top: 6px;
      align-self: flex-start;
    }
  }

  .modal-card {
    width: min(100vw - 12px, 420px);
    max-height: calc(100dvh - 12px);
    border-radius: 14px;
  }

  .modal-actions {
    padding: 12px 14px;
    gap: 8px;
  }

  .modal-actions .btn-primary,
  .modal-actions .btn-secondary {
    min-height: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 10px;
  }

  .modal-card.manage-users-modal {
    width: calc(100vw - 12px);
    height: min(calc(100dvh - 12px), 680px);
    max-height: calc(100dvh - 12px);
    border-radius: 14px;
  }

  .manage-body {
    height: 100%;
  }

  .manage-left {
    height: auto;
    max-height: 38vh;
  }

  .manage-search {
    padding: 10px 12px;
  }

  .manage-search .search-input-wrapper input {
    height: 34px;
    font-size: 12px;
  }

  .manage-search .search-input-wrapper i {
    left: 10px;
    font-size: 13px;
  }

  .manage-right-wrapper {
    height: auto;
    min-height: 0;
  }

  .manage-right {
    padding: 14px;
  }

  .manage-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .manage-table {
    min-width: 560px;
  }

  .manage-table thead th {
    padding: 8px 10px;
    font-size: 10px;
    letter-spacing: 0.35px;
  }

  .manage-table tbody tr td {
    padding: 9px 10px;
  }

  .user-cell {
    gap: 8px;
  }

  .user-cell .avatar-mini {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 11px;
  }

  .user-cell .user-info .u-name {
    font-size: 12px;
  }

  .user-cell .user-info .u-email {
    font-size: 10px;
  }

  .badge-role {
    padding: 2px 6px;
    font-size: 9px;
  }

  .actions-group {
    gap: 3px;
  }

  .actions-group .btn-action {
    width: 26px;
    height: 26px;
  }

  .edit-header-info {
    gap: 10px;
    margin-bottom: 14px;

    .avatar-large {
      width: 42px;
      height: 42px;
      font-size: 14px;
    }

    .info-text h4 {
      font-size: 14px;
    }

    .info-text span {
      font-size: 12px;
    }
  }

  .manage-actions-footer {
    margin-top: 18px;
    padding-top: 14px;
    gap: 8px;

    .btn-delete-permanent-left {
      margin-right: 0;
    }
  }

  .list-footer {
    flex-wrap: wrap;
    gap: 8px;

    .pagination {
      width: 100%;
      justify-content: center;
      flex-wrap: wrap;
    }
  }

  .side-menu {
    width: min(88vw, 320px);
  }
}

@media (max-width: 420px) {
  .header-inner > .logo-area {
    gap: 6px;
  }

  .header-inner > .logo-area .logo-symbol {
    width: 32px;
    height: 32px;
  }

  .header-inner > .logo-area .lg-wordmark {
    --scale: 0.18;
  }

  .header-inner > .header-actions .btn-login-header {
    padding: 6px 8px;
    font-size: 11px;
    gap: 3px;
  }

  .left-logged .logo-area {
    gap: 6px;
  }

  .left-logged .logo-area .lg-wordmark {
    --scale: 0.175;
  }

  .logged-actions {
    gap: 4px;
  }

  .user-trigger {
    .chevron {
      display: none;
    }
  }

  .notifications-dropdown {
    left: 6px;
    right: 6px;
    top: calc(var(--app-header-offset, 76px) + 6px);
  }

  .options-dropdown {
    right: 6px;
    top: calc(var(--app-header-offset, 76px) + 6px);
    width: min(216px, calc(100vw - 12px));
  }

  .options-dropdown .options-item {
    padding: 7px 9px;
    font-size: 11px;
    gap: 7px;
  }

  .modal-actions {
    padding: 10px 12px;
  }

  .modal-actions .btn-primary,
  .modal-actions .btn-secondary {
    min-height: 40px;
    height: 40px;
    font-size: 12px;
  }

  .manage-table {
    min-width: 520px;
  }

  .manage-table thead th {
    padding: 7px 8px;
    font-size: 9px;
  }

  .manage-table tbody tr td {
    padding: 8px;
  }

  .user-cell .avatar-mini {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }

  .actions-group .btn-action {
    width: 24px;
    height: 24px;
  }

  .notifications-head {
    .head-actions {
      justify-content: stretch;
    }

    .head-btn {
      flex: 1 1 100%;
      justify-content: center;
    }

    .see-all {
      width: 100%;
      text-align: center;
      margin-left: 0;
      padding-top: 2px;
    }
  }

  .notification-item {
    .icon-circle {
      width: 32px;
      height: 32px;
      font-size: 14px;
    }

    .notif-meta-line {
      gap: 4px;
      font-size: 11px;
    }
  }
}
