/* Loading states for the whole system (loading-ui.js):
   - the start screen shown before the data arrives (desktop and phone)
   - page skeletons while a heavy page is being drawn
   - the thin bar at the top while a request the user made is running
   - a spinner on the button that started a request */

:root {
  --sk-base: #e8eef6;
  --sk-shine: #f6f9fd;
  --sk-line: #e7eefa;
}

/* ------------------------------------------------------------ shimmer */
.sk {
  background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-base) 35%, var(--sk-shine) 50%, var(--sk-base) 65%, var(--sk-base) 100%);
  background-size: 300% 100%;
  animation: sk-shine 1.4s ease-in-out infinite;
  border-radius: 8px;
  display: block;
}
@keyframes sk-shine {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; background: var(--sk-base); }
}
.sk-line { height: 12px; margin: 8px 0; }
.sk-line.is-title { height: 18px; margin-bottom: 14px; }
.sk-line.is-big { height: 28px; }
.sk-circle { border-radius: 50%; flex: none; }
.sk-pill { border-radius: 999px; height: 30px; }
.w20 { width: 20%; } .w30 { width: 30%; } .w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; }

/* ------------------------------------------------------------ page skeletons */
.sk-page { display: grid; gap: 16px; padding-bottom: 24px; }
.sk-page[aria-busy="true"] { cursor: progress; }
.sk-card { background: #fff; border: 1px solid var(--sk-line); border-radius: 14px; padding: 16px; }
.sk-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.sk-kpis .sk-card { min-height: 104px; }
.sk-grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.sk-toolbar { align-items: center; display: flex; gap: 10px; flex-wrap: wrap; }
.sk-toolbar .sk-pill { width: 110px; }
.sk-toolbar .sk-search { border-radius: 10px; flex: 1 1 240px; height: 40px; }
.sk-table { display: grid; }
.sk-row { align-items: center; border-bottom: 1px solid var(--sk-line); display: grid; gap: 14px; grid-template-columns: 1.2fr 1.6fr 1fr 1fr .8fr; padding: 14px 4px; }
.sk-row:last-child { border-bottom: 0; }
.sk-row .sk-line { margin: 0; }
.sk-row.is-head .sk-line { height: 10px; opacity: .7; }
.sk-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sk-tile { display: grid; gap: 10px; }
.sk-tile .sk-img { aspect-ratio: 4 / 3; border-radius: 10px; }
.sk-person { align-items: center; display: flex; gap: 12px; }
.sk-person > div { flex: 1; }
.sk-chart { border-radius: 10px; height: 220px; }
.sk-map { border-radius: 12px; height: 420px; }
.sk-hero { align-items: center; display: flex; gap: 16px; }
.sk-hero > div { flex: 1; }
.sk-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.sk-tabs .sk-pill { width: 120px; height: 38px; }
.sk-field { display: grid; gap: 6px; margin: 14px 0; }
.sk-field .sk-input { border-radius: 10px; height: 40px; }

/* WhatsApp page */
.sk-chat { border: 1px solid var(--sk-line); border-radius: 16px; display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 120px); min-height: 460px; overflow: hidden; background: #fff; }
.sk-chat-list { border-inline-end: 1px solid var(--sk-line); display: grid; align-content: start; gap: 4px; padding: 12px; }
.sk-chat-item { align-items: center; display: flex; gap: 10px; padding: 8px 4px; }
.sk-chat-item > div { flex: 1; }
.sk-chat-thread { background: #f4f1ec; display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.sk-bubble { border-radius: 12px; height: 46px; max-width: 60%; }
.sk-bubble.is-in { align-self: flex-start; width: 46%; }
.sk-bubble.is-out { align-self: flex-end; width: 38%; }
.sk-chat-head { align-items: center; display: flex; gap: 12px; margin: -18px -18px 6px; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--sk-line); }
.sk-chat-head > div { flex: 1; }

@media (max-width: 980px) {
  .sk-grid2 { grid-template-columns: 1fr; }
  .sk-chat { grid-template-columns: 1fr; }
  .sk-chat-thread { display: none; }
  .sk-row { grid-template-columns: 1.2fr 1.6fr 1fr; }
  .sk-row > :nth-child(n + 4) { display: none; }
}

/* An area loading inside a page (a log, a list read from the server). */
.sk-block { display: grid; gap: 4px; padding: 4px 0; }

/* ------------------------------------------------------------ start screen */
.boot-sk { background: #f4f7fb; inset: 0; position: fixed; z-index: 9000; transition: opacity .25s ease; }
.boot-sk.is-leaving { opacity: 0; pointer-events: none; }
.boot-desk { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100%; }
.boot-side { background: #fff; border-inline-end: 1px solid var(--sk-line); display: flex; flex-direction: column; gap: 6px; grid-column: 1; grid-row: 1; padding: 20px 16px; }
.boot-brand { align-items: center; display: flex; gap: 10px; margin-bottom: 18px; }
.boot-brand img { height: 42px; width: 42px; }
.boot-brand strong { color: #0b2b5e; display: block; font-size: 16px; }
.boot-brand small { color: #6b7d97; font-size: 12px; }
.boot-nav { align-items: center; display: flex; gap: 10px; padding: 8px 6px; }
.boot-nav .sk-circle { height: 20px; width: 20px; }
.boot-main { grid-column: 2; grid-row: 1; overflow: hidden; padding: 24px 28px; }
.boot-top { align-items: center; display: flex; justify-content: space-between; margin-bottom: 22px; }
.boot-top > div { width: 280px; }
.boot-status { align-items: center; color: #55677f; display: flex; font-size: 13.5px; font-weight: 600; gap: 8px; margin: 0; }
.boot-spin, .is-busy::after {
  animation: nq-spin .8s linear infinite;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  display: inline-block;
  height: 14px;
  width: 14px;
}
@keyframes nq-spin { to { transform: rotate(360deg); } }
.boot-phone { display: none; }

@media (max-width: 760px) {
  .boot-desk { display: none; }
  .boot-phone { display: flex; flex-direction: column; height: 100%; }
  .boot-phone-head { align-items: center; background: #0b2b5e; display: flex; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 16px; }
  .boot-phone-head img { background: #fff; border-radius: 12px; height: 40px; padding: 4px; width: 40px; }
  .boot-phone-head strong { color: #fff; display: block; font-size: 16px; }
  .boot-phone-head small { color: #b9cbe6; font-size: 12px; }
  .boot-phone-body { display: grid; flex: 1; gap: 12px; align-content: start; overflow: hidden; padding: 16px; }
  .boot-phone-body .sk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .boot-phone-tabs { background: #fff; border-top: 1px solid var(--sk-line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 10px 8px calc(env(safe-area-inset-bottom, 0px) + 10px); }
  .boot-phone-tabs span { display: grid; gap: 6px; justify-items: center; }
  .boot-phone-tabs .sk-circle { height: 22px; width: 22px; }
  .boot-phone-tabs .sk-line { height: 8px; margin: 0; width: 34px; }
}

/* ------------------------------------------------------------ top bar */
.nq-topbar { height: 3px; inset-inline: 0; pointer-events: none; position: fixed; top: 0; z-index: 9500; }
.nq-topbar i { background: linear-gradient(90deg, #1668e3, #38b2f8); border-radius: 0 0 3px 3px; box-shadow: 0 0 8px rgba(22, 104, 227, .55); display: block; height: 100%; margin-inline-start: auto; opacity: 0; transition: width .3s ease, opacity .3s ease; width: 0; }
.nq-topbar.is-on i { opacity: 1; }

/* ------------------------------------------------------------ busy buttons */
.is-busy { cursor: progress !important; opacity: .85; pointer-events: none; position: relative; }
.is-busy::after { content: ""; height: 13px; margin-inline-start: 8px; vertical-align: -2px; width: 13px; }
.icon-button.is-busy::after, .zid-icon-btn.is-busy::after, .wa-tool.is-busy::after { margin: 0; position: absolute; inset: 0; margin: auto; }
.icon-button.is-busy > *, .zid-icon-btn.is-busy > * { opacity: 0; }

/* Phone screens (mobile-shell.js) */
.sk-phone { gap: 10px; padding: 14px; }
.sk-phone .sk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sk-phone .sk-kpis .sk-card { min-height: 84px; }
.sk-phone .sk-card { border-radius: 16px; padding: 14px; }
