.portal-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: #f0f0f0;
  color: #1e1e1e;
}

.portal-sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 40;
  display: flex;
  width: 20rem;
  flex-shrink: 0;
  flex-direction: column;
  background: #fbe233;
  transform: translateX(-100%);
  transition: transform 0.3s;
}

@media (min-width: 768px) {
  .portal-sidebar {
    position: static;
    transform: translateX(0);
  }
}

/* モバイル: JS が .is-open を付与して表示（Tailwind 版サイドバーとは別経路） */
.portal-sidebar.is-open {
  transform: translateX(0);
}

.portal-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.portal-nav-link {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border-radius: 9999px;
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

.portal-master-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border-radius: 9999px;
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

.portal-master-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border-radius: 9999px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.2s;
}

.portal-history-new-chat-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 9999px;
  background: #fff;
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  color: #1e1e1e;
  transition: opacity 0.2s;
}

.portal-history-new-chat-btn:hover {
  opacity: 0.8;
}

.portal-history-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e1e1e;
  transition: all 0.2s;
}

.portal-history-item:hover {
  background: rgba(255, 255, 255, 0.3);
}

.portal-user-popover {
  position: absolute;
  right: 1rem;
  left: 1rem;
  bottom: calc(100% - 10px);
  z-index: 50;
  margin-bottom: 0.5rem;
  /* display は Tailwind の .hidden / .flex に任せる（ここで none を固定すると後勝ちで flex が効かない） */
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(241 245 249);
  border-radius: 1rem;
  background: #fff;
  padding: 0.25rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.portal-user-popover-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: rgb(51 65 85);
  transition: background-color 0.2s;
}

.portal-user-popover-item:hover {
  background: rgb(248 250 252);
}

.portal-user-popover-item-danger {
  color: rgb(239 68 68);
}

.portal-user-popover-item-danger:hover {
  background: rgb(254 242 242);
}

.portal-user-menu-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #fff;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem;
  text-align: left;
}

.portal-main {
  position: relative;
  display: flex;
  height: 100%;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.portal-main-header {
  z-index: 10;
  display: flex;
  height: 4rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
}

.portal-content-area {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 0 2.5rem 2rem;
}

@media (max-width: 1024px) {
  .portal-main-header {
    padding: 0 1.5rem;
  }

  .portal-content-area {
    padding: 0 1.5rem 1.5rem;
  }
}

@media (min-width: 768px) and (max-width: 1536px) {
  .portal-main-header {
    height: 1rem;
  }
}

@media (max-width: 767px) {
  .portal-main-header {
    height: 4rem;
  }

  .portal-shell {
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .portal-main {
    height: auto;
    overflow: visible;
  }

  .portal-content-area {
    overflow: visible;
  }
}

.portal-modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  transition: opacity 0.2s;
}

.portal-modal-btn:hover {
  opacity: 0.7;
}

.portal-modal-btn-secondary {
  border-color: rgb(226 232 240);
  background: #fff;
  color: #1e1e1e;
}

.portal-modal-btn-primary {
  border-color: #fbe233;
  background: #fbe233;
  color: #1e1e1e;
}
