@font-face {
  font-family: "Noto Serif CJK JP";
  src: local("Noto Serif CJK JP"), local("Noto Serif CJK JP Regular");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Serif CJK JP";
  src: local("Noto Serif CJK JP Bold"), local("Noto Serif CJK JP");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "BIZ UDPMincho";
  src: local("BIZ UDPMincho"), local("BIZ UDPMincho Regular");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "BIZ UDPMincho";
  src: local("BIZ UDPMincho Bold"), local("BIZ UDPMincho");
  font-weight: 700; font-style: normal; font-display: swap;
}
:root {
  --bg: #F4F1EA;
  --surface: #FFFFFF;
  --surface-2: #E8E4DB;
  --ink: #1A1F1C;
  --muted: #6B726C;
  --green: #00442d;
  --gold: #C4A574;
  --sage: #5B8A72;
  --coral: #D17A6A;
  --link: #5B7C8A;
  --r: 14px;
  --shadow-1: 0 1px 2px rgba(26,31,28,.04), 0 4px 12px rgba(26,31,28,.06);
  --shadow-2: 0 4px 10px rgba(26,31,28,.07), 0 12px 28px rgba(26,31,28,.10);
  --shadow-3: 0 10px 20px rgba(26,31,28,.10), 0 24px 48px rgba(26,31,28,.14);
  --font: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Noto Serif JP", "Sawarabi Mincho", "Noto Serif CJK JP", "Source Han Serif JP", "IPAexMincho", "BIZ UDPMincho", serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-width: 1024px; min-height: 100vh; overflow: auto; background: var(--bg); color: var(--ink); font-family: var(--font); }
html, body, button, input, select, textarea {
  font-family: var(--font) !important;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; }
body.page-enter { opacity: 0; }
body.page-enter-done { opacity: 1; transition: opacity .18s ease; }
body.page-leave { opacity: 0; transform: scale(0.995); transition: opacity .16s ease, transform .16s ease; }

.topbar {
  height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: rgba(255,255,255,.72); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(196,165,116,.35); flex-shrink: 0;
}
.logo {
  width: 92px; height: 36px; background: var(--green); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: #fff; font-weight: 700; letter-spacing: .08em; font-size: 15px;
  text-decoration: none;
}
.logo img { height: 22px; width: auto; display: block; }
.brand { font-size: 16px; font-weight: 700; white-space: nowrap; }
.search {
  flex: 1; max-width: 420px; margin-left: 12px; height: 38px; border-radius: 999px;
  border: 1px solid rgba(26,31,28,.08); background: #fff; display: flex; align-items: center;
  gap: 8px; padding: 0 14px; color: var(--muted); font-size: 13px; box-shadow: var(--shadow-1);
}
.search .ico { opacity: .55; }
.userchip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(145deg, #E8E4DB, #C4A574);
  border: 2px solid #fff; box-shadow: var(--shadow-1);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--green);
}
.uname { font-size: 13px; }
.sso {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(0,68,45,.08); color: var(--green); border: 1px solid rgba(0,68,45,.18);
}
.logout {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: #fff; color: var(--muted); border: 1px solid rgba(26,31,28,.1);
  text-decoration: none; font-family: inherit;
}
.logout:hover { color: var(--green); border-color: rgba(0,68,45,.25); }
.shell { flex: 1; display: flex; min-height: 0; }
.nav {
  width: 210px; padding: 18px 12px; border-right: 1px solid rgba(196,165,116,.28);
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(244,241,234,.35));
  display: flex; flex-direction: column; gap: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 12px; color: var(--muted); font-size: 13px; position: relative;
  cursor: pointer; text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.nav-item .dot {
  width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--gold);
  flex-shrink: 0;
}
.nav-item.active {
  background: rgba(0,68,45,.10); color: var(--green); font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0,68,45,.12);
}
.nav-item.active .dot { background: var(--green); border-color: var(--green); color: #fff; }
.nav-item:hover { background: rgba(0,68,45,.06); color: var(--green); }
.main { flex: 1; padding: 22px 24px 20px; overflow: auto; position: relative; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: .02em; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; background: #fff;
  border: 1px solid rgba(26,31,28,.08); color: var(--muted); font-size: 12px;
  display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-1);
}
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 999px; font-size: 10px; background: var(--green); color: #fff;
}
.badge.soft { background: rgba(0,68,45,.10); color: var(--green); }
.badge.warn { background: rgba(209,122,106,.15); color: var(--coral); }
.badge.gold { background: rgba(196,165,116,.22); color: #8a6d3f; border: 1px solid rgba(196,165,116,.45); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }

.card {
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow-1); border: 1px solid rgba(26,31,28,.05);
  padding: 16px 16px 14px; position: relative;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, opacity .2s ease;
  cursor: pointer;
}
.card.l2 { background: linear-gradient(180deg, #fff, #FBF9F4); box-shadow: var(--shadow-2); border-color: rgba(196,165,116,.22); }
.card:hover, .card.l3, .card.hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-3);
  border-color: rgba(0,68,45,.18);
}
.card .card-kicker { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card h3 { font-size: 16px; font-weight: 700; }
.card .meta { font-size: 11px; color: var(--muted); }
.inner {
  background: var(--surface-2); border-radius: 10px; padding: 10px 12px;
  border: 1px solid rgba(26,31,28,.04);
}
.btn {
  height: 32px; padding: 0 14px; border-radius: 10px; border: none;
  background: var(--green); color: #fff; font-family: inherit; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid rgba(196,165,116,.55); }
.btn.soft { background: var(--surface-2); color: var(--ink); border: 1px solid rgba(26,31,28,.06); }
.btn.lg { height: 44px; padding: 0 28px; font-size: 14px; border-radius: 12px; }
.progress {
  height: 8px; border-radius: 999px; background: rgba(26,31,28,.08); overflow: hidden; margin: 8px 0;
}
.progress > i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.progress.sage > i { background: var(--sage); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list .item, .expandable.item {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 8px 10px;
  background: #fff; border-radius: 10px; border: 1px solid rgba(26,31,28,.05);
  cursor: pointer; transition: background .2s ease, transform .2s ease;
}
.list .item:hover, .expandable.item:hover { background: rgba(0,68,45,.06); transform: translateX(2px); }
.list .item.open, .expandable.item.open { background: rgba(0,68,45,.08); }
.list .item .check {
  width: 18px; height: 18px; border-radius: 50%; background: rgba(0,68,45,.1);
  color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0;
}
.item .detail {
  display: grid; grid-template-rows: 0fr; width: 100%;
  font-size: 12px; color: var(--muted); padding-left: 26px;
  transition: grid-template-rows .2s ease, opacity .2s ease, margin .2s ease;
  opacity: 0; margin-top: 0; overflow: hidden;
}
.item .detail > span { min-height: 0; overflow: hidden; }
.item.open .detail {
  grid-template-rows: 1fr; opacity: 1; margin-top: 6px;
}
.tiny { font-size: 11px; color: var(--muted); }
.gold-line { height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 10px 0; }
.icon-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.icon-tile {
  background: #fff; border: 1px solid rgba(26,31,28,.06); border-radius: 10px;
  padding: 10px 8px; text-align: center; font-size: 11px;
}
.icon-tile .g {
  width: 28px; height: 28px; margin: 0 auto 6px; border-radius: 8px;
  border: 1.5px solid var(--gold); display: flex; align-items: center; justify-content: center;
  color: var(--green); font-size: 13px;
}
.org { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.org-root {
  background: var(--green); color: #fff; padding: 8px 18px; border-radius: 10px; font-size: 13px; font-weight: 700;
}
.org-line { width: 2px; height: 16px; background: var(--gold); }
.org-kids { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.org-kid {
  background: #fff; border: 1px solid rgba(196,165,116,.5); padding: 8px 12px; border-radius: 10px;
  font-size: 12px; min-width: 90px; text-align: center; box-shadow: var(--shadow-1);
}
.segbar {
  display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px;
  border: 1px solid rgba(26,31,28,.06);
}
.segbar span {
  padding: 5px 12px; border-radius: 999px; font-size: 11px; color: var(--muted); cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segbar span:hover { color: var(--green); }
.segbar span.on { background: #fff; color: var(--green); font-weight: 700; box-shadow: var(--shadow-1); }
.seg-panel { transition: opacity .18s ease; }
.seg-panel.is-fading { opacity: 0; }
.hero-banner {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(0,68,45,.06), rgba(196,165,116,.12));
  border: 1px solid rgba(196,165,116,.35);
}
.hero-banner strong { font-size: 14px; }
.hero-banner span { font-size: 11px; color: var(--muted); }
.foot-note {
  position: absolute; right: 20px; bottom: 12px; font-size: 10px; color: var(--muted);
  background: rgba(255,255,255,.7); padding: 4px 8px; border-radius: 8px;
}
.expand-panel {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: linear-gradient(180deg, #fff, #F7F4EC);
  border: 1px solid rgba(0,68,45,.15); box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .2s ease, opacity .2s ease, margin .2s ease;
  overflow: hidden;
}
.expand-panel > .inner-wrap { min-height: 0; overflow: hidden; }
.card.is-expanded .expand-panel,
.expand-panel.open {
  grid-template-rows: 1fr; opacity: 1;
}

/* Stagger entrance — static offset + animated settle on load */
.stagger-0, .stagger-1, .stagger-2, .stagger-3 {
  opacity: 0;
  transform: translateY(18px);
}
.stagger-ready .stagger-0 { animation: cardIn .32s ease forwards; animation-delay: 0ms; }
.stagger-ready .stagger-1 { animation: cardIn .36s ease forwards; animation-delay: 70ms; }
.stagger-ready .stagger-2 { animation: cardIn .4s ease forwards; animation-delay: 140ms; }
.stagger-ready .stagger-3 { animation: cardIn .44s ease forwards; animation-delay: 210ms; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Keep hover lift after entrance */
.stagger-ready .card.stagger-0:hover,
.stagger-ready .card.stagger-1:hover,
.stagger-ready .card.stagger-2:hover,
.stagger-ready .card.stagger-3:hover {
  transform: translateY(-6px);
}

/* Login page — no desktop min-width; touch-safe CTAs (iPhone Chrome) */
html.login-page,
html.login-page body,
body.login-page,
html:has(body.login-page) {
  min-width: 0 !important;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
body.login-page {
  display: block;
}
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px 16px;
  width: 100%;
  box-sizing: border-box;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 18px; padding: 36px 32px 28px;
  box-shadow: var(--shadow-2); border: 1px solid rgba(196,165,116,.28);
  text-align: center;
  position: relative; z-index: 1;
}
.login-card .logo { margin: 0 auto 18px; }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.login-card p { font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-actions {
  display: flex; flex-direction: column; gap: 12px;
  position: relative; z-index: 2;
}
a.login-cta.btn,
.login-card .btn,
.login-card a.btn {
  width: 100%;
  min-height: 48px;
  height: auto;
  padding: 12px 20px;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  z-index: 3;
  -webkit-tap-highlight-color: rgba(0, 68, 45, 0.15);
  user-select: none;
  box-sizing: border-box;
}

.login-bypass {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 18px; padding: 14px 12px;
  background: rgba(0,68,45,.06);
  border: 1px solid rgba(0,68,45,.22);
  border-radius: 14px;
  position: relative; z-index: 4;
}
.login-bypass-label {
  margin: 0 0 2px !important;
  font-size: 12px !important;
  font-weight: 700;
  color: var(--green) !important;
}
.login-bypass-cta {
  box-shadow: var(--shadow-1);
}
.login-post-fallback {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.login-actions { margin-top: 4px; }
.login-hint { margin-top: 18px; font-size: 11px; color: var(--muted); }
.login-hint code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-family: inherit; word-break: break-all; }
@media (max-width: 480px) {
  .login-card { padding: 28px 20px 22px; border-radius: 14px; }
  .login-card h1 { font-size: 20px; }
}

/* —— Layout DnD (snap on release, dashed placeholder) —— */
.drag-handle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(26,31,28,.10);
  background: rgba(255,255,255,.92);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit !important;
  box-shadow: var(--shadow-1);
  opacity: .72;
  transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}
.card:hover .drag-handle,
.drag-handle:focus-visible { opacity: 1; color: var(--green); border-color: rgba(0,68,45,.28); }
.drag-handle:active { cursor: grabbing; }
.card[data-layout-id] { padding-right: 40px; }
.card.is-dragging {
  opacity: .35;
  transform: none !important;
  box-shadow: var(--shadow-1) !important;
  pointer-events: none;
}
.layout-placeholder {
  border-radius: var(--r);
  border: 2px dashed rgba(0,68,45,.45);
  background: rgba(0,68,45,.05);
  box-shadow: none;
  min-height: 88px;
  pointer-events: none;
}
.stack > .layout-placeholder { width: 100%; }
.layout-reset,
.layout-reset-wrap .layout-reset {
  font-size: 11px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-family: inherit !important;
  white-space: nowrap;
  margin-left: 8px;
}
.layout-reset:hover { color: var(--green); }
.layout-reset-wrap { display: flex; align-items: center; }
.org-kid[data-layout-id] { position: relative; padding-right: 28px; cursor: grab; }
.org-kid .drag-handle {
  top: 4px; right: 4px; width: 22px; height: 22px; font-size: 12px;
  border-radius: 6px;
}
.list[data-layout-board] > .item[data-layout-id] { position: relative; padding-right: 36px; }
.list[data-layout-board] > .item .drag-handle { top: 6px; right: 6px; }
.list[data-layout-board] > .layout-placeholder { min-height: 44px; border-radius: 10px; }
.org-kids > .layout-placeholder {
  min-width: 90px; min-height: 44px; border-radius: 10px;
}
