/* Role: Global tokens, reset, layout, and shared shell UI (header/footer). */
:root {
  /* === Brand color palette (consolidated to 4 blue tones) === */
  --brand-deep: #00437f;       /* Deepest navy - footer, strong accent */
  --brand-primary: #1f6f99;    /* Primary actions - buttons, links */
  --brand-light: #329bd2;      /* Light accent - hover, focus, highlights */
  --brand-pale: #eef4f9;       /* Pale tint - subtle backgrounds */

  /* === Surfaces & text === */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-tinted: #f7f9fc;
  --text: #222222;
  --text-strong: #1a2230;
  --muted: #6f6f6f;

  /* === Lines & borders === */
  --line: #e3e3df;
  --line-strong: #c8c8c0;

  /* === State colors === */
  --state-success: #0f6b3e;
  --state-danger: #b4122b;
  --badge-required-bg: var(--state-danger);
  --badge-optional-bg: #6e7478;

  /* === Spacing scale (4px base) === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* === Border radius scale === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* === Elevation shadows (consistent navy-tinted base) === */
  --shadow-sm: 0 1px 2px rgba(15, 35, 60, 0.06), 0 1px 1px rgba(15, 35, 60, 0.04);
  --shadow-md: 0 6px 14px rgba(15, 35, 60, 0.08), 0 2px 4px rgba(15, 35, 60, 0.04);
  --shadow-lg: 0 18px 34px rgba(15, 35, 60, 0.12), 0 4px 10px rgba(15, 35, 60, 0.06);

  /* === Motion === */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.15, 1);

  /* === Focus ring (brand-aligned) === */
  --focus-ring-color: rgba(50, 155, 210, 0.35);
  --focus-ring: 0 0 0 3px var(--focus-ring-color);

  /* === Backward-compatible aliases (do not remove) === */
  --accent: var(--brand-light);
  --accent-dark: var(--brand-primary);
  --footer-bg-color: var(--brand-deep);
  --guide-underline-color: #004aa3;
  --underline-color: var(--brand-light);
  --underline-thickness: 2px;
  --underline-gap: 10px;
  --choice-bg: #f2f2ef;
  --choice-sub-bg: #e4e4df;
  --choice-sub-border: #cfcfc7;
  --focus: var(--brand-light);

  /* === Layout vars === */
  --logo-width: 220px;
  --logo-height: 50px;
  /* UI-ADJ: header-row(70px)内でロゴを中央寄せするため調整 */
  --logo-top: 10px;
  /* UI-ADJ: ロゴの水平位置調整 */
  --logo-left: 20px;
  --lang-top: 22px;
  --lang-right: 24px;
  --auth-right: 120px;
  /* 縦スクロールバー有無による横ズレ抑止: スクロールバー幅差(100vw-100%)を固定要素の位置補正に利用 */
  --scrollbar-width-diff: calc(100vw - 100%);
  --scrollbar-width-diff-half: calc(var(--scrollbar-width-diff) / 2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

html:not([data-layout-ready="true"]) #site-header,
html:not([data-layout-ready="true"]) #site-footer {
  visibility: hidden;
}

html:not([data-layout-ready="true"]) .main-content {
  visibility: hidden;
}

#site-header {
  min-height: 140px;
}

.page > #site-footer {
  margin-top: auto;
}

.container {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 0 calc(24px - 40mm);
  /* 縦スクロールバー有無による横ズレ抑止: 中央寄せコンテナの見かけ位置を補正 */
  position: relative;
  left: var(--scrollbar-width-diff-half);
}

.site-header {
  /* UI-ADJ: ロゴ帯とパンくずの間の白余白を除去 */
  padding: 0;
  background: #fff;
}

.site-header::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: #fff;
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fff;
  height: 70px;
}

.logo-slot {
  width: var(--logo-width);
  height: var(--logo-height);
}

.logo {
  position: fixed;
  top: var(--logo-top);
  left: var(--logo-left);
  z-index: 20;
  background: #fff;
  padding: 0;
  border-radius: 0;
}

.logo img {
  height: var(--logo-height);
}

.lang-slot {
  width: 80px;
  height: 24px;
}

.auth-slot {
  position: fixed;
  top: var(--lang-top);
  right: calc(var(--auth-right) - var(--scrollbar-width-diff));
  z-index: 20;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: auto;
}

.auth-toggle-button {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 6px 12px;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-full);
  background: var(--brand-light);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.auth-toggle-button:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.auth-toggle-button:active {
  transform: translateY(1px);
}

.auth-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.auth-user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.auth-user-menu-trigger:hover,
.auth-user-menu-trigger[aria-expanded="true"] {
  background: var(--brand-pale);
  border-color: var(--line);
}

.auth-user-menu-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.auth-user-menu-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform var(--duration-fast) var(--ease-out);
}

.auth-user-menu-trigger[aria-expanded="true"] .auth-user-menu-caret {
  transform: rotate(180deg);
}

.auth-user-name {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: 32px;
  max-width: 260px;
  color: var(--text);
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-user-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 30;
  animation: auth-user-menu-rise var(--duration-fast) var(--ease-out) both;
}

.auth-user-menu-list[hidden] {
  display: none;
}

@keyframes auth-user-menu-rise {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-user-menu-list { animation: none; }
  .auth-user-menu-caret { transition: none; }
}

.auth-user-menu-item {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out);
}

.auth-user-menu-item:hover,
.auth-user-menu-item:focus-visible {
  background: var(--brand-pale);
  color: var(--brand-deep);
  outline: none;
}

.auth-company-name,
.auth-customer-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-company-name {
  font-size: 14px;
  font-weight: 700;
}

.auth-customer-name {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.auth-toggle-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  position: fixed;
  top: var(--lang-top);
  right: calc(var(--lang-right) - var(--scrollbar-width-diff));
  z-index: 20;
  background: #fff;
  padding: 4px 6px;
  border-radius: 4px;
}

html[data-lang-switch="on"] .lang-switch {
  display: none;
}

.lang {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
}

.lang.is-active {
  color: var(--text);
  font-weight: 600;
}

.lang:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .header-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .auth-slot {
    position: static;
    order: 3;
    margin-left: auto;
    max-width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
  }

  .auth-user-name {
    max-width: 180px;
  }

  .auth-company-name {
    font-size: 12px;
  }

  .auth-customer-name {
    font-size: 11px;
  }

  .auth-user-menu-list {
    right: 0;
    left: auto;
    min-width: 180px;
  }
}

.title-row {
  /* UI-ADJ: site-header padding除去分を見出し側へ移管 */
  padding: 34px 0 20px;
  background: #fff;
}

/* UI-ADJ: 共通ヘッダーパンくず（デフォルト非表示、必要ページのみ表示） */
.header-breadcrumb-band {
  display: none;
  width: 100%;
  background: #eef1f5;
  border-top: 1px solid #d8dde5;
  border-bottom: 1px solid #d8dde5;
}

.header-breadcrumb-band.is-visible {
  display: block;
}

.header-breadcrumb-inner {
  padding-top: 10px;
  padding-bottom: 10px;
}

.header-breadcrumb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4b5b70;
  font-size: 14px;
  line-height: 1.4;
}

.header-breadcrumb-item {
  margin: 0;
}

.header-breadcrumb-link {
  color: #1f4f93;
  text-decoration: underline;
}

.header-breadcrumb-link:hover {
  text-decoration: none;
}

.header-breadcrumb-separator {
  color: #7a8596;
}

.header-breadcrumb-item.is-current {
  color: #1f2a3a;
  font-weight: 400;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 6px;
}

.page-title {
  font-size: 28px;
  margin: 0;
  font-weight: 600;
  color: var(--text-strong);
  display: inline-block;
  position: relative;
  padding-bottom: var(--underline-gap);
  letter-spacing: 0.01em;
}

.page-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: var(--underline-thickness);
  background: linear-gradient(90deg, var(--brand-light) 0%, var(--brand-deep) 100%);
  border-radius: 1px;
  transform-origin: left center;
  animation: page-title-underline-grow var(--duration-slow) var(--ease-out) 80ms both;
}

@keyframes page-title-underline-grow {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-title::after {
    animation: none;
  }
}

.main-content {
  padding: 28px 24px 48px;
  background: var(--surface);
}

.bottom-band {
  display: none;
}

.site-footer {
  background: var(--footer-bg-color);
  color: #fff;
  padding: 54px 0 60px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footer-links a {
  color: #fff;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-sep {
  color: rgba(255, 255, 255, 0.6);
}

.footer-copy {
  margin: 0;
  font-size: 12px;
}

.footer-text {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  :root {
    --logo-width: 180px;
    --logo-height: 40px;
    --logo-top: 12px;
    --logo-left: 16px;
    --lang-top: 16px;
    --lang-right: 16px;
    --auth-right: 96px;
  }

  .container {
    padding: 0 16px;
  }

  .main-content {
    padding: 20px 16px 36px;
    border-left: none;
    border-right: none;
  }

  .page-title {
    font-size: 24px;
  }

  .header-breadcrumb-list {
    font-size: 13px;
    gap: 6px;
  }
}
