/* Munkanyilvántartó */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --text: #1d1f1e;
  --muted: #6a6f6c;
  --line: #e2e0da;
  --brand: #1f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0ec;
  --ok: #1f7a4d;
  --ok-soft: #e2f3e9;
  --warn: #a65d00;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info: #2a5db0;
  --info-soft: #e4ecfa;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716;
    --surface: #1d2120;
    --surface-2: #252a28;
    --text: #e9ecea;
    --muted: #9aa29e;
    --line: #313735;
    --brand: #3fa48a;
    --brand-ink: #0d1412;
    --brand-soft: #1d322c;
    --ok: #5cc28c;
    --ok-soft: #1b3226;
    --warn: #e8a54a;
    --warn-soft: #36291a;
    --bad: #f07a70;
    --bad-soft: #3a1f1d;
    --info: #7fa8ee;
    --info-soft: #1e2a3f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 6px; font-size: .9em; word-break: break-all; }
[hidden] { display: none !important; }

/* --- Gombok, űrlapok --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 44px; padding: .6em 1.1em;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: .3em .75em; font-size: .9rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

label { display: block; font-weight: 600; margin-bottom: .3em; }
.field { margin-bottom: 1em; }
.field small { display: block; font-weight: 400; margin-top: .25em; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=date], input[type=month], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: .55em .75em;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: .5em; font-weight: 400; margin: .35em 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.days { display: flex; flex-wrap: wrap; gap: .4em; }
.days label { display: inline-flex; align-items: center; gap: .3em; font-weight: 500; padding: .35em .7em; border: 1px solid var(--line); border-radius: 999px; margin: 0; background: var(--surface); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1em; }

/* --- Kártyák, jelzések --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1em; margin-bottom: 1em; box-shadow: var(--shadow); }
.card > h2:first-child { margin-bottom: .7em; }
.chip { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip.done, .chip.in { background: var(--ok-soft); color: var(--ok); }
.chip.late, .chip.break, .chip.soon { background: var(--warn-soft); color: var(--warn); }
.chip.overdue { background: var(--bad-soft); color: var(--bad); }
.chip.out, .chip.open { background: var(--surface-2); color: var(--muted); }
.alert { padding: .8em 1em; border-radius: 12px; margin-bottom: 1em; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* --- Dolgozói app --- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .8em 1em; background: var(--brand); color: var(--brand-ink); }
.topbar .brand { font-weight: 800; letter-spacing: .01em; }
.topbar .who { font-size: .9rem; opacity: .9; }
.app { max-width: 560px; margin: 0 auto; padding: 1em; }
.status { text-align: center; padding: 1.4em 1em; }
.status .state { font-size: 1.6rem; font-weight: 800; margin: .3em 0 .1em; }
.status .sub { color: var(--muted); }
.status .clock { font-variant-numeric: tabular-nums; font-size: .95rem; color: var(--muted); }
.status.in { border-color: var(--ok); }
.status.break { border-color: var(--warn); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7em; margin-bottom: 1em; }
.actions .btn { min-height: 64px; font-size: 1.1rem; border-radius: 16px; }
.actions .btn:only-child { grid-column: 1 / -1; }
.actions .btn .ico { font-size: 1.3rem; }
.stats { display: flex; gap: 1em; margin-bottom: .6em; }
.stats div { flex: 1; background: var(--surface-2); border-radius: 10px; padding: .55em .7em; }
.stats b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: .8rem; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .8em; padding: .3em 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.2em; }
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: .8em; padding: .75em 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .due { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 600; }
.task .meta { font-size: .85rem; color: var(--muted); }
.task.overdue .due { color: var(--bad); }
.task.soon .due { color: var(--warn); }
.task.done .title, .task.late .title { color: var(--muted); }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: .5em 0 2em; }
.empty { color: var(--muted); text-align: center; padding: .6em 0; }

/* --- Kamera --- */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam-head { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .8em 1em; padding-top: max(.8em, env(safe-area-inset-top)); background: rgba(0,0,0,.6); position: relative; z-index: 2; }
.cam-head b { font-size: 1.05rem; }
.cam-close { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }
.cam-view { position: relative; flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cam-view video, .cam-view img { width: 100%; height: 100%; object-fit: cover; }
.cam-view video.mirror { transform: scaleX(-1); }
.cam-target { position: absolute; width: min(64vw, 64vh, 320px); aspect-ratio: 1; border: 3px solid rgba(255,255,255,.9); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.cam-count { position: absolute; font-size: 6rem; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 1em; text-align: center; padding: 0 1em; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.cam-hint.error { color: #ffb4ab; }
.cam-foot { padding: 1em; padding-bottom: max(1em, env(safe-area-inset-bottom)); background: rgba(0,0,0,.6); display: flex; flex-direction: column; gap: .7em; }
.cam-foot .btns { display: flex; gap: .7em; }
.cam-foot .btns .btn { flex: 1; }
.cam-foot textarea { min-height: 52px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.shutter { align-self: center; width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.shutter:active { background: #fff; }

.toast { position: fixed; left: 50%; bottom: 1.2em; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 2em); padding: .8em 1.2em; border-radius: 12px; background: #1d1f1e; color: #fff; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); color: #fff; }

/* --- Belépés --- */
.auth { max-width: 380px; margin: 0 auto; padding: 3em 1em; }
.auth .logo { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 1em; }
.pin-input { letter-spacing: .4em; font-size: 1.3rem; text-align: center; }

/* --- Admin --- */
.admin-nav { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.admin-nav .inner { max-width: 1200px; margin: 0 auto; padding: 0 1em; display: flex; align-items: center; gap: .3em; overflow-x: auto; }
.admin-nav .brand { font-weight: 800; color: var(--brand); text-decoration: none; margin-right: .8em; white-space: nowrap; padding: .9em 0; }
.admin-nav a.tab { padding: .9em .7em; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.admin-nav a.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.admin-nav .spacer { flex: 1; }
.page { max-width: 1200px; margin: 0 auto; padding: 1.2em 1em 3em; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8em; margin-bottom: 1em; }
.page-head h1 { margin: 0; }
.page-head form { display: flex; gap: .5em; align-items: center; }
.page-head input { width: auto; }
.grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1em; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.narrow { max-width: 640px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.inactive td { color: var(--muted); }
.table-wrap { overflow-x: auto; }
.person { border-bottom: 1px solid var(--line); padding: .8em 0; }
.person:last-child { border-bottom: 0; }
.person-head { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.person-head .name { font-weight: 700; }
.person-head .sum { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.events { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .5em; }
.ev { display: flex; align-items: center; gap: .45em; background: var(--surface-2); border-radius: 10px; padding: .3em .5em .3em .3em; font-size: .88rem; }
.ev .thumb, .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--line); display: block; cursor: zoom-in; }
.ev .nothumb { width: 44px; height: 44px; border-radius: 8px; background: var(--line); display: grid; place-items: center; font-size: .7rem; color: var(--muted); }
.ev b { font-variant-numeric: tabular-nums; }
.ev form { margin: 0; }
.ev .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 .2em; }
.warn-text { color: var(--warn); font-size: .85rem; }
.bad-text { color: var(--bad); font-size: .85rem; }
.task-row { display: flex; gap: .7em; align-items: center; padding: .6em 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row .due { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3em; }
.task-row .body { flex: 1; min-width: 0; }
.task-row .meta { font-size: .85rem; color: var(--muted); }
details.add { margin-top: .5em; }
details.add summary { cursor: pointer; color: var(--brand); font-weight: 600; }
details.add form { margin-top: .8em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4em 1em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.qr-box { background: #fff; padding: 12px; border-radius: 12px; width: 220px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 1em; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.log { font-size: .85rem; }
.log td { padding: .35em .4em; }
