/* MITA home — matches landing app shell */
body.home-app {
  font-family: var(--font-ui);
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: auto;
}

.home-app__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 50% -30%, rgba(124, 144, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 40%, rgba(255, 255, 255, 0.04), transparent 45%),
    var(--bg-dark);
}

.home-app__bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black, transparent);
}

.home-shell {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.home-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(32px, 6vw, 48px);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.home-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.home-brand img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.home-brand-text h1 {
  margin: 0 0 6px 0;
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.home-brand-text p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 36rem;
}

.profile-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.profile-trigger:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-strong);
}

.profile-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: #c8d4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-chev {
  font-size: 0.65rem;
  opacity: 0.5;
  margin-left: 2px;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(20, 20, 24, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.profile-dropdown.is-open {
  display: flex;
}

.profile-dd-item {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.profile-dd-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.profile-dd-item--danger {
  color: var(--danger);
}

.profile-dd-item--danger:hover {
  background: rgba(248, 113, 113, 0.08);
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.home-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 22px;
  min-height: 168px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 144, 255, 0.35);
  box-shadow:
    0 0 0 1px rgba(124, 144, 255, 0.1),
    0 20px 40px -18px rgba(0, 0, 0, 0.75);
}

.home-tile:active {
  transform: translateY(-1px);
}

.home-tile-ic {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: #c8d4ff;
}

.home-tile-ic svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-tile h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-tile p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}

/* Profile placeholder modal */
#profileModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#profileModal.is-open {
  display: flex;
}

.home-modal-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
}

.home-modal-card h2 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-modal-card p {
  margin: 0 0 22px 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.home-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.home-modal-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #fff;
  color: #0a0a0c;
  transition: opacity 0.15s ease;
}

.home-modal-btn:hover {
  opacity: 0.92;
}

@media (max-width: 640px) {
  .home-top {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-wrap {
    align-self: flex-end;
  }
}