/* Colours are sampled from the logo: gold #E7AC06 and near-black ink, on white.
   The logo's PNG is transparent with black lettering, so it always sits on a light surface. */

/* Noto Sans JP draws the bar on long vowels such as the o in Shōgō to the right of the letter,
   so those letters alone come from a system font. Where none of these exist, Noto Sans JP is still used. */
@font-face {
  font-family: "Latin Long Vowels";
  src: local("Segoe UI"), local("Roboto"), local("Helvetica Neue"), local("Arial");
  unicode-range: U+0100-017F;
}

:root {
  --gold: #e7ac06;
  --gold-hover: #cf9a05;
  --gold-deep: #7d5c00;
  --gold-wash: #fdf6df;
  --ink: #0a0a0a;
  --ink-soft: #35322b;
  --muted: #5f5a4e;
  --paper: #ffffff;
  --paper-warm: #faf8f2;
  --line: #e6e1d4;
  --line-strong: #bdb6a4;
  --ok: #1c6636;
  --ok-wash: #e8f4ec;
  --bad: #a11f16;
  --bad-wash: #fbeceb;
  --warn-wash: #fdf6df;
  --font-display: "Barlow Condensed", "Arial Narrow", "Noto Sans JP", sans-serif;
  --font-body: "Latin Long Vowels", "Noto Sans JP", "Yu Gothic", "Hiragino Sans", "Segoe UI", system-ui, sans-serif;
  --font-brush: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: 16px;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

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

a { color: var(--gold-deep); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 .5em;
  letter-spacing: .01em;
}
h1 { font-size: clamp(2.1rem, 5vw, 3rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

.lead { font-size: 1.08rem; color: var(--ink-soft); max-width: 62ch; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 800px; }
.wrap-auth { max-width: 460px; }
.page { padding-top: 32px; padding-bottom: 64px; }
.center-page { text-align: center; padding-top: 80px; }
.center-page .lead { margin-inline: auto; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; color: #fff; }

/* Header: white so the logo's black lettering stays legible, closed by the logo's gold. */
.site-header { background: var(--paper); border-bottom: 5px solid var(--gold); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand img { width: 44px; height: 56px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .03em; }
.brand-text span { font-size: .78rem; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-nav a:not(.btn), .link-button { display: inline-block; padding: 10px 0; color: var(--ink); font-weight: 500; text-decoration: none; font-size: .95rem; }
.site-nav a:not(.btn):hover, .link-button:hover { text-decoration: underline; }
.link-button { background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* Buttons: gold always carries black text. Gold text on white fails contrast. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid transparent; border-radius: 3px;
  padding: 9px 20px; min-height: 44px;
  font-family: var(--font-body); font-weight: 700; font-size: .95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .12s ease;
}
.btn-gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--ink); }
.btn-outline { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-danger { background: var(--paper); color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-small { padding: 5px 12px; min-height: 36px; font-size: .86rem; }
.btn-large { padding: 12px 26px; min-height: 52px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn-push-right { margin-left: auto; }

/* Home */
.hero { background: var(--paper); padding: 48px 0 56px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 40px; }
.eyebrow { font-size: 1.15rem; font-weight: 700; color: var(--gold-deep); margin: 0 0 8px; letter-spacing: .06em; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 4.8rem); text-transform: uppercase; letter-spacing: .015em; line-height: .98; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 14px; }
.hero-note { color: var(--muted); margin: 0; }
.hero-note strong { color: var(--ink); }
.hero-logo { text-align: center; }
.hero-logo img { width: min(100%, 370px); }

.band { padding: 56px 0; }
.band-paper { background: var(--paper-warm); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: 2.1rem; text-transform: uppercase; margin-bottom: 24px; }

.need-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.need { border-top: 4px solid var(--gold); padding-top: 14px; }
.need p { margin: 0; color: var(--ink-soft); }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 32px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; column-gap: 12px; }
.steps li::before {
  content: counter(step); grid-row: span 2;
  width: 44px; height: 44px; border-radius: 50%; border: 5px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
}
.steps strong { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.2; }
.steps span { color: var(--ink-soft); font-size: .95rem; }

.cta { background: var(--ink); color: #fff; padding: 36px 0; }
.cta-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.cta-row > div { flex: 1; min-width: 220px; }
.cta h2 { margin: 0; font-size: 2rem; text-transform: uppercase; }
.cta p { margin: 4px 0 0; color: #d9d5ca; }
.cta-kanji { font-family: var(--font-brush); font-size: 2.2rem; color: var(--gold); margin: 0; letter-spacing: .08em; }

/* Home: organization content */
.anchor-target { scroll-margin-top: 16px; }
.section-lead { max-width: 78ch; margin: 0 0 32px; font-size: 1.02rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 16px 40px; align-items: start; }
.prose { max-width: 72ch; color: var(--ink-soft); }
.prose p { margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }

.smart { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 32px; }
.smart li { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 14px; align-items: start; }
.smart-letter {
  width: 56px; height: 56px; border-radius: 50%; border: 6px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1;
}
.smart h3 { margin: 2px 0 4px; }
.smart p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.band-ink { background: var(--ink); color: #f3f0e8; }
.band-ink .section-title { color: var(--gold); margin-bottom: 14px; }
.purpose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 56px; }
.purpose-grid p { margin: 0; }

.member-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.member-type { display: flex; flex-direction: column; align-items: flex-start; padding: 24px; border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: 3px; }
.member-type h3 { font-size: 1.6rem; }
.member-type h4 { margin: 4px 0 8px; font-size: 1rem; }
.member-type p { margin: 0 0 16px; color: var(--ink-soft); }
.member-type ul { margin: 0 0 22px; padding-left: 20px; color: var(--ink-soft); flex: 1; }
.member-type li { margin-bottom: 6px; }
.member-type .btn { margin-top: auto; }
.member-type-note { font-size: .92rem; }

@media (max-width: 860px) {
  .split, .purpose-grid, .member-types { grid-template-columns: 1fr; }
  .smart { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .header-row { gap: 4px 16px; }
  .site-nav { gap: 12px; width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .site-nav a:not(.btn), .link-button { font-size: .88rem; white-space: nowrap; }
  .site-nav .btn { flex: none; }
  .smart { grid-template-columns: 1fr; }
  .member-type .btn { width: 100%; }
}

/* Member dashboard */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dash { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 32px; align-items: start; }
.dash-photo { display: block; width: 132px; height: 132px; border-radius: 50%; object-fit: cover; object-position: top; border: 5px solid var(--gold); background: var(--paper-warm); }
.dash-name { font-size: 1.9rem; margin: 14px 0 0; overflow-wrap: anywhere; }
.dash-kana { margin: 2px 0 6px; font-weight: 700; color: var(--ink-soft); overflow-wrap: anywhere; }
.dash-rank { margin: 0 0 8px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-contact { margin: 0; font-size: .92rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.dash-nav { display: flex; flex-direction: column; margin: 18px 0 14px; border-top: 1px solid var(--line); }
.dash-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 2px; color: var(--ink); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--line); }
.dash-nav a:hover { color: var(--gold-deep); }
.dash-nav a.nav-alert { color: var(--bad); font-weight: 700; }
.dash-more { margin: 0 0 6px; font-size: .88rem; }
.dash-alert { display: block; text-decoration: none; color: var(--bad); }
.dash-alert:hover { color: var(--bad); text-decoration: underline; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.overview { padding: 16px 18px; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 3px; min-width: 0; }
.overview-alert { border-color: var(--bad); }
.overview-alert .overview-value { color: var(--bad); }
.overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.overview-head h3 { margin: 0; font-size: 1.15rem; }
.overview-head a { font-size: .86rem; }
.overview-value { margin: 6px 0 8px; font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.overview-number { font-family: var(--font-display); font-size: 2.5rem; line-height: 1; }
.dash-foot { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 20px; padding-top: 14px; border-top: 2px solid var(--ink); font-size: .92rem; overflow-wrap: anywhere; }
.dash-photo-logo { object-fit: contain; object-position: center; padding: 14px; background: #fff; }
.dash-panel { margin-top: 20px; }
.apply-switch { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.apply-switch > div { flex: 1 1 260px; min-width: 0; }
.apply-switch form { margin: 0; }
.apply-switch-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.apply-switch-title h3 { margin: 0; font-size: 1.15rem; }

.ladder { display: flex; gap: 3px; margin: 4px 0 6px; }
.ladder-step { flex: 1; height: 10px; background: var(--line); border-radius: 2px; }
.ladder-step.is-done { background: var(--gold); }
.ladder-caption { margin: 0 0 4px; font-size: .84rem; color: var(--muted); }

.pathway { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.pathway-step { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 3px; }
.pathway-number { width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; border: 3px solid var(--line); }
.pathway-name { flex: 1; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.pathway-state { font-size: .78rem; color: var(--muted); }
.pathway-step.is-done .pathway-number { background: var(--gold); border-color: var(--gold); }
.pathway-step.is-current { border-color: var(--ink); }
.pathway-step.is-current .pathway-number { background: var(--ink); border-color: var(--ink); color: #fff; }
.pathway-step.is-current .pathway-state { color: var(--ink); font-weight: 700; }
.pathway-step.is-next .pathway-number { border-color: var(--gold); }
.pathway-step.is-locked { background: var(--paper-warm); color: var(--muted); }

.exam-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rich-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.requirement-list { list-style: none; margin: 8px 0 0; padding: 0; }
.requirement-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.requirement-list li > span:first-child { flex: 1 1 220px; }
.requirement-list form { margin: 0; }
.requirement-list .is-done > span:first-child { color: var(--muted); }

.waiver-text { max-height: 420px; overflow-y: auto; padding: 14px; background: var(--paper-warm); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.stack-small, .field-help.stack-small { margin-top: 12px; margin-bottom: 12px; }
.field[hidden] { display: none; }
.score-sheet input { min-width: 78px; }
.score-sheet td:nth-child(3) input { min-width: 180px; }
.score-sheet label { font-weight: 400; margin: 0; }
.score-total { text-align: right; font-size: 1.2rem; margin: 12px 0; }
.score-total strong, .score-total-value { color: var(--bad); font-weight: 700; }
.consent-choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.consent-choice legend { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; padding: 0; margin-bottom: 6px; }
.consent-choice label { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0; font-weight: 400; }
.consent-choice input { flex: none; width: auto; margin: 5px 0 0; }
.signature-canvas { display: block; width: 100%; height: 190px; background: #fff; border: 2px dashed var(--line-strong); border-radius: 3px; touch-action: none; cursor: crosshair; }
.signature-canvas:focus-visible { outline: 3px solid var(--gold); }
.signature-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.certificate-preview { display: block; width: 100%; max-width: 420px; height: auto; margin-top: 16px; border: 1px solid var(--line-strong); }

.dojo-title { margin: 0 0 2px; }
.student-photo { width: 120px; height: 150px; object-fit: cover; object-position: top; border: 1px solid var(--line-strong); }
.student-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.student-head > div { flex: 1 1 240px; min-width: 0; }
.tally-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tally { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); text-decoration: none; }
.tally:hover { border-color: var(--ink); color: var(--ink); }
.tally strong { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.tally span { font-size: .85rem; color: var(--muted); }
details.history { border: 1px solid var(--line); border-radius: 3px; margin-bottom: 14px; }
details.history > summary { padding: 11px 14px; cursor: pointer; font-weight: 500; }
details.history > .table-wrap { border: 0; border-top: 1px solid var(--line); }
.curriculum-level { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.curriculum-level h2 { font-size: 1.15rem; margin: 14px 0 4px; }
.curriculum-belt { display: block; width: 120px; height: 120px; margin-top: 14px; }
.curriculum-diagram { display: block; width: 100%; max-width: 480px; height: auto; margin: 14px auto 0; }
.curriculum-section { display: inline-block; font-size: 1.15em; font-weight: 700; border-bottom: 2px solid var(--gold); }
.curriculum-inline-belt { display: inline-block; width: 96px; height: 96px; vertical-align: middle; }
.curriculum-columns { column-gap: 28px; column-rule: 1px solid var(--line); margin: 6px 0; }
.curriculum-columns-2 { column-count: 2; }
.curriculum-columns-3 { column-count: 3; }
.curriculum-col-break { display: block; break-after: column; }
.rich-editor .curriculum-columns { outline: 1px dashed var(--line-strong); outline-offset: 2px; }
.rich-editor .curriculum-col-break { margin: 4px 0; border-top: 2px dashed var(--gold); }
@media (max-width: 600px) {
  /* Columns too narrow to read become one, so members never scroll sideways on a phone. */
  .curriculum-columns-2, .curriculum-columns-3 { column-count: 1; }
  .curriculum-col-break { break-after: auto; }
}
.tc-black { color: #000000; }
.tc-red { color: #c00000; }
.tc-orange { color: #c55a11; }
.tc-gold { color: #a67c00; }
.tc-green { color: #2e7d32; }
.tc-blue { color: #0b5394; }
.tc-purple { color: #674ea7; }

/* The curriculum editor's toolbar, laid out like a word processor's. */
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 6px 8px; background: #f5f3ec; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 3px 3px 0 0; }
.rich-toolbar[hidden] { display: none; }
.schedule-options { margin: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 3px; }
.schedule-options legend { padding: 0 4px; font-weight: 700; }
.schedule-options label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-weight: 500; }
.schedule-options input[type="checkbox"] { width: auto; margin: 0; }
.shogo-title.is-held { border-left: 5px solid var(--gold); }
.rich-group { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.rich-button { min-width: 30px; height: 30px; padding: 0 6px; font: inherit; font-size: .9rem; line-height: 1; background: #fff; border: 1px solid var(--line-strong); border-radius: 3px; cursor: pointer; }
.rich-button:hover { background: #fbf3d6; }
.rich-button:focus-visible, .rich-select:focus-visible { outline: 3px solid var(--gold); }
.rich-bold { font-weight: 700; }
.rich-italic { font-style: italic; }
.rich-underline { text-decoration: underline; }
.rich-colour { font-weight: 700; border-bottom-width: 4px; border-bottom-color: currentColor; }
.rich-wide { white-space: nowrap; }
.rich-label { font-size: .85rem; }
.rich-select { height: 30px; max-width: 190px; font: inherit; font-size: .9rem; background: #fff; border: 1px solid var(--line-strong); border-radius: 3px; }
.rich-editor { min-height: 130px; max-height: 460px; overflow: auto; padding: 10px; background: #fff; border: 1px solid var(--line-strong); border-radius: 0 0 3px 3px; }
.rich-editor:focus { outline: 3px solid var(--gold); outline-offset: -1px; }
.rich-editor-large { min-height: 320px; max-height: 70vh; display: flow-root; }
.rich-editor .is-selected { outline: 3px solid var(--gold); outline-offset: 2px; }
.rich-toolbar input.rich-number { width: 56px; height: 30px; min-height: 0; padding: 0 4px; font: inherit; font-size: .9rem; background: #fff; border: 1px solid var(--line-strong); border-radius: 3px; }

.id-card-preview { display: block; width: 100%; height: auto; }

/* Pictures, videos and tables in resources. */
.resource-body { display: flow-root; }
.resource-image { height: auto; max-width: 100%; border-radius: 3px; }
.resource-image-s { width: 25%; }
.resource-image-m { width: 50%; }
.resource-image-l { width: 75%; }
.resource-image-f { width: 100%; }
.resource-align-l { float: left; margin: 4px 14px 8px 0; }
.resource-align-r { float: right; margin: 4px 0 8px 14px; }
.resource-align-c { display: block; margin: 8px auto; }
.resource-video { display: block; width: 100%; max-width: 100%; margin: 8px 0; background: #000; border-radius: 3px; }
.curriculum-table { display: block; max-width: 100%; margin: 8px 0; overflow-x: auto; border-collapse: collapse; }
.curriculum-table td { min-width: 70px; padding: 6px 10px; vertical-align: top; border: 1px solid var(--line-strong); }
.curriculum-columns .resource-image, .curriculum-columns .resource-video, .curriculum-columns .curriculum-table { break-inside: avoid; }
@media (max-width: 640px) {
  .resource-image-s { width: 40%; }
  .resource-image-m, .resource-image-l { width: 100%; }
  .resource-image-m.resource-align-l, .resource-image-m.resource-align-r, .resource-image-l.resource-align-l, .resource-image-l.resource-align-r { float: none; display: block; margin: 8px 0; }
}
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; margin: 12px 0; }
.check-list label { display: flex; align-items: flex-start; font-weight: 400; }
.check-list-scroll { max-height: 320px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); background: var(--paper-warm); }

@media (max-width: 860px) {
  .dash { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* Admin panel: the same left sidebar on every page. */
.admin-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; max-width: 1360px; margin: 0 auto; padding: 28px var(--gutter) 56px; }
.admin-side { --sidebar-dim: #FAEFC8; --sidebar-strong: #F3DC8F; --sidebar-line: #E8D391; position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow-y: auto; padding: 14px 12px; background: var(--sidebar-dim); border-radius: 4px; }
.admin-profile { display: flex; gap: 10px; align-items: center; padding-bottom: 12px; }
.admin-profile img { flex: none; width: 48px; height: auto; }
.admin-profile img.admin-icon { width: 54px; }
.admin-profile > div { min-width: 0; }
.admin-name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.15; overflow-wrap: anywhere; }
.admin-role { margin: 0; font-size: .85rem; font-weight: 700; }
.admin-profile .dash-contact { font-size: .74rem; color: var(--ink); }
.admin-menu, .member-menu { display: flex; flex-direction: column; border-top: 1px solid var(--sidebar-line); }
.admin-menu a, .member-menu a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem; line-height: 1.35; border-bottom: 1px solid var(--sidebar-line); border-left: 4px solid transparent; }
.admin-menu a:hover, .member-menu a:hover { color: var(--ink); background: var(--sidebar-strong); }
.admin-menu a.is-current, .member-menu a.is-current { font-weight: 700; border-left-color: var(--ink); background: var(--sidebar-strong); }
.admin-menu a.nav-alert, .member-menu a.nav-alert { color: var(--bad); font-weight: 700; }
.admin-menu .badge-gold { background: var(--ink); color: #fff; }
.member-profile { flex-direction: column; text-align: center; gap: 4px; }
.admin-profile img.member-avatar { display: block; width: 104px; height: 104px; border-radius: 50%; object-fit: cover; object-position: top; border: 4px solid var(--gold); background: #fff; }
.member-details { width: 100%; }
.member-kana { margin: 0; font-size: .82rem; font-weight: 700; overflow-wrap: anywhere; }
.member-photo-link { margin: 0 0 6px; font-size: .78rem; }
.member-contact { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--sidebar-line); font-size: .8rem; line-height: 1.35; text-align: left; }
.member-contact dt { font-weight: 700; }
.member-contact dd { margin: 0 0 6px; overflow-wrap: anywhere; }
.photo-change { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.photo-change .field { flex: 1 1 240px; min-width: 0; }
.admin-main { min-width: 0; }
.admin-main .wrap { max-width: none; padding: 0; margin: 0; }
.admin-main .wrap-narrow { max-width: 800px; }
.admin-main .page { padding-top: 0; padding-bottom: 0; }
.admin-main h1 { margin-top: 0; }

@media (max-width: 860px) {
  /* On a phone the tabs become one line that scrolls sideways, so the page itself stays near the top. */
  .admin-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 12px; }
  .admin-side { position: static; max-height: none; overflow: hidden; padding: 0; }
  .admin-profile { display: none; }
  .member-profile { display: flex; padding: 12px 12px 10px; }
  .admin-menu, .member-menu { flex-direction: row; overflow-x: auto; border-top: 0; -webkit-overflow-scrolling: touch; }
  .admin-menu a, .member-menu a { flex: none; white-space: nowrap; border-bottom: 4px solid transparent; border-left: 0; padding: 10px 12px; }
  .admin-menu a.is-current, .member-menu a.is-current { border-left: 0; border-bottom-color: var(--ink); }
}

@media (max-width: 600px) {
  .overview-grid, .pathway { grid-template-columns: 1fr; }
}

/* Progress */
.progress { list-style: none; margin: 0 0 28px; padding: 0; display: flex; gap: 6px; counter-reset: p; }
.progress li {
  counter-increment: p; flex: 1;
  border-top: 5px solid var(--line);
  padding-top: 7px; font-size: .86rem; color: var(--muted);
}
.progress li.is-done { border-color: var(--ink); color: var(--ink); }
.progress li.is-current { border-color: var(--gold); color: var(--ink); font-weight: 700; }

/* Forms */
.form-section { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 22px 0 8px; min-width: 0; }
.form-section legend { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; padding: 0 12px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-weight: 500; font-size: .93rem; }
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  background: var(--paper); color: var(--ink);
  font: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 0; border-color: var(--ink); }
input[type="file"] { width: 100%; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 3px; background: var(--paper-warm); font: inherit; font-size: .9rem; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); margin: 3px 8px 0 0; flex: none; }
.input-validation-error { border-color: var(--bad) !important; }
.field-help { font-size: .84rem; color: var(--muted); margin: 0; }
.field-error { font-size: .88rem; color: var(--bad); font-weight: 500; }
.field-error:empty { display: none; }
.field-check { margin-top: 20px; }
.field-check label { display: flex; align-items: flex-start; font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }
.input-with-button .btn { flex: none; min-height: 44px; }
.input-katakana { font-size: 1.1rem; }
.photo-preview { width: 140px; aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--line-strong); margin-top: 8px; }
.validation-summary-valid { display: none; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

.alert { padding: 11px 14px; border-radius: 3px; border-left: 5px solid var(--line-strong); background: var(--paper-warm); margin: 0 0 18px; }
.alert-ok { background: var(--ok-wash); border-color: var(--ok); }
.alert-bad { background: var(--bad-wash); border-color: var(--bad); }
.alert-warn { background: var(--warn-wash); border-color: var(--gold); }
main > .wrap > .alert:first-child { margin-top: 18px; margin-bottom: 0; }

/* Panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 20px; margin-bottom: 20px; min-width: 0; }
.panel h2 { font-size: 1.45rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.panel-head h2 { margin-bottom: 2px; }
.panel-decide { border-top: 5px solid var(--gold); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stack { margin-top: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.breadcrumb { margin: 0 0 10px; font-size: .92rem; }
.breadcrumb a::before { content: "← "; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.title-row h1 { margin: 0; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-wide { grid-template-columns: minmax(130px, 200px) minmax(0, 1fr); padding-bottom: 8px; }
.mono { font-family: var(--font-mono); font-size: .88em; overflow-wrap: anywhere; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: #eeebe2; color: var(--ink-soft); }
.badge-gold { background: var(--gold); color: var(--ink); }
.badge-ok { background: var(--ok-wash); color: var(--ok); }
.badge-bad { background: var(--bad-wash); color: var(--bad); }

/* Payment */
.pay-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.fee-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-top: 2px solid var(--ink); margin: 16px 0 0; padding-top: 12px; }
.fee-line strong { font-family: var(--font-display); font-size: 1.7rem; white-space: nowrap; }
.panel-pay { border-top: 5px solid var(--gold); }
#paypal-buttons { min-height: 120px; }
.sim-box { background: var(--warn-wash); border: 2px dashed var(--gold-deep); padding: 14px; margin-bottom: 12px; }
.sim-box p { margin: 0 0 12px; font-size: .93rem; }

/* Auth */
.auth-card { text-align: left; }
.auth-logo { display: block; margin: 0 auto 18px; width: 120px; }
.auth-card h1 { font-size: 2.3rem; }
.auth-links { margin: 14px 0 0; font-size: .95rem; }

/* Member profile: photograph left, Katakana on its right, rank directly under the name. */
.member-card {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: center;
  padding: 24px; margin-bottom: 20px;
  border: 1px solid var(--line); border-top: 6px solid var(--gold); border-radius: 3px;
  background: var(--paper);
}
.member-photo img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border: 1px solid var(--line-strong); background: var(--paper-warm); }
.member-identity { min-width: 0; }
.member-katakana { margin: 0 0 2px; font-size: clamp(1.25rem, 3vw, 1.8rem); font-weight: 700; color: var(--ink-soft); letter-spacing: .06em; overflow-wrap: anywhere; }
.member-name { font-size: clamp(2.3rem, 6vw, 3.8rem); text-transform: uppercase; margin: 0 0 6px; overflow-wrap: anywhere; }
.member-rank { margin: 0 0 10px; font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rank-kanji { font-family: var(--font-brush); background: var(--gold); color: var(--ink); padding: 1px 10px; border-radius: 2px; }
.member-license { margin: 0 0 10px; font-weight: 500; color: var(--ink-soft); }
.member-tag { display: inline-block; margin: 4px 0 0; padding: 3px 12px; background: var(--ink); color: #fff; font-family: var(--font-display); font-weight: 600; letter-spacing: .08em; font-size: .95rem; }

/* Admin */
.admin-nav { display: flex; gap: 2px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line-strong); margin-bottom: 26px; }
.admin-nav a { padding: 7px 0; color: var(--ink-soft); text-decoration: none; font-weight: 500; border-bottom: 4px solid transparent; margin-bottom: -1px; }
.admin-nav a:hover { color: var(--ink); border-color: var(--line-strong); }
.admin-nav a.is-current { color: var(--ink); border-color: var(--gold); font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0 22px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); text-decoration: none; }
.stat:hover { border-color: var(--ink); color: var(--ink); }
.stat-primary { background: var(--gold); border-color: var(--gold); }
.stat-primary .stat-label { color: var(--ink); }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .9rem; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px; margin-bottom: 18px; background: var(--paper-warm); border: 1px solid var(--line); border-radius: 3px; }
.filter-bar .field { margin: 0; flex: 1 1 170px; }
.result-count { color: var(--muted); margin: 0 0 8px; font-size: .92rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
.panel .table-wrap { border: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--paper-warm); padding: 9px 12px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-action { text-align: right; white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }
.cell-details { min-width: 240px; font-size: .86rem; overflow-wrap: anywhere; }
.cell-member { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-member img { width: 40px; height: 40px; object-fit: cover; object-position: top; border-radius: 50%; border: 2px solid var(--gold); flex: none; }
.cell-member small { color: var(--muted); }

.empty-state { padding: 36px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 3px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; font-size: .92rem; }

.review-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.doc { margin: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.doc figcaption { font-weight: 500; font-size: .93rem; }
.doc img { display: block; max-height: 320px; width: auto; border: 1px solid var(--line-strong); }
.doc-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%; min-height: 180px; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper-warm); font-weight: 700; overflow-wrap: anywhere; }
.doc-pdf small { font-weight: 400; color: var(--muted); }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 8px 0 14px; }
.perm { display: flex; align-items: flex-start; }
.perm span { display: flex; flex-direction: column; }
.perm strong { font-weight: 500; }
.perm small { color: var(--muted); }

.site-footer { background: var(--paper-warm); border-top: 5px solid var(--gold); padding: 20px 0; font-size: .9rem; }
.footer-row { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.footer-contact { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); }

@media (max-width: 860px) {
  .hero { padding-top: 24px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-logo { order: -1; }
  .hero-logo img { width: 200px; }
  .need-grid { grid-template-columns: 1fr; gap: 20px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-grid, .two-col, .pay-layout { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .member-card { grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 14px; align-items: start; }
  .member-rank { font-size: 1.02rem; }
  .doc-grid { grid-template-columns: 1fr; }
  .kv-wide { grid-template-columns: minmax(100px, 38%) minmax(0, 1fr); }
  .input-with-button { flex-direction: column; }
  .hero-actions .btn { flex: 1 1 100%; }
  .btn-push-right { margin-left: 0; }
}
