/**
 * PWA install wall, notification wall, and the installed-app sign-in form.
 * Desktop layout is unchanged. The app form is shown only when the
 * document is in the installed shell on the Login route.
 */

#siqPwaGate {
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(640px 380px at 50% -8%, rgba(110, 24, 56, .12), transparent 58%),
    #ffffff;
  color: #111827;
  font-family: var(--ax-font-sans, "Montserrat", ui-sans-serif, system-ui, sans-serif);
}

html[data-siq-gate="install"] #siqPwaNotify { display: none !important; }
html[data-siq-gate="notify"] #siqPwaInstall { display: none !important; }

#siqPwaGate [hidden] {
  display: none !important;
}

.siq-pwa-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.siq-pwa-btn--secondary {
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, .1);
  color: #111827;
}

.siq-pwa-panels {
  margin-top: 8px;
  text-align: left;
}

.siq-pwa-install-panel {
  display: none;
  padding: 16px;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, .08);
}

.siq-pwa-install-panel.is-active {
  display: block;
}

.siq-pwa-panel-lead {
  margin: 0 0 12px !important;
  font-size: 14px !important;
  color: #374151 !important;
  text-align: left;
}

.siq-pwa-icon {
  display: inline-block;
  font-weight: 700;
  opacity: .9;
}

.siq-pwa-card {
  width: min(420px, 100%);
  text-align: center;
}

.siq-pwa-mark {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin: 0 auto 20px;
  display: block;
  object-fit: contain;
}

.siq-pwa-card h1 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #111827;
}

.siq-pwa-card p {
  margin: 0 0 22px;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.5;
}

.siq-pwa-btn {
  appearance: none;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #6e1838;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.siq-pwa-btn:active { transform: translateY(1px); }

.siq-pwa-note {
  margin-top: 16px !important;
  font-size: 13px !important;
}

.siq-pwa-steps {
  margin: 8px 0 0;
  padding: 0 0 0 1.2em;
  text-align: left;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.55;
}

.siq-pwa-steps li + li { margin-top: 8px; }

.siq-pwa-steps strong {
  color: #111827;
  font-weight: 700;
}

/* Installed app sign-in. Hidden until the shell attribute is set. */
.siq-app-login {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background: #ffffff;
  z-index: 2;
  box-sizing: border-box;
  overflow: auto;
  font-family: var(--ax-font-sans, "Montserrat", ui-sans-serif, system-ui, sans-serif);
}

html[data-siq-shell="app"][data-ax-route="Login"]:not([data-siq-gate]) body {
  overflow: hidden;
  background: #fff;
}

.siq-app-login__brand {
  flex: 0 0 auto;
  text-align: center;
  padding: clamp(32px, 12vh, 72px) 24px 24px;
  background: #fff;
}

.siq-app-login__brand img {
  height: 16px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.siq-app-login__form {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 8px 24px max(28px, env(safe-area-inset-bottom));
  box-shadow: none;
  box-sizing: border-box;
}

.siq-app-login__form h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #111;
  text-align: center;
}

.siq-app-login__lead {
  margin: 0 0 22px;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
}

.siq-app-login .ax-input {
  min-height: 52px;
  font-size: 16px;
  border-radius: 14px;
}

.siq-app-login .ax-btn--lg {
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

/* ─── Installed app shell (header + tab bar) ─── */
html[data-siq-shell="app"] {
  touch-action: manipulation;
  --siq-app-header-h: 56px;
  --siq-app-content-gap: 24px;
  --siq-app-tabbar-h: 68px;
}

html[data-siq-shell="app"] body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html[data-siq-shell="app"] input,
html[data-siq-shell="app"] textarea,
html[data-siq-shell="app"] select,
html[data-siq-shell="app"] [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

html[data-siq-shell="app"] .ax-sidebar,
html[data-siq-shell="app"] .siq-mobile-nav,
html[data-siq-shell="app"] .ax-sidebar__foot,
html[data-siq-shell="app"] .ax-customizer {
  display: none !important;
}

html[data-siq-shell="app"] .ax-layout {
  display: block;
  min-height: 100dvh;
}

html[data-siq-shell="app"] .ax-shell {
  margin: 0;
  min-height: 100dvh;
}

html[data-siq-shell="app"] .ax-main {
  box-sizing: border-box;
  padding-top: calc(var(--siq-app-header-h) + var(--siq-app-content-gap) + env(safe-area-inset-top, 0px)) !important;
  padding-bottom: calc(var(--siq-app-tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
  padding-block-start: calc(var(--siq-app-header-h) + var(--siq-app-content-gap) + env(safe-area-inset-top, 0px)) !important;
  padding-block-end: calc(var(--siq-app-tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
  padding-inline: 16px !important;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

html[data-siq-shell="app"] .ax-shell {
  padding-top: 0 !important;
}

html[data-siq-shell="app"] .ax-main > *:last-child {
  margin-bottom: 12px;
}

.siq-app-chrome__header {
  display: none;
}

html[data-siq-shell="app"] .siq-app-chrome__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  box-sizing: border-box;
  min-height: calc(var(--siq-app-header-h) + env(safe-area-inset-top, 0px));
  padding:
    env(safe-area-inset-top, 0px)
    16px
    10px
    16px;
  background: var(--siq-surface, #fff);
  border-bottom: 1px solid var(--siq-line, rgba(0, 0, 0, .08));
}

.siq-app-chrome__logo {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 32px;
  padding: 4px 0;
  text-decoration: none;
}

.siq-app-chrome__logo img {
  height: 16px;
  width: auto;
  display: block;
  vertical-align: middle;
}

.siq-app-chrome__actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 2px;
  flex-shrink: 0;
}

.siq-app-notify-btn,
.siq-app-profile-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #374151;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  text-decoration: none;
  position: relative;
  cursor: pointer;
}

.siq-app-notify-btn svg,
.siq-app-profile-btn svg {
  width: 22px;
  height: 22px;
}

.siq-app-profile-btn.is-active {
  color: var(--siq-accent, #0d7377);
  background: rgba(13, 115, 119, .08);
}

.siq-app-notify-btn__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #6e1838;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

html[data-siq-app-sheet="open"] body {
  overflow: hidden;
}

.siq-app-sheet-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--siq-app-header-h) + env(safe-area-inset-top, 0px));
  bottom: 0;
  z-index: 1245;
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(2px);
}

.siq-app-sheet-backdrop[hidden] {
  display: none !important;
}

.siq-app-sheet {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--siq-app-header-h) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--siq-app-tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 1250;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
}

.siq-app-sheet[hidden] {
  display: none !important;
}

.siq-app-sheet__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.siq-app-sheet__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #111827;
}

.siq-app-sheet__close {
  appearance: none;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #374151;
}

.siq-app-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.siq-app-sheet__body--menu {
  padding: 8px 0 16px;
}

.siq-app-sheet__menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.siq-app-sheet__menu-item:active {
  background: #f9fafb;
}

.siq-app-sheet__menu-item--danger {
  color: #b91c1c;
}

.siq-app-notify-panel__empty {
  margin: 0;
  padding: 32px 20px;
  text-align: center;
  font-size: 15px;
  color: #6b7280;
}

.siq-app-notify-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 16px;
}

.siq-app-notify-list__link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  color: #111827;
  cursor: pointer;
  font: inherit;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.siq-app-notify-list__link.is-unread {
  background: linear-gradient(90deg, rgba(110, 24, 56, .06), transparent 70%);
}

.siq-app-notify-list__link:active {
  background: #f3f4f6;
}

.siq-app-notify-list__num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #6e1838;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 26px;
  text-align: center;
}

.siq-app-notify-list__num.is-read {
  background: #e5e7eb;
  color: #9ca3af;
  font-weight: 700;
}

.siq-app-notify-list__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.siq-app-notify-list__title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.siq-app-notify-list__text {
  font-size: 13px;
  line-height: 1.4;
  color: #4b5563;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.siq-app-notify-list__meta {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: .02em;
}

.siq-app-chrome__tabbar {
  display: none;
}

html[data-siq-shell="app"] .siq-app-chrome__tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  box-sizing: border-box;
  min-height: calc(var(--siq-app-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding:
    4px 12px
    calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--siq-surface, #fff);
  border-top: 1px solid var(--siq-line, rgba(0, 0, 0, .08));
  align-items: end;
  column-gap: 4px;
}

.siq-app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-height: 46px;
  text-decoration: none;
  color: var(--siq-muted, #6b7280);
  font-size: 11px;
  font-weight: 600;
  position: relative;
  padding-bottom: 2px;
}

.siq-app-tab svg {
  width: 22px;
  height: 22px;
}

.siq-app-tab.is-active {
  color: var(--siq-accent, #0d7377);
}

.siq-app-tab--fab {
  align-self: center;
  justify-content: center;
  min-height: auto;
  padding-bottom: 0;
  margin-top: -18px;
}

.siq-app-tab__fab {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(145deg, #6e1838, #4a0d2c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(110, 24, 56, .35);
}

.siq-app-tab__fab svg {
  width: 26px;
  height: 26px;
}

.siq-app-tab__fab-label {
  font-size: 10px;
  font-weight: 700;
  color: #6e1838;
  margin-top: 2px;
}

.siq-app-tab--fab.is-active .siq-app-tab__fab-label {
  color: #6e1838;
}

.siq-app-tab__badge {
  position: absolute;
  top: 2px;
  right: 14%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--siq-accent, #0d7377);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

html[data-siq-shell="app"] .siq-page-head {
  scroll-margin-top: calc(var(--siq-app-header-h) + var(--siq-app-content-gap) + env(safe-area-inset-top, 0px) + 8px);
}

/* Dashboard: tighter gap between Welcome and Case Overview */
html[data-siq-shell="app"] .siq-page-head + .siq-dash-crm {
  margin-top: 0;
}

html[data-siq-shell="app"] .siq-page-head + .siq-dash-crm,
html[data-siq-shell="app"] .siq-page-head + .siq-dash-feed {
  margin-top: 0;
}

html[data-siq-shell="app"] .siq-page-head:has(+ .siq-dash-crm) {
  margin-bottom: 10px;
}

html[data-siq-shell="app"] .siq-page-head--welcome {
  padding-top: 8px;
}

/* Support tickets — card list instead of DataTable (PWA + narrow viewport) */
@media (max-width: 767.98px) {
  .siq-support-list .ax-card__header,
  .siq-support-list .siq-customer-list__toolbar,
  .siq-support-list__table {
    display: none !important;
  }

  .siq-support-list.ax-card {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .siq-support-list .ax-card__body {
    padding: 0;
  }
}

.siq-support-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.siq-support-cards__empty {
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  color: var(--siq-muted, #6b7280);
  font-size: 15px;
}

.siq-support-card {
  background: var(--siq-surface, #fff);
  border: 1px solid var(--siq-line, rgba(0, 0, 0, .08));
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, .04);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.siq-support-card:active {
  transform: scale(0.995);
}

.siq-support-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.siq-support-card__id .siq-sup-id {
  font-weight: 700;
  font-size: 13px;
}

.siq-support-card__subject {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--siq-ink, #111827);
}

.siq-support-card__subject.is-unread {
  font-weight: 800;
}

.siq-support-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 0;
}

.siq-support-card__meta > div {
  min-width: 0;
}

.siq-support-card__meta dt {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--siq-muted, #9ca3af);
}

.siq-support-card__meta dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--siq-ink, #374151);
}

.siq-support-card__meta > div:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 767.98px) {
  .siq-license-list .ax-card__header,
  .siq-license-list .siq-customer-list__toolbar,
  .siq-license-list__table,
  .siq-doc-list .ax-card__header,
  .siq-doc-list .siq-customer-list__toolbar,
  .siq-doc-list__table {
    display: none !important;
  }

  .siq-license-list.ax-card,
  .siq-doc-list.ax-card {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .siq-license-list .ax-card__body,
  .siq-doc-list .ax-card__body {
    padding: 0;
  }
}

.siq-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.siq-mobile-card {
  background: var(--siq-surface, #fff);
  border: 1px solid var(--siq-line, rgba(0, 0, 0, .08));
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, .04);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.siq-mobile-card:active {
  transform: scale(0.995);
}

.siq-mobile-card__title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--siq-ink, #111827);
}

.siq-mobile-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 0;
}

.siq-mobile-card__meta dt {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--siq-muted, #9ca3af);
}

.siq-mobile-card__meta dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--siq-ink, #374151);
}

.siq-mobile-card__meta > div:last-child {
  grid-column: 1 / -1;
}
