:root {
  --ink: #11161c;
  --text: #39434d;
  --muted: #6b7680;
  --surface: #ffffff;
  --page: #f5f6f4;
  --rule: #e3e6e1;
  --live: #17795e;
  --live-soft: #dceee6;
  --warn: #a8620a;
  --warn-soft: #fbf0dd;
  --idle: #d6dbd5;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { color: var(--ink); font-weight: 600; margin: 0; }
h1 { font-size: 27px; letter-spacing: -0.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- chrome */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 56px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 18px 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.lede { color: var(--muted); margin: 4px 0 24px; max-width: 68ch; }

/* ---------------------------------------------------------------- panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.panel-body { padding: 18px; }

/* ---------------------------------------------------------------- summary line */
.summary {
  display: flex;
  gap: 34px;
  flex-wrap: wrap;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.summary div { min-width: 88px; }
.summary dt { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.summary dd { margin: 0; color: var(--ink); font-size: 23px; font-weight: 600; }
.summary dd small { font-size: 14px; font-weight: 400; color: var(--muted); }

/* ---------------------------------------------------------------- timeline */
.tl-scale {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.tl-scale span { border-left: 1px solid transparent; padding-left: 2px; }
.tl-scale span:nth-child(3n+1) { border-left-color: var(--rule); }

.tl-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 1fr 76px;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}
.tl-row:first-of-type { border-top: none; }
.tl-name { min-width: 0; }
.tl-name a { display: block; color: var(--ink); text-decoration: none; font-weight: 500; }
.tl-name a:hover { text-decoration: underline; }
.tl-meta {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-track {
  position: relative;
  height: 24px;
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.tl-work {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #ffffff;
}
.tl-hour {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}
.tl-seg {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: var(--live);
  border-radius: 2px;
  min-width: 2px;
}
.tl-seg.open { background: repeating-linear-gradient(135deg, var(--live) 0 5px, #2f9578 5px 10px); }
.tl-seg.lost { background: var(--warn); }
.tl-total { text-align: right; font-weight: 600; color: var(--ink); }
.tl-total.zero { color: var(--muted); font-weight: 400; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- status */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--idle); }
.dot.on { background: var(--live); }
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--page);
  color: var(--muted);
  border: 1px solid var(--rule);
}
.pill.live { background: var(--live-soft); color: var(--live); border-color: #c2e2d6; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: #ecd9b4; }

/* ---------------------------------------------------------------- table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--rule); }
thead th {
  border-top: none;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}
tbody tr:hover { background: #fafbf9; }
td.right, th.right { text-align: right; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=date], input[type=time], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; }
.row > .shrink { flex: 0 0 auto; }

button, .btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover, .btn:hover { background: #000; }
.btn-quiet, button.quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
}
.btn-quiet:hover, button.quiet:hover { background: var(--page); }

.notice {
  padding: 10px 14px;
  border: 1px solid #c2e2d6;
  background: var(--live-soft);
  color: #0f5b46;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.notice.bad { background: #fdecec; border-color: #f2c4c4; color: #8c2f2f; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 4px; }

@media (max-width: 720px) {
  .tl-row { grid-template-columns: 1fr 64px; }
  .tl-track { grid-column: 1 / -1; }
  .tl-scale { display: none; }
  .summary { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
