:root {
  --bg: #F4F1EB; --card: #FFFFFF; --ink: #23211E; --muted: #756F66; --line: #E4DED4;
  --gold: #A8803A; --gold-soft: #F1E6CC; --green: #2E7A4C; --green-soft: #DDEFE3;
  --red: #B3261E; --red-soft: #F8E1DE; --dark: #23211E; --on-dark: #F6F1E7;
  --radius: 16px; --shadow: 0 1px 2px rgba(35,33,30,.06), 0 4px 16px rgba(35,33,30,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513; --card: #211F1C; --ink: #F2EEE7; --muted: #A39C91; --line: #34312C;
    --gold: #E3C27F; --gold-soft: #3A3222; --green: #5FC08A; --green-soft: #1E3327;
    --red: #F08A80; --red-soft: #3D2220; --dark: #F2EEE7; --on-dark: #1A1917;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.wrap { max-width: 460px; margin: 0 auto; padding: 20px 16px 32px; }
.wide { max-width: 1100px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-size: 17px; letter-spacing: .2px; }
.brand span { color: var(--muted); font-size: 14px; }
.brand .grow { flex: 1; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.stack > * + * { margin-top: 12px; }

button, .btn {
  font: inherit; border: 0; border-radius: 12px; cursor: pointer; padding: 12px 16px;
  background: var(--gold-soft); color: var(--ink); font-weight: 600;
}
button:disabled { opacity: .5; cursor: default; }
.btn-dark { background: var(--dark); color: var(--on-dark); }
.btn-line { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.link { background: none; padding: 6px; color: var(--muted); font-weight: 500; text-decoration: underline; }

/* ---- Angajat: alegere nume ---- */
.names { display: grid; gap: 10px; }
.names button {
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-align: left; padding: 16px 18px; font-size: 17px; display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: 15px;
}

/* ---- PIN ---- */
.pin-head { text-align: center; margin: 8px 0 18px; }
.dots { display: flex; justify-content: center; gap: 16px; margin: 18px 0 6px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }
.err { color: var(--red); text-align: center; min-height: 22px; font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 8px auto 0; }
.keypad button { height: 66px; font-size: 26px; font-weight: 500; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.keypad button:active { background: var(--gold-soft); }
.keypad .ghost { background: transparent; border-color: transparent; font-size: 16px; color: var(--muted); }

/* ---- Ecran principal ---- */
.clock { text-align: center; margin: 4px 0 18px; }
.clock .time { font-size: 56px; font-weight: 700; letter-spacing: -1px; }
.clock .date { color: var(--muted); text-transform: capitalize; }
.status { display: flex; align-items: center; gap: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.status b { display: block; }
.punch {
  width: 100%; height: 132px; border-radius: 24px; font-size: 26px; font-weight: 700; letter-spacing: .5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin: 16px 0;
}
.punch small { font-size: 14px; font-weight: 500; opacity: .85; }
.punch.in { background: var(--green); color: #fff; }
.punch.out { background: var(--dark); color: var(--on-dark); }
.punch:active { transform: scale(.985); }
.warn { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.today-list { list-style: none; padding: 0; margin: 10px 0 0; }
.today-list li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.total { display: flex; justify-content: space-between; align-items: baseline; }
.total strong { font-size: 22px; }
.foot { text-align: center; margin-top: 18px; }
.privacy { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 22px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--dark); color: var(--on-dark); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 50; text-align: center;
}
.toast.bad { background: var(--red); color: #fff; }

/* ---- Administrare ---- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 18px; padding: 0 16px 4px; }
.tabs button { background: transparent; border: 1px solid var(--line); white-space: nowrap; padding: 9px 14px; font-weight: 500; }
.tabs button.on { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
input, select {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; max-width: 100%;
}
label.field { display: block; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
label.field input, label.field select { width: 100%; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.person { display: flex; gap: 12px; align-items: center; }
.person .info { flex: 1; min-width: 0; }
.person .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.summary .card { padding: 14px 16px; flex: 1; min-width: 140px; }
.summary .card strong { display: block; font-size: 28px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: var(--card); }
tr:last-child td { border-bottom: 0; }
.grid th, .grid td { padding: 8px 6px; text-align: center; min-width: 40px; }
.grid th:first-child, .grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 150px; }
.grid .we { background: color-mix(in srgb, var(--line) 45%, var(--card)); }
.grid td.has { font-weight: 600; }
td.actions { text-align: right; }
td.actions button { padding: 7px 10px; font-size: 13px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(420px, calc(100% - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin-bottom: 14px; }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
dialog .row .grow { flex: 1; }
.login { max-width: 380px; margin: 8vh auto 0; }
