/* NCCS -- mobile-first styles */
:root {
  --primary: #1a73e8;
  --primary-dark: #1558b0;
  --danger: #d93025;
  --ok: #188038;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --border: #dadce0;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .spacer { width: 64px; }
.lang-toggle {
  background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.5);
  border-radius: 20px; padding: 8px 14px; font-size: 14px; min-height: 40px; cursor: pointer;
}
.back-btn {
  background: none; border: none; color: #fff; font-size: 16px; cursor: pointer;
  min-height: 44px; min-width: 44px;
}

.page { padding: 16px 16px 40px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card h2 { margin: 0 0 12px; font-size: 18px; }
.card h3 { margin: 14px 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* forms */
label.field { display: block; margin-bottom: 14px; font-weight: 600; font-size: 15px; }
label.field .req { color: var(--danger); }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], textarea, select {
  display: block; width: 100%; margin-top: 6px;
  padding: 14px 12px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* checkable option rows — big touch targets */
.check-grid { display: grid; gap: 10px; }
.member-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-row .check-opt { flex: 1; min-width: 180px; }
.check-opt {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 12px; min-height: 56px; cursor: pointer; background: #fff;
  font-size: 16px; user-select: none;
}
.check-opt input { width: 22px; height: 22px; accent-color: var(--primary); flex-shrink: 0; }
.check-opt.selected { border-color: var(--primary); background: #e8f0fe; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 22px; font-size: 17px; font-weight: 600;
  border: none; border-radius: 10px; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn.block { display: flex; width: 100%; }
.btn.secondary { background: #e8eaed; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* check-in hero button */
.checkin-hero { text-align: center; padding: 8px 0; }
.checkin-hero .btn { font-size: 20px; min-height: 64px; padding: 14px 40px; border-radius: 14px; }
.checked-badge {
  display: inline-block; background: #e6f4ea; color: var(--ok);
  font-size: 18px; font-weight: 700; padding: 14px 28px; border-radius: 14px;
}

/* messages */
.msg-item {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; cursor: pointer; font-size: 16px; color: var(--text);
}
.msg-item.unread { border-left: 5px solid var(--primary); background: #fff; }
.msg-item .msg-title { font-weight: 700; margin-bottom: 4px; }
.msg-item .msg-time { font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block; background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 12px; padding: 2px 9px; margin-left: 8px;
  vertical-align: middle;
}
.msg-body { white-space: pre-wrap; font-size: 16px; }
/* unread people are marked in red wherever read stats are shown */
.unread-name { color: var(--danger); font-weight: 700; }
.read-count-low { color: var(--danger); font-weight: 700; }

/* nav tabs (staff bottom nav) */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px; z-index: 50;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; text-align: center; padding: 12px 4px 10px; text-decoration: none;
  color: var(--muted); font-size: 13px; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.bottomnav a .ico { font-size: 22px; }
.bottomnav a.active { color: var(--primary); font-weight: 700; }
.has-bottomnav { padding-bottom: 90px; }

/* admin */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 14px 8px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.staff-row { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.staff-row > button.head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: none; padding: 14px; font-size: 16px; cursor: pointer; text-align: left; color: var(--text);
}
.staff-row .detail { padding: 0 14px 14px; border-top: 1px solid var(--border); display: none; }
.staff-row.open .detail { display: block; }
.staff-row .detail dl { margin: 10px 0; }
.staff-row .detail dt { font-weight: 700; font-size: 14px; color: var(--muted); margin-top: 8px; }
.staff-row .detail dd { margin: 2px 0 0; font-size: 15px; }
.pill { display: inline-block; background: #e8f0fe; color: var(--primary-dark); border-radius: 20px; padding: 4px 12px; font-size: 14px; margin: 2px 4px 2px 0; }
.pill.ok { background: #e6f4ea; color: var(--ok); }
.pill.no { background: #fce8e6; color: var(--danger); }
a.tel { color: var(--primary); font-weight: 700; font-size: 17px; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table.admin-table { width: max-content; min-width: 100%; }
.table-scroll th, .table-scroll td { white-space: nowrap; }
.table-scroll input { max-width: 150px; }
table.admin-table th, table.admin-table td { border-bottom: 1px solid var(--border); padding: 10px 6px; text-align: left; }
.admin-nav { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.admin-nav a {
  flex-shrink: 0; text-decoration: none; color: var(--muted); font-size: 15px;
  padding: 10px 14px; border-radius: 20px; background: var(--bg); min-height: 44px;
  display: inline-flex; align-items: center;
}
.admin-nav a.active { background: var(--primary); color: #fff; font-weight: 700; }
.searchbar { margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: #bdc1c6; }

/* QR */
.qr-wrap { text-align: center; }
.qr-wrap img { max-width: 100%; width: 300px; height: auto; border: 8px solid #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.code-box { word-break: break-all; background: #f1f3f4; border-radius: 8px; padding: 10px; font-size: 14px; margin: 12px 0; }

/* guide steps */
.step { display: flex; gap: 12px; margin-bottom: 16px; }
.step .n {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step .t { font-size: 16px; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.alert.err { background: #fce8e6; color: #a50e0e; }
.alert.ok { background: #e6f4ea; color: #0d652d; }
.alert.info { background: #e8f0fe; color: #174ea6; }

.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.checkbox-line { display: flex; align-items: center; gap: 10px; min-height: 52px; font-size: 16px; cursor: pointer; }
.checkbox-line input { width: 22px; height: 22px; accent-color: var(--primary); }

.shift-row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); }
.shift-row:last-child { border-bottom: none; }
.shift-row .muted { font-size: 13px; }
.slot-assign { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.punch-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.punch-table th, .punch-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.punch-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.group-head { font-weight: 700; margin: 12px 0 6px; color: var(--text); }
.group-head:first-child { margin-top: 0; }
