:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --ink: #1f2420;
  --muted: #6b726c;
  --line: #dde1db;
  --accent: #2f6b4f;
  --accent-soft: #e4f0e9;
  --wait: #b5651d;
  --wait-soft: #fbeedd;
  --danger: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 16px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; background: var(--accent); color: #fff;
}
.top a, .top .linkbtn { color: #fff; text-decoration: none; }
.brand { font-weight: bold; }
.top nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 380px; margin: 40px auto; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 16px 0 8px; }

.flash { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }

.btn {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); text-decoration: none; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.full { width: 100%; }
.linkbtn { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

.form label, .card.narrow label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-family: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px; }
legend { font-size: 14px; color: var(--muted); padding: 0 4px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radio { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; color: var(--ink) !important; font-size: 16px !important; }
.radio input { width: auto; margin: 0; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--line); }

.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.monthnav h1 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .btn.primary { margin-left: auto; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.muted { color: var(--muted); }

.res.past { opacity: .6; }
.res-head { display: flex; justify-content: space-between; align-items: center; }
.date { font-size: 20px; font-weight: bold; margin-right: 8px; }
.time { color: var(--muted); }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.wait { background: var(--wait-soft); color: var(--wait); }
.client { margin-top: 4px; font-weight: bold; }
.spec { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 4px; font-size: 14px; }

.duty { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); padding: 10px 0 4px; }
.duty-label { width: 40px; flex: none; font-weight: bold; padding-top: 2px; }
.duty-body { flex: 1; min-width: 0; }
.assignee.set { font-weight: bold; color: var(--accent); }
.assignee.unset { font-weight: bold; color: var(--wait); }
.hands { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hand { display: inline-block; background: #f0f1ee; color: var(--ink); border-radius: 4px; padding: 0 6px; margin: 2px 2px 0 0; }
.hand.chosen { background: var(--accent-soft); color: var(--accent); font-weight: bold; }
.assign select { margin-top: 6px; font-size: 14px; padding: 6px 8px; }
.handform { flex: none; }
.handbtn { min-width: 84px; text-align: center; border-color: var(--accent); color: var(--accent); font-weight: bold; }
.handbtn.on { background: var(--accent); color: #fff; }
.handbtn small { display: block; font-size: 11px; font-weight: normal; }
.res-foot { display: flex; gap: 16px; justify-content: flex-end; font-size: 14px; padding-top: 8px; }

table.list, table.kv { width: 100%; border-collapse: collapse; }
table.list th, table.list td, table.kv th, table.kv td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 13px; color: var(--muted); font-weight: normal; }
tr.inactive td { color: var(--muted); }
.nowrap { white-space: nowrap; }
.nowrap > * { margin-left: 10px; }
table.kv th { width: 100px; color: var(--muted); font-weight: normal; }
td.big { font-size: 20px; font-weight: bold; }
.warn { color: var(--wait); font-weight: bold; }
.instructions { border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-height: 60px; }

.figure { display: block; width: 100%; max-width: 420px; margin: 16px auto; }
.fig-base { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.fig-use { fill: var(--accent); fill-opacity: .35; }
.fig-line { stroke: var(--muted); stroke-dasharray: 4 4; }
.fig-dir { font-size: 13px; fill: var(--muted); }
.fig-label { font-size: 13px; fill: var(--ink); }
.door-open { fill: var(--accent); }
.door-closed { fill: #fff; stroke: var(--danger); stroke-width: 2; }

@media (max-width: 480px) {
  .date { font-size: 18px; }
  .toolbar .btn.primary { margin-left: 0; width: 100%; text-align: center; }
}
@media print {
  .noprint { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: none; }
}
.small { font-size: 13px; }
p.small { margin: 0 0 10px; }
.role { font-size: 13px; padding: 1px 8px; border-radius: 999px; background: #f0f1ee; white-space: nowrap; }
.role-admin { background: var(--accent); color: #fff; }
.role-sub { background: var(--accent-soft); color: var(--accent); }
.badges { display: flex; gap: 6px; align-items: center; }
.badge.src { background: #e8eefb; color: #2b55a3; }
.badge.cancel { background: #f6e1df; color: var(--danger); }
.inactive-res .date, .inactive-res .time, .inactive-res .client { text-decoration: line-through; color: var(--muted); }
.review { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; background: var(--wait-soft); color: var(--wait); border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 13px; }
.review .linkbtn { color: var(--wait); font-size: 13px; }
.syncbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.syncbar.error { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.chip .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--wait); color: #fff; font-size: 12px; text-align: center; }
.alert { background: var(--wait-soft); color: var(--wait); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.note { background: #e8eefb; color: #2b55a3; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
input[readonly] { background: #f4f5f2; color: var(--muted); }
.feed { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.feed input { font-size: 13px; background: #fff; color: var(--ink); }
