/* 現場NOTE — Figma 共通 UI（ハブ＋各画面） design-tokens.css の後に読み込む */

/* ========== ハブ（index.html） ========== */
.hub-shell{ min-height:100dvh; display:flex; flex-direction:column; background:var(--bg); }
.hub-head{ flex-shrink:0; display:flex; flex-direction:column; }

.hub-nav{
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px 12px;
  flex-wrap:nowrap;
  width:100%;
}
.hub-brand{
  flex-shrink:0;
  display:flex;
  align-items:center;
  font-weight:800;
  font-size:16px;
  letter-spacing:.02em;
  color:var(--ink);
  padding:4px 0;
}
.hub-nav .tab-select-wrap{ display:none; }
.hub-tabs{
  display:flex;
  flex:1;
  min-width:0;
  gap:2px;
  overflow-x:auto;
  overflow-y:hidden;
  align-items:center;
  padding:2px 0;
  scrollbar-width:thin;
  flex-wrap:nowrap;
}
.hub-tab-sep{
  flex-shrink:0;
  font-size:13px;
  font-weight:300;
  padding:0 6px;
  user-select:none;
  line-height:1;
}
.hub-tabs .tab{
  flex-shrink:0;
  border:none;
  border-radius:999px;
  background:transparent;
  color:var(--ink2);
  padding:6px 11px;
  font-size:var(--btn-fz);
  font-family:var(--font);
  cursor:pointer;
  white-space:nowrap;
}
.hub-tabs .tab:hover{ color:var(--ink); background:var(--bg-head); }
.hub-tabs .tab.is-active{
  background:var(--ink);
  color:#fff;
  font-weight:700;
}

/* PC：黒ナビ・区切り┃（スマホは index.html の下部ドックのまま） */
@media (min-width:769px){
  .hub-nav-dark{
    background:var(--ink);
    border-bottom:none;
  }
  .hub-nav-dark .hub-brand{
    color:#fff;
    padding:6px 4px 6px 0;
    margin-right:4px;
  }
  .hub-nav-dark .hub-tabs{
    scrollbar-color:rgba(255,255,255,.35) transparent;
  }
  .hub-nav-dark .hub-tab-sep{ color:rgba(255,255,255,.35); }
  .hub-nav-dark .hub-tabs .tab{
    color:rgba(255,255,255,.82);
  }
  .hub-nav-dark .hub-tabs .tab:hover{
    color:#fff;
    background:rgba(255,255,255,.12);
  }
  .hub-nav-dark .hub-tabs .tab.is-active{
    background:#fff;
    color:var(--ink);
    font-weight:700;
  }
}

.hub-bar-min{
  display:flex;
  align-items:center;
  padding:4px 14px 6px;
  background:var(--bg-head);
  border-bottom:1px solid var(--line);
}
.sync-lamp-dots{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:var(--fz-sm);
  color:var(--muted);
}
.sync-lamp-dots .hub-sync-label{
  font-size:var(--fz-sm);
  color:var(--muted);
  margin-right:2px;
}
.sync-lamp-dots .sync-badge{
  padding:0;
  border:none;
  background:transparent;
  gap:0;
}
.sync-lamp-dots .sync-badge .dot{
  width:9px;
  height:9px;
}

.hub-main{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
  padding:0;
  background:var(--bg);
}
.hub-main .pane{
  height:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.hub-main iframe:not(.hide){
  display:block;
  width:100%;
  height:100%;
  border:none;
  border-radius:0;
  background:var(--bg);
}

/* 表紙（ハブ）— 左サイドバー + 本文 */
.hub-main #cover.pane-cover{
  padding:0;
  display:flex;
  flex-direction:column;
  min-height:0;
  height:100%;
  overflow:hidden;
}
.cover-shell{
  flex:1;
  display:flex;
  align-items:flex-start;
  min-height:0;
  height:100%;
  width:100%;
  max-width:100%;
  margin:0;
  overflow-y:scroll;
  overflow-x:hidden;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
}
.cover-aside{
  flex:0 0 220px;
  width:220px;
  position:sticky;
  top:0;
  align-self:flex-start;
  overflow:visible;
  background:var(--bg-head);
  border-right:1px solid var(--line);
  padding:12px 10px 16px;
  z-index:1;
}
.cover-aside-title{
  margin:0 0 8px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  color:var(--muted);
  text-transform:uppercase;
}
.cover-screen-nav{
  display:flex;
  flex-direction:column;
  gap:2px;
  margin-bottom:14px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}
.cover-nav-btn{
  display:block;
  width:100%;
  text-align:left;
  padding:7px 8px;
  border:none;
  border-radius:var(--radius-md);
  background:transparent;
  color:var(--ink);
  font-size:var(--fz-sm);
  font-family:var(--font);
  cursor:pointer;
  line-height:1.35;
}
.cover-nav-btn:hover{
  background:var(--bg-card);
}
.cover-body{
  flex:1;
  min-width:0;
  overflow:visible;
}
/* 使い方: スクロールバーは shell の右端に1本だけ */
.cover-shell{
  scrollbar-width:thin;
  scrollbar-color:rgba(15,23,42,.5) #e8ecf1;
}
.cover-shell::-webkit-scrollbar{
  width:14px;
}
.cover-shell::-webkit-scrollbar-track{
  background:#e8ecf1;
  border-left:1px solid var(--line);
}
.cover-shell::-webkit-scrollbar-thumb{
  background:rgba(15,23,42,.4);
  border-radius:8px;
  border:3px solid #e8ecf1;
  min-height:48px;
}
.cover-shell::-webkit-scrollbar-thumb:hover{
  background:rgba(15,23,42,.6);
}
.cover-drawer-btn,
.cover-backdrop{
  display:none;
}
.gn-cover{
  padding:16px;
  max-width:none;
  margin:0;
}
.gn-cover-card{
  padding:22px 24px 20px;
  box-shadow:0 1px 3px rgba(0,0,0,.06);
}

.hub-brand-block{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:18px;
}
.hub-brand-block .hub-brand-logo{
  flex-shrink:0;
  width:52px;
  height:52px;
  border-radius:14px;
  background:linear-gradient(180deg,var(--ink),#0f172a);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:22px;
  box-shadow:0 2px 8px rgba(0,0,0,.12);
}
.hub-brand-block .hub-brand-name{
  font-weight:800;
  font-size:22px;
  line-height:1.15;
  color:var(--ink);
}
.hub-brand-block .hub-brand-sub{
  font-size:var(--fz-sm);
  color:var(--muted);
  margin-top:2px;
}
.hub-tenant-site{
  font-size:var(--fz-sm);
  color:var(--ok-ink);
  font-weight:600;
  margin:0 0 8px;
  padding:6px 10px;
  background:var(--ok-bg);
  border-radius:var(--radius-lg);
  border:1px solid var(--ok-bd);
}
.hub-tenant-support{ margin:8px 0 0; font-size:var(--fz-sm); }
.hub-tenant-support a{ color:var(--kind-31); }
.hub-tenant-warn{ margin-top:10px; }

.hub-intro-box{
  background:var(--bg-head);
  border-radius:var(--radius-lg);
  padding:14px 16px;
  margin-bottom:18px;
  font-size:var(--fz);
  line-height:1.65;
  color:var(--ink2);
}
.hub-intro-teaser p{ margin:0 0 8px; }
.hub-intro-teaser p:last-child{ margin-bottom:0; }
.hub-intro-box .note-view{
  margin-top:0;
  padding-top:0;
  border-top:0;
  font-size:var(--btn-fz);
  line-height:1.55;
}
.hub-intro-box .note-view h2,
.hub-intro-box .note-view h3{
  scroll-margin-top:12px;
}
.cover-toc{
  font-size:var(--fz-sm);
  line-height:1.45;
  color:var(--ink2);
}
.cover-toc-title{
  margin:0 0 8px;
  font-size:var(--fz-sm);
  font-weight:700;
  color:var(--ink);
}
.cover-toc-msg{ margin:0; font-size:var(--fz-sm); color:var(--muted); }
.cover-toc-list ul{
  margin:0;
  padding:0;
  list-style:none;
}
.cover-toc-list li{ margin:0 0 4px; }
.cover-toc-list li.toc-l3{ padding-left:10px; }
.cover-toc-list a{
  color:var(--kind-31);
  text-decoration:none;
  display:block;
  padding:3px 0;
}
.cover-toc-list a:hover{ text-decoration:underline; }
@media (max-width: 768px){
  /* スマホ: 上メニュー→下本文、スクロールバーは画面右 */
  .cover-shell{
    flex-direction:column;
    max-width:100%;
    height:100%;
  }
  .cover-aside{
    position:static;
    width:100%;
    flex:0 0 auto;
    border-right:none;
    border-bottom:1px solid var(--line);
  }
  .cover-body{
    flex:0 0 auto;
    width:100%;
  }
  .cover-screen-nav{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:4px;
  }
  .cover-drawer-btn,
  .cover-backdrop{
    display:none !important;
  }
}

.hub-launch-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
@media (max-width:420px){
  .hub-launch-grid{ grid-template-columns:1fr; }
}
.hub-launch-grid .ql{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:76px;
  padding:14px 16px;
  border-radius:var(--radius-xl);
  border:1px solid var(--line);
  background:var(--bg-card);
  font-size:16px;
  font-weight:700;
  font-family:var(--font);
  cursor:pointer;
  text-decoration:none;
  color:var(--ink);
  transition:background .12s, border-color .12s;
}
.hub-launch-grid .ql:hover{ background:var(--bg-head); }
.hub-launch-grid .ql.primary{
  background:var(--ink);
  color:#fff;
  border-color:var(--ink);
}
.hub-launch-grid .ql.primary:hover{ background:var(--ink2); border-color:var(--ink2); }
.hub-launch-grid .ql .ql-ico{ font-size:22px; line-height:1; }

.hub-util-links{
  margin:14px 0 0;
  padding-top:12px;
  border-top:1px solid var(--line);
  font-size:var(--fz-sm);
  color:var(--muted);
  text-align:center;
}
.hub-util-link{
  border:none;
  background:none;
  padding:0;
  font:inherit;
  font-size:inherit;
  color:var(--ink2);
  cursor:pointer;
  text-decoration:underline;
  text-underline-offset:2px;
}
.hub-util-link:hover{ color:var(--ink); }
.hub-util-sep{ margin:0 6px; opacity:.5; }

/* ========== 子画面共通（iframe 内） ========== */
body.gn-page-body,
body:has(.gn-page){
  background:var(--bg);
  color:var(--ink);
}

.gn-page,
.pg-page,
.a4-wrap.pg-page,
body.gn-page-body > .wrap.gn-page{
  max-width:min(var(--content-max-w, 960px), 100%);
  margin:0 auto;
  padding:16px 20px 28px;
  box-sizing:border-box;
}
.gn-page > h3,
.pg-page > h3{ display:none; }
.gn-page-head{
  display:block;
  margin-bottom:16px;
}
.gn-page-head h1{
  display:block !important;
  margin:0 0 8px;
  font-size:22px;
  font-weight:800;
  color:var(--ink);
}
.gn-page-head .gn-lead{
  margin:0;
  font-size:var(--fz);
  color:var(--ink2);
  line-height:1.55;
}

.hub-setup-banner{
  margin:0 0 14px;
  padding:10px 12px;
  background:var(--warn-bg);
  border:1px solid var(--warn-bd);
  border-radius:var(--radius-lg);
  font-size:var(--btn-fz);
  color:var(--warn-ink);
}
.hub-setup-banner-link{
  border:none;
  background:none;
  color:var(--kind-31);
  font:inherit;
  font-weight:700;
  cursor:pointer;
  text-decoration:underline;
  padding:0;
}

.gn-toolbar,
.pg-toolbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px 12px;
  margin:0 0 14px;
  padding:10px 12px;
  background:var(--bg-card);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
}
.gn-toolbar-main,
.pg-toolbar-main{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px 10px;
}
.gn-toolbar .save-controls,
.pg-toolbar .save-controls{ margin:0; flex-shrink:0; }

.gn-field,
.pg-field{ margin-bottom:10px; }
.gn-field > label,
.pg-field > label{
  display:block;
  font-size:var(--fz-sm);
  color:var(--ink2);
  margin-bottom:4px;
  font-weight:600;
}
.gn-field-row,
.pg-field-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px 14px;
  margin-bottom:10px;
}
@media (max-width:640px){
  .gn-field-row, .pg-field-row{ grid-template-columns:1fr; }
}
.gn-radios,
.pg-radios{
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  font-size:var(--btn-fz);
  color:var(--ink2);
}
.gn-radios label,
.pg-radios label{ display:inline-flex; align-items:center; gap:6px; cursor:pointer; }

.gn-stats,
.pg-stats{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:10px;
  margin-bottom:16px;
}
@media (max-width:900px){
  .gn-stats, .pg-stats{ grid-template-columns:repeat(2, 1fr); }
}
@media (max-width:480px){
  .gn-stats, .pg-stats{ grid-template-columns:1fr; }
}
.gn-stat,
.pg-stat{
  background:var(--bg-card);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  padding:10px 12px;
}
.gn-stat-label,
.pg-stat-label{
  display:block;
  font-size:var(--fz-sm);
  color:var(--muted);
  margin-bottom:6px;
}
.gn-stat input,
.pg-stat input{
  border:none;
  background:transparent;
  padding:0;
  font-size:18px;
  font-weight:700;
  color:var(--ink);
  width:100%;
}
.gn-stat.is-rate input,
.pg-stat.is-rate input{ color:var(--kind-31); font-size:22px; }
.gn-stat input[type="date"],
.pg-stat input[type="date"]{
  font-size:var(--fz);
  pointer-events:none;
}

.gn-section-title,
.pg-section-title{
  margin:4px 0 10px;
  font-size:14px;
  font-weight:700;
  color:var(--ink);
}

.gn-kinds,
.pg-kinds{ display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.gn-kind,
.pg-kind{
  background:var(--bg-card);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  overflow:hidden;
}
.gn-kind > summary,
.pg-kind > summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  font-size:var(--fz);
  font-weight:700;
  color:var(--ink);
  border-left:4px solid var(--kind-accent, var(--green));
}
.pg-kind-summary-main{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
  padding-right:4px;
}
.pg-kind-vendors{
  font-size:var(--fz-sm);
  font-weight:400;
  color:var(--ink2);
  line-height:1.4;
  word-break:break-word;
}
.pg-kind-vendors.is-unset{ color:var(--muted); font-style:italic; }
.gn-kind > summary::-webkit-details-marker,
.pg-kind > summary::-webkit-details-marker{ display:none; }
.gn-kind > summary::after,
.pg-kind > summary::after{
  content:'';
  margin-left:auto;
  width:8px; height:8px;
  border-right:2px solid var(--muted);
  border-bottom:2px solid var(--muted);
  transform:rotate(45deg);
  transition:transform .15s;
}
.gn-kind[open] > summary::after,
.pg-kind[open] > summary::after{ transform:rotate(-135deg); margin-top:4px; }
.gn-kind-body,
.pg-kind-body{ padding:0 12px 12px; border-top:1px solid var(--line); }

.gn-kind-31, .pg-kind-31{ --kind-accent:var(--kind-31); }
.gn-kind-32, .pg-kind-32{ --kind-accent:var(--kind-32); }
.gn-kind-33, .pg-kind-33{ --kind-accent:var(--kind-33); }
.gn-kind-34, .pg-kind-34{ --kind-accent:var(--kind-34); }
.gn-kind-35, .pg-kind-35{ --kind-accent:var(--kind-35); }
.gn-kind-36, .pg-kind-36{ --kind-accent:var(--kind-36); }
.gn-kind-37, .pg-kind-37{ --kind-accent:var(--muted); }

.gn-card-block{ margin-bottom:14px; }
.gn-card-block .sect-head{ margin-bottom:12px; }


.gn-doc-toolbar.toolbar{
  border-radius:var(--radius-lg);
  margin-bottom:12px;
  border:1px solid var(--line);
}

/* 日報など：工事種別チェック（管理内容・指摘）— 共通 */
.m-cats{
  display:flex;
  flex-wrap:wrap;
  gap:12px 14px;
}
.m-cats label{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:var(--btn-fz);
  padding:8px 16px;
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  background:var(--bg-card);
  white-space:nowrap;
  line-height:1.4;
  cursor:pointer;
  min-height:36px;
}
.m-cats label:has(input:checked){
  border-color:var(--ink);
  background:var(--bg-head);
  font-weight:600;
}
body.gn-page-body table th{
  width:14%;
  min-width:5.5em;
}
body.gn-page-body table td{ padding:8px 10px; }

/* 進捗・出面：日報と同じ幅（--content-max-w）※印刷は各HTMLの @print */
@media screen{
  body.gn-page-body > .wrap.gn-page,
  body.gn-page-body > .gn-page.wrap,
  body.gn-page-body .a4-wrap.pg-page{
    max-width:min(var(--content-max-w, 960px), 100%) !important;
    width:100% !important;
    padding:16px 20px 28px !important;
    box-sizing:border-box;
  }
}

/* iframe 内：ハブのフッターと二重にならない調整 */
body.gn-in-iframe .gn-brand-footer-screen{ display:none !important; }

@media (max-width:768px){
  .hub-nav-dark{
    background:var(--bg-card);
    border-bottom:1px solid var(--line);
    padding:8px 10px;
  }
  .hub-nav-dark .hub-brand{ color:var(--ink); }
  .hub-tabs{ display:none !important; }
  .hub-tab-sep{ display:none; }
  .hub-bar-min{ padding:4px 10px; }

  /* 進捗・日報（iframe 内）：工事項目見出しの業者名 */
  .pg-kind > summary{ align-items:flex-start; }
  .pg-kind-summary-main{ gap:4px; }
  .pg-kind-label{ font-size:15px; }
  .pg-kind-vendors{
    font-size:13px;
    line-height:1.45;
    word-break:break-word;
    display:block;
  }
  /* 進捗：業者ごとの入力枠（スマホ） */
  .pc-vendor-blocks{ gap:14px; }
  .pc-vendor-title{ font-size:16px; }
  .pc-vendor-name-inp{ min-height:44px; font-size:16px; }
  .pc-add-extra-block{ min-height:44px; width:100%; }

  /* 日報：工事種別チェック */
  .m-cats{ gap:8px 10px; }
  .m-cats label{
    padding:6px 12px;
    font-size:13px;
    max-width:100%;
    white-space:normal;
  }
  body.gn-page-body table th{
    width:28%;
    min-width:4.5em;
  }
}

@media print{
  .hub-head, .app-dock, .pwa-install{ display:none !important; }
  .hub-main{ padding:0; }
  .gn-toolbar, .pg-toolbar, .gn-stats, .pg-stats{ display:none !important; }
  .gn-page, .pg-page{ max-width:none; padding:0; }
  /* 画面用の全幅指定を印刷では無効化（子ページは各HTMLの @print で 190mm） */
  body.gn-page-body > .wrap.gn-page,
  body.gn-page-body > .gn-page.wrap{
    max-width:190mm !important;
    width:auto !important;
    padding:0 !important;
  }
  body.gn-page-body .a4-wrap.pg-page{
    max-width:190mm !important;
    width:auto !important;
    padding:0 !important;
  }
}
