/* HIT field app — brand Red/Black/Grey. iPad-friendly, large touch targets. */
:root {
  --red: #C01F1F; --black: #1A1A1A; --grey: #5A5A5A; --lgrey: #EDEDED;
  --line: #DDD; --bg: #F7F7F7; --ok: #2E7D32; --warn: #B8860B;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--black); }
.hidden { display: none !important; }

.app-header { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #fff; border-bottom: 2px solid var(--red); position: sticky; top: 0; z-index: 10; }
.logo { height: 38px; }
.header-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--grey); }
.net-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.net-dot.online { background: var(--ok); }
.net-dot.offline { background: var(--warn); }

.offline-banner { background: var(--warn); color: #fff; padding: 8px 16px; font-size: 13px; text-align: center; }

main { padding: 16px; padding-bottom: 40px; max-width: 820px; margin: 0 auto; }

h1 { font-size: 22px; color: var(--red); margin: 4px 0 14px; }
h2 { font-size: 17px; color: var(--black); margin: 18px 0 8px; }
.muted { color: var(--grey); font-size: 13px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: #fafafa; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--lgrey); color: var(--grey); }
.pill.red { background: #fcebeb; color: var(--red); }
.pill.ok { background: #e8f5e9; color: var(--ok); }

button { font-family: inherit; }
.btn { background: var(--red); color: #fff; border: none; border-radius: 10px;
  padding: 14px 18px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%; }
.btn.secondary { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn.grey { background: var(--grey); }
.btn:active { opacity: .85; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row .btn { width: auto; flex: 1; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input, textarea, select { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; }

/* checklist */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--lgrey); }
.task:last-child { border-bottom: none; }
.checkbox { width: 28px; height: 28px; border: 2px solid var(--grey); border-radius: 6px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--red); cursor: pointer; }
.checkbox.checked { background: #fcebeb; border-color: var(--red); }
.task-label { font-size: 15px; line-height: 1.35; padding-top: 2px; }

/* signature pad */
.sigpad { border: 2px dashed var(--grey); border-radius: 10px; background: #fff; touch-action: none; width: 100%; height: 150px; }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.tabbar { position: sticky; top: 58px; z-index: 9; display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: none; background: none; padding: 14px 0; font-size: 13px; color: var(--grey); cursor: pointer; }
.tab.active { color: var(--red); font-weight: 700; box-shadow: inset 0 -3px 0 var(--red); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat .n { font-size: 28px; font-weight: 800; color: var(--red); }
.stat .l { font-size: 12px; color: var(--grey); }

.banner-note { background: #fff8e1; border: 1px solid #ffe082; border-radius: 10px; padding: 10px 12px; font-size: 12px; color: #7a5c00; margin-bottom: 12px; }
.back { background: none; border: none; color: var(--red); font-size: 15px; padding: 6px 0; cursor: pointer; }

/* calendar */
.cal-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.cal-mode { flex: 1; padding: 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 14px; color: var(--grey); cursor: pointer; }
.cal-mode.active { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-arrow { background: #fff; border: 1px solid var(--line); border-radius: 8px; width: 44px; height: 40px; font-size: 18px; color: var(--red); cursor: pointer; }
.cal-title { font-size: 16px; font-weight: 700; color: var(--black); }

.appt-chip { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-left: 3px solid var(--red); background: #fff; border-radius: 6px; margin-bottom: 8px; cursor: pointer; }
.appt-chip:active { background: #fafafa; }
.appt-time { font-size: 12px; color: var(--red); font-weight: 600; }

.week-row { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--lgrey); }
.week-row:last-child { border-bottom: none; }
.week-day { flex: 0 0 50px; text-align: center; cursor: pointer; border-radius: 8px; padding: 4px 0; }
.week-day.today { background: #fcebeb; }
.wd-name { font-size: 11px; color: var(--grey); }
.wd-num { font-size: 18px; font-weight: 700; }
.week-appts { flex: 1; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.m-dow { background: var(--black); color: #fff; text-align: center; font-size: 11px; padding: 6px 0; }
.m-cell { background: #fff; min-height: 64px; padding: 4px; cursor: pointer; font-size: 11px; }
.m-cell.dim { background: #f4f4f4; color: #bbb; }
.m-cell.today .m-num { background: var(--red); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.m-num { font-weight: 600; }
.m-dot { background: #fcebeb; color: var(--red); border-radius: 4px; padding: 1px 3px; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; }
.m-more { color: var(--grey); font-size: 10px; margin-top: 1px; }

/* ---- Login screen ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { background: #fff; border-radius: 14px; border-top: 4px solid var(--red); padding: 32px 28px; width: 100%; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,0.08); text-align: center; }
.login-logo { height: 56px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; color: var(--black); }
.login-sub { font-size: 14px; color: var(--grey); margin: 0 0 20px; }
.login-card input { width: 100%; padding: 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.login-card input:focus { outline: none; border-color: var(--red); }
.login-card button { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; color: #fff; background: var(--red); border: none; border-radius: 8px; cursor: pointer; }
.login-card button:disabled { opacity: 0.6; }
.login-err { color: var(--red); font-size: 14px; min-height: 18px; margin: 10px 0 0; }
.logout-btn { background: none; border: 1px solid var(--line); color: var(--grey); font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
