:root {
  --teal: #173f4a;
  --teal-2: #20515e;
  --bg: #eef2f4;
  --card: #ffffff;
  --line: #dde5e8;
  --ink: #142d35;
  --muted: #6b7f86;
  --soft: #f1f5f6;
  --green-bg: #eef6e6;
  --green-line: #cfe3bd;
  --green-ink: #3d6b22;
  --green-btn: #e6f1dc;
  --green-btn-line: #b7d39c;
  --lime: #c6e86e;
  --warn-bg: #fdefea;
  --warn-ink: #a8442a;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.statusbar { height: env(safe-area-inset-top); background: var(--teal); position: sticky; top: 0; z-index: 5; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 48px; height: 48px; border-radius: 12px; }
.brand-name { font-weight: 700; letter-spacing: .12em; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 15px; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-bg); border: 1px solid var(--green-line);
  font-weight: 700; color: var(--teal);
}
.icon-btn {
  border: 0; background: none; color: var(--ink); padding: 8px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn.boxed { border: 1px solid var(--line); width: 52px; height: 52px; background: #fff; }

/* Layout */
.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.eyebrow { margin: 22px 0 4px; letter-spacing: .12em; font-size: 13px; font-weight: 600; color: var(--muted); }
h1 { margin: 0; font-size: 38px; letter-spacing: -.02em; line-height: 1.1; }
.lead { margin: 6px 0 20px; color: var(--muted); font-size: 17px; }
h2 { margin: 0 0 14px; font-size: 21px; }
h2.tight { margin: 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px; margin-bottom: 18px;
}
.card-soft {
  background: #e4ece9; border: 1px solid #d3e0dc; border-radius: 16px;
}
.label { margin: 0; font-size: 13px; letter-spacing: .14em; font-weight: 600; color: var(--muted); }
.label.green { color: #7a8f6a; }
.label.light { color: #a9c2c8; }
.muted { color: var(--muted); margin: 0; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* Install banner */
.install { display: flex; align-items: center; gap: 12px; padding: 12px; }
.install img { width: 44px; height: 44px; border-radius: 10px; }
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.install-text strong { font-size: 15px; }
.install-text span { font-size: 13px; color: var(--muted); }

/* Workday */
.badge {
  font-size: 14px; padding: 5px 12px; border-radius: 8px;
  background: var(--soft); color: var(--muted); white-space: nowrap;
}
.badge.on { background: #e3f1d6; color: var(--green-ink); }
.badge.on::before { content: "● "; font-size: 10px; vertical-align: 2px; }
.clock { margin: 18px 0 4px; font-size: 64px; font-weight: 400; letter-spacing: -.02em; color: var(--teal); line-height: 1; font-variant-numeric: tabular-nums; }

#since { margin-bottom: 18px; }

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-size: 15px; margin-bottom: 6px; }
.field em { font-style: normal; color: var(--muted); font-size: 13px; margin-left: 4px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  appearance: none; -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7f86' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.field input:focus, .field select:focus { outline: 2px solid #9cc3cc; border-color: transparent; }

button { font: inherit; cursor: pointer; }
button:disabled { opacity: .6; cursor: progress; }
.wide { width: 100%; }
.btn-dark, .btn-green, .btn-white {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 14px; padding: 15px 18px; font-size: 18px;
}
.btn-dark { background: var(--teal); color: #fff; border: 0; }
.btn-dark.small { font-size: 15px; padding: 11px 14px; border-radius: 10px; gap: 8px; white-space: nowrap; }
.btn-green { background: var(--green-btn); color: #2c4a1a; border: 1px solid var(--green-btn-line); }
.btn-white { background: #fff; color: var(--teal); border: 0; font-size: 17px; padding: 13px 18px; border-radius: 10px; }

.site-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--green-bg); border: 1px solid var(--green-line); border-radius: 14px;
  padding: 18px 16px; margin-bottom: 4px;
}
.site-icon { width: 48px; height: 48px; border-radius: 10px; background: #dcebcf; display: grid; place-items: center; color: var(--green-ink); }
.site-icon svg { width: 24px; height: 24px; }
.site-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 15px; color: var(--muted); }
.site-text strong { color: var(--ink); font-size: 19px; margin: 2px 0; overflow-wrap: anywhere; }
.tick { color: var(--green-ink); width: 26px; height: 26px; }

.note { display: flex; gap: 8px; color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.note svg { width: 18px; height: 18px; margin-top: 1px; }

/* GPS card */
.gps { background: var(--teal); border-color: var(--teal); color: #fff; }
.gps-icon { color: #a9c2c8; width: 24px; height: 24px; }
.gps-head { display: flex; gap: 18px; align-items: flex-start; margin: 22px 0 16px; }
.pin-box { width: 74px; height: 74px; border-radius: 16px; background: var(--teal-2); border: 1px solid #3b6b77; display: grid; place-items: center; color: var(--lime); flex: none; }
.pin-box svg { width: 30px; height: 30px; }
.gps-head h3 { margin: 0 0 6px; font-size: 21px; }
.gps-head p { margin: 0; color: #c7d8dc; }
.gps-body { color: #c7d8dc; font-size: 15px; margin: 0 0 18px; }
.gps-result { background: var(--teal-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.gps-result a { color: var(--lime); }

/* Today */
.big { font-size: 48px; color: var(--teal); margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.split { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.split > div { display: flex; flex-direction: column; gap: 4px; }
.split > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.split strong { font-size: 18px; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 16px; margin-top: 16px; font-size: 15px; }

/* History */
.history { padding-bottom: 6px; }
.hist-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; background: var(--soft); margin: 16px -20px 0; padding: 12px 20px; border-bottom: 2px solid var(--teal); }
#historyList { list-style: none; margin: 0 -20px; padding: 0; }
#historyList li { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
#historyList li:last-child { border-bottom: 0; }
.h-left { min-width: 0; }
.h-left strong { display: block; font-size: 17px; overflow-wrap: anywhere; }
.h-left span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.h-right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 15px; }
.h-right span { display: block; }
.h-right .out-open { color: var(--green-ink); }
.h-right .dur { color: var(--muted); font-size: 13px; }
.h-links a { color: var(--teal); font-size: 13px; margin-right: 10px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }

/* Dialog + toast */
dialog { border: 0; border-radius: 18px; padding: 22px; max-width: 360px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(10, 30, 36, .45); }
dialog h3 { margin: 0 0 10px; }
dialog ol { padding-left: 20px; margin: 0 0 18px; }
dialog li { margin-bottom: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px;
  max-width: calc(100% - 32px); width: max-content; opacity: 0; pointer-events: none; transition: .25s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--warn-ink); }
.toast.good { background: var(--green-ink); }

@media (max-width: 380px) {
  .clock { font-size: 52px; }
  h1 { font-size: 32px; }
  .install .btn-dark.small { padding: 10px; }
}
