:root {
  --green: #006C35;
  --green-dark: #004D26;
  --green-soft: #E6F2EB;
  --gold: #F2B630;
  --ink: #0E1A14;
  --muted: #4F5B54;
  --line: #E3E8E4;
  --bg: #F5F7F4;
  --card: #FFFFFF;
  --red: #8E1B1B;
  --red-soft: #FBE9E9;
  --amber: #6B4600;
  --amber-soft: #FDF3DC;
  --blue: #1F4E79;
  --blue-soft: #E7EEF6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #EEF3EF; --muted: #A9B5AE; --line: #26322B; --bg: #0F1712; --card: #17211B;
    --green-soft: #12301F; --red-soft: #3A1717; --amber-soft: #3A2C0E; --blue-soft: #14263A;
    --red: #F2A3A3; --amber: #F5CE7A; --blue: #A9C8EA;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Cairo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--green); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.brand img { background: #fff; border-radius: 8px; padding: 2px; }
.link { background: none; border: 0; color: #fff; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; padding: 0 8px; }
main { max-width: 480px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 0; }
.section-h { margin: 24px 0 8px; font-size: 16px; }
.muted { color: var(--muted); margin: 0 0 12px; }
.small { font-size: 13px; }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
input, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1.5px solid #C9D2CC; border-radius: 12px; min-height: 48px; padding: 8px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent); border-color: var(--green); }
.tenant summary { cursor: pointer; color: var(--muted); font-size: 13px; min-height: 32px; }
.tenant input { margin-top: 6px; }
.btn { font: inherit; font-weight: 800; font-size: 16px; min-height: 50px; border-radius: 12px; border: 0; cursor: pointer; padding: 0 18px; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid #C9D2CC; }
.err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; margin: 0; font-weight: 700; font-size: 14px; }

.hello h1 { margin-top: 4px; }
.status { text-align: center; }
.clock { font-size: 52px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.day-line { margin: 6px 0 10px; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.facts div { background: var(--bg); border-radius: 10px; padding: 8px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 800; font-size: 16px; }

.punch {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 200px; height: 200px; margin: 24px auto 8px; border-radius: 50%; border: 0; cursor: pointer;
  font: inherit; font-size: 20px; font-weight: 800; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 108, 53, .25);
}
.punch.in { background: var(--green); }
.punch.out { background: var(--green-dark); box-shadow: 0 10px 30px rgba(0, 77, 38, .3); }
.punch.done { background: #9AA49D; box-shadow: none; }
.punch:disabled { cursor: wait; opacity: .75; }
.punch:focus-visible { outline: 4px solid var(--gold); outline-offset: 4px; }
.punch-icon { width: 44px; height: 44px; border: 4px solid #fff; border-radius: 50%; position: relative; }
.punch-icon::after { content: ""; position: absolute; top: 8px; right: 17px; width: 4px; height: 14px; background: #fff; border-radius: 2px; }

.result { margin-top: 12px; border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.result.accepted { background: var(--green-soft); color: var(--green); }
.result.pendingApproval { background: var(--amber-soft); color: var(--amber); }
.result.rejected { background: var(--red-soft); color: var(--red); }

.punches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.punches li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.p-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.p-kind { font-weight: 800; }
.p-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.badge.accepted { background: var(--green-soft); color: var(--green); }
.badge.pendingApproval { background: var(--amber-soft); color: var(--amber); }
.badge.rejected { background: var(--red-soft); color: var(--red); }
.p-msg { font-size: 13px; color: var(--muted); }

.sheet-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  background: var(--card); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
  max-height: 90dvh; overflow: auto;
}
.sheet h2 { text-align: center; }
.sheet-time { text-align: center; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.early { background: var(--amber-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.early p { margin: 0; }
.warn { color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 14px; font-weight: 700; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px solid #C9D2CC; background: var(--card); color: var(--ink); cursor: pointer; }
.chip[aria-checked="true"] { background: var(--green); border-color: var(--green); color: #fff; }
