:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: #0f1115;
  color: #f3f5f8;
  --surface: #171a20;
  --inset: #111419;
  --border: #2d333e;
  --muted: #a7b0bf;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #0f1115; color: #f3f5f8; line-height: 1.45; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
input, select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid #3b424f; border-radius: 9px; background: var(--inset); color: #f3f5f8; font-size: 16px; }
input::placeholder { color: #939dac; opacity: 1; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid #96b8f4; outline-offset: 3px; }
input[type="month"], input[type="date"], input[type="datetime-local"] { appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; min-height: 46px; }
input::-webkit-date-and-time-value { min-height: 1.45em; text-align: left; }
input::-webkit-datetime-edit { display: inline-flex; padding: 0; }
form { margin: 0; }
a { color: #b9d2fa; }
button, .quiet-button, .delete-button { transition: background-color .12s, border-color .12s; }
.wordmark { color: #dce1e9; font-size: 12px; font-weight: 600; letter-spacing: .085em; text-decoration: none; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; pointer-events: none; }
.quiet-button, .copy-button, .delete-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 12px; border: 1px solid #414955; border-radius: 8px; background: transparent; color: #edf0f6; font-size: 14px; font-weight: 550; line-height: 1.3; text-align: center; text-decoration: none; }
.quiet-button:hover, .copy-button:hover { background: #252b35; }
.delete-button { border-color: #88434b; color: #ff9aa3; }
.delete-button:hover { background: #3a2027; border-color: #c26873; }
.form-error { color: #ffadb5 !important; }
/* Blue means signing in; green/red remain reserved for time punches. */
#staff-enter:not(:disabled), #admin-pin-next:not(:disabled), .auth-card:not(.admin-pin-card) form > button {
  background: #3569d0;
  color: #fff;
}
#staff-enter:not(:disabled):hover, #admin-pin-next:not(:disabled):hover, .auth-card:not(.admin-pin-card) form > button:hover {
  background: #2b59b4;
}
.admin-alert { margin: 0 0 20px; padding: 12px 14px; border: 1px solid #32674d; border-radius: 9px; background: #152d22; color: #c4f0d6; font-size: 14px; }
.admin-alert.is-error { border-color: #83434c; background: #341d23; color: #ffd0d5; }

/* Staff keypad and personal page. */
.staff-shell { min-height: 100svh; display: grid; place-items: center; padding: 20px 16px; }
.staff-card { width: min(100%, 420px); min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.staff-head { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "brand clock" "brand date"; gap: 3px 14px; align-items: center; margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.staff-head .wordmark { grid-area: brand; font-size: 11px; letter-spacing: .07em; }
.live-clock { grid-area: clock; justify-self: end; color: #f7f8fc; font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -.025em; }
.today { grid-area: date; justify-self: end; max-width: 175px; color: var(--muted); font-size: 11px; text-align: right; line-height: 1.4; }
.pin-zone { text-align: center; }
.pin-prompt { margin: 0 0 16px; color: #cbd2df; font-size: 15px; }
.pin-dots { min-height: 34px; color: #f3f6fb; font-size: 26px; line-height: 1.2; letter-spacing: .2em; }
.pin-dots.invalid { color: #ff707b; animation: shake .28s linear 2; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 22px; }
.keypad button { min-height: 64px; padding: 12px 4px; border: 1px solid #363e4b; border-radius: 12px; background: #222730; color: #f8f9fb; font-size: 23px; font-weight: 550; user-select: none; }
.keypad button:active { background: #3b4758; border-color: #8399b5; transform: scale(.98); }
.keypad .key-text { color: #c0c9d8; font-size: 13px; font-weight: 500; }
.staff-status { min-height: 22px; margin: 16px 0 10px; color: #cbd4e2; font-size: 14px; text-align: center; }
.staff-status:empty { min-height: 0; margin: 12px 0; }
.punch-button { width: 100%; min-height: 56px; padding: 14px 16px; border: 1px solid transparent; border-radius: 11px; background: #168354; color: #fff; font-size: 17px; font-weight: 600; }
.punch-button:hover { background: #209866; }
.punch-button.is-out { background: #b73e4b; }
.punch-button.is-out:hover { background: #ca4c59; }
.punch-button.logout-button { background: transparent; border-color: #414955; color: #dce4ef; }
.punch-button.logout-button:hover { background: #242a34; }
.staff-card > form.staff-logout { margin-top: 10px; }
#staff-enter { margin-top: 10px; }
#staff-enter:disabled { cursor: default; background: #303844; color: #aab5c5; opacity: 1; }
.punch-result { margin: 18px 0; padding: 25px 16px; border: 1px solid var(--border); border-radius: 12px; text-align: center; overflow-wrap: anywhere; }
.punch-result strong { display: block; font-size: 25px; font-weight: 600; letter-spacing: -.025em; }
.punch-result span { display: block; margin-top: 8px; font-size: 18px; }
.punch-result .result-time { display: block; margin-top: 12px; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.punch-result.is-in { background: #123b2b; border-color: #328662; color: #e7fff1; }
.punch-result.is-out { background: #481f25; border-color: #a84c54; color: #fff0f1; }
.staff-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -.025em; }
.staff-card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.staff-card > p { color: var(--muted); font-size: 14px; }
.staff-card > form[action$="logout"] { margin-top: 22px; }
.staff-card > form[action$="logout"] .quiet-button { width: 100%; }
.staff-workspace { align-items: start; }
.staff-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 20px; }
.staff-toolbar form { margin-left: auto; }
.staff-toolbar .quiet-button { font-size: 13px; }
.history-navigation { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 8px; }
.history-navigation .month-arrow { width: 44px; min-height: 44px; padding: 4px; font-size: 24px; }
.staff-card .history-navigation h2 { margin: 0; text-align: center; }
.staff-greeting, .staff-welcome { margin-bottom: 20px; }
.staff-welcome p { margin: 0; color: var(--muted); font-size: 14px; }
.shift-history { display: grid; gap: 10px; margin: 24px 0 0; padding-top: 22px; border-top: 1px solid var(--border); }
.shift-history h2 { margin-bottom: 2px; }
.staff-monthly-total { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.staff-monthly-total strong { display: block; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.staff-monthly-total p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.shift-history > p, .history-note { margin: 0; color: var(--muted); font-size: 13px; }
.shift-history ul { display: grid; gap: 10px; margin: 4px 0 0; padding: 0; list-style: none; }
.history-empty { padding: 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-size: 14px; }
.shift-row { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "date duration" "times duration"; gap: 4px 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--inset); }
.shift-date { grid-area: date; font-size: 14px; font-weight: 550; }
.shift-times { grid-area: times; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.shift-times > span { display: block; }
.shift-times strong { color: #dde4ef; font-weight: 500; }
.shift-duration { grid-area: duration; align-self: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Login and explicit deletion confirmation share one compact card. */
.auth-shell { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(100%,420px); padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.auth-card h1 { margin: 24px 0 8px; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; }
.auth-card p { margin: 0 0 22px; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.auth-card form { display: grid; gap: 16px; }
.auth-card label { display: grid; gap: 7px; color: #cbd2df; font-size: 14px; }
.auth-card form > button { min-height: 48px; padding: 11px 16px; border: 0; border-radius: 9px; background: #e7ecf4; color: #15181e; font-size: 16px; font-weight: 600; }
.auth-card .auth-switch { display: block; margin: 20px 0 0; font-size: 14px; line-height: 1.5; text-align: center; }
.admin-login-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.auth-card .admin-login-head h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0; }
.auth-card .staff-entry-link { display: inline-flex; width: 44px; height: 44px; padding: 0; }
.auth-card .auth-switch a, a.auth-switch { color: #b9cce8; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.admin-pin-card { padding: 24px; }
.admin-pin-card h1 { margin: 16px 0 8px; }
.admin-pin-card #admin-pin-prompt { margin: 0 0 18px; text-align: center; }
.admin-pin-card form { gap: 12px; }
.admin-pin-card #admin-pin-step { display: block; color: var(--muted); font-size: 12px; font-weight: 500; text-align: center; }
.admin-pin-card #admin-pin-dots { min-height: 34px; color: #f3f6fb; font-size: 25px; line-height: 1.2; letter-spacing: .08em; text-align: center; user-select: none; }
.admin-pin-card .keypad { gap: 8px; margin-top: 4px; }
.admin-pin-card .keypad button { min-height: 64px; }
.admin-pin-card #admin-pin-next { min-height: 56px; margin-top: 2px; background: #3569d0; color: #fff; }
.admin-pin-card #admin-pin-next:disabled { cursor: default; background: #303844; color: #aab5c5; opacity: 1; }
.admin-pin-card #admin-pin-previous { min-height: 44px; padding: 8px; border: 1px solid #414955; background: transparent; color: #dce4ef; font-size: 14px; font-weight: 500; }
.admin-pin-card #admin-pin-error { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #83434c; border-radius: 9px; background: #341d23; color: #ffd0d5; font-size: 14px; }
.admin-pin-card #admin-pin-error:empty { display: none; }
.admin-pin-card .auth-switch { margin-top: 16px; }
.confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.confirmation-actions .quiet-button, .confirmation-actions .delete-button { min-height: 48px; margin: 0; font-size: 15px; }
.confirmation-actions .delete-button { background: #a73845; border-color: #a73845; color: #fff; }

/* Employee management: one form, one action row per person. */
.management-shell { min-height: 100svh; display: grid; place-items: start center; padding: 24px 16px; }
.management-card { width: min(100%,600px); margin: 0; padding: 26px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.management-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.management-head .quiet-button { min-height: 38px; padding: 7px 12px; font-size: 13px; }
.management-card h1 { margin: 24px 0 6px; font-size: 25px; font-weight: 600; letter-spacing: -.03em; }
.management-intro { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.management-title { margin: 26px 0 12px; font-size: 16px; font-weight: 600; }
.management-add { display: grid; grid-template-columns: minmax(0,1fr) 140px; gap: 10px; margin: 0 0 26px; }
.management-add button { grid-column: 1/-1; min-height: 48px; padding: 12px; border: 0; border-radius: 9px; background: #e7ecf4; color: #15181e; font-size: 15px; font-weight: 600; }
.management-list { display: grid; gap: 12px; }
.employee-editor { display: grid; gap: 14px; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--inset); }
.employee-fields { display: grid; grid-template-columns: minmax(0,1fr) 116px; gap: 12px; }
.employee-editor label { display: grid; gap: 7px; color: #b5bfcd; font-size: 12px; font-weight: 500; }
.employee-editor input { min-height: 46px; background: #191e26; font-size: 16px; font-weight: 400; }
.employee-editor input[name="pin"] { font-family: ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing: .06em; }
.employee-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.employee-actions button, .employee-actions .delete-button { min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #424c5a; border-radius: 8px; background: #202733; color: #eef2f8; font-size: 14px; font-weight: 550; }
.employee-actions .delete-button { background: transparent; border-color: #87434c; color: #ffabb3; }
.management-empty { margin: 0; color: var(--muted); font-size: 14px; }

/* Administration. */
.admin-shell { display: grid; grid-template-columns: 190px minmax(0,1fr); max-width: 1440px; min-height: 100svh; margin: 0 auto; }
.side-nav { position: sticky; top: 0; display: flex; flex-direction: column; align-items: stretch; gap: 28px; height: 100svh; padding: 30px 20px; border-right: 1px solid var(--border); background: #12151a; }
.side-nav .wordmark { padding: 0 10px; }
.side-nav nav { display: grid; gap: 6px; }
.side-nav nav a, .logout { padding: 10px; border-radius: 8px; color: #c0cad8; font-size: 14px; text-decoration: none; }
.side-nav nav a:hover, .logout:hover { background: #242a34; }
.side-nav nav a[aria-current="page"] { background: #263650; color: #edf4ff; }
.logout { margin-top: auto; }
.admin-content { min-width: 0; width: 100%; padding: 32px; }
.admin-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 550; letter-spacing: .08em; text-transform: uppercase; }
.admin-head h1 { margin: 0 0 5px; font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.035em; }
.admin-head p { margin: 0; color: var(--muted); font-size: 15px; }
.panel { min-width: 0; margin: 0 0 22px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); scroll-margin-top: 18px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.section-meta { color: var(--muted); font-size: 13px; }
.add-form { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto; gap: 10px; margin-bottom: 20px; }
.add-form button, .filter-form button, .month-form button { min-height: 46px; padding: 10px 16px; border: 0; border-radius: 9px; background: #e7ecf4; color: #15181e; font-size: 14px; font-weight: 600; }
.filter-form { display: grid; grid-template-columns: minmax(0,1.4fr) repeat(3,minmax(0,1fr)) auto; gap: 10px; align-items: end; margin-bottom: 20px; }
.export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.record-date-time { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.record-date-time label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.record-date-time input { width: 100%; min-width: 0; }
.filter-form label, .month-form label { display: grid; min-width: 0; gap: 6px; color: var(--muted); font-size: 13px; }
.month-form { display: flex; gap: 10px; align-items: end; width: min(100%,330px); margin: 0 0 18px; }
.month-form input, .month-form label { flex: 1; min-width: 0; }
.table-wrap { min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
th { position: sticky; top: 0; z-index: 1; padding: 12px 10px; background: #222730; color: #c1cbda; font-size: 11px; font-weight: 600; letter-spacing: .045em; text-align: left; text-transform: uppercase; }
th:first-child { border-top-left-radius: 9px; }
th:last-child { border-top-right-radius: 9px; }
td { padding: 12px 10px; border-top: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:nth-child(even) { background: #1c2129; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 9px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 9px; }
.inline-input, .inline-select { min-width: 0; min-height: 40px; padding: 8px; border: 1px solid #3b424f; background: var(--inset); font-size: 16px; }
.pin-cell .pin-input { width: calc(100% - 66px); max-width: 104px; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing: .03em; }
.pin-cell .copy-button { min-height: 40px; margin-left: 6px; padding: 8px; font-size: 12px; }
.row-actions { white-space: normal; }
.row-actions .quiet-button, .row-actions .delete-button { margin: 3px 2px; min-height: 36px; padding: 8px; font-size: 12px; }
.employee-more { position: relative; display: inline-block; vertical-align: middle; }
.employee-more > summary { width: 44px; min-height: 44px; padding: 0; list-style: none; cursor: pointer; font-size: 24px; line-height: 1; }
.employee-more > summary::-webkit-details-marker { display: none; }
.employee-more > summary:focus-visible { outline: 2px solid #96b8f4; outline-offset: 3px; }
.row-actions .employee-more > summary { min-height: 44px; padding: 0; font-size: 24px; }
.employee-more-menu { position: absolute; z-index: 4; top: calc(100% + 5px); right: 0; min-width: 132px; padding: 7px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #0006; }
.employee-more-menu .delete-button { width: 100%; min-height: 44px; margin: 0; }
.employee-actions > .employee-more { justify-self: end; }
.inline-form { display: inline; }
.status-badge { display: inline-block; padding: 5px 9px; border-radius: 99px; font-size: 12px; line-height: 1.4; }
.status-badge.active { background: #153d2e; color: #a8ecc8; }
.status-badge.inactive { background: #353c47; color: #d1d8e2; }
.empty-cell { padding: 22px; color: var(--muted); text-align: center; }
.export-link { font-size: 14px; text-underline-offset: 3px; }
.totals-table { max-width: 580px; }
.totals-table th:first-child { width: 65%; }
.totals-table th:last-child, .totals-table td:last-child { text-align: right; }
.daily-totals { margin-top: 26px; }
.monthly-averages { margin-top: 26px; max-width: 720px; }
.monthly-averages h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.monthly-averages > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.monthly-averages small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.monthly-averages th, .monthly-averages td { overflow-wrap: anywhere; }
.daily-totals h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.daily-totals th:first-child { width: 29%; }
.daily-totals th:last-child { width: 23%; }
.daily-totals td:last-child, .daily-totals th:last-child { text-align: right; }
#employees th:nth-child(1) { width: 25%; }
#employees th:nth-child(2) { width: 24%; }
#employees th:nth-child(3) { width: 14%; }
#employees th:nth-child(4) { width: 37%; }
#records th:nth-child(1) { width: 25%; }
#records th:nth-child(2) { width: 38%; }
#records th:nth-child(3) { width: 22%; }
#records th:nth-child(4) { width: 15%; }

@media (max-width: 1000px) {
  .admin-shell { grid-template-columns: 160px minmax(0,1fr); }
  .side-nav { padding-inline: 12px; }
  .admin-content { padding: 22px; }
  .panel { padding: 18px; }
  .filter-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  #employees table, #employees tbody, #employees tr, #employees td,
  #records table, #records tbody, #records tr, #records td { display: block; width: 100%; }
  #employees thead, #records thead { display: none; }
  #employees .table-wrap, #records .table-wrap { border: 0; }
  #employees tbody, #records tbody { display: grid; gap: 12px; }
  #employees tbody tr, #records tbody tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--inset); }
  #employees td, #records td { min-width: 0; padding: 0; border: 0; }
  #employees td::before, #records td::before { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
  #employees td:nth-child(1)::before { content: 'Nome'; }
  #employees td:nth-child(2)::before { content: 'PIN'; }
  #employees td:nth-child(3)::before { content: 'Estado'; }
  #records td:nth-child(1)::before { content: 'Funcionário'; }
  #records td:nth-child(2)::before { content: 'Data e hora'; }
  #records td:nth-child(3)::before { content: 'Tipo'; }
  #employees .row-actions { display: flex; grid-column: 1/-1; flex-wrap: wrap; gap: 8px; }
  #employees .row-actions > * { flex: 1 1 auto; margin: 0; min-height: 42px; }
  #employees .row-actions > .employee-more { flex: 0 0 44px; min-height: 44px; }
  #employees td[colspan], #records td[colspan] { grid-column: 1/-1; padding: 8px; }
  #employees td[colspan]::before, #records td[colspan]::before { display: none; }
  #records td:last-child { align-self: end; }
  #records td:last-child .quiet-button { width: 100%; min-height: 42px; }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .side-nav { position: static; height: auto; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .side-nav .wordmark { padding: 0; }
  .side-nav nav { display: flex; flex-wrap: wrap; order: 3; width: 100%; gap: 6px; }
  .side-nav nav a { padding: 8px 10px; background: #1d232c; font-size: 13px; }
  .side-nav .logout { margin: 0 0 0 auto; padding: 6px 10px; }
  .admin-content { padding: 22px 16px; }
  .admin-head h1 { font-size: 25px; }
  .admin-head p { font-size: 14px; }
  .panel { padding: 16px; }
  .add-form { grid-template-columns: minmax(0,1fr) 118px; }
  .add-form button { grid-column: 1/-1; }
  .filter-form { grid-template-columns: minmax(0,1fr); }
  .filter-form button { min-height: 46px; }
  #employees tbody tr, #records tbody tr { padding: 12px; }
  #employees tbody tr { grid-template-columns: minmax(0,1fr) 110px; }
  #employees .pin-cell .pin-input { width: 100%; max-width: none; }
  #employees .pin-cell .copy-button { width: 100%; min-height: 30px; margin: 6px 0 0; padding: 5px; }
  #employees td:nth-child(3) { grid-column: 1/-1; }
  #employees td:nth-child(3)::before { display: inline; margin-right: 8px; }
  #records tbody tr { grid-template-columns: minmax(0,1fr); }
  .daily-totals table, .totals-table table { font-size: 13px; }
  .daily-totals td, .daily-totals th, .totals-table td, .totals-table th { padding: 10px 8px; }
  .management-card { padding: 22px; }
  .management-add { grid-template-columns: minmax(0,1fr) 112px; }
  .employee-fields { grid-template-columns: minmax(0,1fr) 94px; gap: 10px; }
  .employee-editor { padding: 14px; }
}

@media (max-width: 390px) {
  .staff-card { padding: 20px; }
  .staff-head { gap: 3px 10px; }
  .staff-head .wordmark { max-width: 108px; }
  .today { max-width: 158px; font-size: 10px; }
  .staff-head .live-clock { font-size: 24px; }
  .management-card { padding: 18px; }
  .management-head .wordmark { font-size: 10px; }
  .management-add { grid-template-columns: minmax(0,1fr); }
  .employee-fields { grid-template-columns: minmax(0,1fr) 86px; }
  .auth-card { padding: 24px; }
}

/* Employee cards keep status and secondary actions in the same corners on every screen. */
#employees table, #employees tbody, #employees tr, #employees td { display: block; width: 100%; }
#employees thead { display: none; }
#employees .table-wrap { border: 0; }
#employees tbody { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
#employees tbody tr { position: relative; display: grid; grid-template-columns: minmax(0,1fr) max-content; gap: 14px 10px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--inset); }
#employees td { min-width: 0; padding: 0; border: 0; }
#employees td:nth-child(1)::before, #employees td:nth-child(2)::before { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
#employees td:nth-child(1)::before { content: 'Nome'; }
#employees td:nth-child(1) .inline-input { width: min(100%, 18ch); min-height: 44px; }
#employees td:nth-child(2)::before { content: 'PIN'; }
#employees td:nth-child(3) { order: -1; grid-column: 1/-1; display: flex; align-items: center; min-height: 44px; padding-right: 56px; }
#employees td:nth-child(3)::before { display: none; }
#employees .pin-cell { display: grid; grid-template-columns: max-content 44px; column-gap: 8px; }
#employees .pin-cell::before { grid-column: 1/-1; }
#employees .pin-cell .pin-input { width: calc(4ch + 22px); min-height: 44px; max-width: none; }
#employees .pin-cell .copy-button { width: 44px; min-height: 44px; margin: 0; padding: 8px; }
.copy-button .copy-confirm, .copy-button.is-copied .copy-icon { display: none; }
.copy-button.is-copied .copy-confirm { display: block; }
.copy-button.is-copied { color: #a8ecc8; border-color: #398762; }
#employees .row-actions { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 10px; }
#employees .row-actions > button { flex: 1 1 auto; min-height: 44px; margin: 0; font-size: 14px; }
#employees .row-actions > .employee-more { position: absolute; top: 16px; right: 16px; width: 44px; margin: 0; }
#employees .employee-more > summary { margin: 0; }
@media (max-width: 1000px) {
  #employees tbody { grid-template-columns: minmax(0,1fr); }
}

/* Compact editable records: name and type above the paired date/time fields. */
#records table, #records tbody, #records tr, #records td { display: block; width: 100%; }
#records thead { display: none; }
#records .table-wrap { border: 0; }
#records tbody { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
#records tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "name kind" "date date" "save save"; align-items: center; gap: 8px 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--inset); }
#records td { min-width: 0; padding: 0; border: 0; }
#records td::before { display: none; }
#records td:nth-child(1) { grid-area: name; font-size: 14px; font-weight: 600; }
#records td:nth-child(2) { grid-area: date; }
#records td:nth-child(3) { grid-area: kind; }
#records td:nth-child(4) { grid-area: save; text-align: right; }
#records .inline-select { width: 100px; min-height: 44px; padding: 5px 7px; font-size: 16px; }
#records .record-date-time { grid-template-columns: minmax(0,1.08fr) minmax(0,1fr); gap: 8px; }
#records .record-date-time input { min-height: 42px; padding: 7px 5px; }
#records td:last-child .quiet-button { width: auto; min-height: 44px; margin: 0; padding: 6px 16px; font-size: 16px; }
#records .correction-options { margin-top: 10px; font-size: 14px; }
#records .correction-options label { display: block; margin-top: 10px; }
#records .correction-options input, #records .correction-options select { width: 100%; min-height: 44px; font-size: 16px; }
.record-warnings { padding: 12px 16px; border: 1px solid #9e7935; border-radius: 10px; margin-bottom: 16px; }
.record-warnings ul { padding-left: 20px; }
#records td[colspan] { grid-area: auto; grid-column: 1/-1; }
@media (max-width: 1000px) {
  #records tbody { grid-template-columns: minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
