/* 現行のWindowsアプリ（NC副作用連絡処理）の画面に寄せた見た目 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 12px;
  color: #101418;
  background: #f0f0f0;
}
button { font-family: inherit; font-size: 12px; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 12px; }

/* ---------- 共通パーツ ---------- */
.win { background: #f0f0f0; border: 1px solid #a9b3c0; margin: 8px; }
.win-title {
  background: linear-gradient(#fdfdfd, #eef1f5);
  border-bottom: 1px solid #c6cedb;
  padding: 5px 10px; font-size: 12px; display: flex; align-items: center; gap: 8px;
}
.win-title .spacer { flex: 1; }
.win-body { padding: 8px; }

.btn {
  padding: 5px 14px; border: 1px solid #8e9bab; background: linear-gradient(#ffffff, #e9edf3);
  border-radius: 3px; color: #101418;
}
.btn:hover { background: linear-gradient(#ffffff, #dbe3ee); }
.btn:disabled { color: #9aa4b1; background: #f2f2f2; cursor: default; }
.btn-sm { padding: 2px 8px; }
/* 左側の赤字セクションボタン（①情報入手日 など） */
.btn-sec {
  border: 1px solid #9aa4b1; background: linear-gradient(#ffffff, #ececec);
  color: #c00000; font-weight: 700; border-radius: 3px;
  padding: 6px 4px; width: 100%; line-height: 1.3;
}
.btn-sec:hover { background: linear-gradient(#ffffff, #dfe6ef); }

/* 入力欄は現行アプリと同じ淡い水色 */
input[type=text], input[type=date], input[type=number], select, textarea {
  border: 1px solid #9fb2c8; background: #dce9f5; padding: 3px 5px; width: 100%;
}
input[readonly], input:disabled, select:disabled, textarea[readonly] {
  background: #eef1f4; color: #46505c;
}
label.ck { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
label.ck input { width: auto; }

fieldset {
  border: 1px solid #b6bfcc; margin: 0; padding: 6px 8px 8px; background: #f5f7fa;
}
fieldset > legend { font-size: 11px; color: #23405f; padding: 0 4px; }
fieldset.patient { background: #fbf8dd; border-color: #ccc6a0; }

.hdr {
  background: #c9c9c9; border: 1px solid #a9a9a9; text-align: center;
  padding: 2px 4px; font-size: 11px; line-height: 1.25;
}
.hdr.red { color: #c00000; font-weight: 700; }
.listbox {
  border: 1px solid #9fb2c8; background: #dce9f5; height: 96px; overflow: auto;
  padding: 2px; font-size: 11.5px;
}
.listbox div { padding: 1px 3px; cursor: default; }
.listbox div.sel { background: #2a6fb5; color: #fff; }

/* ---------- 一覧画面 ---------- */
.searchbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field > span { font-size: 11px; color: #3f4b59; }
.field input, .field select { min-width: 120px; }

table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td {
  border: 1px solid #cdd4dd; padding: 2px 5px; text-align: left; white-space: nowrap;
}
table.grid th { background: #e6e6e6; font-weight: 600; font-size: 11px; position: sticky; top: 0; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: #eef5fd; }
table.grid tbody tr.sel { background: #2a6fb5; color: #fff; }
.gridwrap { max-height: 300px; overflow: auto; border: 1px solid #b6bfcc; background: #fff; }
.clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }

.detail { display: grid; grid-template-columns: 300px 180px 200px 1fr; gap: 6px; margin-top: 8px; }
.detail .kvgrid { display: grid; grid-template-columns: 84px 1fr; gap: 3px 6px; align-items: center; }
.detail .kvgrid > span { background: #c9c9c9; border: 1px solid #a9a9a9; padding: 2px 5px; font-size: 11px; }

/* ---------- 入力画面 ---------- */
.formtop { display: grid; grid-template-columns: 62px 1fr 1.35fr auto; gap: 6px; align-items: start; }
.seccol { display: grid; gap: 6px; }
.basicgrid { display: grid; grid-template-columns: 68px 1fr 88px; gap: 4px 6px; align-items: center; }
.basicgrid > .hdr { text-align: right; }
.patgrid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.patgrid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 6px; }
.topbtns { display: grid; gap: 4px; align-content: start; }
.topbtns .btn { white-space: nowrap; }

.secrow { display: grid; grid-template-columns: 62px 1fr; gap: 6px; margin-top: 8px; align-items: start; }
.secrow.split { grid-template-columns: 62px 1fr 300px; }

table.rows { width: 100%; border-collapse: collapse; background: #fff; }
table.rows th, table.rows td { border: 1px solid #cdd4dd; padding: 1px 2px; }
table.rows th { background: #e6e6e6; font-size: 11px; font-weight: 600; white-space: nowrap; }
table.rows input, table.rows select { border: none; background: transparent; padding: 2px 3px; }
table.rows tr:nth-child(even) td { background: #f4f8fc; }
table.rows td.ctrl { width: 58px; white-space: nowrap; text-align: center; background: #eef1f4; }
.rowbtn {
  border: 1px solid #9aa4b1; background: #fff; border-radius: 2px;
  width: 17px; height: 17px; line-height: 1; padding: 0; font-size: 10px;
}
.deathbox { border: 1px solid #b6bfcc; background: #f5f7fa; padding: 6px; }
.deathbox .note { color: #c00000; font-size: 11px; margin-bottom: 4px; }
.deathgrid { display: grid; grid-template-columns: 70px 1fr; gap: 4px; align-items: center; }
.deathgrid > .hdr { text-align: center; }

.bottombar { display: grid; grid-template-columns: 150px 1fr 190px 1fr; gap: 6px; align-items: center; margin-top: 8px; }

.actionbar {
  position: sticky; bottom: 0; background: #f0f0f0; border-top: 1px solid #b6bfcc;
  padding: 8px; display: flex; gap: 8px; justify-content: flex-end;
}

/* ---------- モーダル ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,28,38,.35);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #f0f0f0; border: 1px solid #8e9bab; box-shadow: 0 6px 24px rgba(0,0,0,.28);
  width: min(940px, 94vw); max-height: 90vh; display: flex; flex-direction: column;
}
.modal > header {
  padding: 5px 10px; background: linear-gradient(#fdfdfd, #eef1f5);
  border-bottom: 1px solid #c6cedb; font-size: 12px;
}
.modal > .content { padding: 10px; overflow: auto; }
.modal > footer { padding: 8px 10px; border-top: 1px solid #c6cedb; display: flex; gap: 8px; justify-content: flex-end; }
.note-red { color: #c00000; font-size: 11px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 3px 8px; font-size: 12px; }
.kv > div:nth-child(odd) { color: #3f4b59; text-align: right; }
pre.mailbody {
  background: #fff; border: 1px solid #c6cedb; padding: 8px;
  white-space: pre-wrap; font-family: inherit; font-size: 12px; margin: 6px 0 0;
}

/* ---------- ログイン / 新規登録 ---------- */
.auth-page { min-height: 100vh; background: #f5f7fa; display: flex; flex-direction: column; }
.auth-bar {
  background: #fff; border-bottom: 1px solid #e6eaf0; padding: 12px 20px;
  display: flex; align-items: center; gap: 10px;
}
.auth-bar .brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.auth-bar .brand .mark { width: 26px; height: 26px; }
.auth-bar .brand .a { color: #17457a; }
.auth-bar .brand .b { color: #2f6fd0; }
.auth-bar .spacer { flex: 1; }
.auth-bar .badge {
  background: #eaf0fb; color: #3a63b8; border-radius: 999px;
  padding: 5px 14px; font-size: 13px; font-weight: 600;
}

.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  background: #fff; border-radius: 14px; width: 380px; padding: 32px 34px 34px;
  box-shadow: 0 6px 28px rgba(23, 45, 80, .10);
}
.auth-card .logo { text-align: center; margin-bottom: 12px; }
.auth-card .logo img { width: 64px; height: 64px; }
.auth-card h1 {
  font-size: 19px; font-weight: 700; margin: 0 0 22px; text-align: center; color: #16202c;
  line-height: 1.4;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #e6eaf0; margin-bottom: 22px; }
.auth-tabs button {
  background: none; border: none; padding: 10px 0 12px; font-size: 14px; font-weight: 600;
  color: #8b95a3; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs button.on { color: #2f6fd0; border-bottom-color: #2f6fd0; }
.auth-field { margin-bottom: 16px; }
.auth-field > label { display: block; font-size: 13px; font-weight: 600; color: #46505c; margin-bottom: 6px; }
.auth-field > input {
  width: 100%; padding: 11px 13px; border: 1px solid #dfe4ea; border-radius: 8px;
  background: #fff; font-size: 14px;
}
.auth-field > input:focus { outline: none; border-color: #2f6fd0; box-shadow: 0 0 0 3px rgba(47,111,208,.12); }
.auth-submit {
  width: 100%; padding: 13px; border: none; border-radius: 8px;
  background: #2563eb; color: #fff; font-size: 15px; font-weight: 700; margin-top: 6px;
}
.auth-submit:hover { background: #1d55cc; }
.auth-submit:disabled { background: #9bb4e4; }
.auth-msg { font-size: 13px; margin-bottom: 14px; padding: 9px 12px; border-radius: 7px; }
.auth-msg.err { background: #fdeced; color: #b3261e; }
.auth-msg.ok { background: #e9f6ee; color: #1c7a4b; }

.err { color: #c00000; font-size: 12px; margin-bottom: 8px; }
.muted { color: #66707c; font-size: 11px; }

/* ステータスバー（現行アプリ下部の表示） */
.statusbar {
  border-top: 1px solid #c6cedb; background: #f0f0f0; padding: 4px 10px;
  font-size: 11px; color: #3f4b59;
}
