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

body {
  min-width: 320px;
}

img {
  max-width: 100%;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(160, 0, 152, .28);
  outline-offset: 2px;
}

.mobile-menu-toggle,
.nav-backdrop,
.mobile-stage-move {
  display: none;
}

.side > .brand-logo {
  flex: 0 0 94px !important;
  height: 94px !important;
  min-height: 94px !important;
  padding: 8px 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
}

.side > .brand-logo img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.side > .nav {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.side > .nav > button,
.admin-submenu > button {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
}

.admin-submenu {
  align-content: start;
  grid-auto-rows: 48px;
}

.side > .logout-bottom {
  flex: 0 0 auto;
}

.app.collapsed .side > .brand-logo {
  flex-basis: 72px !important;
  width: 72px !important;
  height: 72px !important;
  min-height: 72px !important;
  padding: 0 !important;
}

.login-version {
  grid-column: 1 / -1;
  color: #6c6f82;
  font-size: 12px;
  text-align: center;
}

.greeting-dialog {
  position: relative;
  width: min(520px, 100%);
  padding: 32px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20, 20, 42, .2);
  text-align: center;
}

.greeting-dialog .greeting-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f7e7f7;
  color: #7b007b;
  font-size: 12px;
  font-weight: 900;
}

.greeting-dialog h2 {
  margin: 18px 0 10px;
  color: #211f3d;
  font-size: 28px;
  line-height: 1.2;
  text-wrap: balance;
}

.greeting-dialog p {
  max-width: 42ch;
  margin: 0 auto;
  color: #55596f;
  font-size: 17px;
  line-height: 1.55;
  text-wrap: pretty;
}

.greeting-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid #e7e8f1;
  background: #fff;
  color: #211f3d;
  font-size: 22px;
}

.greeting-action {
  width: 100%;
  min-height: 48px;
  margin-top: 26px;
}

.password-choice-dialog {
  width: min(560px, 100%);
  padding: 32px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20, 20, 42, .2);
  text-align: center;
}

.password-choice-dialog .greeting-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f7e7f7;
  color: #7b007b;
  font-size: 12px;
  font-weight: 900;
}

.password-choice-dialog h2 {
  margin: 18px 0 10px;
  color: #211f3d;
  font-size: 28px;
  line-height: 1.2;
}

.password-choice-dialog > p {
  max-width: 48ch;
  margin: 0 auto;
  color: #55596f;
  font-size: 16px;
  line-height: 1.55;
}

.password-choice-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}

.password-choice-error {
  display: none;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: #be123c;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.password-choice-error:not(:empty) {
  display: block;
}

.password-choice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.password-choice-actions > * {
  width: 100%;
  min-height: 48px;
}

.app,
.main,
.grid,
.panel,
.report-item > div {
  min-width: 0;
}

.main > * {
  max-width: 100%;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
}

.report-item .meta {
  white-space: normal;
  overflow-wrap: anywhere;
}

.side-credit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: rgba(255, 255, 255, .66);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
}

.side-credit img {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.side-credit span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-credit a {
  color: #f0a13a;
  font-weight: 900;
}

.app.collapsed .side-credit {
  display: none;
}

.bell-symbol {
  position: relative;
  display: inline-block;
  flex: 0 0 18px;
  width: 18px;
  height: 19px;
  color: currentColor;
}

.bell-symbol::before {
  position: absolute;
  top: 1px;
  left: 2px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 8px 8px 4px 4px;
  content: "";
}

.bell-symbol::after {
  position: absolute;
  bottom: 0;
  left: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.top-bell {
  align-items: center;
  justify-content: center;
}

.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
}

.kanban-toolbar .hint {
  margin: 0;
}

.kanban-export {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.kanban-export:hover {
  border-color: #b000a7;
  color: #7b007b;
}

.kanban .col > header {
  gap: 10px;
}

.kanban-count {
  flex: 0 0 auto;
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kanban-search {
  position: relative;
  display: block;
  margin: 10px 0 12px;
}

.kanban-search > span {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  transform: translateY(-50%);
  color: #6c6f82;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
}

.kanban-search input {
  min-height: 40px;
  padding: 9px 34px 9px 36px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.kanban-search input::placeholder {
  color: #646779;
}

.kanban-search input:focus {
  border-color: #7b007b;
  outline: 3px solid rgba(123, 0, 123, .12);
}

.kanban-empty {
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.lead[hidden],
.kanban-empty[hidden] {
  display: none !important;
}

.scheduled-repique-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 9px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f7e7f7;
  color: #7b007b;
  font-size: 11px;
  font-weight: 850;
}

.scheduled-repique-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, .55fr);
  gap: 14px;
  margin: 4px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8fc;
}

.scheduled-repique-box legend {
  padding: 0 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.scheduled-repique-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.scheduled-repique-toggle > span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  font-weight: 850;
}

.scheduled-repique-toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: #7b007b;
}

.scheduled-repique-toggle small,
.scheduled-repique-error {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.scheduled-repique-date {
  align-self: end;
}

.scheduled-repique-date.inactive {
  opacity: .55;
}

.scheduled-repique-error {
  grid-column: 1 / -1;
  color: #be123c;
}

.repique-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.repique-kind {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 850;
}

.repique-kind.scheduled {
  background: #f7e7f7;
  color: #7b007b;
}

.repique-kind.automatic {
  background: #e9f8f4;
  color: #087c66;
}

.channel-report-list {
  gap: 0;
}

.channel-report-item {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.channel-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #eef0f6;
  color: #211f3d;
  font-size: 18px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.channel-icon-facebook {
  background: #1877f2;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 25px;
}

.channel-icon-facebook b {
  transform: translateY(3px);
}

.channel-icon-instagram {
  position: relative;
  background: #c13584;
}

.channel-icon-instagram i {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 6px;
}

.channel-icon-instagram i::before {
  position: absolute;
  inset: 4px;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
}

.channel-icon-instagram i::after {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.channel-icon-whatsapp {
  background: #16a66a;
  color: #fff;
}

.channel-icon-google {
  background: #eef4ff;
  color: #1769e0;
  font-family: Arial, sans-serif;
}

.channel-icon-organic {
  background: #e8f7ef;
  color: #128052;
  font-size: 23px;
}

.channel-icon-referral {
  background: #fff2df;
  color: #9a5b00;
}

.channel-icon-other {
  background: #eef0f6;
  color: #55596f;
  font-size: 22px;
}

@media (min-width: 1024px) {
  .app.collapsed .side > .nav > button {
    position: relative;
  }

  .app.collapsed .side > .nav > button .badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    margin: 0;
    padding: 0 5px;
    font-size: 10px;
  }

  .login {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .login-frame {
    max-height: none;
    grid-template-rows: auto auto auto;
    row-gap: 14px;
  }

  .login-footer {
    margin-top: 8px;
  }

  .login-version {
    margin-top: -12px;
    padding-bottom: 8px;
    font-size: 10px;
    line-height: 1.2;
  }
}

.panel > div[style*="overflow"] {
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1360px) {
  .kanban {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (pointer: coarse) {
  button,
  .whatsapp,
  input,
  select {
    min-height: 44px;
  }
}

@media (max-width: 1023px) {
  .app,
  .app.collapsed {
    display: block;
    min-height: 100dvh;
  }

  .app.mobile-nav-open {
    height: 100dvh;
    overflow: hidden;
  }

  .side,
  .app.collapsed .side {
    position: fixed;
    z-index: 41;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
    align-items: stretch !important;
    overflow: hidden;
    transform: translateX(-105%);
    transition: transform .2s ease-out;
    box-shadow: 8px 0 24px rgba(15, 15, 32, .2);
  }

  .app.mobile-nav-open > .side,
  .app.collapsed.mobile-nav-open > .side {
    transform: translate3d(0, 0, 0) !important;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    z-index: 40;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0;
    background: rgba(17, 18, 36, .52);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease-out;
  }

  .mobile-nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .side > .brand-logo,
  .app.collapsed .side > .brand-logo {
    flex-basis: 94px !important;
    width: 226px !important;
    height: 94px !important;
    min-height: 94px !important;
    padding: 8px 0 !important;
    align-self: flex-start;
  }

  .side > .nav {
    overflow-y: auto;
    padding-right: 4px;
  }

  .app.collapsed .label,
  .app.collapsed .chev {
    display: inline;
  }

  .app.collapsed .side-credit {
    display: flex;
  }

  .app.collapsed .admin-submenu:not(.closed) {
    display: grid;
  }

  .app.collapsed .nav button,
  .app.collapsed .logout-bottom > button {
    width: 100%;
    justify-content: flex-start;
  }

  .app.collapsed .nav-admin-toggle {
    margin-top: 8px;
    padding-top: 16px !important;
    border-top: 1px solid rgba(255, 255, 255, .12) !important;
  }

  .collapse-toggle,
  .app.collapsed .collapse-toggle {
    align-self: flex-end;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 22px 20px 40px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    background: #fff;
    color: #211f3d;
    border: 1px solid #e7e8f1;
  }

  .top {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .top-title {
    min-width: 0;
  }

  .top-title h1,
  .top-title p {
    overflow-wrap: anywhere;
  }

  .top-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .kanban-toolbar {
    align-items: flex-start;
  }

  .scheduled-repique-box {
    grid-template-columns: 1fr;
  }

  .scheduled-repique-date {
    align-self: stretch;
  }

  .mobile-stage-move {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    color: #55596f;
    font-size: 12px;
  }

  .mobile-stage-move select {
    background: #fff;
  }

  .filters {
    align-items: stretch;
  }

  .filters label {
    flex: 1 1 220px;
  }

  .login {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  }

  .login-frame {
    width: min(620px, 100%);
    max-height: none;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .login-info {
    display: none;
  }

  .login-card {
    padding: 34px;
  }

  .login-logo {
    width: min(300px, 88%);
  }

  .login-footer,
  .login-version {
    grid-column: 1;
  }
}

@media (max-width: 767px) {
  .main {
    padding: 16px 12px max(28px, env(safe-area-inset-bottom));
  }

  .top {
    margin-bottom: 16px;
  }

  .top h1 {
    font-size: 25px;
    line-height: 1.2;
  }

  .top p {
    font-size: 13px;
    line-height: 1.4;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .kanban-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .kanban-export {
    width: 100%;
  }

  .top-actions > .ghost:first-child {
    flex: 1 1 auto;
  }

  .top-bell {
    width: 48px;
    height: 48px;
  }

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

  .card,
  .panel {
    min-width: 0;
  }

  .card {
    padding: 16px;
  }

  .card strong {
    font-size: 26px;
    overflow-wrap: anywhere;
  }

  .panel {
    padding: 16px;
  }

  .panel-head {
    align-items: stretch;
  }

  .panel-head > button,
  .panel-head > a {
    width: 100%;
  }

  .modal-box > .panel-head {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .modal-box > .panel-head > .icon-btn {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    margin-left: auto;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  textarea {
    min-height: 120px;
  }

  .kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 12px;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .kanban .col {
    flex: 0 0 min(88vw, 390px);
    width: min(88vw, 390px);
    min-height: 480px;
    scroll-snap-align: start;
  }

  .kanban-search input {
    min-height: 44px;
  }

  .col header h2 {
    font-size: 20px;
  }

  .lead {
    cursor: default;
  }

  .lead-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-actions button,
  .lead-actions a {
    min-height: 44px;
  }

  .panel > div[style*="overflow"] {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  table {
    min-width: 700px;
  }

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

  .filters > *,
  .filters button,
  .filters a {
    width: 100%;
  }

  .report-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .channel-report-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .channel-report-item > b {
    grid-column: 2;
    justify-self: start;
  }

  .report-item .value,
  .report-item .progress,
  .progress {
    grid-column: 2;
    text-align: left;
  }

  .repique-card {
    grid-template-columns: 1fr;
  }

  .repique-card .table-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .repique-card .table-actions > * {
    width: 100%;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    width: 100%;
    max-height: 92dvh;
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
  }

  .daily-greeting-modal,
  .password-choice-modal {
    align-items: center;
    padding: 16px;
  }

  .daily-greeting-modal .greeting-dialog {
    width: min(100%, 480px);
    padding: 28px 20px 20px;
    border-radius: 12px;
  }

  .password-choice-modal .password-choice-dialog {
    width: min(100%, 520px);
    padding: 28px 20px 20px;
    border-radius: 12px;
  }

  .password-choice-dialog h2 {
    font-size: 24px;
  }

  .password-choice-fields,
  .password-choice-actions {
    grid-template-columns: 1fr;
  }

  .greeting-dialog h2 {
    padding-inline: 24px;
    font-size: 24px;
  }

  .greeting-dialog p {
    font-size: 16px;
  }

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

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-actions > * {
    width: 100%;
  }

  .login {
    align-items: center;
    padding-inline: 14px;
  }

  .login-card {
    padding: 28px 20px;
  }

  .login-logo {
    width: min(250px, 86%);
    margin-bottom: 22px;
  }

  .login-footer {
    flex-wrap: wrap;
    gap: 6px;
    padding-inline: 8px;
    text-align: center;
  }

  .login-version {
    margin-top: -4px;
  }
}

@media (max-width: 479px) {
  .user-trigger {
    min-width: 48px;
    width: 48px;
    height: 48px;
    padding: 3px;
    justify-content: center;
  }

  .user-trigger > span:not(.profile-photo) {
    display: none;
  }

  .user-trigger .profile-photo {
    width: 38px;
    height: 38px;
  }

  .user-dropdown {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }

  .lead-head,
  .lead-meta {
    align-items: flex-start;
  }

  .lead-meta {
    flex-direction: column;
  }

  .lead-meta b {
    overflow-wrap: anywhere;
  }

  .greeting-close {
    top: 10px;
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
