/* BKRY Housekeeping — friendly, simple, phone-first */
:root {
  --brand: #9E4130;
  --brand-dark: #7d3225;
  --brand-soft: #f7e9e5;
  --accent: #F3FF98;
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #2b2420;
  --muted: #7a6f68;
  --line: #ece5dd;
  --ok: #2e7d4f;
  --ok-soft: #e3f4e9;
  --bad: #c0392b;
  --bad-soft: #fde8e6;
  --na: #6b7280;
  --na-soft: #eef0f2;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 14px rgba(60, 30, 20, .05);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

.splash { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.splash img { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px;
}
.topbar img { width: 34px; height: 34px; border-radius: 9px; background: #fff; }
.topbar .t1 { font-weight: 700; font-size: 16px; line-height: 1.1; }
.topbar .t2 { font-size: 12px; opacity: .85; }
.topbar .who { margin-left: auto; text-align: right; font-size: 12px; line-height: 1.2; }
.topbar .who b { display: block; font-size: 13px; }
.main { padding: 14px 14px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 860px; margin: 0 auto; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; position: relative;
}
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--brand); }
.nav a.on::before { content: ""; position: absolute; top: 6px; width: 46px; height: 30px; border-radius: 15px; background: var(--brand-soft); z-index: -1; }
.nav .dot { position: absolute; top: 6px; margin-left: 26px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 5px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 230px 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: 56px; height: calc(100vh - 56px); flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 14px 10px; gap: 4px;
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: 14px; }
  .nav a.on { background: var(--brand-soft); }
  .nav a.on::before { display: none; }
  .nav .dot { position: static; margin-left: auto; }
  .main { padding-bottom: 40px; width: 100%; }
}

/* ---------- common ---------- */
h1 { font-size: 21px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; min-height: 46px; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.green { background: var(--ok); }
.btn.red { background: var(--bad); }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.iconbtn { border: 0; background: var(--brand-soft); color: var(--brand); width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.iconbtn svg { width: 20px; height: 20px; }

label.f { display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 5px; }
input.i, select.i, textarea.i {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 11px; padding: 11px 12px; min-height: 46px; outline: none;
}
input.i:focus, select.i:focus, textarea.i:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.i { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.err { color: var(--bad); font-size: 13.5px; margin-top: 10px; min-height: 1em; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 999px;
  font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 14px;
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--na-soft); color: var(--na); white-space: nowrap; }
.pill.open { background: var(--warn-soft); color: var(--warn); }
.pill.submitted { background: #e6effc; color: #2457a6; }
.pill.verified { background: var(--ok-soft); color: var(--ok); }
.pill.role-admin { background: var(--brand); color: #fff; }
.pill.role-manager { background: #e6effc; color: #2457a6; }
.pill.role-supervisor { background: var(--warn-soft); color: var(--warn); }
.pill.role-staff { background: var(--na-soft); color: var(--na); }
.pill.when { background: var(--accent); color: #5a5a10; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty svg { width: 46px; height: 46px; color: #cdbfb4; }

/* ---------- date + shift picker ---------- */
.datebar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.datebar .d { flex: 1; text-align: center; font-weight: 700; font-size: 16px; position: relative; }
.datebar .d small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.datebar input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* ---------- progress ---------- */
.progress { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; width: 74px; height: 74px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), #efe9e2 0); }
.ring span { width: 58px; height: 58px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.counts span { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 8px; }
.c-done { background: var(--ok-soft); color: var(--ok); }
.c-bad { background: var(--bad-soft); color: var(--bad); }
.c-na { background: var(--na-soft); color: var(--na); }
.c-left { background: var(--warn-soft); color: var(--warn); }
.bar { height: 8px; border-radius: 4px; background: #efe9e2; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }

/* ---------- checklist ---------- */
.area { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.area-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fffdf9; border-bottom: 1px solid var(--line); font-weight: 700; }
.area-h .n { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.task { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .tt { font-weight: 600; }
.task .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task .remark { font-size: 13px; background: #fbf8f4; border-left: 3px solid var(--line); padding: 6px 9px; border-radius: 6px; margin-top: 7px; }
.task.s-not_done .remark { border-left-color: var(--bad); background: var(--bad-soft); }
.task.s-done { background: linear-gradient(90deg, var(--ok-soft), #fff 45%); }
.task.s-not_done { background: linear-gradient(90deg, var(--bad-soft), #fff 45%); }
.task.s-na { background: linear-gradient(90deg, var(--na-soft), #fff 45%); }
.seg { display: grid; grid-template-columns: 1.25fr 1.35fr .8fr 42px 42px; gap: 6px; margin-top: 10px; }
.seg button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 11px; min-height: 42px; font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; color: var(--muted);
}
.seg button svg { width: 17px; height: 17px; }
.seg .b-done.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg .b-not_done.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.seg .b-na.on { background: var(--na); border-color: var(--na); color: #fff; }
.seg .b-icon { padding: 0; }
.seg button:disabled { cursor: default; }
.task.busy { opacity: .6; }
.ro-status { font-weight: 700; font-size: 13px; }
.ro-status.done { color: var(--ok); } .ro-status.not_done { color: var(--bad); } .ro-status.na { color: var(--na); } .ro-status.none { color: var(--warn); }

.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.banner.info { background: #e6effc; color: #1d4580; }
.banner.ok { background: var(--ok-soft); color: #1f5a38; }
.banner.warn { background: var(--warn-soft); color: #7a5212; }
.banner.offline { background: #333; color: #fff; }

.actions { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 10; margin-top: 8px; }
@media (min-width: 900px) { .actions { bottom: 12px; } }
.actions .card { margin: 0; box-shadow: 0 6px 24px rgba(60, 30, 20, .16); }

/* ---------- lists ---------- */
.list .li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.list .li:last-child { border-bottom: 0; }
.list .li:active { background: #fbf7f2; }
.list.card { padding: 0; }
.li .big { font-weight: 700; }
.li .chev { color: #c9bdb3; width: 18px; height: 18px; flex: 0 0 auto; }
.pct { font-weight: 800; font-size: 15px; min-width: 46px; text-align: right; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.tile b { display: block; font-size: 22px; }
.tile span { font-size: 12px; color: var(--muted); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 700; }
table.t td.num, table.t th.num { text-align: right; }

.menu a { display: flex; align-items: center; gap: 14px; padding: 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; cursor: pointer; }
.menu a:last-child { border-bottom: 0; }
.menu a .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.menu a .ic svg { width: 20px; height: 20px; }
.menu a small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }

.levels { font-size: 13px; }
.levels div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.levels div:last-child { border-bottom: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, var(--brand) 0 38%, var(--bg) 38%); }
.login .card { width: 100%; max-width: 380px; padding: 26px 22px; }
.login .logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin: -70px auto 10px; box-shadow: var(--shadow); background: #fff; }
.login h1 { text-align: center; margin: 6px 0 2px; }
.login p.sub { text-align: center; color: var(--muted); margin: 0 0 8px; }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(30, 18, 12, .45); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: #fff; width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); max-height: 92vh; overflow: auto; animation: up .18s ease-out; }
@media (min-width: 640px) { .modal { align-items: center; } .modal .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet .btns { display: flex; gap: 10px; margin-top: 18px; }
.sheet .btns .btn { flex: 1; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 200;
  background: #2b2420; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12px; }
  .topbar, .nav, .actions, .no-print, .seg, #toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .print-only { display: block; }
  .area, .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .task { padding: 6px 10px; background: none !important; }
}

/* ---------- v1.1 additions ---------- */
.topbar .bell { position: relative; color: #fff; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.12); flex: 0 0 auto; }
.topbar .bell svg { width: 22px; height: 22px; }
.topbar .bell .badge { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #4b3a00; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--brand); }
.pill.cam { background: #fde8e6; color: var(--bad); display: inline-flex; align-items: center; gap: 4px; }
.pill.cam svg { width: 12px; height: 12px; }
.thumb { display: block; border: 0; padding: 0; margin-top: 8px; background: none; cursor: zoom-in; }
.thumb img { width: 92px; height: 70px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); display: block; }
.ovw { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ov { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px; text-align: left; cursor: pointer; }
.ov b { display: block; font-size: 13.5px; }
.ov span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ov.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ov.open span { color: var(--warn); } .ov.submitted span { color: #2457a6; } .ov.verified span { color: var(--ok); } .ov.missed span { color: var(--bad); }
details.card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
details[open].card summary::after { content: '▴'; }
.acts { margin-top: 10px; font-size: 13px; max-height: 360px; overflow: auto; }
.acts div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ic-c { width: 42px; height: 42px; border-radius: 12px; background: var(--na-soft); color: var(--na); display: grid; place-items: center; flex: 0 0 auto; }
.ic-c svg { width: 21px; height: 21px; }
.ic-c.on { background: var(--ok-soft); color: var(--ok); }
.nitem.unread { background: #fffbea; }
.nitem.unread .big::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 7px; vertical-align: middle; }
.pre { white-space: pre-line; }
#updBanner .btn { flex: 0 0 auto; }
@media (max-width: 360px) { .topbar .who { display: none; } }
.seg button { white-space: nowrap; }
@media (max-width: 440px) {
  .seg { grid-template-columns: 1fr 1.15fr .7fr 40px 40px; gap: 5px; }
  .seg .b-done svg, .seg .b-not_done svg { display: none; }
  .seg button { font-size: 13px; }
}
/* messages at the top so they never cover the Submit bar */
#toast { top: calc(env(safe-area-inset-top, 0px) + 66px); bottom: auto; transform: translateX(-50%) translateY(-14px); }
#toast.show { transform: translateX(-50%); }
