:root {
  --ink: #14181f;
  --soft: #3d4654;
  --muted: #667085;
  --line: #e6e8ee;
  --paper: #eef1f5;
  --card: #fff;
  --teal: #17657c;
  --teal-2: #124f61;
  --brand: #3cb0c9;
  --bad: #c4322c;
  --ok: #0f7a45;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 14px; background: var(--paper); color: var(--ink); line-height: 1.4; overflow-x: hidden; }
a { color: var(--teal); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.hdr { background: #fff; min-height: 56px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); position: relative; gap: 8px 12px; }
.hdr::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { height: 36px; width: auto; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand small, .muted { color: var(--muted); font-size: 12px; }
.hdr-r, .row-actions, .page-head, .person-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hdr-r { margin-left: auto; min-width: 0; }
.who { font-size: 13px; color: var(--soft); max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { background: #fff; display: flex; gap: 2px; padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav a { padding: 10px 12px 8px; text-decoration: none; color: var(--muted); font-weight: 650; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a.on, .nav a:hover { color: var(--ink); border-bottom-color: var(--brand); }
main { padding: 16px max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.page-head { justify-content: space-between; margin-bottom: 12px; }
.card, .login-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 12px 0; }
.login-card { max-width: 420px; margin: 48px auto; }
.login-card .btn.primary { width: 100%; min-height: 48px; }
.login-card img { height: 42px; }
.login-card h1 { margin: 12px 0 4px; }
.btn { border: 1px solid #d5d9e2; background: #fff; border-radius: 8px; padding: 8px 12px; font-weight: 650; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; }
.btn.primary { background: var(--teal); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--teal-2); }
.btn.danger { color: var(--bad); border-color: #f0c4c2; }
.btn.ghost { background: transparent; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 650; color: var(--soft); margin: 8px 0; }
label.check { flex-direction: row; align-items: center; }
input, select, textarea { border: 1px solid #d5d9e2; border-radius: 8px; padding: 8px 10px; background: #fff; font-weight: 450; max-width: 100%; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--teal); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(23, 101, 124, 0.14); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 8px 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.invite { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.invite input { width: 11rem; margin: 0; }
.invite input[type="email"] { width: min(18rem, 100%); }
.person { display: grid; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.person-name { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 28rem; }
.person-name .muted { grid-column: 1 / -1; }
.person-name label, .person-fields label { margin: 0; }
.person-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 12rem)); gap: 8px 12px; align-items: end; }
.person input, .person select { width: 100%; }
.person input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
.person .check { white-space: nowrap; }
.settings-fields { display: grid; grid-template-columns: minmax(12rem, 18rem) minmax(16rem, 28rem) auto; gap: 12px; align-items: end; }
.stack { display: flex; flex-direction: column; }
.flash { padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.flash.ok { background: #e5f6ed; color: var(--ok); }
.flash.bad { background: #fdeceb; color: var(--bad); }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
.grid th { background: var(--brand); color: #fff; text-align: left; font-size: 12px; padding: 8px; }
.grid td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hours-list { table-layout: fixed; }
.hours-list .col-person { width: 22%; }
.hours-list .col-date { width: 7.2rem; white-space: nowrap; }
.hours-list .col-hours { width: 4.2rem; white-space: nowrap; }
.hours-list .col-notes { overflow-wrap: anywhere; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 120px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: 0 1px 0 rgba(20, 24, 31, 0.04); }
.tile strong { font-size: 22px; letter-spacing: -0.02em; }
.tile.in { border-color: #b7dfc8; background: #f4fbf7; }
.flag { font-size: 12px; font-weight: 650; color: var(--teal); }
.flag.quiet { color: var(--muted); }
.since { margin-top: 6px; color: var(--soft); font-size: 13px; }
.people-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.people-pick a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--soft); font-weight: 650; }
.people-pick a.on { background: var(--teal); color: #fff; border-color: transparent; }
.clock-boxes { display: grid; grid-template-columns: 1fr; max-width: 640px; }
.clock-box { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; min-height: 180px; width: 100%; padding: 28px 18px; border: 0; border-radius: 12px; background: var(--teal); color: #fff; font: inherit; text-align: center; cursor: pointer; touch-action: manipulation; }
.clock-box strong { font-size: 32px; letter-spacing: -0.02em; line-height: 1.15; }
.clock-box span { color: rgba(255, 255, 255, 0.86); font-size: 15px; font-weight: 450; }
.clock-box:hover { background: var(--teal-2); }
@media (max-width: 800px) {
  .settings-fields { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr 1fr; }
  .nav { flex-wrap: wrap; overflow: visible; padding: 6px 10px 8px; gap: 4px; }
  .nav a { border-radius: 8px; padding: 10px 12px; }
  .nav a.on { background: #e7f6fa; border-bottom-color: transparent; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head .btn { width: 100%; }
  .clock-boxes { max-width: none; }
  .clock-box { min-height: 160px; }
  .clock-box strong { font-size: 28px; }
  .invite { flex-direction: column; align-items: stretch; }
  .invite input, .invite input[type="email"] { width: 100%; }
  .person-name, .person-fields { grid-template-columns: 1fr; max-width: none; }
  .person .check { white-space: normal; }
  .person-actions, .settings-fields .person-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .person-actions .btn { width: 100%; }
  .login-card { margin: 20px auto; }
  .table-scroll { overflow: visible; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: auto; }
  .grid { background: transparent; border-radius: 0; overflow: visible; }
  .grid thead { display: none; }
  .grid tr { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 4px 0; }
  .grid td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 38%) 1fr;
    gap: 8px 12px;
    align-items: start;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .grid td:last-child { border-bottom: 0; }
  .grid td::before { content: attr(data-label); font-weight: 650; color: var(--muted); text-align: left; }
  .grid td:first-child { font-weight: 700; }
  .grid td:first-child::before { font-weight: 650; }
  .grid td.num { text-align: right; }
  .grid td.row-link { grid-template-columns: 1fr; }
  .grid td.row-link::before { content: none; }
  .grid td.row-link .btn, .grid td.row-link form { width: 100%; }
  .grid td[colspan] { display: block; text-align: left; }
  .grid td[colspan]::before { content: none; }
  .grid td[data-label="Notes"], .grid td[data-label="What"] { grid-template-columns: 1fr; text-align: left; }
  .people-pick a { min-height: 44px; }
  .table-scroll:has(.hours-list) { overflow-x: auto; }
  .hours-list.grid { display: table; width: 100%; background: #fff; border-radius: 8px; overflow: hidden; }
  .hours-list thead { display: table-header-group; }
  .hours-list tbody { display: table-row-group; width: auto; }
  .hours-list tr { display: table-row; background: transparent; border: 0; border-radius: 0; margin: 0; padding: 0; }
  .hours-list th, .hours-list td {
    display: table-cell;
    width: auto;
    text-align: left;
    font-weight: 450;
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    vertical-align: top;
  }
  .hours-list th { font-weight: 650; }
  .hours-list td::before, .hours-list th::before { content: none; }
  .hours-list td:last-child { border-bottom: 1px solid var(--line); }
  .hours-list .num { text-align: right; font-weight: 650; }
  .hours-list .col-date { width: 6.6rem; }
  .hours-list .col-hours { width: 3.6rem; }
  .hours-list td[colspan] { text-align: left; }
}
@media (max-width: 520px) {
  .board { grid-template-columns: 1fr; }
  .brand small { display: none; }
}
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  input[type="checkbox"] { width: 1.35rem; height: 1.35rem; }
  .btn { min-height: 44px; }
  .nav a, .people-pick a { min-height: 44px; display: inline-flex; align-items: center; }
}
