.backdrop {
  position: fixed;
  z-index: 90;
  top: var(--app-visual-top, 0px);
  left: 50%;
  right: auto;
  bottom: auto;
  height: var(--app-visual-height, 100dvh);
  width: min(100%, var(--content-max-width));
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  touch-action: none;
  overscroll-behavior: none;
  isolation: isolate;
}
.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(10, 28, 35, var(--overlay-alpha, 0.42));
  -webkit-backdrop-filter: blur(var(--overlay-blur, 3px));
  backdrop-filter: blur(var(--overlay-blur, 3px));
  pointer-events: none;
}
.backdrop > * { position: relative; z-index: 1; }
.sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  max-height: min(calc(var(--app-visual-height, 100dvh) - 10px), 760px);
  transform: translateY(var(--drag-y, 0px));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: 0 -24px 70px rgba(2, 6, 23, .24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  touch-action: none;
  overscroll-behavior: contain;
  transition: transform 0.22s ease;
}
.sheet.dragging { transition: none; }
.sheet-grab {
  flex: 0 0 auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  background: var(--surface);
  z-index: 2;
}
.sheet.dragging .sheet-grab { cursor: grabbing; }
.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  margin: 10px auto 8px;
}
.sheet-header {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 12px;
  align-items: center;
  padding: 2px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.sheet-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.16;
  font-weight: 900;
  letter-spacing: -.02em;
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--surface);
  scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }
/* Focused controls keep a comfortable margin when iOS changes the visual viewport. */
.sheet-body :is(input, textarea, select, [contenteditable="true"]),
.install-sheet-body :is(input, textarea, select, [contenteditable="true"]) {
  scroll-margin-block: 18px 28px;
}

body.keyboard-open .sheet-body { padding-bottom: 14px; }
.modal-backdrop {
  position: fixed;
  z-index: 150;
  inset: 0;
  background: rgba(10, 28, 35, var(--overlay-alpha, 0.42));
  -webkit-backdrop-filter: blur(var(--overlay-blur, 3px));
  backdrop-filter: blur(var(--overlay-blur, 3px));
  display: grid;
  place-items: center;
  padding: 20px;
}
.choice-list {
  display: grid;
  gap: 8px;
}
.choice-list > button {
  min-height: 58px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.choice-list > button {
  grid-template-columns: 1fr auto;
}
.choice-list > button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Navigable actions inside the Add sheet use the same muted surface as Settings rows. */
.create-hub-list > button {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  color: var(--text);
  box-shadow: none;
}
.create-hub-list > button:active {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  transform: scale(0.995);
}
.danger-zone {
  margin-top: 14px;
  display: grid;
}
.about-panel {
  text-align: center;
}
.about-panel img {
  width: min(430px, 90%);
  height: auto;
  margin: 8px auto 22px;
}
.about-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.about-product-name {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}
.about-product-copy {
  margin-top: 0;
}
.ai-orb {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.danger-zone .subtle-danger {
  width: 100%;
}
.sheet-grab {
  user-select: none;
  -webkit-user-select: none;
}

/* Settings keeps compact vertical rhythm while sharing the common responsive sheet width. */
.sheet-settings {
  max-height: min(88vh, 720px);
}
.sheet-settings .sheet-header {
  padding-top: 2px;
}
.sheet-settings .sheet-header h2 {
  margin: 0;
  font-size: 1.16rem;
  letter-spacing: -0.01em;
}
.sheet-settings .sheet-body {
  padding: 14px;
}
.settings-list {
  display: grid;
  gap: 10px;
}
.settings-row {
  min-height: 58px;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: var(--surface-2);
  border-radius: 15px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 1fr 24px;
  align-items: center;
  gap: 10px;
  text-align: left;
  box-shadow: none;
}
.settings-row:active {
  transform: scale(0.995);
}
.settings-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.settings-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}
.settings-copy strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
.settings-chevron {
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--muted) 76%, var(--accent));
}
.settings-chevron svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}
.settings-danger-zone {
  margin-top: 6px;
}
.settings-danger-zone .subtle-danger {
  min-height: 48px;
  border-radius: 15px;
  font-weight: 760;
}

/* Reusable destructive confirmation dialog. */
.confirm-modal {
  width: min(336px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 16px 16px;
  background: var(--surface-card);
  color: var(--text);
  opacity: 1;
  box-shadow: var(--shadow-elev-3);
  isolation: isolate;
}
.confirm-eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.confirm-modal h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.confirm-modal p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.confirm-modal .modal-actions {
  margin-top: 16px;
  gap: 8px;
}
.confirm-modal .modal-actions button {
  min-height: 44px;
  border-radius: 13px;
}
.confirm-cancel {
  background: var(--surface-2);
  border-color: transparent;
}
.confirm-accept {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}
.confirm-accept:active {
  background: color-mix(in srgb, var(--danger) 12%, var(--danger-soft));
}


/* Unified menu and About rows: same visual language as Settings. */
.sheet-menu .sheet-body,
.sheet-about .sheet-body {
  padding: 14px;
}
.menu-settings-list {
  gap: 10px;
}
.menu-settings-row {
  grid-template-columns: 34px 1fr 24px;
}
.settings-leading-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}
.settings-leading-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}
.about-action-row {
  grid-template-columns: 1fr 24px;
}
.about-actions.settings-list {
  margin-top: 16px;
}

/* Consistent selectable sub-sheets. */
.sheet-choice .sheet-body { padding: 14px; }
.choice-settings-row { grid-template-columns: 1fr 28px; }
.choice-settings-row.selected {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}
.choice-settings-row.selected .settings-copy strong { color: var(--accent); }
.choice-check {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); font-weight: 900;
}
.about-action-row {
  grid-template-columns: 1fr;
  text-align: center;
}
.about-action-row .settings-copy { justify-items: center; }
.about-action-row .settings-copy strong { text-align: center; }
