html,
body {
  height: 100%;
}

:root {
  --bg: var(--theme-bg);
  --bg-secondary: var(--theme-bg-secondary);
  --panel: var(--theme-surface);
  --panel-strong: var(--theme-surface-strong);
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --accent: var(--theme-accent);
  --accent-strong: var(--theme-accent-strong);
  --accent-rgb: var(--theme-accent-rgb);
  --accent-soft: var(--theme-accent-soft);
  --border: var(--theme-border);
  --danger: var(--theme-danger);
  --danger-rgb: var(--theme-danger-rgb);
  --success: var(--theme-success);
  --success-rgb: var(--theme-success-rgb);
  --shadow: var(--theme-shadow);
  --field-bg: var(--theme-input-bg);
  --surface-tint: var(--theme-surface-tint);
  --overlay: var(--theme-overlay);
  --button-bg: var(--theme-button-bg);
  --button-text: var(--theme-button-text);
  --button-bg-hover: var(--theme-button-bg-hover);
  --focus-ring: var(--theme-focus-ring);
  --chat-bubble-bg: var(--theme-chat-bubble-bg);
  --chat-bubble-border: var(--theme-chat-bubble-border);
  --chat-own-bg: var(--theme-chat-own-bg);
  --chat-own-border: var(--theme-chat-own-border);
  --chat-checks: var(--theme-chat-checks);
  --status-new-bg: var(--theme-status-new-bg);
  --status-new-text: var(--theme-status-new-text);
  --status-in-progress-bg: var(--theme-status-in-progress-bg);
  --status-in-progress-text: var(--theme-status-in-progress-text);
  --status-done-bg: var(--theme-status-done-bg);
  --status-done-text: var(--theme-status-done-text);
  --status-rejected-bg: var(--theme-status-rejected-bg);
  --status-rejected-text: var(--theme-status-rejected-text);
  --request-sent-text-color: #123728;
  --request-sent-close-color: #184432;
  --request-sent-shadow: 0 10px 22px rgb(15 24 37 / 0.12);
}

:root[data-theme="dark"] {
  --request-sent-text-color: #f4fff9;
  --request-sent-close-color: #e4fff0;
  --request-sent-shadow: 0 12px 24px rgb(0 0 0 / 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
}

body.app-booting .page-shell,
body.app-booting .iphone-frame,
body.app-booting .overlay {
  opacity: 0;
  visibility: hidden;
}

body.app-ready .page-shell,
body.app-ready .iphone-frame,
body.app-ready .overlay {
  transition: opacity 180ms ease, transform 180ms ease;
}

html[data-page-transition="pending"] .page-shell,
html[data-page-transition="pending"] .iphone-frame,
html[data-page-transition="pending"] .overlay,
html[data-page-transition="pending"] .request-sent-toast {
  opacity: 0;
  visibility: hidden;
}

body.mobile-preview {
  --app-height: 100dvh;
  --keyboard-inset: 0px;
  --mobile-header-offset: 96px;
  --device-screen-width: 375px;
  --device-screen-height: 812px;
  --device-frame-padding: 7px;
  --device-safe-top: 34px;
  --device-shell-padding: 0;
  --device-panel-radius: 18px;
  --device-panel-padding: 0;
  --device-control-height: 40px;
  --device-control-font: 0.9rem;
  --device-field-font: 0.92rem;
  --device-notch-width: 124px;
  --device-notch-height: 24px;
  --device-frame-radius: 34px;
  --device-screen-radius: 26px;
  --device-preview-scale: 0.88;
  background: var(--bg);
  min-height: var(--app-height);
  height: var(--app-height);
  max-height: var(--app-height);
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  touch-action: manipulation;
}

body.mobile-preview[data-device="android-tall"] {
  --device-screen-width: 360px;
  --device-screen-height: 800px;
  --device-frame-padding: 6px;
  --device-safe-top: 24px;
  --device-control-height: 38px;
  --device-control-font: 0.88rem;
  --device-field-font: 0.9rem;
  --device-notch-width: 92px;
  --device-notch-height: 16px;
  --device-frame-radius: 30px;
  --device-screen-radius: 24px;
  --device-preview-scale: 0.9;
}

body.mobile-preview[data-device="android-compact"] {
  --device-screen-width: 360px;
  --device-screen-height: 640px;
  --device-frame-padding: 6px;
  --device-safe-top: 20px;
  --device-control-height: 36px;
  --device-control-font: 0.84rem;
  --device-field-font: 0.86rem;
  --device-notch-width: 82px;
  --device-notch-height: 14px;
  --device-frame-radius: 28px;
  --device-screen-radius: 22px;
  --device-preview-scale: 0.96;
}

body.mobile-preview.overlay-open {
  overflow: hidden;
}

body.mobile-preview.overlay-open .page-shell {
  pointer-events: none;
}

body.mobile-preview.overlay-open .content,
body.mobile-preview.overlay-open .requests-list,
body.mobile-preview.overlay-open .chat-messages {
  overscroll-behavior: contain;
}

body.transition-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

textarea {
  resize: none;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  line-height: 1.1;
  font-weight: 700;
}

.hero-copy {
  max-width: 560px;
  color: var(--muted);
  margin: 10px 0 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  margin: 10px 0 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.theme-toggle,
.secondary-button,
.menu-button,
.subtype-button,
.submit-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 32, 56, 0.04);
}

.page-shell,
.hero,
.panel,
.theme-toggle,
.secondary-button,
.menu-button,
.subtype-button,
.submit-button,
.role-badge,
input,
textarea,
select,
.request-summary-card,
.chat-message,
.modal-shell,
.request-status-badge,
.empty-state-card,
.instruction-box,
.feedback,
.alert {
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    color 220ms ease,
    box-shadow 220ms ease,
    opacity 220ms ease;
}

.theme-toggle:hover,
.secondary-button:hover,
.menu-button:hover,
.subtype-button:hover,
.submit-button:hover {
  border-color: var(--theme-accent-border-weak);
  box-shadow: var(--theme-accent-glow);
}

.theme-toggle {
  padding: 10px 14px;
}

.secondary-button {
  padding: 10px 14px;
  background: var(--surface-tint);
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-radius: 999px;
}

.admin-link-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

.control-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  line-height: 0;
}

.control-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}

.layout,
.sidebar,
.content,
.panel {
  transition: opacity 180ms ease, transform 180ms ease, gap 180ms ease;
}

.layout.step-transitioning #menuPanel,
.layout.step-transitioning .content {
  opacity: 0.86;
  transform: translateY(4px);
}

body.desktop-menu-only .layout,
.layout.desktop-menu-only {
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
}

body.desktop-menu-only .content,
.layout.desktop-menu-only .content {
  display: none;
}

body.desktop-menu-only .sidebar,
.layout.desktop-menu-only .sidebar {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 22px;
  min-height: auto;
}

body.desktop-menu-only .sidebar h2,
.layout.desktop-menu-only .sidebar h2 {
  margin-bottom: 16px;
}

body.desktop-menu-only .menu-grid,
.layout.desktop-menu-only .menu-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
}

body.desktop-menu-only .menu-button,
.layout.desktop-menu-only .menu-button {
  min-height: 58px;
  justify-content: flex-start;
  text-align: left;
}

body.onboarding-screen .layout {
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
}

body.onboarding-screen .content {
  display: grid;
}

body.onboarding-screen .sidebar {
  padding: 28px;
  border-radius: 24px;
}

body.onboarding-screen .menu-grid {
  gap: 14px;
}

body.onboarding-screen .menu-button {
  min-height: 60px;
  justify-content: center;
  text-align: center;
  font-size: 1rem;
  background: rgb(var(--accent-rgb) / 0.12);
  border-color: var(--theme-accent-border-weak);
  box-shadow: 0 12px 24px rgb(var(--accent-rgb) / 0.1);
}

body.onboarding-screen .menu-button.active,
body.onboarding-screen .menu-button:hover {
  background: rgb(var(--accent-rgb) / 0.18);
  border-color: rgb(var(--accent-rgb) / 0.34);
}

.sidebar,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.menu-grid,
.subtype-list,
.request-form {
  display: grid;
  gap: 12px;
}

.menu-button,
.subtype-button {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
}

.hero-nav {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  backdrop-filter: blur(10px);
}

.overlay.hidden {
  display: none;
}

.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.transition-boot-overlay {
  z-index: 159;
}

html[data-page-transition="pending"] .transition-boot-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

:root[data-theme="dark"] .transition-overlay {
  background: var(--bg);
}

.transition-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.transition-overlay.is-leaving {
  opacity: 0;
}

.transition-loader {
  position: relative;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
}

.transition-cross {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-block;
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: transitionCrossSpin 1s linear infinite;
}

.transition-cross::before,
.transition-cross::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.transition-cross::before {
  top: 2px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 13px solid var(--accent-strong);
  filter: drop-shadow(0 0 6px rgb(var(--accent-rgb) / 0.18));
}

.transition-cross::after {
  bottom: 2px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 13px solid var(--accent-strong);
  filter: drop-shadow(0 0 6px rgb(var(--accent-rgb) / 0.18));
}

.transition-cross {
  overflow: hidden;
}

.transition-cross span,
.transition-cross::marker {
  display: none;
}

.transition-cross::before,
.transition-cross::after {
  will-change: transform;
}

.transition-cross:after,
.transition-cross:before {
  opacity: 0.95;
}

.transition-cross {
  border-top: 2px solid var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  border-radius: 8px;
}

@keyframes transitionCrossSpin {
  from {
    transform: translateZ(0) rotate(0deg);
  }

  to {
    transform: translateZ(0) rotate(360deg);
  }
}

.modal-shell {
  width: min(720px, 100%);
  max-height: min(84vh, 920px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.06rem;
}

.modal-header .icon-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 0.92rem;
  box-shadow: none;
}

.modal-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.requests-list,
.chat-messages {
  overflow: auto;
  padding: 18px;
}

.requests-list {
  display: grid;
  gap: 12px;
}

.request-summary-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-secondary);
  padding: 14px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.request-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.request-summary-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.request-summary-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.request-summary-assignee {
  margin-top: 6px;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 600;
}

.qr-secret-row {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.qr-secret-row code {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  word-break: break-all;
}

.qr-secret-code {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.qr-secret-code:hover,
.qr-secret-code:focus-visible {
  border-color: var(--theme-accent-border-weak);
  box-shadow: var(--focus-ring);
  outline: none;
}

.request-status-badge {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  border: 0;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  appearance: none;
}

button.request-status-badge {
  cursor: pointer;
}

.request-status-badge.status-new {
  background: var(--status-new-bg);
  color: var(--status-new-text);
}

.request-status-badge.status-in_progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress-text);
}

.request-status-badge.status-done {
  background: var(--status-done-bg);
  color: var(--status-done-text);
}

.request-status-badge.status-rejected {
  background: var(--status-rejected-bg);
  color: var(--status-rejected-text);
}

.request-summary-message {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.45;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  align-self: stretch;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.chat-shell {
  width: min(760px, 100%);
  height: min(84vh, 860px);
  max-height: min(84vh, 860px);
}

.chat-messages {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 340px;
  align-content: end;
  overflow-y: auto;
  overflow-x: hidden;
}

.chat-empty {
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
}

.chat-message {
  width: fit-content;
  max-width: 78%;
  min-width: min(220px, 78%);
  min-height: 56px;
  display: grid;
  gap: 4px;
  padding: 8px 11px 6px;
  border-radius: 18px 18px 18px 10px;
  background: var(--chat-bubble-bg);
  border: 1px solid var(--chat-bubble-border);
  box-shadow: var(--theme-card-shadow);
  align-content: space-between;
}

body:not(.mobile-preview) .chat-message {
  width: min(360px, 78%);
  max-width: min(360px, 78%);
  min-width: min(360px, 78%);
}

.chat-message.own {
  margin-left: auto;
  background: var(--chat-own-bg);
  border-radius: 18px 18px 10px 18px;
  border-color: var(--chat-own-border);
}

.chat-message-text {
  white-space: pre-wrap;
  line-height: 1.32;
  font-size: 0.88rem;
  word-break: break-word;
  text-align: left;
}

.chat-message-meta {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.chat-message-time {
  color: inherit;
  font-size: inherit;
}

.chat-message-checks {
  letter-spacing: -0.08em;
  font-weight: 700;
  color: var(--chat-checks);
}

.chat-message-checks.seen {
  color: var(--accent-strong);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--field-bg);
  color: var(--text);
  padding: 0 14px;
  line-height: 46px;
}

.chat-form input::placeholder {
  color: var(--muted);
  font-size: 0.96rem;
}

.chat-form .submit-button {
  min-width: 112px;
  min-height: 46px;
  border-radius: 18px;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--theme-accent-border-strong);
  box-shadow: var(--focus-ring);
}

.menu-button.active,
.subtype-button.active {
  background: var(--accent-soft);
  border-color: rgb(var(--accent-rgb) / 0.28);
}

.submit-button {
  background: var(--button-bg);
  border-color: transparent;
  color: var(--button-text);
}

.submit-button:hover {
  background: var(--button-bg-hover);
  border-color: transparent;
}

.subtype-button span,
.panel-header p {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

.panel-nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-nav-row.desktop-back-only {
  margin-bottom: 10px;
}

.panel-nav-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-nav-copy p {
  margin: 0;
}

.desktop-back-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 14px;
}

.content {
  display: grid;
  gap: 20px;
}

.panel-header h2,
.sidebar h2 {
  margin: 0 0 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 600;
}

.mobile-choice-group {
  display: grid;
  gap: 8px;
}

.mobile-choice-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-choice-button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  font-weight: 600;
}

.mobile-choice-button.active {
  background: var(--accent-soft);
  border-color: rgb(var(--accent-rgb) / 0.28);
  color: var(--accent-strong);
}

.date-stack {
  display: grid;
  gap: 8px;
}

.date-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.field-hint-link {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  caret-color: var(--accent-strong);
  padding: 12px 14px;
  box-shadow: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--theme-accent-border-strong);
  box-shadow: var(--focus-ring);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-strong) 50%),
    linear-gradient(135deg, var(--accent-strong) 50%, transparent 50%);
  background-position:
    calc(100% - 21px) calc(50% - 2px),
    calc(100% - 15px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.submit-button {
  padding: 14px 18px;
  font-weight: 700;
}

.feedback,
.alert,
.instruction-box {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.feedback.success {
  background: rgba(46, 167, 114, 0.12);
  color: var(--success);
}

.feedback.error,
.alert {
  background: rgba(218, 82, 82, 0.12);
  color: var(--danger);
}

.instruction-box {
  background: var(--accent-soft);
  color: var(--text);
}

.empty-state-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.empty-state-card strong,
.empty-state-card p {
  margin: 0;
}

.empty-state-card p {
  color: var(--muted);
}

.software-library {
  display: grid;
  gap: 12px;
}

.software-library-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.software-file-card {
  gap: 10px;
}

.software-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.software-file-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
}

.software-file-copy strong {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.software-file-uploader {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 600;
}

.software-download-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.request-sent-toast {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  width: min(332px, calc(100vw - 30px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.request-sent-toast.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.request-sent-toast.is-leaving {
  opacity: 0;
}

.request-sent-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(46, 167, 114, 0.34) !important;
  border: 1px solid rgb(var(--success-rgb) / 0.34) !important;
  background-color: rgba(46, 167, 114, 0.18) !important;
  background-color: rgb(var(--success-rgb) / 0.18) !important;
  background-image: linear-gradient(180deg, rgba(46, 167, 114, 0.18), rgba(46, 167, 114, 0.14)) !important;
  background-image: linear-gradient(180deg, rgb(var(--success-rgb) / 0.18), rgb(var(--success-rgb) / 0.14)) !important;
  box-shadow: var(--request-sent-shadow) !important;
  transform: translate3d(0, calc(-18px + var(--request-sent-drag-offset, 0px)), 0);
  opacity: 1;
  transition: transform 220ms ease, opacity 220ms ease;
  touch-action: pan-x;
  will-change: transform, opacity;
  overflow: hidden;
  backdrop-filter: blur(12px);
  isolation: isolate;
}

.request-sent-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.request-sent-toast.is-active .request-sent-shell {
  transform: translate3d(0, var(--request-sent-drag-offset, 0px), 0);
}

.request-sent-shell.is-dragging {
  transition: none;
}

.request-sent-close {
  position: static;
  flex: 0 0 auto;
  align-self: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  color: var(--request-sent-close-color);
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.request-sent-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  align-self: center;
  min-height: 30px;
  padding: 0 0 0 4px;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.12;
  text-align: left;
  color: var(--request-sent-text-color);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.qr-code {
  display: block;
  width: min(220px, 100%);
  margin: 12px auto;
  border-radius: 12px;
  background: var(--theme-modal-bg);
  padding: 8px;
}

.hidden {
  display: none;
}

.mobile-stepbar {
  display: none;
}

body.mobile-preview .page-shell {
  max-width: none;
  min-height: var(--app-height);
  height: var(--app-height);
  max-height: var(--app-height);
  padding:
    0
    max(12px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.mobile-preview.mobile-form-scroll .page-shell {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scroll-padding-top: 18px;
  scroll-padding-bottom: calc(24px + var(--keyboard-inset));
}

body.mobile-preview .layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

body.mobile-preview.mobile-form-scroll .layout {
  flex: 0 0 auto;
  min-height: max-content;
  overflow: visible;
}

body.mobile-preview .hero {
  position: relative;
  flex-direction: column;
  margin-bottom: 0;
  padding: calc(var(--device-safe-top) + 4px) 12px 8px;
  gap: 8px;
  background: var(--bg);
  z-index: 2;
}

body.mobile-preview .hero h1 {
  font-size: 1.05rem;
  line-height: 1.2;
  max-width: calc(100% - 52px);
  color: var(--text);
}

body.mobile-preview .hero-copy {
  font-size: 0.82rem;
  margin: 0;
  color: var(--muted);
}

body.mobile-preview .hero-actions {
  position: absolute;
  top: calc(var(--device-safe-top) + 2px);
  right: 12px;
  width: auto;
  gap: 8px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

body.mobile-preview .hero-actions #adminLink {
  flex: 0 0 auto;
  width: 34px;
  max-width: 34px;
  min-width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  font-size: 0.98rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-preview .hero-actions #adminLink.hidden,
body.mobile-preview .hero-actions #adminLink[hidden],
body.mobile-preview.onboarding-screen .hero-actions #adminLink {
  display: none !important;
}

body.mobile-preview .hero-actions .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
}

body.mobile-preview .hero-actions .icon-button .theme-icon,
body.mobile-preview .hero-actions .admin-link-button .admin-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.mobile-preview .mobile-stepbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px 8px;
  position: relative;
  z-index: 2;
  background: var(--bg);
}

body.mobile-preview .mobile-step-title {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

body.mobile-preview .mobile-step-title:empty {
  display: none;
}

body.mobile-preview.form-entry-active .hero,
body.mobile-preview.form-entry-active .mobile-stepbar {
  display: none;
}

body.mobile-preview.form-entry-active .layout {
  gap: 0;
}

body.mobile-preview .theme-toggle,
body.mobile-preview .secondary-button,
body.mobile-preview .menu-button,
body.mobile-preview .subtype-button,
body.mobile-preview .submit-button {
  min-height: var(--device-control-height);
  font-size: var(--device-control-font);
  touch-action: manipulation;
}

body.mobile-preview .hero,
body.mobile-preview .mobile-stepbar,
body.mobile-preview .layout,
body.mobile-preview .menu-grid,
body.mobile-preview .subtype-list,
body.mobile-preview .overlay,
body.mobile-preview .modal-shell,
body.mobile-preview .requests-list,
body.mobile-preview .chat-messages,
body.mobile-preview .chat-shell,
body.mobile-preview .request-sent-toast {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

body.mobile-preview.mobile-form-scroll .hero,
body.mobile-preview.mobile-form-scroll .mobile-stepbar,
body.mobile-preview.mobile-form-scroll .layout,
body.mobile-preview.mobile-form-scroll .content,
body.mobile-preview.mobile-form-scroll .content > .panel,
body.mobile-preview.mobile-form-scroll .request-form,
body.mobile-preview.mobile-form-scroll .field,
body.mobile-preview.mobile-form-scroll .field input,
body.mobile-preview.mobile-form-scroll .field textarea,
body.mobile-preview.mobile-form-scroll .field select {
  will-change: auto;
  transform: none;
  backface-visibility: visible;
}

body.mobile-preview .theme-toggle,
body.mobile-preview .secondary-button,
body.mobile-preview .menu-button,
body.mobile-preview .subtype-button {
  background: var(--surface-tint);
  color: var(--text);
  border-color: var(--border);
}

body.mobile-preview .sidebar,
body.mobile-preview .panel {
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.mobile-preview .sidebar {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  padding: 0 12px 12px;
}

body.mobile-preview.onboarding-screen .sidebar {
  padding: 0 12px 12px;
}

body.mobile-preview.onboarding-screen .menu-button {
  flex: 0 0 auto;
  min-height: 56px;
}

body.mobile-preview .sidebar h2 {
  display: none;
}

body.mobile-preview .content {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  padding:
    0
    max(12px, env(safe-area-inset-right))
    calc(max(16px, env(safe-area-inset-bottom)) + var(--keyboard-inset))
    max(12px, env(safe-area-inset-left));
  scroll-padding-top: calc(var(--mobile-header-offset) + 28px);
  scroll-padding-bottom: calc(28px + var(--keyboard-inset));
  scroll-behavior: auto;
}

body.mobile-preview.mobile-form-scroll .content {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
  scroll-padding-top: 18px;
  scroll-padding-bottom: calc(24px + var(--keyboard-inset));
}

body.mobile-preview .content > .panel {
  flex: 1 1 auto;
}

body.mobile-preview.mobile-form-scroll .content > .panel {
  flex: 0 0 auto;
}

body.mobile-preview .menu-grid,
body.mobile-preview .subtype-list {
  gap: 8px;
  width: 100%;
}

body.mobile-preview .hero-nav {
  margin-top: 10px;
}

body.mobile-preview .hero-nav .secondary-button {
  width: 100%;
}

body.mobile-preview .overlay {
  padding:
    0
    max(env(safe-area-inset-right), 0px)
    max(env(safe-area-inset-bottom), 0px)
    max(env(safe-area-inset-left), 0px);
  width: 100vw;
  height: var(--app-height);
  max-height: var(--app-height);
  background: var(--bg);
  backdrop-filter: none;
}

body.mobile-preview .modal-shell {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: none;
  border-radius: 0;
  border: 0;
  overflow: hidden;
}

body.mobile-preview .requests-list,
body.mobile-preview .chat-messages {
  padding:
    14px
    max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  overscroll-behavior-y: contain;
}

body.mobile-preview .modal-header,
body.mobile-preview .chat-form {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

body.mobile-preview .request-summary-head {
  flex-direction: column;
}

body.mobile-preview .software-file-head {
  flex-direction: column;
  align-items: stretch;
}

body.mobile-preview .software-library-toolbar {
  justify-content: stretch;
}

body.mobile-preview .software-library-toolbar .secondary-button {
  width: 100%;
}

body.mobile-preview .software-download-button {
  width: 100%;
}

body.mobile-preview .request-summary-head > div,
body.mobile-preview .request-summary-message,
body.mobile-preview .request-summary-meta,
body.mobile-preview .request-summary-assignee {
  width: 100%;
  min-width: 0;
  text-align: left;
}

body.mobile-preview .chat-message {
  width: min(82%, 320px);
  max-width: min(82%, 320px);
  min-width: min(200px, 82%);
  min-height: 54px;
  padding: 7px 10px 6px;
  border-radius: 14px;
}

body.mobile-preview .chat-message-text {
  width: 100%;
  text-align: left;
}

body.mobile-preview .menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  flex: 1 1 auto;
}

body.mobile-preview .menu-button,
body.mobile-preview .subtype-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: center;
  color: var(--text);
}

body.mobile-preview .menu-button {
  grid-column: 1 / -1;
}

body.mobile-preview .menu-button--half {
  grid-column: span 1;
}

body.mobile-preview .subtype-button {
  justify-content: flex-start;
  text-align: left;
}

body.mobile-preview .menu-button.active,
body.mobile-preview .subtype-button.active {
  background: rgb(var(--accent-rgb) / 0.16);
  border-color: rgb(var(--accent-rgb) / 0.2);
  color: var(--text);
}

body.mobile-preview .field {
  scroll-margin-top: calc(var(--mobile-header-offset) + 28px);
}

body.mobile-preview.mobile-form-scroll .field {
  scroll-margin-top: 18px;
  scroll-margin-bottom: calc(24px + var(--keyboard-inset));
}

body.mobile-preview .field input,
body.mobile-preview .field textarea,
body.mobile-preview .field select {
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 16px;
  background: var(--field-bg);
  scroll-margin-bottom: calc(28px + var(--keyboard-inset));
  scroll-margin-top: calc(var(--mobile-header-offset) + 28px);
}

body.mobile-preview.mobile-form-scroll .field input,
body.mobile-preview.mobile-form-scroll .field textarea,
body.mobile-preview.mobile-form-scroll .field select {
  scroll-margin-top: 18px;
  scroll-margin-bottom: calc(24px + var(--keyboard-inset));
}

body.mobile-preview .mobile-choice-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.mobile-preview .mobile-choice-button {
  min-height: 40px;
  font-size: 0.92rem;
}

body.mobile-preview .chat-shell {
  min-height: 100%;
  height: var(--app-height);
  max-height: var(--app-height);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.mobile-preview .chat-messages {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 10px;
  align-content: start;
}

body.mobile-preview .chat-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2;
  flex: 0 0 auto;
  background: var(--bg);
  position: sticky;
  bottom: var(--keyboard-inset);
  border-top: 1px solid var(--border);
}

body.mobile-preview .chat-form input {
  display: block;
  height: 42px;
  padding: 0 12px;
  border-radius: 20px;
  font-size: 16px;
  line-height: 42px;
  caret-color: var(--accent-strong);
}

body.mobile-preview .chat-form input::placeholder {
  font-size: 1rem;
}

body.mobile-preview .modal-header .chat-close-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 0.96rem;
  line-height: 1;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
}

body.mobile-preview .chat-form .submit-button {
  min-width: 98px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 18px;
}

body.mobile-preview.keyboard-open .chat-messages {
  padding-bottom: calc(10px + var(--keyboard-inset));
}

body.mobile-preview .request-sent-toast {
  position: absolute;
  top: calc(var(--device-safe-top) + 10px);
  left: 12px;
  right: 12px;
  width: auto;
  max-width: none;
  transform: none;
}

body.mobile-preview .field span,
body.mobile-preview .field-hint,
body.mobile-preview .panel-header p,
body.mobile-preview .subtype-button span {
  color: var(--muted);
  font-size: 0.8rem;
}

body.mobile-preview #menuPanel:not(.hidden) {
  flex: 1 1 auto;
  min-height: 100%;
}

body.mobile-preview #menuPanel:not(.hidden) .menu-grid {
  height: 100%;
}

body.mobile-preview .content.hidden,
body.mobile-preview #menuPanel.hidden + .content.hidden {
  display: none;
}

body.mobile-preview .layout.show-menu-step {
  gap: 0;
}

body.mobile-preview .layout.show-menu-step > #menuPanel {
  flex: 1 1 auto;
}

body.mobile-preview .layout.show-menu-step > .content,
body.mobile-preview .layout.show-type-step > #menuPanel,
body.mobile-preview .layout.show-form-step > #menuPanel {
  display: none;
}

body.mobile-preview .layout.show-type-step > .content,
body.mobile-preview .layout.show-form-step > .content {
  flex: 1 1 auto;
  display: flex;
}

body.mobile-preview.mobile-form-scroll .layout.show-type-step > .content,
body.mobile-preview.mobile-form-scroll .layout.show-form-step > .content {
  flex: 0 0 auto;
  min-height: auto;
}

body.mobile-preview.mobile-menu-step .layout {
  flex: 1 1 auto;
  gap: 0;
  overflow: hidden;
}

body.mobile-preview.mobile-menu-step #menuPanel {
  padding: 0 12px 12px;
}

.iphone-frame {
  width: min(100%, 390px);
  margin: 12px auto;
  padding: 10px;
  border-radius: 34px;
  background: #0f131b;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  position: relative;
}

.iphone-notch {
  width: 124px;
  height: 24px;
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-radius: 0 0 16px 16px;
  background: #070a10;
  z-index: 3;
}

.iphone-screen {
  min-height: 760px;
  border-radius: 26px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

body.mobile-preview .iphone-screen {
  width: var(--device-screen-width);
  height: min(var(--device-screen-height), var(--app-height));
  min-height: 0;
  border-radius: var(--device-screen-radius);
  background: var(--bg);
}

body.mobile-preview .iphone-frame {
  width: calc(var(--device-screen-width) + (var(--device-frame-padding) * 2));
  max-width: 100%;
  margin: 12px auto;
  padding: var(--device-frame-padding);
  border-radius: var(--device-frame-radius);
}

body.mobile-preview:not(.embedded-preview) .iphone-frame {
  transform: scale(var(--device-preview-scale));
  transform-origin: top center;
}

body.mobile-preview .iphone-notch {
  width: var(--device-notch-width);
  height: var(--device-notch-height);
}

body.mobile-preview[data-device="android-tall"] .iphone-notch,
body.mobile-preview[data-device="android-compact"] .iphone-notch {
  border-radius: 0 0 12px 12px;
  background: #111823;
}

body.mobile-preview.embedded-preview .iphone-frame {
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.mobile-preview.embedded-preview .iphone-notch {
  display: none;
}

body.mobile-preview.embedded-preview .iphone-screen {
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  max-height: var(--app-height);
  border-radius: 0;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
  }

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