/* Home KDS admin PWA — phone-first, single light theme (it is the phone's own UI). Palette and components from the approved mockup. */
:root {
  --p-bg: #f4f5f7; --p-card: #ffffff; --p-ink: #14181d; --p-muted: #6b7684; --p-line: #e2e6eb; --p-acc: #1f6f8b; --p-acc-ink: #fff; --p-soft: #e6f1f5;
  --p-red: #d9363e; --p-amber: #d98a0b; --p-green: #2a9461; --p-blue: #2f7fd1;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--p-bg); color: var(--p-ink); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
.scr { position: relative; height: 100%; height: 100dvh; max-width: 560px; margin: 0 auto; background: var(--p-bg); display: flex; flex-direction: column; overflow: hidden; padding-top: var(--sat); }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px; flex: none; }
.top h2 { font-size: 26px; margin: 0; flex: 1; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .bk { font-size: 15px; color: var(--p-acc); cursor: pointer; padding: 6px 0; white-space: nowrap; }
.top .act { font-size: 15px; color: var(--p-acc); cursor: pointer; font-weight: 600; white-space: nowrap; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px calc(90px + var(--sab)); -webkit-overflow-scrolling: touch; }
.tabs { position: absolute; left: 0; right: 0; bottom: 0; height: calc(64px + var(--sab)); background: var(--p-card); border-top: 1px solid var(--p-line); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: var(--sab); z-index: 3; }
.tabs div { display: grid; place-items: center; align-content: center; gap: 3px; font-size: 11px; color: var(--p-muted); cursor: pointer; position: relative; }
.tabs div i { font-style: normal; font-size: 22px; }
.tabs div.on { color: var(--p-acc); font-weight: 600; }
.tabs div .n { position: absolute; top: 8px; right: calc(50% - 22px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--p-red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.card { background: var(--p-card); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.tap { cursor: pointer; }
.card.hasCell { padding: 0; overflow: hidden; }
.card.hasCell .row { padding: 12px 0 12px 14px; }
.mcell { align-self: stretch; width: 64px; margin: -12px 0; border-left: 1px solid var(--p-line); background: linear-gradient(180deg, #fafbfc, #f1f3f6); display: grid; place-items: center; align-content: center; gap: 2px; color: var(--p-muted); position: relative; flex: none; }
.mcell .ic { position: relative; width: 26px; height: 26px; }
.mcell svg { width: 26px; height: 26px; display: block; }
.mcell svg .b { fill: currentColor; opacity: .5; } .mcell svg .d { fill: #f6f7f9; }
.mcell.has { color: var(--p-ink); } .mcell.has svg .b { opacity: .85; }
.mcell .n { position: absolute; top: 0; right: 0; transform: translate(45%, -45%); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: var(--p-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; border: 2px solid #f6f7f9; box-sizing: content-box; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.mcell .n.red { background: #ff3b30; color: #fff; box-shadow: none; }
.mcell.unread { background: linear-gradient(180deg, #4c9dff, #2f7fd1); color: #fff; border-left-color: var(--p-blue); } .mcell.unread svg .b { opacity: 1; } .mcell.unread svg .d { fill: var(--p-blue); }
.mcell .lbl { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.mcell .lbl.dr { color: var(--p-acc); opacity: 1; font-weight: 700; }
.top .icb { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--p-acc); background: var(--p-soft); cursor: pointer; position: relative; flex: none; }
.top .icb svg { width: 22px; height: 22px; display: block; }
.top .icb .n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; border: 2px solid var(--p-bg); box-sizing: content-box; }
.top .icb.bell { color: var(--p-amber); background: #fdf1dc; }
.items { display: grid; gap: 6px; }
.items .it { display: flex; align-items: center; gap: 8px; }
.items .it input { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid var(--p-line); border-radius: 10px; background: var(--p-card); color: var(--p-ink); min-width: 0; }
.items .it .x { color: var(--p-muted); cursor: pointer; padding: 6px; }
.cl { display: grid; gap: 6px; }
.cl .c { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.cl .c .bx { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--p-line); display: grid; place-items: center; font-size: 13px; color: #fff; flex: none; }
.cl .c.on .bx { background: var(--p-green); border-color: var(--p-green); } .cl .c.on span:last-child { color: var(--p-muted); text-decoration: line-through; }
.chatwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 10px; display: flex; flex-direction: column; justify-content: flex-start; }
.chat .spacer { flex: 1 0 auto; }
.chatbar { flex: none; display: flex; gap: 8px; padding: 10px 12px; padding-bottom: calc(64px + 10px + var(--sab)); background: var(--p-card); border-top: 1px solid var(--p-line); align-items: flex-end; }
.chatbar textarea { flex: 1; font: inherit; line-height: 1.35; padding: 11px 14px; border: 1px solid var(--p-line); border-radius: 22px; background: var(--p-bg); color: var(--p-ink); resize: none; overflow-y: hidden; display: block; min-width: 0; scrollbar-width: none; }
.chatbar textarea::-webkit-scrollbar { display: none; }
.chatbar .btn { border-radius: 22px; }
.chatbar .icb2 { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; background: var(--p-soft); color: var(--p-acc); cursor: pointer; flex: none; font-size: 20px; }
.attd { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--p-card); font-size: 13px; color: var(--p-muted); }
.attd img { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; }
.sec { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--p-muted); margin: 14px 2px 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.ttl { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.meta { color: var(--p-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.c-new { background: #e8f0fb; color: var(--p-blue); } .c-seen { background: #eef0f3; color: var(--p-muted); } .c-acc { background: #e5f4ec; color: var(--p-green); } .c-done { background: #eef0f3; color: var(--p-muted); text-decoration: line-through; }
.c-urg { background: var(--p-red); color: #fff; } .c-late { background: #fbe8e9; color: var(--p-red); } .c-miss { background: #fbe8e9; color: var(--p-red); }
.card.urgent { border-left: 4px solid var(--p-red); } .c-soon { background: #fdf1dc; color: var(--p-amber); }
.stripe { width: 5px; align-self: stretch; border-radius: 3px; background: var(--p-green); }
.stripe.red { background: var(--p-red); } .stripe.amber { background: var(--p-amber); } .stripe.grey { background: var(--p-line); }
.fab { position: absolute; right: 18px; bottom: calc(82px + var(--sab)); width: 58px; height: 58px; border-radius: 50%; background: var(--p-acc); color: var(--p-acc-ink); display: grid; place-items: center; font-size: 32px; box-shadow: 0 6px 18px rgba(31,111,139,.4); cursor: pointer; z-index: 2; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 12px; border: 0; background: var(--p-acc); color: var(--p-acc-ink); font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; text-align: center; }
.btn.sec2 { background: var(--p-soft); color: var(--p-acc); }
.btn.warn { background: #fbe8e9; color: var(--p-red); }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; display: inline-block; }
.btn[disabled] { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fld { display: block; margin-bottom: 12px; }
.fld label { display: block; font-size: 12px; color: var(--p-muted); margin-bottom: 4px; }
.fld input, .fld textarea, .fld select { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--p-line); border-radius: 10px; background: var(--p-card); color: var(--p-ink); }
.fld textarea { min-height: 70px; resize: vertical; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg span { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--p-line); background: var(--p-card); cursor: pointer; font-size: 14px; }
.seg span.on { background: var(--p-acc); color: var(--p-acc-ink); border-color: var(--p-acc); }
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--p-line); }
.tl .ev { position: relative; margin-bottom: 10px; font-size: 14px; overflow-wrap: anywhere; }
.tl .ev::before { content: ""; position: absolute; left: -19px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--p-acc); }
.tl .ev.pend::before { background: var(--p-line); } .tl .ev.red { color: var(--p-red); } .tl .ev.red::before { background: var(--p-red); }
.tl .ev small { display: block; color: var(--p-muted); font-size: 12px; }
.lang2 { background: var(--p-soft); border-radius: 12px; padding: 12px 14px; }
.lang2 .ltabs { display: flex; gap: 4px; background: rgba(0,0,0,.06); border-radius: 8px; padding: 3px; width: max-content; margin-bottom: 10px; }
.lang2 .ltabs span { padding: 5px 12px; border-radius: 6px; font-size: 11px; letter-spacing: .06em; font-weight: 600; color: var(--p-muted); cursor: pointer; }
.lang2 .ltabs span.on { background: var(--p-card); color: var(--p-acc); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.lang2 .lt { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.lang2 .ln { font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.lang2 .ln:empty::before { content: 'No details'; color: var(--p-muted); }
.lang2.pend { background: #fdf1dc; }
.lang2 .edit { margin-top: 10px; }
.lang2 .edit textarea, .lang2 .edit input { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--p-line); border-radius: 8px; background: var(--p-card); color: var(--p-ink); margin-bottom: 6px; }
.msg { padding: 10px 12px; border-radius: 12px; background: var(--p-card); margin-bottom: 8px; font-size: 14px; max-width: 88%; border: 1px solid var(--p-line); overflow-wrap: anywhere; }
.msg.me { margin-left: auto; background: var(--p-soft); border-color: transparent; }
.msg small { display: block; color: var(--p-muted); font-size: 11px; margin-top: 3px; }
.msg .att { display: block; margin-top: 8px; width: 200px; max-width: 100%; border-radius: 10px; overflow: hidden; position: relative; background: #000; cursor: pointer; }
.msg .att img { display: block; width: 100%; height: 140px; object-fit: cover; }
.msg .att .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 36px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.msg .att .dur { position: absolute; right: 6px; bottom: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.msg .att.gone { height: 60px; display: grid; place-items: center; color: #aaa; background: #333; font-size: 12px; }
.gal { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.gal::-webkit-scrollbar { display: none; }
.gal .g { flex: none; width: 110px; height: 80px; border-radius: 10px; overflow: hidden; position: relative; background: #000; cursor: pointer; }
.gal .g img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal .g .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.gal .g .dur { position: absolute; right: 5px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 5px; }
.gal .g .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 11px; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; font-size: 12px; }
.gal .g .mv { position: absolute; left: 4px; bottom: 4px; display: flex; gap: 3px; } .gal .g .mv span { width: 22px; height: 22px; border-radius: 11px; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; font-size: 12px; }
.gal .add { flex: none; width: 110px; height: 80px; border-radius: 10px; border: 2px dashed var(--p-line); display: grid; place-items: center; color: var(--p-acc); font-size: 13px; text-align: center; cursor: pointer; }
.viewer { position: absolute; inset: 0; background: #000; z-index: 9; display: none; flex-direction: column; color: #fff; }
.viewer.show { display: flex; }
.viewer .vtop { display: flex; gap: 12px; padding: calc(16px + var(--sat)) 16px 10px; font-size: 14px; color: #bbb; } .viewer .vtop b { color: #fff; cursor: pointer; }
.viewer .vbody { flex: 1; display: grid; place-items: center; min-height: 0; } .viewer .vbody img, .viewer .vbody video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .vcap { padding: 12px 16px calc(24px + var(--sab)); font-size: 14px; }
.msg .rd { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.msg .rd.ok { background: #e5f4ec; color: var(--p-green); } .msg .rd.no { background: #fdf1dc; color: var(--p-amber); }
.compose { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.compose textarea { flex: 1; font: inherit; line-height: 1.35; padding: 11px 12px; border: 1px solid var(--p-line); border-radius: 12px; background: var(--p-card); color: var(--p-ink); resize: none; overflow-y: hidden; min-width: 0; scrollbar-width: none; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--p-line); }
.tog:last-child { border-bottom: 0; }
.tog .d { color: var(--p-muted); font-size: 12px; margin-top: 2px; }
.sw { width: 50px; height: 30px; border-radius: 15px; background: var(--p-line); position: relative; cursor: pointer; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.sw.on { background: var(--p-green); } .sw.on::after { left: 23px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--p-green); flex: none; } .dot.off { background: var(--p-red); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--p-line); font-size: 14px; }
.kv:last-child { border-bottom: 0; } .kv span:last-child { color: var(--p-muted); text-align: right; overflow-wrap: anywhere; }
.toast { position: absolute; left: 50%; bottom: calc(100px + var(--sab)); transform: translateX(-50%); background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; display: none; z-index: 5; max-width: 90%; text-align: center; }
.toast.show { display: block; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat .card { margin: 0; text-align: center; padding: 10px 6px; }
.stat .n { font-size: 26px; font-weight: 700; } .stat .k { font-size: 11px; color: var(--p-muted); text-transform: uppercase; letter-spacing: .05em; }
.modal { position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 8; display: grid; place-items: end center; padding: 16px; }
.mbox { background: var(--p-card); border-radius: 16px; padding: 16px; width: 100%; max-width: 420px; margin-bottom: calc(16px + var(--sab)); }
.mbox h3 { margin: 0 0 8px; font-size: 18px; }
.auth { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 12px; }
.auth h1 { font-size: 28px; margin: 0 0 4px; }
.auth .logo { width: 72px; height: 72px; border-radius: 18px; background: var(--p-acc); display: grid; place-items: center; margin-bottom: 8px; }
.auth .logo svg { width: 44px; height: 44px; }
.err { color: var(--p-red); font-size: 13px; }
.ok { color: var(--p-green); font-size: 13px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--p-line); border-top-color: var(--p-acc); animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.presetrow { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.presetrow input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--p-line); border-radius: 8px; }
.presetrow .x, .presetrow .up { color: var(--p-muted); cursor: pointer; padding: 6px; }
.empty { color: var(--p-muted); font-size: 14px; padding: 8px 2px; }
.stale { background: #fdf1dc; color: var(--p-amber); font-size: 13px; padding: 8px 12px; border-radius: 10px; margin: 8px 0; cursor: pointer; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .sw::after { transition: none; } .spin { animation: none; } }

/* fingerprints card */
.ico { color: var(--p-muted); cursor: pointer; margin-left: 6px; font-size: 14px; }
.inl { font: inherit; padding: 4px 8px; border: 1px solid var(--p-line); border-radius: 8px; background: var(--p-bg); color: inherit; width: 60%; }
.seg span.off { opacity: .45; }
.seg.mini { display: inline-flex; gap: 0; vertical-align: middle; margin-left: 6px; border: 1px solid var(--p-line); border-radius: 999px; overflow: hidden; }
.seg.mini span { padding: 2px 9px; font-size: 12px; border: 0; border-radius: 0; background: var(--p-card); color: var(--p-muted); }
.seg.mini span.on { background: var(--p-acc); color: var(--p-acc-ink); }
.seg.mini span.on.warn { background: var(--p-amber); color: #fff; }
.tl .ev.amber { color: #a05a00; } .tl .ev.amber::before { background: #e0a040; }
.c-warn { background: #fdf1e0; color: #a05a00; }
.seg span.old { color: #a05a00; }
