/**
 * Start menu — iPadOS Control Center
 * Frosted sheet · connectivity cluster · wide modules · compact app pins
 * Loaded after trn-skrashevskyi / app-shell so it wins at equal specificity.
 */

/* ── Tokens ─────────────────────────────────────────────────── */
.sd-start-menu.sd-start-menu--ios {
  --cc-blur: 48px;
  --cc-radius: 32px;
  --cc-module-radius: 22px;
  --cc-module: rgba(255, 255, 255, 0.12);
  --cc-module-press: rgba(255, 255, 255, 0.2);
  --cc-glyph: rgba(255, 255, 255, 0.18);
  --cc-glyph-on: #007aff;
  --cc-label: rgba(235, 235, 245, 0.72);
  --cc-title: #f5f5f7;
  --cc-sub: rgba(235, 235, 245, 0.48);
  --cc-sheet: rgba(18, 18, 20, 0.55);
  --cc-border: rgba(255, 255, 255, 0.16);
  --cc-hairline: rgba(255, 255, 255, 0.1);
  --cc-gap: 10px;
  --cc-app: 52px;
  --sd-start-w: 400px;
  --sd-start-max-h: 680px;
  /* legacy aliases used by shared shell */
  --start-ios-blur: var(--cc-blur);
  --start-ios-radius: var(--cc-radius);
  --start-ios-sheet: var(--cc-sheet);
  --start-ios-border: var(--cc-border);
  --start-ios-hairline: var(--cc-hairline);
  --start-ios-secondary: var(--cc-label);
  --start-ios-cell: var(--cc-module);
  --start-ios-cell-press: var(--cc-module-press);
}

html:not([data-theme="dark"]) .sd-start-menu.sd-start-menu--ios {
  --cc-module: rgba(255, 255, 255, 0.62);
  --cc-module-press: rgba(255, 255, 255, 0.82);
  --cc-glyph: rgba(60, 60, 67, 0.12);
  --cc-label: rgba(60, 60, 67, 0.65);
  --cc-title: #1c1c1e;
  --cc-sub: rgba(60, 60, 67, 0.45);
  --cc-sheet: rgba(242, 242, 247, 0.72);
  --cc-border: rgba(255, 255, 255, 0.7);
  --cc-hairline: rgba(60, 60, 67, 0.12);
}

/* ── Sheet shell ────────────────────────────────────────────── */
.sd-start-menu.sd-start-menu--ios {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, transparent 42%),
    var(--cc-sheet);
  backdrop-filter: blur(var(--cc-blur)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--cc-blur)) saturate(190%);
  border: 0.5px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.48),
    0 0 0 0.5px rgba(0, 0, 0, 0.22),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

html:not([data-theme="dark"]) .sd-start-menu.sd-start-menu--ios {
  box-shadow:
    0 22px 56px rgba(15, 30, 50, 0.16),
    0 0 0 0.5px rgba(0, 0, 0, 0.05),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.9);
}

/* ── Compact header ─────────────────────────────────────────── */
.sd-start-menu--ios .sd-start-top {
  padding: 0;
  background: transparent;
}

.sd-start-menu--ios .sd-start-hero,
.sd-start-menu--ios .sd-start-search {
  display: none !important;
}

.sd-start-menu--ios .sd-start-header,
.sd-start-menu--ios .sd-cc-header {
  padding: 14px 16px 6px;
  gap: 10px;
}

.sd-start-menu--ios .sd-start-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.sd-start-menu--ios .sd-start-user-avatar--initials {
  background: linear-gradient(145deg, #5ac8fa, #007aff);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.sd-start-menu--ios .sd-start-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cc-title);
  text-shadow: none;
}

html:not([data-theme="dark"]) .sd-start-menu--ios .sd-start-user-name {
  color: #1c1c1e;
}

.sd-start-menu--ios .sd-start-user-role {
  margin-top: 1px;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--cc-label);
}

.sd-start-menu--ios .sd-start-user-role::before {
  width: 5px;
  height: 5px;
  background: #30d158;
  box-shadow: none;
}

/* ── Body / Control Center layout ───────────────────────────── */
.sd-start-menu--ios .sd-start-body,
.sd-start-menu--ios .sd-cc-body {
  /* Content-sized: do not flex-grow into empty fullscreen space */
  flex: 0 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 14px 12px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: var(--cc-gap);
}

.sd-start-menu--ios .sd-start-section-title {
  display: none !important;
}

/* Legacy Home Screen grid — unused in CC, keep harmless */
.sd-start-menu--ios .sd-start-pinned-grid {
  display: none !important;
}

.sd-start-menu--ios .sd-start-settings {
  display: none !important;
}

/* ── Connectivity cluster (2×2) ─────────────────────────────── */
.sd-cc-cluster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  padding: 12px;
  border-radius: var(--cc-module-radius);
  background: var(--cc-module);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.12);
  border: 0.5px solid color-mix(in srgb, var(--cc-border) 55%, transparent);
}

/* ── iOS theme switch row ───────────────────────────────────── */
.sd-cc-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--cc-module);
  border: 0.5px solid color-mix(in srgb, var(--cc-border) 55%, transparent);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.14),
    0 6px 18px rgba(0, 0, 0, 0.1);
  margin-bottom: var(--cc-gap, 10px);
}

.sd-cc-theme-row__lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sd-cc-theme-row__glyph {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
  background: linear-gradient(145deg, #5856d6, #af52de);
  box-shadow: 0 4px 12px rgba(88, 86, 214, 0.35);
  flex-shrink: 0;
}

.sd-cc-theme-row__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sd-cc-theme-row__title {
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--cc-label, inherit);
}

.sd-cc-theme-row__sub {
  font-size: 0.72rem;
  color: color-mix(in srgb, var(--cc-label, #8b9bb0) 70%, transparent);
}

/* iOS-style switch: track + thumb */
.sd-ios-switch {
  position: relative;
  width: 58px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.sd-ios-switch__track {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #787880;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: background 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sd-ios-switch.is-on .sd-ios-switch__track,
.sd-ios-switch[aria-checked="true"] .sd-ios-switch__track {
  background: #34c759;
}

.sd-ios-switch__sun,
.sd-ios-switch__moon {
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.55;
  color: #fff;
  z-index: 1;
  transition: opacity 180ms ease;
}

.sd-ios-switch:not(.is-on) .sd-ios-switch__sun { opacity: 0.95; }
.sd-ios-switch.is-on .sd-ios-switch__moon,
.sd-ios-switch[aria-checked="true"] .sd-ios-switch__moon { opacity: 0.95; }

.sd-ios-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.28),
    0 1px 1px rgba(0, 0, 0, 0.12);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.sd-ios-switch.is-on .sd-ios-switch__thumb,
.sd-ios-switch[aria-checked="true"] .sd-ios-switch__thumb {
  transform: translateX(24px);
}

.sd-ios-switch:focus-visible {
  outline: 2px solid var(--sd-accent, #5b9fd4);
  outline-offset: 3px;
}

.sd-ios-switch:active .sd-ios-switch__thumb {
  width: 34px;
}

.sd-ios-switch.is-on:active .sd-ios-switch__thumb,
.sd-ios-switch[aria-checked="true"]:active .sd-ios-switch__thumb {
  transform: translateX(20px);
}

.sd-cc-cluster--3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto; /* one row of 3 — no empty 1fr second row */
}

.sd-cc-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 8px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 100ms ease, transform 100ms ease;
}

.sd-cc-toggle:hover {
  background: color-mix(in srgb, var(--cc-module-press) 45%, transparent);
  text-decoration: none;
  color: inherit;
}

.sd-cc-toggle:active {
  transform: scale(0.94);
  background: var(--cc-module-press);
}

.sd-cc-toggle__glyph {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.15rem;
  background: var(--cc-glyph);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.18),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.25);
  transition: background 160ms ease, transform 100ms ease;
}

.sd-cc-toggle__glyph--theme { background: #5856d6; }
.sd-cc-toggle__glyph--notif { background: #ff3b30; }
.sd-cc-toggle__glyph--security { background: #34c759; }
.sd-cc-toggle__glyph--profile { background: #007aff; }

.sd-cc-toggle__label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
  color: var(--cc-label);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

/* ── Wide modules (Desktop / Cabinet) ───────────────────────── */
.sd-cc-wide-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--cc-gap);
}

.sd-cc-module {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 14px;
  border-radius: var(--cc-module-radius);
  background: var(--cc-module);
  border: 0.5px solid color-mix(in srgb, var(--cc-border) 55%, transparent);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.1);
  color: inherit;
  text-decoration: none;
  transition: background 100ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.sd-cc-module:hover {
  background: color-mix(in srgb, var(--cc-module-press) 55%, transparent);
  text-decoration: none;
  color: inherit;
}

.sd-cc-module:active {
  transform: scale(0.97);
  background: var(--cc-module-press);
}

.sd-cc-module__icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 0;
  display: grid;
  place-items: center;
  font-size: 1.85rem;
  color: #5ac8fa;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.sd-cc-module__icon--cabinet {
  background: transparent;
  box-shadow: none;
  color: #13c6d5;
}

.sd-cc-module__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* PNG emblems include inner padding — scale up so the glyph fills the slot */
  transform: scale(1.12);
  transform-origin: center;
}

.sd-cc-module__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sd-cc-module__title {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cc-title);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-cc-module__sub {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--cc-sub);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Compact app pins ───────────────────────────────────────── */
.sd-cc-apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 8px 4px;
  padding: 4px 2px 2px;
  justify-items: center;
}

.sd-cc-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  max-width: 64px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease;
}

.sd-cc-app:hover {
  text-decoration: none;
  color: inherit;
}

.sd-cc-app:hover .sd-cc-app__glyph {
  transform: scale(1.05);
  filter: brightness(1.08);
}

.sd-cc-app:active {
  transform: scale(0.92);
}

.sd-cc-app.is-active-space .sd-cc-app__glyph {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--module-color, #007aff) 75%, transparent),
    0 6px 14px rgba(0, 0, 0, 0.28),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.28);
}

.sd-cc-app__glyph {
  width: var(--cc-app);
  height: var(--cc-app);
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 55%),
    color-mix(in srgb, var(--module-color, #5ac8fa) 32%, rgba(18, 28, 42, 0.65));
  color: var(--module-color-bright, var(--module-color, #5ac8fa));
  font-size: 1.2rem;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.26),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.28);
  overflow: hidden;
  transition: transform 100ms ease, filter 100ms ease, box-shadow 160ms ease;
}

html:not([data-theme="dark"]) .sd-cc-app__glyph {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.75), transparent 50%),
    color-mix(in srgb, var(--module-color, #007aff) 16%, rgba(240, 244, 248, 0.95));
  box-shadow:
    0 4px 10px rgba(20, 40, 60, 0.12),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.85);
}

/* PNG emblems — no CSS well / border / inset ring (same as Hub Home) */
.sd-cc-app__glyph.sd-cc-app__glyph--image {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

html:not([data-theme="dark"]) .sd-cc-app__glyph.sd-cc-app__glyph--image {
  background: transparent;
  box-shadow: none;
}

.sd-cc-app__glyph.sd-cc-app__glyph--image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

html:not([data-theme="dark"]) .sd-cc-app__glyph.sd-cc-app__glyph--image img {
  filter: drop-shadow(0 3px 8px rgba(20, 40, 60, 0.14));
}

.sd-cc-app.is-active-space .sd-cc-app__glyph.sd-cc-app__glyph--image {
  box-shadow: none;
  outline: 2px solid color-mix(in srgb, var(--module-color, #007aff) 75%, transparent);
  outline-offset: 2px;
}

.sd-cc-app__glyph--admin {
  background: linear-gradient(145deg, #aeaeb2, #636366);
  color: #fff;
}

.sd-cc-app__label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cc-label);
}

/* ── Footer / Logout ────────────────────────────────────────── */
.sd-start-menu--ios .sd-start-footer,
.sd-start-menu--ios .sd-cc-footer {
  padding: 6px 14px 12px;
  border-top: 0;
  background: transparent;
  gap: 0;
  display: block;
}

.sd-cc-logout {
  display: block;
  width: 100%;
}

.sd-cc-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--cc-module);
  border: 0.5px solid color-mix(in srgb, var(--cc-border) 55%, transparent);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.1);
  color: #ff453a;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 100ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.sd-cc-logout-btn:hover {
  background: rgba(255, 59, 48, 0.16);
}

.sd-cc-logout-btn:active {
  transform: scale(0.98);
  background: rgba(255, 59, 48, 0.22);
}

.sd-cc-logout-btn i {
  color: #ff453a;
  font-size: 1.05rem;
}

/* Legacy footer link styles (unused, keep safe) */
.sd-start-menu--ios .sd-start-link--footer {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  color: var(--cc-title);
  font-size: 0.88rem;
  font-weight: 500;
  gap: 8px;
}

.sd-start-menu--ios .sd-start-link--danger i {
  color: #ff453a;
}

/* ── Open animation ─────────────────────────────────────────── */
.sd-start-menu--ios.open .sd-start-top {
  animation: sd-cc-fade 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sd-start-menu--ios.open .sd-cc-cluster {
  animation: sd-cc-pop 320ms cubic-bezier(0.22, 1, 0.36, 1) 20ms both;
}

.sd-start-menu--ios.open .sd-cc-wide-row {
  animation: sd-cc-fade 300ms cubic-bezier(0.22, 1, 0.36, 1) 50ms both;
}

.sd-start-menu--ios.open .sd-cc-app {
  animation: sd-cc-pop 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sd-start-menu--ios.open .sd-cc-app:nth-child(1) { animation-delay: 70ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(2) { animation-delay: 85ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(3) { animation-delay: 100ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(4) { animation-delay: 115ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(5) { animation-delay: 130ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(6) { animation-delay: 145ms; }
.sd-start-menu--ios.open .sd-cc-app:nth-child(n+7) { animation-delay: 155ms; }

.sd-start-menu--ios.open .sd-cc-footer {
  animation: sd-cc-fade 300ms cubic-bezier(0.22, 1, 0.36, 1) 100ms both;
}

@keyframes sd-cc-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes sd-cc-pop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* ── Phone ≤720 ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .sd-start-menu.sd-start-menu--ios {
    --cc-radius: 24px;
    --cc-app: 54px;
    --sd-start-max-h: 78dvh;
    top: auto;
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--sd-chrome-bottom, calc(var(--sd-taskbar-h) + var(--sd-safe-bottom, 0px))) + 8px);
    width: auto;
    max-width: none;
    max-height: min(var(--sd-start-max-h), calc(100dvh - var(--sd-chrome-bottom, 72px) - 20px));
    height: auto;
    border-radius: var(--cc-radius);
    margin-inline: auto;
  }

  .sd-start-menu--ios .sd-start-header,
  .sd-start-menu--ios .sd-cc-header {
    padding: 12px 14px 4px;
  }

  .sd-start-menu--ios .sd-start-body,
  .sd-start-menu--ios .sd-cc-body {
    padding: 4px 12px 10px;
    gap: 10px;
    flex: 0 1 auto;
  }

  .sd-cc-cluster {
    padding: 10px;
  }

  .sd-cc-toggle {
    min-height: 68px;
  }

  .sd-cc-wide-row {
    grid-template-columns: 1fr 1fr;
  }

  .sd-cc-module {
    min-height: 68px;
    padding: 12px;
  }

  .sd-cc-apps {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px 2px;
  }

  .sd-cc-app {
    max-width: none;
  }

  .sd-cc-app__glyph {
    width: 48px;
    height: 48px;
  }

  .sd-cc-app__label {
    font-size: 0.55rem;
  }

  .sd-start-menu--ios .sd-cc-footer {
    padding: 6px 12px max(12px, env(safe-area-inset-bottom, 0px));
  }

  .sd-cc-logout-btn {
    min-height: 52px;
  }
}

/* ── Tablet portrait ────────────────────────────────────────── */
@media (min-width: 721px) and (max-width: 960px) {
  .sd-start-menu.sd-start-menu--ios {
    --cc-app: 54px;
    --cc-radius: 28px;
    top: auto;
    left: 50%;
    right: auto;
    width: min(420px, calc(100vw - 24px));
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(var(--sd-start-max-h, 620px), calc(100dvh - var(--sd-chrome-bottom, 72px) - 32px));
    height: auto;
    border-radius: var(--cc-radius);
    transform: translateX(-50%) translateY(14px) scale(0.97);
    transform-origin: bottom center;
    margin-inline: 0;
  }

  .sd-start-menu.sd-start-menu--ios.open {
    transform: translateX(-50%);
  }
}

/* ── App shell / touch: keep compact CC card (override any leftover fullscreen) ─ */
@media (max-width: 960px) {
  body.sd-app .sd-start-menu.sd-start-menu--ios {
    top: auto !important;
    height: auto !important;
    max-height: min(var(--sd-start-max-h, 680px), calc(100dvh - var(--sd-chrome-bottom, 72px) - 20px)) !important;
    border-radius: var(--cc-radius, 28px);
    padding-top: 0;
  }
}

html.trn-touch body.sd-app .sd-start-menu.sd-start-menu--ios {
  --cc-app: 56px;
  --cc-radius: 28px;
  top: auto !important;
  left: 12px;
  right: auto;
  bottom: calc(var(--sd-chrome-bottom, 72px) + 10px);
  width: min(420px, calc(100vw - 24px));
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(var(--sd-start-max-h, 680px), calc(100dvh - var(--sd-chrome-bottom, 72px) - 24px)) !important;
  height: auto !important;
  border-radius: var(--cc-radius);
  padding-top: 0;
  transform: translateY(14px) scale(0.97);
  transform-origin: bottom left;
  margin-inline: 0;
}

html.trn-touch body.sd-app .sd-start-menu.sd-start-menu--ios.open {
  transform: none;
}

html.trn-touch body.sd-app .sd-cc-toggle {
  min-height: 76px;
}

html.trn-touch body.sd-app .sd-cc-logout-btn {
  min-height: 52px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sd-start-menu--ios.open .sd-start-top,
  .sd-start-menu--ios.open .sd-cc-cluster,
  .sd-start-menu--ios.open .sd-cc-wide-row,
  .sd-start-menu--ios.open .sd-cc-app,
  .sd-start-menu--ios.open .sd-cc-footer {
    animation: none !important;
  }

  .sd-cc-toggle,
  .sd-cc-module,
  .sd-cc-app,
  .sd-cc-app__glyph,
  .sd-cc-logout-btn {
    transition: none !important;
  }
}
