/* 位置の共有 画面の見た目。
   平らな単色ヘッダー、グレー地に白ブロック、角 4px、影なし。
   状態の色：移動中＝青、滞在＝橙、電波なし＝灰、退勤＝薄い灰 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink: #1a1d21; --sub: #5b636d; --line: #d9dde3; --bg: #eef1f3; --paper: #fff;
  --accent: #1f5f6b; --accent-soft: #e6eff1;
  --moving: #1e6fc2; --stay: #d9740a; --offline: #7a828b; --off: #b8bec5; --ng: #c2185b; --ok: #1b7a3d;
}

html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); }
h2 { font-size: 16px; margin: 0 0 10px; }

/* ---------- ヘッダー ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  height: 50px; padding: 0 16px; background: var(--accent); color: #fff;
}
.appbar h1 { font-size: 17px; margin: 0; font-weight: 700; white-space: nowrap; }
.appbar .co { font-size: 13px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar nav { display: flex; gap: 4px; margin-left: 8px; }
.appbar nav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 4px; font-size: 14px; white-space: nowrap; }
.appbar nav { overflow-x: auto; scrollbar-width: none; }
.appbar nav a.on { background: rgba(255,255,255,.18); font-weight: 700; }
.appbar .spacer { flex: 1; }
.appbar .who { font-size: 13px; white-space: nowrap; }
.appbar .who a { color: #fff; }

/* ---------- 入力・ボタン ---------- */
label { font-size: 12px; color: var(--sub); display: block; margin-bottom: 3px; }
input[type=text], input[type=date], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; font: inherit; color: var(--ink);
}
textarea { height: auto; padding: 8px 10px; min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; font-weight: 400; }
.btn.danger { color: var(--ng); border-color: #e6a5c0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active { transform: translateY(1px); }
.hint { font-size: 12px; color: var(--sub); margin: 6px 0 0; }
.error { color: var(--ng); font-size: 13px; margin: 8px 0; }
.notice { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 4px; padding: 10px 12px; font-size: 13px; margin: 0 0 12px; }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > div { min-width: 0; }
.grow { flex: 1; }

/* ---------- 状態の印 ---------- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.moving { background: var(--moving); } .dot.stay { background: var(--stay); }
.dot.offline { background: var(--offline); } .dot.off { background: var(--off); }
.st { font-size: 12px; padding: 2px 7px; border-radius: 3px; color: #fff; white-space: nowrap; }
.st.moving { background: var(--moving); } .st.stay { background: var(--stay); }
.st.offline { background: var(--offline); } .st.off { background: var(--off); color: var(--ink); }

/* ---------- 地図の画面 ---------- */
.mapwrap { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 50px); }
.side { border-right: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; min-height: 0; }
.side .tools { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.counts button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 4px 8px; font: inherit; font-size: 13px; cursor: pointer; }
.counts button.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.list { overflow: auto; flex: 1; }
.person { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.person:hover { background: #f6f8f9; }
.person.sel { background: var(--accent-soft); }
.person .glyph { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.person .glyph svg { width: 20px; height: 20px; fill: #fff; }
.person .nm { font-weight: 700; }
.person .ds { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .tm { font-size: 12px; color: var(--sub); text-align: right; }
.empty { padding: 30px 14px; color: var(--sub); text-align: center; font-size: 14px; }
#map { width: 100%; height: 100%; background: #dfe6ea; }
.mapbox { position: relative; min-height: 0; }
.mapbtns { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 5; }
.mapbtns .btn { height: 34px; font-size: 13px; }
.mapbtns .btn.on { background: var(--accent-soft); border-color: var(--accent); }
.nomap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; color: var(--sub); }

/* 1 人の詳細 */
.detail { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.detail .head { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.detail .head .nm { font-size: 17px; font-weight: 700; }
.detail .body { overflow: auto; flex: 1; padding: 10px 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--sub); font-weight: 400; font-size: 12px; background: #f6f8f9; }
table.tbl td.num { text-align: right; white-space: nowrap; }
table.tbl tr.open td { color: var(--stay); }

.warn { display: inline-block; font-size: 11px; color: #fff; background: var(--ng); border-radius: 3px; padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
.mk .n.w { background: var(--ng); color: #fff; border-color: var(--ng); }
.pl { width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); transform: rotate(45deg); }
.pl-l { font-size: 10px; color: var(--accent); background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; white-space: nowrap; margin-top: 4px; }

/* 地図の印 */
.mk { position: relative; transform: translateY(6px); text-align: center; }
.mk .b { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; display: inline-flex; align-items: center; justify-content: center; }
.mk .b svg { width: 18px; height: 18px; fill: #fff; }
.mk .l { font-size: 11px; font-weight: 700; color: #111; background: rgba(255,255,255,.9); padding: 1px 5px; border-radius: 3px; white-space: nowrap; margin-top: 2px; }
.mk.moving .b { background: var(--moving); } .mk.stay .b { background: var(--stay); } .mk.offline .b { background: var(--offline); }
.mk.sel .b { outline: 3px solid #ffd54f; }
.mk .n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #fff; color: var(--stay); font-size: 11px; font-weight: 700; line-height: 18px; padding: 0 4px; border: 1px solid var(--stay); }
.pt { width: 10px; height: 10px; border-radius: 50%; background: var(--stay); border: 2px solid #fff; }

/* ---------- 管理の画面 ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 14px 14px 40px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--sub); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.pins { font-family: Consolas, "Courier New", monospace; font-size: 14px; }

/* ---------- ログイン ---------- */
.login-page { background: var(--bg); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 26px 24px; }
.login-box h1 { font-size: 20px; margin: 0 0 6px; }
.login-box .lead { color: var(--sub); font-size: 13px; margin: 0 0 18px; }
.login-box label { margin-top: 12px; }
.login-box .btn { width: 100%; margin-top: 18px; }

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
  .appbar { gap: 8px; padding: 0 10px; }
  .appbar .co, .appbar .who span { display: none; }
  .appbar nav a { padding: 6px 7px; font-size: 13px; }
  .mapwrap { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .side { border-right: 0; border-top: 1px solid var(--line); order: 2; }
  .mapbox { order: 1; }
  .row > div { flex: 1 1 140px; }
}

@media print {
  .appbar, .tabs, .noprint { display: none; }
  body { background: #fff; }
  .block { border: 0; padding: 0; }
}
