:root {
  --ink: #1B2230;
  --ink-2: #3A4352;
  --muted: #5B6472;
  --ground: #F3F4F1;
  --card: #FFFFFF;
  --line: #DADDD6;
  --line-2: #E6E8E3;
  --accent: #1F4E79;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EEF5;
  --warn-bg: #FFF6E5;
  --warn-line: #F0CF8A;
  --warn-ink: #7A4A00;
  --ok-bg: #E3F1E8;
  --ok-ink: #1E5C36;
  --bad-bg: #FBE7E7;
  --bad-ink: #8A1F1F;
  --radius: 14px;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--ground); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--ink); color: var(--ground);
}
.brand { color: var(--ground); text-decoration: none; font-weight: 700; font-size: 16px; }
.proto { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #2A3344; color: #B9C0CC; }
.spacer { flex: 1; }
.who { font-size: 13px; color: #B9C0CC; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 12px; color: var(--muted); }
.pre { white-space: pre-wrap; }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { border-color: #B9BDB3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad-ink); }
.btn.ghost { background: transparent; border-color: #4A5468; color: inherit; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.rec { background: #C62828; border-color: #C62828; color: #fff; font-weight: 700; min-height: 64px; padding: 0 28px; font-size: 17px; border-radius: 16px; }

label { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; flex-direction: column; gap: 4px; }
input[type=text], input[type=password], input[type=date], select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: #FAFAF8;
  border: 1px solid #C9CDC4; border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid #9DB7D1; outline-offset: 1px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 16px 0; }
.tabs a {
  padding: 12px 16px; min-height: 44px; text-decoration: none; color: var(--muted); font-weight: 500;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }

.chip { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: #FDEBD3; color: var(--warn-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #3D2A00; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.notice.info { background: var(--accent-soft); border-color: #C3D3E3; color: var(--ink); }
.notice.error { background: var(--bad-bg); border-color: #EBB8B8; color: var(--bad-ink); }

.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-2); }
.list-item:first-child { border-top: none; }
.grow { flex: 1; min-width: 0; }

.audit-card { text-decoration: none; color: inherit; display: block; }
.audit-card:hover { border-color: #B9BDB3; }

.risk { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.q { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.q .opening { font-size: 16px; font-weight: 500; }
.followup { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; font-size: 14px; padding: 8px 10px; background: #F6F7F4; border-radius: 8px; }
@media (max-width: 760px) { .followup { grid-template-columns: minmax(0, 1fr); } }
.quote { font-size: 13px; color: var(--ink-2); background: #F6F7F4; border-radius: 8px; padding: 6px 10px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

.seg { display: grid; grid-template-columns: 64px 116px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); align-items: start; }
.seg:first-child { border-top: none; }
.seg .t { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--accent); background: none; border: none; padding: 10px 0; cursor: pointer; text-align: left; }
.seg select { min-height: 38px; padding: 4px 8px; font-size: 13px; }
.seg .txt { padding: 8px 0; cursor: text; }
.seg .txt.edited::after { content: "修正済"; font-size: 11px; color: var(--ok-ink); background: var(--ok-bg); border-radius: 4px; padding: 0 4px; margin-left: 6px; }
@media (max-width: 760px) { .seg { grid-template-columns: 56px minmax(0, 1fr); } .seg select { grid-column: 2; } .seg .txt { grid-column: 1 / -1; } }

.finding { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.finding.accepted, .finding.edited { border-color: #9CC8AB; background: #FBFEFC; }
.finding.rejected { opacity: .6; }
.finding .statement { font-size: 15px; }

.rec-panel { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 16px; }
.rec-time { font-family: ui-monospace, Menlo, monospace; font-size: 44px; font-weight: 500; letter-spacing: .04em; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: #C62828; display: inline-block; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
progress { width: 100%; height: 10px; }

.spinner { width: 16px; height: 16px; border: 2px solid #C3D3E3; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-top: 1px solid var(--line-2); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; }

.subcard { border: 1px solid var(--line-2); background: #FAFAF8; border-radius: 12px; padding: 12px 14px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
kbd { font-family: inherit; font-size: 12px; border: 1px solid #C9CDC4; border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: #fff; }
.share-preview { width: 100%; max-height: 260px; background: #1B2230; border-radius: 10px; object-fit: contain; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid #9DB7D1; outline-offset: 1px; }

.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-height: 60px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; }
.mode[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

dialog.wide { max-width: 1160px; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.review-img { width: 100%; max-height: 72vh; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@media (max-width: 860px) { .review-grid { grid-template-columns: minmax(0, 1fr); } .review-img { max-height: 45vh; } }
.table-wrap { overflow-x: auto; }

/* 携帯（Android）の画面幅 */
@media (max-width: 560px) {
  body { font-size: 15px; }
  main { padding: 12px 10px 72px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .who, .proto { display: none; }
  h1 { font-size: 19px; }
  .card { padding: 14px 12px; }
  .tabs { margin: 12px -10px; padding: 0 6px; }
  .tabs a { padding: 10px 10px; }
  .rec-panel { padding: 20px 8px; }
  .rec-time { font-size: 38px; }
  .btn.rec { width: 100%; }
  .modes { grid-template-columns: minmax(0, 1fr); }
  .list-item { flex-wrap: wrap; }
  .row.between > .row { width: 100%; }
  .row.between > .row > .btn { flex: 1; }
  dialog { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; margin: 0; }
  .dialog-body { padding: 14px 12px; }
}

.login { max-width: 400px; margin: 60px auto; }
dialog { border: none; border-radius: 16px; padding: 0; max-width: 640px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(27, 34, 48, .45); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
