/* Portal shared styles for Apple/Google-like minimal UI */
:root {
  --accent: #228ad8;
  --accent-soft: #66cffc;
  --text: #1f2937;
  --muted: #4b5563;
  --border: #e5e7eb;
  --surface: #ffffff;
  --bg: #f5f5f7; /* subtle gray background for the whole page */
  /* softer card shadow */
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "ヒラギノ角ゴ ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* footerを下寄せするための縦フレックス */
}

main {
  flex: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-soft);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px; /* 幅と左右余白はcontainerに集約 */
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid #e5e5ea; /* logo row separator */
}

.portal-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 48px;
  width: 48px;
  object-fit: contain;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
}

.brand-sub {
  display: none; /* Portal 削除 */
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #f7fafc;
  border: 1px solid #eef2f7;
  color: var(--muted);
  font-size: 0.95rem;
}

.user-chip strong {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.header-link,
.header-button {
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.header-link:hover,
.header-button:hover {
  color: var(--text);
}

.header-logout {
  margin: 0;
}

main {
  padding: 32px 0 56px;
}

.page-hero {
  margin-bottom: 20px;
}

.page-hero .eyebrow {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.page-hero h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.page-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
  line-height: 1.3;
}

.page-description {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.surface-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid #eef2f6;
}

.card-padding {
  padding: 22px 22px 20px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.menu-card {
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%; /* 高さを揃えてボタン位置を安定させる */
}

.menu-card h2 {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-card p {
  margin: 0;
  color: var(--muted);
}

.menu-card .actions {
  margin-top: auto; /* ボタンを下に押し出して位置を揃える */
  display: flex;
  align-items: flex-start; /* ボタンの上端を揃える */
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(34, 138, 216, 0.2);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  background: #3a9cf0;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  background: #1a7cc3;
  color: #ffffff;
}

.btn-secondary {
  background: #f3f6f9;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid #e5eaf0;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #e5eaf0;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-label {
  display: inline-block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: border 0.12s ease, box-shadow 0.12s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 138, 216, 0.18);
}

.muted-text {
  color: var(--muted);
}

.small {
  font-size: 0.92rem;
}

.subtle {
  color: #6b7280;
  font-size: 0.9rem;
}

.w-100 {
  width: 100%;
}

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

.gap-sm {
  gap: 10px;
}

.upload-box {
  border: 1px dashed #dce4ec;
  border-radius: 16px;
  padding: 18px;
  background: #f9fbfd;
  text-align: center;
  transition: border 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.upload-box:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(34, 138, 216, 0.08);
}

.upload-box.is-dragover {
  border-color: var(--accent);
  background: #f4f9ff;
  box-shadow: 0 12px 28px rgba(34, 138, 216, 0.12);
}

.upload-box .icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 6px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 800;
}

.upload-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}

.upload-box .helper {
  color: var(--muted);
  font-size: 0.95rem;
}

.selected-file {
  margin-top: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.alert-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #f5f5f7;
}

.alert-banner[data-variant="success"] {
  background: #f4f8ff;
  border-color: #d9e6fb;
}

.alert-banner[data-variant="error"] {
  background: #fff5f5;
  border-color: #f7c8c8;
}

.alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

.alert-banner[data-variant="success"] .alert-icon {
  background: #e1edff;
  color: var(--accent);
}

.alert-banner[data-variant="error"] .alert-icon {
  background: #ffe1e1;
  color: #c02626;
}

.alert-text strong {
  display: block;
  font-weight: 700;
}

.alert-text span {
  display: block;
  color: var(--muted);
  font-size: 0.96rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
}

.status-chip[data-state="success"] {
  color: var(--accent);
  background: #edf5ff;
}

.status-chip[data-state="error"] {
  color: #c02626;
  background: #fff1f1;
}

.status-errors {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #c02626;
}

.error-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #c02626;
}

.error-list li + li {
  margin-top: 4px;
}

.helper-link {
  margin-top: 8px;
  font-size: 0.95rem;
}

.auth-main {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 18px 18px 48px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 22px 22px 20px;
}

.auth-card .form-stack {
  gap: 12px;
  margin-top: 10px;
}

.auth-eyebrow {
  font-size: 13px;
  font-weight: 500;
  color: #6e6e73;
  margin: 0 0 2px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
}

.auth-desc {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
}

.header-badge {
  font-size: 12px;
  padding: 4px 10px;
}

.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer {
  padding: 16px 0 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* simple horizontal nav below header */
.portal-nav {
  padding: 8px 0;
  margin-bottom: 24px;
}

.nav-inner {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 0;
  margin: 0;
}

.nav-link {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.92rem;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
  border-color: var(--accent);
}

.template-help {
  font-size: 0.81rem;
  margin: 4px 0 8px;
  color: #3a3a3c;
}

.portal-templates {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e5e5ea;
}

.portal-templates__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #3a3a3c;
}

.portal-templates__desc {
  font-size: 13px;
  margin: 0 0 4px;
  color: #6e6e73;
}

.portal-templates__links {
  font-size: 13px;
  margin: 0;
}

.portal-templates__links a {
  text-decoration: none;
  color: #0070c9;
}

.portal-templates__links a:hover {
  text-decoration: underline;
}

/* 内側の左余白をなくし、containerに集約 */
.header-inner,
.page-hero {
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 768px) {
  .menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
