/* 介護生産性向上PDCAナビ 共通スタイル（本体サイト調：オレンジ×ネイビー） */
:root {
  --orange: #E8845A;
  --orange-d: #d4724a;
  --green: #5A9E8A;
  --navy: #2C3E50;
  --navy-d: #1e2d3d;
  --offwhite: #FAF7F2;
  --light: #F0EDE8;
  --warmgray: #8C8279;
  --border: #E0DCD6;
  --white: #fff;
  --red: #c0564f;
  --shadow: 0 4px 14px rgba(44, 62, 80, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--offwhite);
  color: var(--navy);
  line-height: 1.7;
  font-size: 15px;
}
a { color: var(--orange-d); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); color: var(--navy); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
textarea { min-height: 90px; resize: vertical; }

/* ─── 認証系 ─── */
.auth-body { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 40px 16px; }
.auth-box { width: 100%; max-width: 460px; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo img { height: 36px; margin-bottom: 8px; }
.auth-logo h1 { font-size: 20px; color: var(--navy); }
.auth-sub { color: var(--warmgray); font-size: 13px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--light); border-radius: 10px; padding: 4px; }
.auth-tabs a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px; text-decoration: none; color: var(--warmgray); font-size: 13px; font-weight: 600; }
.auth-tabs a.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }
.auth-form { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 5px; }
.btn-main {
  background: var(--orange); color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; transition: background .2s;
}
.btn-main:hover { background: var(--orange-d); }
.auth-note { font-size: 12px; color: var(--warmgray); }
.auth-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--warmgray); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.auth-radio-group { display: flex; flex-direction: column; gap: 6px; background: var(--offwhite); border-radius: 10px; padding: 10px 12px; }
.auth-radio-label { font-size: 12px; font-weight: 700; color: var(--warmgray); }
.auth-radio { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; flex-direction: row !important; }
.auth-radio input { width: auto; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fbeae9; color: var(--red); border: 1px solid #eecfcc; }
.alert-ok { background: #e9f4f0; color: var(--green); border: 1px solid #cbe5dd; }
.pending-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 28px 22px; text-align: center; margin-bottom: 18px; }
.pending-icon { font-size: 40px; margin-bottom: 8px; }
.pending-card h2 { font-size: 18px; margin-bottom: 8px; }
.pending-card p { font-size: 14px; color: var(--warmgray); }
.pending-join { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; }
.pending-join h3 { font-size: 15px; margin-bottom: 4px; }
.pending-join p { font-size: 13px; color: var(--warmgray); margin-bottom: 12px; }

/* ─── アプリ共通 ─── */
.app-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.app-header.header-hidden { display: none; }
.app-header-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 54px; flex-wrap: wrap; }
.app-brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; }
.app-nav { display: flex; gap: 4px; flex: 1; }
.app-nav a { color: #cfd8e0; text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px; }
.app-nav a.active, .app-nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.app-user { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #cfd8e0; }
.app-ws { font-weight: 600; color: #fff; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-logout { color: #cfd8e0; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.loading { text-align: center; padding: 60px 0; color: var(--warmgray); }

h2.page-title { font-size: 20px; margin-bottom: 4px; }
.page-sub { color: var(--warmgray); font-size: 13px; margin-bottom: 18px; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.btn { display: inline-block; background: var(--orange); color: #fff; border: none; border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 700; text-decoration: none; }
.btn:hover { background: var(--orange-d); }
.btn-sub { background: var(--white); color: var(--navy); border: 1px solid var(--border); }
.btn-sub:hover { background: var(--light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: var(--white); color: var(--red); border: 1px solid #eecfcc; }
.btn-danger:hover { background: #fbeae9; }
.btn-ai { background: var(--navy); }
.btn-ai:hover { background: var(--navy-d); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-mic.recording { background: var(--red); animation: mic-pulse 1.4s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.badge-kasan { background: #fdeee6; color: var(--orange-d); }
.badge-guideline { background: #e9f4f0; color: var(--green); }
.badge-gray { background: var(--light); color: var(--warmgray); }
.badge-phase { background: var(--navy); color: #fff; }

/* プロジェクトカード */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pj-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; }
.pj-card:hover { transform: translateY(-2px); }
.pj-card h4 { font-size: 15px; margin: 6px 0 4px; }
.pj-meta { font-size: 12px; color: var(--warmgray); }

/* 加算チェック */
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.check-item { background: var(--offwhite); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.check-item .num { font-size: 22px; font-weight: 700; }
.check-item .lbl { font-size: 11px; color: var(--warmgray); }
.check-item.ok { border-color: var(--green); background: #f2f9f6; }
.check-item.ok .num { color: var(--green); }

/* タブ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--warmgray); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--orange-d); border-bottom-color: var(--orange); }

/* テーブル */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th { color: var(--warmgray); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }

/* 課題ボード */
.issue-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--light); border-radius: 999px; padding: 3px; }
.seg button { border: none; background: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--warmgray); }
.seg button.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }
.issue-row { cursor: pointer; }
.issue-row:hover { background: var(--offwhite); }
.matrix-wrap { position: relative; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; margin-top: 8px; color: var(--warmgray); }
.matrix-legend span::before { content: "●"; margin-right: 4px; }

/* ドロワー */
.drawer-mask { position: fixed; inset: 0; background: rgba(30,45,61,.45); z-index: 90; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw); background: var(--white); z-index: 91; padding: 22px; overflow-y: auto; box-shadow: -6px 0 24px rgba(0,0,0,.15); }
.drawer h3 { font-size: 16px; margin-bottom: 4px; padding-right: 30px; }
.drawer-close { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 22px; color: var(--warmgray); }
.drawer .fld { margin-top: 12px; font-size: 13px; }
.drawer .fld b { display: block; color: var(--warmgray); font-size: 11px; font-weight: 600; }
.drawer-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* モーダル */
.modal-mask { position: fixed; inset: 0; background: rgba(30,45,61,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 560px; padding: 22px; position: relative; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal .form-grid { display: flex; flex-direction: column; gap: 12px; }
.modal label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* PDCA */
.theme-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--white); }
.theme-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-head h4 { font-size: 15px; flex: 1; }
.stepper { display: flex; gap: 0; margin: 10px 0; }
.step { flex: 1; text-align: center; font-size: 12px; font-weight: 700; padding: 6px 0; background: var(--light); color: var(--warmgray); position: relative; }
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; }
.step.done { background: #e9f4f0; color: var(--green); }
.step.now { background: var(--orange); color: #fff; }
.entry { border-left: 3px solid var(--border); padding: 6px 12px; margin: 8px 0; font-size: 13px; }
.entry .entry-meta { font-size: 11px; color: var(--warmgray); }
.entry-plan { border-left-color: var(--navy); }
.entry-do { border-left-color: var(--orange); }
.entry-check { border-left-color: var(--green); }
.entry-act { border-left-color: #b08968; }
.cycle-label { font-size: 12px; font-weight: 700; color: var(--warmgray); margin-top: 10px; }
details.cycle-fold { border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; background: var(--offwhite); }
details.cycle-fold > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--warmgray); padding: 8px 12px; user-select: none; }
details.cycle-fold > summary:hover { color: var(--navy); }
details.cycle-fold[open] > summary { border-bottom: 1px dashed var(--border); color: var(--navy); }
details.cycle-fold .entry { margin: 8px 12px; }
pre.entry-content { white-space: pre-wrap; font-family: inherit; }

/* AI提案ボックス */
.ai-box { background: #f4f6f8; border: 1px dashed var(--navy); border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-top: 10px; white-space: pre-wrap; }
.ai-note { font-size: 11px; color: var(--warmgray); margin-top: 6px; }

/* タイムスタディ：スマホモード */
.ts-current { background: var(--navy); color: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; text-align: center; }
.ts-current .cat { font-size: 18px; font-weight: 700; }
.ts-current .timer { font-size: 13px; opacity: .85; margin-top: 4px; }
.ts-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.ts-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: mic-pulse 1.2s ease-in-out infinite; }
.ts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.ts-btn { padding: 16px 10px; border-radius: 12px; border: 2px solid var(--border); background: var(--white); font-size: 14px; font-weight: 600; text-align: center; line-height: 1.3; min-height: 64px; }
.ts-btn:active { transform: scale(.97); }
.ts-btn.active { border-color: var(--orange); background: #fdeee6; color: var(--orange-d); }
.ts-fullprompt-mask { position: fixed; inset: 0; background: rgba(20,25,30,.92); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ts-fullprompt { background: #fff; border-radius: 16px; padding: 24px; max-width: 420px; width: 100%; text-align: center; max-height: 90vh; overflow-y: auto; }
.ts-fullprompt h3 { font-size: 18px; margin-bottom: 16px; }

/* ❔ヘルプマーク */
.help-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--navy);
  font-size: 11px; line-height: 1; cursor: pointer;
  vertical-align: middle; margin-left: 2px; background: var(--white);
}
.help-mark:hover, .help-mark:focus { background: var(--light); outline: none; }
.help-pop {
  position: absolute; z-index: 300; max-width: 280px;
  background: var(--navy); color: #fff; font-size: 12px; line-height: 1.5;
  padding: 10px 12px; border-radius: 10px; box-shadow: var(--shadow);
  white-space: pre-wrap;
}

/* つながりマップ */
.map-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.map-tb-label { font-weight: 700; color: var(--warmgray); }
.map-tb-sep { width: 1px; height: 18px; background: var(--border); }
.map-chk { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; color: var(--navy); }
.map-chk input { width: auto; }
.map-wrap { position: relative; height: 70vh; min-height: 380px; border: 1px solid var(--border); border-radius: 12px; background: #fdfcfa; overflow: hidden; touch-action: none; }
.map-wrap svg { width: 100%; height: 100%; display: block; }
.map-node text { text-anchor: middle; pointer-events: none; }
.map-hublabel { font-size: 11px; font-weight: 700; fill: var(--navy); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.map-ilabel { font-size: 9px; fill: var(--warmgray); display: none; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
svg.zoomed .map-ilabel { display: block; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--warmgray); margin-top: 8px; }

/* トースト */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 13px; z-index: 200; box-shadow: var(--shadow); }

/* 印刷レポート */
@media print {
  body { background: #fff; font-size: 12px; }
  .no-print { display: none !important; }
  .report-page { page-break-after: always; }
  .card { box-shadow: none; }
}
.report-body { max-width: 720px; margin: 0 auto; padding: 24px 16px; background: #fff; }
.report-cover { text-align: center; padding: 120px 0 60px; }
.report-cover h1 { font-size: 26px; margin-bottom: 12px; }
.report-cover .rc-sub { color: var(--warmgray); }
.report-section { margin-top: 28px; }
.report-section h2 { font-size: 17px; border-left: 5px solid var(--orange); padding-left: 10px; margin-bottom: 12px; }
.report-toolbar { position: sticky; top: 0; background: var(--offwhite); padding: 12px 0; display: flex; gap: 10px; justify-content: center; z-index: 10; }
@page { size: A4; margin: 18mm 15mm; }

@media (max-width: 640px) {
  .app-header-inner { padding: 8px 12px; }
  .app-user { width: 100%; justify-content: flex-end; }
}
