:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --bg: #f5f7f9;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #6b7785;
  --line: #e5e8eb;
  --danger: #e34d59;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 760px; margin: 0 auto; padding: 16px; }
.app.wide { max-width: 1100px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 16px; }
.brand { font-size: 18px; font-weight: 600; }
.brand small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.links a { color: var(--muted); text-decoration: none; margin-left: 14px; font-size: 14px; }
.links a:hover { color: var(--green); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 18px 0 10px; font-size: 15px; }

.switcher { padding: 14px 20px; }
.switcher label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.switcher select { max-width: 360px; }

.flash {
  background: #e8f7ee; color: #0b7a3b; border: 1px solid #bfe8cf;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 15px; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { border-color: #c9cdd4; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #f3c2c6; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 17px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

select, input[type=text], input[type=password], input[type=month],
input[type=datetime-local], input[type=tel], input[type=search] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fff; color: var(--text);
}
select:focus, input:focus { outline: 2px solid rgba(7, 193, 96, .25); border-color: var(--green); }
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.field span { display: block; margin-bottom: 6px; }

.status { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: #f6f8fa; }
.status.open { background: #e8f7ee; }
.status.paused { background: #fff7e8; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: #c9cdd4; flex: none; }
.status.open .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(7, 193, 96, .15); }
.status.paused .dot { background: #f5a623; box-shadow: 0 0 0 4px rgba(245, 166, 35, .18); }
.punch-actions { display: flex; gap: 10px; margin-top: 16px; }
.punch-actions form { flex: 1; }
.punch-actions .btn { width: 100%; }
.status .label { font-weight: 600; }
.status .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
td.num, th.num { text-align: right; }
tbody tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.pill.done { background: #e8f7ee; color: #0b7a3b; }
.pill.open { background: #e8f0fe; color: #1a56db; }
.pill.paused { background: #fff4e5; color: #b25e00; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #f6f8fa; border-radius: 12px; padding: 14px; }
.stat .n { font-size: 24px; font-weight: 600; }
.stat .t { color: var(--muted); font-size: 13px; margin-top: 2px; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

.auth { max-width: 400px; margin: 8vh auto 0; }
.auth .card { padding: 28px; }
.auth h1 { font-size: 22px; margin: 0 0 6px; }
.auth .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.admin-nav {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  background: #fff; padding: 10px 14px; border-radius: 12px;
  margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.admin-nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.admin-nav a:hover { background: #f2f4f6; color: var(--text); }
.admin-nav .spacer { flex: 1; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: #f2f4f6; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.active { background: var(--green); color: #fff; }

.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.checkitem { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.checkitem input { width: 16px; height: 16px; flex: none; }
.checkitem span.code { color: var(--muted); font-size: 12px; margin-left: 4px; }

.table-wrap { overflow-x: auto; }
.inline-form { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline-flex; gap: 6px; align-items: center; }
.actions input[type=datetime-local] { width: 190px; padding: 6px 8px; font-size: 13px; }

@media (max-width: 600px) {
  .app { padding: 12px; }
  .card { padding: 16px; }
  th, td { padding: 8px 6px; }
  .links a { margin-left: 10px; }
}
