/* 介護経営ナビ（β） 共通スタイル（本体サイト調をベースに、経営分析ツールとして紺×ティールで差別化） */
:root {
  --teal: #2E8B8B;
  --teal-d: #22706f;
  --navy: #1F3245;
  --navy-d: #16232f;
  --offwhite: #F7F9F9;
  --light: #EDF2F2;
  --warmgray: #6E7B82;
  --border: #DCE4E4;
  --white: #fff;
  --red: #c0564f;
  --amber: #C88A2E;
  --green: #4E9E6E;
  --shadow: 0 4px 14px rgba(31, 50, 69, 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(--teal-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(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea { min-height: 90px; resize: vertical; }
table { border-collapse: collapse; }

/* ─── 認証系 ─── */
.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-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(--teal); color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; transition: background .2s;
}
.btn-main:hover { background: var(--teal-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; }
.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: #eaf5f0; color: var(--green); border: 1px solid #cde6da; }
.pending-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 28px 22px; text-align: center; margin-bottom: 18px; }

/* ─── アプリ共通 ─── */
.app-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.app-header-inner { max-width: 1140px; 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; flex-wrap: wrap; }
.app-nav a { color: #c7d2d6; 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: #c7d2d6; }
.app-facility { font-weight: 600; color: #fff; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-logout { color: #c7d2d6; }
.app-main { max-width: 1140px; 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(--teal); color: #fff; border: none; border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 700; text-decoration: none; }
.btn:hover { background: var(--teal-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[disabled] { opacity: .5; cursor: not-allowed; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.badge-gray { background: var(--light); color: var(--warmgray); }
.badge-owner-facility { background: #fdf1e2; color: var(--amber); }
.badge-owner-terrasul { background: #e6edf6; color: #3a5a92; }
.badge-sev-high { background: #fbeae9; color: var(--red); }
.badge-sev-medium { background: #fdf1e2; color: var(--amber); }
.badge-sev-low { background: var(--light); color: var(--warmgray); }
.badge-status-open { background: #fbeae9; color: var(--red); }
.badge-status-resolved { background: #eaf5f0; color: var(--green); }
.badge-status-ignored { background: var(--light); color: var(--warmgray); }

/* テーブル */
.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; }
.tbl tr.row-error td { background: #fff8f7; }

/* KPI（プッシュ型レポート用の見せるカード） */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi-tile { background: var(--offwhite); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi-tile .kpi-label { font-size: 12px; color: var(--warmgray); font-weight: 600; }
.kpi-tile .kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.kpi-tile .kpi-unit { font-size: 12px; color: var(--warmgray); margin-left: 2px; }
.kpi-tile.warn { border-color: #eecfa8; background: #fdf6ea; }
.kpi-tile.warn .kpi-value { color: var(--amber); }
.kpi-tile.danger { border-color: #eecfcc; background: #fdefee; }
.kpi-tile.danger .kpi-value { color: var(--red); }
.kpi-tile.ok { border-color: #cde6da; background: #f0f9f4; }
.kpi-tile.ok .kpi-value { color: var(--green); }

/* ステップ（CSVインポートのウィザード） */
.stepper { display: flex; gap: 0; margin: 10px 0 20px; }
.step { flex: 1; text-align: center; font-size: 12px; font-weight: 700; padding: 8px 4px; 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: #eaf5f0; color: var(--green); }
.step.now { background: var(--teal); color: #fff; }

/* カラムマッピングUI */
.mapping-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mapping-table th, .mapping-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.mapping-table th { color: var(--warmgray); font-size: 12px; text-align: left; }
.mapping-table td.sample { color: var(--warmgray); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping-table select { font-size: 13px; padding: 6px 8px; }
.mapping-table .col-required select { border-color: var(--teal); }
.upload-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 30px 16px; text-align: center; color: var(--warmgray); background: var(--offwhite); }
.upload-drop input[type=file] { width: auto; }

/* ドロワー・モーダル */
.drawer-mask { position: fixed; inset: 0; background: rgba(22,35,47,.45); z-index: 90; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 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(22,35,47,.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: 600px; 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; }

/* トースト */
.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: 760px; margin: 0 auto; padding: 24px 16px; background: #fff; }
.report-cover { text-align: center; padding: 100px 0 50px; }
.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(--teal); 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; }

/* タイムライン（監査ログ） */
.timeline { border-left: 2px solid var(--border); padding-left: 16px; }
.timeline-item { position: relative; padding-bottom: 16px; font-size: 13px; }
.timeline-item::before { content: ""; position: absolute; left: -21px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.timeline-item .t-meta { font-size: 11px; color: var(--warmgray); }

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