/* High-signal Web Interface Guidelines fixes layered over the production theme. */
html {
  -webkit-text-size-adjust: 100%;
}

html.workspace-theme-dark {
  color-scheme: dark;
}

html.workspace-theme-light,
body.carrot-auth-active {
  color-scheme: light;
}

body {
  overflow-x: hidden;
}

button,
a,
input,
select,
textarea,
summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(240, 138, 81, .18);
}

.carrot-login-page :is(button, a, input):focus-visible,
.workspace-console :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid #f08a51;
  outline-offset: 2px;
}

.carrot-login-card-head h2,
.workspace-page-heading strong,
.dashboard-welcome h1,
.gap-page-head h2 {
  text-wrap: balance;
}

.dashboard-metric strong,
.dashboard-summary-item strong,
.dashboard-recent-list small,
table :is(th, td),
.pill {
  font-variant-numeric: tabular-nums;
}

body.workspace-active .modal-mask,
.notice-overlay {
  padding-top: max(18px, env(safe-area-inset-top));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  padding-left: max(18px, env(safe-area-inset-left));
  overscroll-behavior: contain;
}

body.workspace-active .modal,
.notice-popup,
.notice-detail,
.table-wrap,
.questionnaire-embed-shell {
  overscroll-behavior: contain;
}

.notice-close {
  transition: background-color .2s ease, color .2s ease;
}

.notice-card {
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.notice-detail-close {
  transition: background-color .2s ease, color .2s ease;
}

.gallery-card {
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.mode-tab {
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.workspace-sidebar-tools button {
  min-height: 44px;
  padding: 4px 2px;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

.workspace-sidebar-tools button span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Keep the dashboard announcement mark bounded even when a legacy theme
   applies broad sizing rules to nested SVG elements. */
.workspace-console .dashboard-announcement-head > div > span {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.workspace-console .dashboard-announcement-head > div > span > .nav-icon,
.workspace-console .dashboard-announcement-head > div > span > svg {
  display: block;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex: 0 0 20px;
}

/* On narrow screens the announcement should follow its content rather than
   inherit the taller consumption panel's grid track. */
@media (max-width: 1100px) {
  .workspace-console .dashboard-announcement-card {
    min-height: 0 !important;
    height: auto;
  }

  .workspace-console .dashboard-announcement-content {
    flex: 0 1 auto;
    min-height: 0;
  }

  .workspace-console .dashboard-announcement-empty {
    flex: 0 1 auto;
    min-height: 132px;
  }
}

@media (max-width: 900px) {
  .workspace-console .sidebar {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .workspace-console:not(.nav-open) .sidebar {
    visibility: hidden;
    pointer-events: none;
  }

  .workspace-console .topbar {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .workspace-console .site-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .carrot-login-page {
    min-height: 100svh;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .notice-popup,
  .notice-detail {
    max-height: calc(100dvh - max(36px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  }
}

@media (prefers-reduced-motion: reduce) {
  .questionnaire-embed-spinner {
    animation: none;
  }
}
