/* オンサイト 共通スタイル */

:root {
  --ground: #F1F4F2;
  --surface: #FFFFFF;
  --surface-2: #E6ECE9;
  --ink: #14201D;
  --ink-mute: #55645E;
  --line: #C9D5D0;
  --line-soft: #DDE5E2;
  --accent: #0E5C52;
  --accent-ink: #FFFFFF;
  --accent-soft: #DBE9E5;
  --k-faq: #2F6E96;
  --k-tejun: #0E5C52;
  --k-link: #7A5A16;
  --k-study: #554582;
  --danger: #A8352A;
  --shadow: 0 1px 2px rgba(20, 32, 29, .06), 0 6px 18px -12px rgba(20, 32, 29, .28);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0D1412;
    --surface: #151E1B;
    --surface-2: #1C2724;
    --ink: #E3ECE8;
    --ink-mute: #94A6A1;
    --line: #2B3A36;
    --line-soft: #223029;
    --accent: #55B6A5;
    --accent-ink: #0D1412;
    --accent-soft: #14322D;
    --k-faq: #74AAD0;
    --k-tejun: #55B6A5;
    --k-link: #C9A24A;
    --k-study: #A392D4;
    --danger: #E07463;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 22px -14px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "palt" 1;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 14px 80px; }

/* ---------------- header ---------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ground);
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.brand h1 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 19px;
  margin: 0;
  letter-spacing: .04em;
  font-weight: 600;
}
.brand .sub {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: .02em;
}
.brand .spacer { flex: 1; }
.brand a.edit-link {
  font-size: 12.5px;
  color: var(--ink-mute);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}
.brand a.edit-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- search ---------------- */
.searchbox { position: relative; }
.searchbox input {
  width: 100%;
  font-size: 17px;
  font-family: inherit;
  padding: 14px 44px 14px 44px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.searchbox input:focus { border-color: var(--accent); }
.searchbox .icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  pointer-events: none;
  font-size: 17px;
}
.searchbox .clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: transparent;
  color: var(--ink-mute);
  font-size: 20px; line-height: 1;
  padding: 8px 10px; cursor: pointer;
  display: none;
}
.searchbox.has-value .clear { display: block; }

/* ---------------- chips ---------------- */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
  /* 横に続きがあるときだけ、端に影を出す（端まで来ると自然に消える）。
     携帯では2〜3個しか並ばないので、これが無いと続きに気づけない。 */
  background:
    linear-gradient(to right, var(--ground) 40%, transparent) left center / 32px 100% no-repeat local,
    linear-gradient(to left,  var(--ground) 40%, transparent) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(20,32,29,.16), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(20,32,29,.16), transparent) right center / 12px 100% no-repeat scroll;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-mute);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.chips.sections .chip { font-size: 13px; padding: 5px 12px; }

/* ---------------- results ---------------- */
.meta-line {
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 14px 2px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.meta-line .spacer { flex: 1; }

.group-h {
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-mute);
  margin: 22px 2px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.group-h::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.open { border-color: var(--accent); }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  padding: 14px 14px;
  cursor: pointer;
}
.card-head:hover { background: var(--surface-2); }
.card-head .t { flex: 1; font-weight: 600; }
.card-head .arrow {
  color: var(--ink-mute);
  font-size: 13px;
  transition: transform .15s;
  padding-top: 3px;
}
.card.open .card-head .arrow { transform: rotate(90deg); }

a.card-head { text-decoration: none; }
a.card-head .arrow { transform: none !important; }

.badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  letter-spacing: .06em;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px 6px;
  margin-top: 3px;
  white-space: nowrap;
  font-weight: 700;
}
.b-faq { color: var(--k-faq); }
.b-tejun { color: var(--k-tejun); }
.b-link { color: var(--k-link); }
.b-study { color: var(--k-study); }

.sec {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--surface-2);
  border-radius: 3px;
  padding: 1px 7px;
  margin-top: 3px;
  white-space: nowrap;
}

.card-body {
  padding: 0 16px 16px 16px;
  border-top: 1px solid var(--line-soft);
  margin-top: -1px;
}
.card-body .text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.85;
  padding-top: 14px;
}
.card-body .foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-mute);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.card-body a.go {
  display: inline-block;
  margin-top: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 700;
}

.sample-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--danger);
  border: 1px dashed currentColor;
  border-radius: 4px;
  padding: 6px 10px;
  display: inline-block;
}

mark {
  background: var(--accent-soft);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.empty {
  text-align: center;
  color: var(--ink-mute);
  padding: 50px 20px;
  font-size: 15px;
}
.empty b { display: block; color: var(--ink); margin-bottom: 8px; font-size: 16px; }

/* ---------------- forms (admin) ---------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 17px;
  margin: 0 0 14px;
  font-weight: 600;
}
label.f {
  display: block;
  font-size: 12.5px;
  color: var(--ink-mute);
  margin: 14px 0 5px;
  letter-spacing: .03em;
}
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ground);
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 170px; line-height: 1.8; resize: vertical; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
/* 数字の欄は短いので、携帯でも横に並べる（関係が見えるほうが入力しやすい） */
.row.nums > * { flex: 1 1 80px; min-width: 0; }

.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.btn:hover { opacity: .9; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { font-size: 13px; padding: 7px 14px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }

.msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  display: none;
}
.msg.show { display: block; }
.msg.ok { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.msg.ng { background: transparent; color: var(--danger); border: 1px solid var(--danger); font-weight: 700; }

.warn-bar {
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-weight: 700;
}

/* ---------------- 表 ---------------- */
.table-scroll {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  min-width: 440px;   /* これ以下だと文字が詰まりすぎるので、横スクロールに逃がす */
}
.table-scroll th,
.table-scroll td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  line-height: 1.7;
}
.table-scroll thead th {
  background: var(--surface-2);
  font-size: 12px;
  letter-spacing: .05em;
  font-weight: 700;
  white-space: nowrap;
}
.table-scroll tbody tr:last-child td { border-bottom: 0; }

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .t .nm { font-weight: 600; }
.list-row .t .em { color: var(--ink-mute); font-size: 12.5px; margin-left: 8px; }
.list-row .pin { color: var(--accent); font-size: 12px; }

.foot-note {
  margin-top: 30px;
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.8;
  text-align: center;
}

/* ---------------- 共通ナビ（STEP 3 で追加） ---------------- */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 0 0;
  flex-wrap: wrap;
}
.nav a.tab {
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-mute);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav a.tab:hover { color: var(--accent); border-color: var(--line); }
.nav a.tab.on {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.nav .spacer { flex: 1; }
.nav .who {
  font-size: 12.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav .who b { color: var(--ink); font-weight: 700; }
.nav a.mini {
  font-size: 12.5px;
  text-decoration: none;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}
.nav a.mini:hover { color: var(--accent); border-color: var(--accent); }
.nav a.mini.solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.devbar {
  background: var(--warn, #96650C);
  color: #fff;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 6px;
  margin: 10px 0 0;
  font-weight: 700;
  line-height: 1.6;
}
.devbar a { color: #fff; }

/* 鍵付き項目の印 */
.lock {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--k-study);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px 6px;
  margin-top: 3px;
  white-space: nowrap;
}
.hidden-note {
  font-size: 13px;
  color: var(--ink-mute);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  line-height: 1.75;
}
.hidden-note a { font-weight: 700; }

/* ---------------- 掲示板・インシデント ---------------- */
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.post.pin { border-left: 3px solid var(--accent); }
.post h3 {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.55;
}
.post .pmeta {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  align-items: center;
}
.post .ptext {
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.85;
}
.post .pactions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

.tag-sec {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--ink-mute);
  border-radius: 3px;
  padding: 1px 8px;
}
.tag-kind {
  font-size: 11px;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px 8px;
  font-weight: 700;
}
.k-hiyari { color: var(--k-faq); }
.k-inci { color: var(--warn); }
.k-acci { color: var(--danger); }

.st { font-size: 11px; border-radius: 3px; padding: 1px 8px; font-weight: 700; }
.st-uke { background: var(--surface-2); color: var(--ink-mute); }
.st-kaku { background: var(--warn); color: #fff; }
.st-done { background: var(--accent); color: var(--accent-ink); }

.hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 18px 0 26px;
}
.hub a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: block;
}
.hub a:hover { border-color: var(--accent); }
.hub a b { display: block; font-size: 15.5px; margin-bottom: 5px; }
.hub a span { font-size: 12.5px; color: var(--ink-mute); line-height: 1.7; }

.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.pick:hover { border-color: var(--accent); }
.pick .r { font-size: 12px; color: var(--ink-mute); }

.gate {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
}
.gate b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 10px; }
.gate .btn { margin-top: 18px; text-decoration: none; display: inline-block; }

/* ---------------- logout ---------------- */
.logout-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.logout-card {
  width: min(100%, 560px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.logout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: #1e3a5f;
  color: #fff;
}
.logout-head h1 { margin: 0; font-size: 20px; }
.logout-head a,
.logout-head a:visited { color: #fff; font-weight: 700; text-underline-offset: 3px; }
.logout-head a:hover { color: #fff; background: rgba(255,255,255,.16); border-radius: 4px; }
.logout-head a:focus-visible { color: #fff; outline: 2px solid #fff; outline-offset: 3px; }
.logout-body { padding: 24px 22px 26px; }
.logout-body p { margin: 0 0 22px; line-height: 1.8; }
.logout-submit { min-width: 150px; }

@media (max-width: 500px) {
  .wrap { padding: 0 10px 70px; }
  .brand h1 { font-size: 17px; }
  .brand .sub { display: none; }
  .searchbox input { font-size: 16px; padding: 13px 40px; }
  .nav .who span.mail { display: none; }
  /* 携帯では、氏名とアドレスを2行に分ける（1行だと切れて読めない） */
  .list-row { flex-wrap: wrap; }
  .list-row .t { white-space: normal; overflow: visible; flex-basis: 100%; order: 5; }
  .list-row .t .em { display: block; margin-left: 0; word-break: break-all; }
}

/* ── 総括シート ── 前日に出す部分と、終わってから書く部分の区切り */
.half-h {
  display: flex; align-items: baseline; gap: 10px;
  margin: 22px 0 10px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.half-h span { font-size: 12.5px; font-weight: 400; color: var(--ink-mute); }
.chip-todo {
  font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  color: var(--k-link); background: rgba(122, 90, 22, .10);
  border: 1px solid rgba(122, 90, 22, .28);
}
@media (prefers-color-scheme: dark) {
  .chip-todo { color: #D9BC72; background: rgba(217, 188, 114, .12); border-color: rgba(217, 188, 114, .3); }
}
