:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1f5fa8;
  --brand-d: #174a85;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
header.topbar {
  background: var(--brand);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
header.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
header.topbar .sub { font-size: 12px; opacity: .85; }
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.wrap-narrow { max-width: 620px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 64px; resize: vertical; }
.field { margin-bottom: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--ink); cursor: pointer; }
.checks input { width: auto; }
.agreement-text {
  max-height: 280px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.75;
  background: #fafafa; color: var(--ink); margin-top: 8px;
}
.sig-wrap { border: 1px dashed #9ca3af; border-radius: 8px; background: #fff; }
.sigpad { width: 100%; height: 170px; display: block; touch-action: none; cursor: crosshair; }
.cargo-row { margin-bottom: 8px; }
.crow { display: grid; grid-template-columns: 1.3fr 1.6fr 56px; gap: 8px; align-items: center; }
.crow.crow-head { margin-bottom: 4px; gap: 8px; }
.crow select, .crow input { padding: 8px 8px; font-size: 14px; }

button, .btn {
  appearance: none;
  border: none;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--brand-d); }
button.secondary { background: #eef2f7; color: var(--brand); }
button.secondary:hover { background: #e2e8f2; }
button.danger { background: #fff; color: var(--danger); border: 1px solid #f2c7c7; }
button.ghost { background: transparent; color: var(--muted); padding: 6px 8px; }
button.small { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f9fafb; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.st-問い合わせ { background:#eef2ff; color:#4338ca; }
.st-内見 { background:#e0f2fe; color:#0369a1; }
.st-申込 { background:#fef3c7; color:#b45309; }
.st-契約 { background:#dcfce7; color:#15803d; }
.st-引っ越し調整 { background:#ffe4e6; color:#be123c; }
.st-入居後フォロー { background:#f3e8ff; color:#7e22ce; }

.pill { display:inline-block; padding:2px 8px; border-radius:6px; font-size:12px; background:#f1f5f9; color:#475569; }
.pill.ok { background:#dcfce7; color:#15803d; }
.pill.warn { background:#fef3c7; color:#b45309; }
.pill.alert { background:#fee2e2; color:#b91c1c; }

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; }
a { color: var(--brand); }

.estimate-box {
  background: linear-gradient(135deg,#1f5fa8,#2b7fce);
  color:#fff; border-radius:12px; padding:16px; margin-bottom:16px;
}
.estimate-box .big { font-size: 30px; font-weight: 800; line-height:1.1; }
.estimate-box .grid { display:flex; gap:18px; flex-wrap:wrap; margin-top:8px; }
.estimate-box .grid > div { }
.estimate-box small { opacity:.85; display:block; font-size:11px; }

.thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border:1px solid var(--line); }
.thumbs { display:flex; gap:8px; flex-wrap:wrap; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; z-index: 50; overflow-y: auto;
}
.modal {
  background:#fff; border-radius: 14px; width: 100%; max-width: 720px;
  padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,.2); margin: 24px 0;
}
.modal h2 { margin-top: 0; }
.close-x { float: right; background:none; color:var(--muted); font-size:20px; padding:0 6px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #111827; color:#fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.empty { text-align:center; color: var(--muted); padding: 30px 10px; }
.link-box { display:flex; gap:8px; align-items:center; }
.link-box input { font-size: 12px; background:#f8fafc; }

.hr { height:1px; background:var(--line); margin:16px 0; border:0; }
.flag-line { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--line); }
.tabbar { display:flex; gap:6px; margin-bottom:14px; flex-wrap:wrap; }
.tabbar button { background:#eef2f7; color:var(--brand); }
.tabbar button.active { background:var(--brand); color:#fff; }

@media (max-width: 640px) {
  th.hide-sp, td.hide-sp { display: none; }
  .container { padding: 12px; }
}
