/* C4 Site Camera — styled to match hrms.c4infra.com */
:root {
  --c4green: #169447; --c4green2: #39b54a; --c4deep: #0f6f37; --c4navy: #102d39;
  --c4sage: #edf8ef; --c4sage2: #dff1e4; --c4line: #d6e8dc; --white: #fff;
  --ink: #10352a; --ink2: #2b3d33; --mut: #5f6f66; --soft: #f3f8f4;
  --bad: #b42318; --badbg: #fde7e5; --warn: #8a5a00; --warnbg: #fff3d6; --okbg: #e3f5e7;
  --r: 16px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: linear-gradient(135deg, #fff 0%, #f7fbf8 56%, #e8f5eb 100%); background-attachment: fixed; color: var(--c4navy); font-size: 15px; line-height: 1.45; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(57,181,74,.55); outline-offset: 2px; }
h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--c4navy); }
.muted, .hint { color: var(--mut); font-size: 13px; margin: 0 0 8px; }
.center { text-align: center; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; }

/* C4 badge (same as HRMS) */
.badge { display: inline-grid; place-items: center; width: 52px; height: 40px; border-radius: 12px 20px; flex: none;
  background: linear-gradient(135deg, var(--c4navy) 0 48%, var(--c4green2) 49% 100%); color: #fff; font-weight: 900; font-size: 21px; letter-spacing: -3px; box-shadow: 0 8px 18px rgba(23,103,54,.18); }
.badge.big { width: 112px; height: 82px; border-radius: 20px 34px; font-size: 42px; letter-spacing: -6px; margin-bottom: 26px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; isolation: isolate;
  background: radial-gradient(circle at 82% 14%, rgba(57,181,74,.14), transparent 27%), linear-gradient(135deg, #fff 0%, #f7fbf8 56%, #e8f5eb 100%); }
.login::before { content: ""; position: absolute; z-index: -1; right: -10vw; top: -10vh; width: 50vw; height: 52vh; background: linear-gradient(135deg, rgba(22,148,71,.04), rgba(57,181,74,.28)); clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%); }
.loginbox { width: min(1040px, 95vw); display: grid; grid-template-columns: 1.08fr .92fr; border-radius: 30px; overflow: hidden; border: 1px solid rgba(31,113,61,.12); box-shadow: 0 28px 80px rgba(18,57,41,.18); background: rgba(255,255,255,.97); }
.brandpane { position: relative; padding: 54px 48px 56px; background: linear-gradient(145deg, #fff 0%, #f3faf4 58%, #e1f2e5 100%); }
.brandpane h1 { margin: 0; color: var(--c4navy); font-size: 31px; line-height: 1.08; }
.brandpane h2 { color: var(--c4green); font-size: 22px; letter-spacing: .08em; margin: 10px 0 30px; }
.brandcards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brandcard { background: rgba(255,255,255,.9); border: 1px solid #d8eadc; border-top: 0; border-radius: 15px; padding: 18px; box-shadow: 0 10px 28px rgba(26,91,52,.07); color: var(--mut); }
.brandcard b { display: block; font-size: 22px; margin-top: 6px; color: var(--c4navy); }
.tagline { position: absolute; left: 48px; bottom: 22px; color: #168d44; font-size: 10px; font-weight: 900; letter-spacing: .2em; }
.loginpane { padding: 58px 50px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.loginpane h3 { font-size: 34px; margin: 0; display: block; }
.loginpane h3::after { content: ""; display: block; width: 76px; height: 4px; border-radius: 99px; margin-top: 12px; background: linear-gradient(90deg, var(--c4green), var(--c4green2)); }

input, select { width: 100%; padding: 12px 14px; border: 1px solid var(--c4line); border-radius: 12px; background: #fbfdfb; min-height: 46px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--mut); }
.msg { min-height: 20px; color: var(--bad); font-size: 13px; margin: 8px 0 0; }
.msg.ok { color: var(--c4deep); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--c4line); background: #fff; border-radius: 12px; padding: 11px 16px; font-weight: 700; min-height: 44px; }
.btn.primary { border: 0; color: #fff; background: linear-gradient(135deg, #2a9a50, #0f5a2d); box-shadow: 0 10px 22px rgba(22,115,58,.22); }
.btn.primary:disabled { background: #b8c7bd; box-shadow: none; cursor: not-allowed; }
.btn.huge { width: 100%; font-size: 19px; padding: 18px; border-radius: 16px; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.danger { color: var(--bad); border-color: #f1c0bb; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.loginpane .btn.primary { margin-top: 16px; padding: 14px; font-size: 16px; }
.iconbtn { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }

/* ---------- app shell ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); background: var(--c4navy); color: #fff; }
.top .ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top .ttl b { font-size: 17px; }
.top .ttl span { font-size: 12px; color: #b9d8c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topr { display: flex; gap: 8px; align-items: center; }
.chip { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 99px; background: rgba(57,181,74,.2); color: #b6f0c0; white-space: nowrap; }
.chip.off { background: rgba(229,72,77,.25); color: #ffc9c9; }
.tabs { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 9; display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid #dbeadf; padding: 0 max(8px, env(safe-area-inset-left)); scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 12px 12px 11px; font-weight: 700; color: var(--mut); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--c4deep); border-bottom-color: var(--c4green2); }
main { max-width: 980px; margin: 0 auto; padding: 14px max(14px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.tab { display: flex; flex-direction: column; gap: 12px; }
.card { background: rgba(255,255,255,.96); border: 1px solid #dbeadf; border-radius: var(--r); padding: 14px; box-shadow: 0 10px 28px rgba(26,91,52,.06); min-width: 0; }
.n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c4green); color: #fff; font-size: 12px; }

.gpsbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid #dbeadf; font-weight: 600; font-size: 14px; }
.gpsbar .dot { width: 11px; height: 11px; border-radius: 50%; background: #c2c9c4; flex: none; }
.gpsbar.ok .dot { background: var(--c4green2); box-shadow: 0 0 0 4px rgba(57,181,74,.2); }
.gpsbar.warn .dot { background: #e6a100; } .gpsbar.bad .dot { background: #e5484d; }
.note { padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.note.ok { background: var(--okbg); color: var(--c4deep); }
.note.warn { background: var(--warnbg); color: var(--warn); }
.note.bad { background: var(--badbg); color: var(--bad); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.chips button { text-align: left; border: 1.5px solid var(--c4line); background: #fff; border-radius: 12px; padding: 10px 12px; min-height: 48px; font-weight: 700; display: flex; flex-direction: column; gap: 2px; }
.chips button small { font-weight: 500; font-size: 12px; color: var(--mut); }
.chips button.on { border-color: var(--c4green); background: var(--c4sage); box-shadow: inset 0 0 0 1px var(--c4green); }
.chips button:disabled { opacity: .4; cursor: not-allowed; }
.chips button .far { color: var(--bad); } .chips button .near { color: var(--c4deep); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list button { text-align: left; border: 1.5px solid var(--c4line); background: #fff; border-radius: 12px; padding: 10px 12px; font-weight: 600; }
.list button.on { border-color: var(--c4green); background: var(--c4sage); }
.list button small { display: block; color: var(--mut); font-weight: 500; }
.shootwrap { position: sticky; bottom: 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(247,251,248,0), #f3f9f4 30%); }

/* camera */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.cam video { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.camtop { position: absolute; top: 0; left: 0; right: 0; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: linear-gradient(180deg, rgba(0,0,0,.7), transparent); color: #fff; font-size: 13px; font-weight: 600; }
.camtop b { color: #9fe3ad; }
.camwarn { position: absolute; left: 12px; right: 12px; top: calc(70px + env(safe-area-inset-top)); background: rgba(229,72,77,.92); color: #fff; padding: 10px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.cambar { display: flex; justify-content: space-around; align-items: center; padding: 16px 10px calc(18px + env(safe-area-inset-bottom)); background: #000; }
#shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--c4green2); box-shadow: inset 0 0 0 4px #000; }
#shutter:disabled { background: #555; }
.round { background: none; border: 0; color: #fff; font-weight: 700; width: 80px; min-height: 44px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(8,20,26,.72); overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.sheetin { background: #fff; width: 100%; max-width: 760px; min-height: 100%; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 800px) { .sheet { padding: 24px; } .sheetin { min-height: 0; border-radius: 18px; overflow: hidden; } }
.sheetin img { display: block; width: 100%; background: #111; }
.resinfo, .detbody { padding: 14px max(14px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 12px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.dl dt { color: var(--mut); font-weight: 600; } .dl dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dl a { color: var(--c4deep); font-weight: 700; }

/* grid of photos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph { border: 1px solid #dbeadf; border-radius: 12px; overflow: hidden; background: #fff; padding: 0; text-align: left; display: flex; flex-direction: column; }
.ph img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--c4sage2); display: block; }
.ph div { padding: 7px 9px 9px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ph b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph span { color: var(--mut); font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--okbg); color: var(--c4deep); text-transform: uppercase; letter-spacing: .03em; }
.pill.bad { background: var(--badbg); color: var(--bad); } .pill.warn { background: var(--warnbg); color: var(--warn); } .pill.n { background: #edf1ee; color: var(--mut); }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tablewrap { overflow-x: auto; border: 1px solid #dbeadf; border-radius: 12px; background: #fff; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid #e7efe9; text-align: left; white-space: nowrap; }
.tbl th { background: var(--soft); font-size: 12px; color: var(--mut); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl input, .tbl select { min-height: 36px; padding: 6px 8px; border-radius: 8px; min-width: 90px; }
.sumrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sum { background: #fff; border: 1px solid #dbeadf; border-radius: 12px; padding: 10px 12px; }
.sum span { font-size: 12px; color: var(--mut); font-weight: 600; } .sum b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }

/* dialog + toast */
.dlg { position: fixed; inset: 0; z-index: 80; background: rgba(8,20,26,.6); display: grid; place-items: center; padding: 18px; }
.dlgbox { background: #fff; border-radius: 18px; padding: 18px; max-width: 440px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.dlgbox h4 { margin: 0 0 8px; font-size: 18px; }
.dlgbox p { margin: 0 0 10px; }
.dlgbtns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 90; background: var(--c4navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--bad); }

@media (max-width: 900px) {
  .login { padding: 14px; }
  .loginbox { grid-template-columns: 1fr; border-radius: 24px; }
  .brandpane { padding: 28px 26px 40px; }
  .badge.big { width: 76px; height: 58px; font-size: 30px; margin-bottom: 16px; letter-spacing: -4px; }
  .brandpane h1 { font-size: 22px; } .brandpane h2 { font-size: 16px; margin-bottom: 0; }
  .brandcards { display: none; } .tagline { left: 26px; bottom: 14px; font-size: 8px; }
  .loginpane { padding: 26px; } .loginpane h3 { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* login type switch */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--c4sage); border-radius: 12px; margin: 14px 0 4px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 10px; font-weight: 800; color: var(--mut); min-height: 42px; }
.seg button.on { background: #fff; color: var(--c4deep); box-shadow: 0 4px 12px rgba(26,91,52,.12); }
.lform { display: flex; flex-direction: column; gap: 6px; }
.lform label { font-weight: 700; font-size: 13px; margin-top: 10px; color: var(--c4navy); }
.lform .btn.primary { margin-top: 16px; padding: 14px; font-size: 16px; }
.sitechk { display: flex; flex-wrap: wrap; gap: 4px 10px; white-space: normal; min-width: 220px; }
.sitechk label { flex-direction: row; align-items: center; gap: 4px; font-size: 12px; color: var(--c4navy); }
.sitechk input { width: auto; min-height: 0; padding: 0; }
