:root { --bd:#ddd; --bg:#f7f7f7; --fg:#111; --green:#2e7d32; --red:#b00; }
* { box-sizing: border-box; }
body { margin:0; font-family: system-ui,-apple-system,"Segoe UI",sans-serif; color:var(--fg); background:var(--bg); }
a { color: inherit; }

/* ========== Header ========== */
.top { padding:12px 16px; background:#fff; border-bottom:1px solid var(--bd); position:sticky; top:0; z-index:6; }
.brand { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.title { font-size:18px; font-weight:700; }
.nav { display:flex; gap:12px; flex-wrap:wrap; }
.navlink { font-size:13px; padding:4px 10px; border:1px solid var(--bd); border-radius:6px; text-decoration:none; background:#fff; }
.navlink:hover { background:#f0f0f0; }

/* ========== Layout ========== */
.wrap { width:100%; max-width:100%; margin:0 auto; padding:0 12px; box-sizing:border-box; display:flex; flex-direction:column; gap:12px; }

/* ========== Card ========== */
.card { background:#fff; border:1px solid var(--bd); border-radius:10px; padding:12px; }
h2 { margin:0 0 10px; font-size:16px; }
h3 { margin:10px 0 6px; font-size:14px; }

/* ========== Form elements ========== */
label { display:block; font-size:12px; margin-bottom:6px; color:#333; }
input, select, textarea { width:100%; padding:10px; border:1px solid var(--bd); border-radius:8px; font-size:14px; background:#fff; }
input[type="password"] { letter-spacing:.1em; }
textarea { resize:vertical; }
.chk { display:flex; align-items:center; gap:8px; font-size:14px; }
.row { display:flex; gap:10px; align-items:center; margin-top:10px; flex-wrap:wrap; }
.msg { font-size:13px; color:var(--red); min-height:18px; }

/* ========== Buttons ========== */
.btn { padding:10px 12px; border:1px solid var(--bd); background:#fff; border-radius:8px; cursor:pointer; font-size:14px; }
.btn.sm { padding:6px 8px; font-size:12px; }
.btn.danger { border-color:#f0b; color:var(--red); }
.btn.primary { background:#333; color:#fff; border-color:#333; }
.btn.green { background:#2e7d32; color:#fff; border:none; }
.btn.green:hover { background:#1b5e20; }
.btn:disabled { opacity:.5; cursor:not-allowed; }

/* ========== Typography ========== */
.small { font-size:12px; color:#444; }
.mono { font-family: ui-monospace,SFMono-Regular,Menlo,monospace; }
.center { text-align:center; }
.right { text-align:right; }
.mt { margin-top:10px; }
.pre { background:#f5f5f5; border:1px solid var(--bd); border-radius:6px; padding:10px; font-size:12px; white-space:pre-wrap; word-break:break-all; }

/* ========== Grid ========== */
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.grid3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.gridReg { display:grid; grid-template-columns:1fr auto auto auto; gap:10px; align-items:end; }
.regStaff { min-width:80px; }

/* ========== Table ========== */
.tableWrap { width:100%; overflow-x:auto; border:1px solid var(--bd); border-radius:10px; }
.t { width:100%; border-collapse:collapse; table-layout:fixed; background:#fff; min-width:900px; }
.t th, .t td { border-bottom:1px solid var(--bd); padding:8px; vertical-align:middle; }
.t th { position:sticky; top:0; background:#fff; z-index:1; font-size:12px; }
.in { width:100%; padding:8px; }
.acts { display:flex; gap:6px; flex-wrap:wrap; }

/* column widths */
.w-id   { width:60px }
.w-house{ width:140px }
.w-room { width:90px }
.w-res  { width:160px }
.w-staff{ width:70px }
.w-code { width:90px }
.w-lg   { width:240px }
.w-act  { width:220px }
.w-login { width: 110px; }

/* ========== Code input ========== */
.codeBlue { color:#06c; font-weight:600; }

/* ========== Dots ========== */
.dot { display:inline-block; width:12px; height:12px; border-radius:50%; border:1px solid var(--bd); }
.dot.big { width:16px; height:16px; }

/* ========== House row color bar ========== */
.houseRow { border-left:6px solid var(--houseColor, transparent); }

/* ========== Color picker ========== */
.colorPickRow { display:flex; align-items:center; gap:10px; }

/* ========== Sticky search ========== */
.stickySearch { position:sticky; top:56px; z-index:5; }
details > summary { cursor:pointer; user-select:none; font-weight:700; list-style:none; }
details > summary::-webkit-details-marker { display:none; }
details > summary::before { content:"▸"; display:inline-block; margin-right:8px; }
details[open] > summary::before { content:"▾"; }

/* ========== Card colors ========== */
.residentRegCard { background:#fffde7; }
.houseRegCard    { background:#e8f5e9; }
.controlCard     { background:#e3f2fd; }

/* ========== Push UI ========== */
.checks { display:flex; flex-wrap:wrap; gap:10px; }
.chkBox { display:flex; align-items:center; gap:6px; border:1px solid var(--bd); border-radius:999px; padding:6px 10px; background:#fff; font-size:13px; cursor:pointer; }
.pushBox { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.pushHead { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.pushBtns { display:flex; gap:8px; flex-wrap:wrap; }
.box { border:1px solid var(--bd); border-radius:8px; padding:10px; background:#fff; font-size:14px; }

/* ========== Control（通知ルール）========== */
.ruleRow { display:grid; grid-template-columns:80px 1fr 1fr 2fr 120px 80px; gap:8px; align-items:center; padding:8px 0; border-bottom:1px solid var(--bd); }
.ruleRow:last-child { border-bottom:none; }
.ruleHead { font-size:12px; font-weight:700; color:#555; }
.ruleEnabled { display:flex; justify-content:center; }
.templateVars { background:#f5f5f5; border-radius:6px; padding:8px; font-size:12px; color:#555; margin-top:6px; }

/* ========== Responsive ========== */
@media (max-width:900px) {
  .pushBox { grid-template-columns:1fr; }
  .gridReg { grid-template-columns:1fr 1fr; }
}
@media (max-width:800px) {
  .grid2 { grid-template-columns:1fr; }
  .grid3 { grid-template-columns:1fr; }
  .stickySearch { top:64px; }
  .ruleRow { grid-template-columns:1fr 1fr; }
}
