:root {
  --olive: #414d26;
  --olive-line: #838b71;
  --bar-text: #f5f2e6;
  --brand: #4f5e2c;
  --cream: #f5f1e3;
  --card: #ffffff;
  --ink: #2a2d22;
  --muted: #6b6e5f;
  --line: #e2dcc8;
  --gold: #f5a81c;
  --gold-strong: #d98f0a;
  --good: #4ca64a;
  --good-strong: #3b8a39;
  --warn: #e8630e;
  --danger: #b13a2e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 40, 20, .06), 0 4px 14px rgba(40, 40, 20, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--olive);
  color: var(--bar-text);
  border-bottom: 3px solid var(--olive-line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .back { color: var(--bar-text); text-decoration: none; font-size: 13px; opacity: .85; white-space: nowrap; }
.topbar .title { font-family: "Permanent Marker", "Poppins", cursive; font-size: 22px; letter-spacing: .5px; flex: 1; text-align: center; }
.chip-me { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; border: 1.5px solid rgba(255,255,255,.7); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
main.wide { max-width: 1180px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card > h3 {
  margin: 0; background: var(--olive); color: var(--bar-text);
  padding: 11px 16px; font-size: 15px; font-weight: 600; letter-spacing: .2px;
}
.card > h3.warn { background: var(--warn); color: #fff; }
.card .body { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn, a.btn {
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  background: var(--gold); color: #2a2100; transition: background .15s, transform .05s; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--gold-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.green { background: var(--good); color: #fff; }
.btn.green:hover { background: var(--good-strong); }
.btn.red { background: var(--danger); color: #fff; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.ghost:hover { background: #faf8f0; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- clock ---------- */
.clock-card { text-align: center; padding: 26px 16px 22px; }
.clock-now { font-size: 42px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.clock-date { color: var(--muted); margin-top: 4px; }
.status-line { margin: 18px 0 20px; font-size: 16px; }
.status-line strong { color: var(--brand); }
.big-clock {
  width: 190px; height: 190px; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 22px; font-weight: 700; letter-spacing: .5px; color: #fff;
  background: var(--good); box-shadow: 0 8px 22px rgba(60, 120, 50, .35), inset 0 -6px 0 rgba(0,0,0,.12);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.big-clock small { font-size: 12px; font-weight: 500; opacity: .9; letter-spacing: 0; }
.big-clock.off { background: var(--danger); box-shadow: 0 8px 22px rgba(160, 50, 40, .35), inset 0 -6px 0 rgba(0,0,0,.12); }
.big-clock:disabled { opacity: .6; cursor: default; }
.notice { margin-top: 16px; padding: 10px 12px; border-radius: 10px; font-size: 14px; text-align: left; }
.notice.ok { background: #e9f4e6; color: #28532a; }
.notice.bad { background: #fbe6e3; color: #7a241b; }
.notice.warn { background: #fff1dd; color: #7a4308; }
.stat-row { display: flex; gap: 10px; margin-top: 18px; }
.stat { flex: 1; background: #faf8f0; border-radius: 10px; padding: 10px; }
.stat b { display: block; font-size: 20px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }

/* ---------- pills ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.pending { background: #fff1dd; color: #8a4b06; }
.pill.approved { background: #e3f1df; color: #2c6a2a; }
.pill.declined { background: #f6e0dc; color: #8c2c22; }
.pill.flag { background: #fff1dd; color: #8a4b06; }
.pill.info { background: #eceadf; color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
textarea { min-height: 80px; resize: vertical; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; min-width: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 96px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 8px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.seg button.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
.file-drop {
  border: 1.5px dashed var(--olive-line); border-radius: 10px; padding: 14px; text-align: center;
  background: #faf8f0; cursor: pointer; display: block; font-weight: 500;
}
.file-drop input { display: none; }

/* ---------- calendar ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.legend .dot { border-color: transparent; }
.cal-tools { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal-scroll { max-height: 68vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.month { padding: 4px 8px 14px; }
.month h4 { position: sticky; top: 0; background: #fff; margin: 0; padding: 10px 6px 6px; z-index: 2; font-size: 16px; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dow div { font-size: 11px; text-align: center; color: var(--muted); font-weight: 600; padding-bottom: 3px; }
.day {
  min-height: 62px; border-radius: 8px; background: #faf8f0; padding: 3px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; border: 2px solid transparent; overflow: hidden;
}
.day.blank { background: transparent; cursor: default; }
.day.weekend { background: #f0ecdd; }
.day.today .num { background: var(--olive); color: var(--bar-text); border-radius: 6px; }
.day.past { opacity: .55; }
.day.sel { border-color: var(--gold); background: #fff4dd; }
.day .num { font-size: 12px; font-weight: 600; padding: 0 4px; align-self: flex-start; }
.bar {
  font-size: 10px; line-height: 14px; color: #fff; border-radius: 4px; padding: 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600;
}
.bar.pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }
.more { font-size: 10px; color: var(--muted); padding-left: 3px; }
.day-detail { padding: 12px 16px; border-top: 1px solid var(--line); background: #fffdf6; }

/* ---------- bottom tabs (phone) ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff;
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; border: 0; background: none; padding: 10px 4px 12px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button .ico { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--brand); }
.tabs a { text-decoration: none; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; cursor: pointer; font-size: 14px; }
.admin-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.badge { background: var(--warn); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #faf8f0; font-weight: 600; font-size: 12px; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.person td { font-weight: 600; background: #fdfcf7; }
tr.flagged td { background: #fff6e8; }
.period-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period-nav .label { font-weight: 600; flex: 1; min-width: 180px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.modal-back { position: fixed; inset: 0; background: rgba(30,30,20,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; }
@media (min-width: 640px) { .modal-back { align-items: center; } .modal { border-radius: 16px; } }
.modal h4 { margin: 0 0 10px; font-size: 17px; }
.actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}

.manage-btn {
  background: var(--gold); color: #2a2100; text-decoration: none; font-weight: 600;
  padding: 5px 11px; border-radius: 8px; margin-right: 10px; font-size: 13px;
}
.manage-btn:hover { background: var(--gold-strong); }
@media (max-width: 420px) { .topbar .back { font-size: 0; } .topbar .back::before { content: "←"; font-size: 16px; } }
.notice a { color: inherit; }

/* ---------- sign in / offline ---------- */
.login-body { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; }
.login-wrap { width: 100%; max-width: 400px; padding: calc(40px + env(safe-area-inset-top)) 16px 32px; text-align: center; }
.login-wrap .card { text-align: left; }
.login-icon { border-radius: 20px; box-shadow: var(--shadow); }
.login-title { font-family: "Permanent Marker", "Poppins", cursive; color: var(--olive); font-size: 34px; margin: 14px 0 2px; font-weight: 400; }

/* installed app: keep the top bar clear of the iPhone notch/status bar */
.topbar { padding-top: calc(12px + env(safe-area-inset-top)); }

/* ---------- install helper ---------- */
.install-card .body { display: flex; gap: 14px; align-items: flex-start; }
.install-card img { border-radius: 12px; flex: none; }
.install-card p { margin: 0 0 8px; }
.install-card ol { margin: 6px 0 10px; padding-left: 20px; }
.install-card li { margin: 3px 0; }
.signout { display: block; text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 0; }
