:root {
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  color: #203c35;
  background: #f3f6f4;
  font-synthesis: none;
  --green: #163e36;
  --muted: #71817a;
  --line: #e5ebe6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #a7c86f;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.demo {
  padding: 9px 20px;
  background: #e4ecd9;
  color: #395035;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.demo span {
  margin-left: 14px;
  opacity: 0.8;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 25px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 20px;
  letter-spacing: 0.1em;
}
.logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #dcefb4;
  border-radius: 11px;
  letter-spacing: 0;
}
.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  font-size: 14px;
}
.shell {
  max-width: 980px;
  margin: auto;
  padding: 0 28px 110px;
}
.heading {
  margin: 25px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
h1 {
  font-size: 30px;
  letter-spacing: -0.04em;
  margin: 6px 0 8px;
}
h2 {
  font-size: 20px;
  margin: 0 0 16px;
}
p {
  line-height: 1.7;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.15em;
  font-weight: 650;
  color: var(--muted);
}
.sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.tag {
  font-size: 12px;
  background: #e5eee7;
  padding: 7px 11px;
  border-radius: 20px;
  white-space: nowrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 20px;
}
.stat:first-child {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.stat small {
  font-size: 14px;
  display: block;
  opacity: 0.75;
}
.stat strong {
  font-size: 36px;
  font-weight: 600;
  display: block;
  margin-top: 12px;
  letter-spacing: -0.05em;
}
.stat strong span {
  font-size: 13px;
  font-weight: 400;
  margin-left: 7px;
  opacity: 0.6;
}
.toolbar {
  display: flex;
  gap: 12px;
  margin: 20px 0 14px;
}
input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #dbe3dc;
  background: #fff;
  color: #203c35;
  padding: 12px 14px;
  border-radius: 12px;
  min-width: 0;
}
input:focus,
select:focus {
  outline: 2px solid #83a581;
  outline-offset: 1px;
}
.toolbar input[type='date'] {
  max-width: 180px;
}
.filters {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: transparent;
  color: #67776f;
  padding: 9px 16px;
  font-size: 14px;
  white-space: nowrap;
}
.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.sectionline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 13px;
}
.sectionline h2 {
  font-size: 16px;
  margin: 0;
}
.sectionline span {
  color: var(--muted);
  font-size: 12px;
}
.list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.record {
  border: 1px solid var(--line);
  background: white;
  border-radius: 18px;
  padding: 19px;
  text-align: left;
  color: inherit;
  width: 100%;
  transition:
    transform 0.15s,
    border-color 0.15s;
}
.record:hover {
  border-color: #91af97;
  transform: translateY(-2px);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  background: #edf1e7;
  color: #587047;
  font-weight: 650;
}
.person {
  flex: 1;
}
.person strong {
  font-size: 16px;
}
.person small {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}
.status {
  font-size: 12px;
  border-radius: 6px;
  padding: 5px 8px;
  background: #eff3ef;
  color: #66786b;
}
.status.working {
  background: #e7f1de;
  color: #486229;
}
.status.abnormal {
  background: #fff0df;
  color: #9d602b;
}
.times {
  margin-top: 17px;
  border-top: 1px solid #f0f3ef;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
}
.times span {
  font-size: 12px;
  color: var(--muted);
}
.times b {
  display: block;
  font-size: 20px;
  font-weight: 550;
  color: #2b433a;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.times .arrow {
  align-self: center;
  color: #9bac9e;
}
.nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  padding: 7px;
  background: #fffefc;
  box-shadow: 0 8px 40px #163e3617;
  border: 1px solid var(--line);
  border-radius: 22px;
  width: min(440px, calc(100% - 32px));
  z-index: 5;
}
.nav button {
  flex: 1;
  background: none;
  border: 0;
  border-radius: 15px;
  padding: 10px 3px;
  color: #829087;
  font-size: 12px;
}
.nav button.active {
  background: #eef3e9;
  color: var(--green);
  font-weight: 700;
}
.nav i {
  font-style: normal;
  display: block;
  font-size: 20px;
  margin-bottom: 3px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 25px;
  margin-bottom: 16px;
}
.primary,
.secondary,
.danger {
  border: 0;
  border-radius: 13px;
  padding: 15px 20px;
  font-weight: 600;
  min-height: 50px;
}
.primary {
  background: var(--green);
  color: white;
}
.secondary {
  background: #e9efdf;
  color: var(--green);
}
.danger {
  background: #fff0e9;
  color: #a54726;
}
.full {
  width: 100%;
}
.stack {
  display: grid;
  gap: 17px;
}
.stack label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}
.login {
  max-width: 440px;
  margin: 28px auto;
}
.login .panel {
  padding: 30px;
}
.login h1 {
  font-size: 28px;
}
.login .sub {
  margin: 12px 0 24px;
}
.note {
  background: #f2f5ed;
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: #607058;
  line-height: 1.8;
  margin-top: 20px;
}
.error {
  color: #b14b30;
  font-size: 14px;
  min-height: 20px;
  margin: 0;
}
.kiosk {
  max-width: 530px;
  margin: auto;
}
.clock {
  text-align: center;
  padding: 30px 0;
}
.clock strong {
  font-size: 68px;
  line-height: 1.2;
  font-weight: 550;
  letter-spacing: -0.06em;
  display: block;
  font-variant-numeric: tabular-nums;
}
.clock p {
  font-size: 14px;
  color: var(--muted);
}
.clock .eyebrow {
  margin-bottom: 12px;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.actions button {
  min-height: 94px;
  font-size: 19px;
}
.actions small {
  display: block;
  font-size: 12px;
  margin-top: 8px;
  font-weight: 400;
  opacity: 0.7;
}
.links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 25px;
}
.links a {
  color: #697c70;
  font-size: 14px;
  text-decoration: none;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  grid-column: 1/-1;
}
.success {
  text-align: center;
  padding: 32px 10px;
}
.check {
  border-radius: 50%;
  width: 70px;
  height: 70px;
  background: #e5efd9;
  color: #47643b;
  display: grid;
  place-items: center;
  font-size: 34px;
  margin: 0 auto 20px;
}
dialog {
  border: 0;
  border-radius: 24px;
  padding: 26px;
  width: min(440px, calc(100% - 30px));
  color: #203c35;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 25px 90px #163e3626;
}
/* Keep the dialog title and close control visible while its form scrolls. */
dialog > .dialoghead {
  position: sticky;
  top: calc(-1 * clamp(16px, 4vw, 26px));
  z-index: 2;
  margin: calc(-1 * clamp(16px, 4vw, 26px));
  margin-bottom: 18px;
  padding: 16px clamp(16px, 4vw, 26px);
  background: #fff;
  border-bottom: 1px solid #e3eae6;
}

#kioskpanel > h2 {
  margin-bottom: 18px;
}
#kioskpanel > .caption {
  margin-bottom: 24px;
}
#kioskpanel > label {
  display: grid;
  gap: 12px;
}
#kioskpanel select {
  min-height: 58px;
  font-size: 18px;
}
#kioskstatus .times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0;
  margin: 24px 0 12px;
}
#kioskstatus .times > div {
  padding: 4px 0;
  background: transparent;
  border-radius: 0;
  text-align: center;
}
#kioskstatus .times > div + div {
  border-left: 1px solid #dce5df;
  padding-left: 0;
}
#kioskstatus .actions button:not(:disabled) {
  background: #163e36;
  color: #fff;
  border: 1px solid #163e36;
}
#kioskstatus .actions button:disabled {
  background: #f1f3f1;
  color: #77857e;
  border: 1px solid #e1e7e2;
  opacity: 1;
}
#kioskstatus .times span {
  display: block;
  font-size: 17px;
  color: #36594e;
  margin-bottom: 10px;
}
#kioskstatus .times b {
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.25;
  color: #163e36;
}
.payroll-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: #e8efdf;
  color: #52683c;
  font-size: 14px;
  font-weight: 700;
}
.payroll-method.daily {
  background: #f5eadb;
  color: #8a602d;
}

dialog::backdrop {
  background: #112f2b66;
  backdrop-filter: blur(4px);
}
.dialoghead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.dialoghead h2 {
  margin: 0;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  background: #183d34;
  color: white;
  padding: 13px 20px;
  border-radius: 13px;
  z-index: 20;
  display: none;
  max-width: 90%;
  font-size: 14px;
  box-shadow: 0 4px 20px #0002;
}
.settingrow {
  padding: 15px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 15px;
}
.settingrow:last-child {
  border: 0;
}
.settingrow strong {
  display: block;
  font-size: 15px;
}
.settingrow small {
  font-size: 12px;
  color: var(--muted);
}
.textlink {
  color: #365f48;
  text-decoration: none;
  font-size: 14px;
}
.devicecode {
  word-break: break-all;
  padding: 12px;
  background: #f1f4ec;
  border-radius: 8px;
  font-size: 13px;
}
.caption {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.login-tabs a {
  flex: 1;
  text-align: center;
  padding: 11px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  font-size: 14px;
}
.login-tabs a.active {
  color: var(--green);
  border-color: var(--green);
}
@media (max-width: 600px) {
  .shell {
    padding: 0 20px 110px;
  }
  header {
    padding: 21px 0;
  }
  .heading {
    margin: 21px 0;
  }
  h1 {
    font-size: 27px;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 17px 13px;
    border-radius: 16px;
  }
  .stat strong {
    font-size: 31px;
  }
  .stat small {
    font-size: 13px;
  }
  .list {
    grid-template-columns: 1fr;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar input[type='date'] {
    max-width: 147px;
    font-size: 14px;
    padding: 10px;
  }
  .panel {
    padding: 20px;
  }
  .clock {
    padding-top: 20px;
  }
  .clock strong {
    font-size: 62px;
  }
  .demo span {
    margin-left: 8px;
  }
  .record {
    padding: 17px;
  }
  .nav {
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .login {
    margin-top: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
.filters {
  scrollbar-width: none;
}
.filters::-webkit-scrollbar {
  display: none;
}
@media (max-width: 600px) {
  .filters {
    gap: 5px;
  }
  .chip {
    padding: 9px 12px;
  }
  .heading .tag {
    padding: 6px 9px;
  }
}

/* Responsive layout: content may wrap; controls must never force page width. */
html {
  scroll-padding-bottom: 8rem;
}
body {
  min-width: 0;
}
.shell {
  width: 100%;
  padding-inline: max(clamp(12px, 4vw, 28px), env(safe-area-inset-left))
    max(clamp(12px, 4vw, 28px), env(safe-area-inset-right));
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
header,
.heading,
.sectionline,
.settingrow,
.row,
.links {
  flex-wrap: wrap;
}
header > .brand {
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
header > .quiet {
  flex-shrink: 0;
}
.logo {
  flex-shrink: 0;
}
.heading > div,
.person,
.settingrow > div,
.row > div {
  min-width: 0;
}
h1 {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
}
h1,
h2,
p,
.person,
.settingrow,
.note,
.eyebrow,
.demo {
  overflow-wrap: anywhere;
}
.person {
  flex: 1 1 100px;
}
.status {
  max-width: 100%;
  white-space: normal;
}
.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat {
  min-width: 0;
  padding: clamp(12px, 3vw, 20px);
}
.stat strong {
  font-size: clamp(1.7rem, 7vw, 2.25rem);
  overflow-wrap: anywhere;
}
.stat small {
  font-size: 0.875rem;
}
.list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.55fr);
}
.toolbar:not(:has(input[type='date'])) {
  grid-template-columns: minmax(0, 1fr);
}
.toolbar input[type='date'] {
  max-width: none;
}
input,
select,
.toolbar input[type='date'] {
  font-size: 1rem;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
}
input[type='date'],
input[type='time'],
input[type='month'] {
  display: block;
  appearance: none;
  -webkit-appearance: none;
}
input::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.3em;
}
.filters {
  flex-wrap: wrap;
  overflow: visible;
  gap: 8px;
}
.chip {
  white-space: normal;
  min-height: 44px;
  font-size: 0.875rem;
}
.quiet,
.links a,
.textlink {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.actions button {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 3vw, 1.1875rem);
  padding: 14px 10px;
}
.clock strong {
  font-size: clamp(2.5rem, 16vw, 4.25rem);
}
.login .panel,
.panel {
  padding: clamp(16px, 4vw, 25px);
}
.nav {
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 24px));
  padding: 6px;
}
.nav button {
  min-width: 0;
  min-height: 52px;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}
.dialoghead {
  gap: 12px;
}
.dialoghead h2 {
  min-width: 0;
}
dialog {
  width: min(440px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  padding: clamp(16px, 4vw, 26px);
  overscroll-behavior: contain;
}
.stack,
.stack label {
  min-width: 0;
}
.times {
  gap: 12px;
  flex-wrap: wrap;
}
#toast {
  width: max-content;
  max-width: calc(100% - 24px);
  overflow-wrap: anywhere;
  bottom: calc(105px + env(safe-area-inset-bottom));
}
@media (max-width: 420px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand {
    font-size: 18px;
    gap: 7px;
  }
  .heading {
    align-items: flex-start;
  }
  .stat strong span {
    display: inline-block;
  }
  .record .row {
    gap: 9px;
  }
}
@media (max-width: 300px) {
  .stats {
    grid-template-columns: 1fr;
  }
  .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat strong {
    margin: 0;
  }
  .actions {
    grid-template-columns: 1fr;
  }
  .demo span {
    display: block;
    margin: 4px 0 0;
  }
}
@media (max-height: 500px) {
  .shell {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
  .clock {
    padding: 12px 0;
  }
  .clock strong {
    font-size: 3rem;
  }
  .heading {
    margin: 12px 0;
  }
  #toast {
    bottom: 12px;
  }
}
@media (hover: none) {
  .record:hover {
    transform: none;
  }
}
[hidden] {
  display: none !important;
}
/* Primary destinations stay visible above every page. */
.topnav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 5px;
  padding: 5px;
  background: #e8eee8;
  border-radius: 16px;
  margin: 0 0 20px;
}
.topnav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 10px 6px;
  text-align: center;
  text-decoration: none;
  color: #52685c;
  font-size: 0.9375rem;
  line-height: 1.5;
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.topnav a.active {
  background: var(--green);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 5px #163e3615;
}
.topnav a:hover:not(.active) {
  background: #f7faf5;
}
@media (min-width: 768px) {
  .topnav {
    max-width: 530px;
    margin-inline: auto;
  }
}
@media (max-width: 340px) {
  .topnav a {
    font-size: 0.875rem;
    padding-inline: 3px;
  }
}
.personal-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.personal-filters label {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
  min-width: 0;
}
.attendance-badge {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 48px;
  padding: 8px;
  border-radius: 14px;
  font-size: 0.9375rem;
  font-weight: 700;
}
.attendance-badge.normal {
  background: #e7f1de;
  color: #486229;
}
.attendance-badge.abnormal {
  background: #fff0df;
  color: #9d602b;
}
@media (max-width: 420px) {
  .personal-filters {
    grid-template-columns: 1fr;
  }
}
/* Personal attendance is a compact, single-column reading surface. */
.shell.personal-shell {
  max-width: 616px;
}
.personal-shell #personalrecords {
  grid-template-columns: minmax(0, 1fr);
}
.personal-shell .topnav {
  max-width: none;
}
.personal-shell .record {
  padding: 10px 16px;
}
.personal-shell .times {
  margin-top: 8px;
  padding-top: 8px;
  align-items: center;
}
.personal-shell .person strong {
  font-size: 1rem;
  line-height: 1.6;
}
/* Compact card height; preserve full query-area width. */
.personal-shell #personalrecords {
  width: 100%;
  gap: 10px;
}

.personal-shell .attendance-badge {
  min-height: 36px;
  padding: 5px 8px;
  border-radius: 11px;
}
.personal-shell .times > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.personal-shell .times b {
  margin-top: 0;
  font-size: 1.125rem;
}

.personal-shell .times > div > span {
  font-size: 1rem;
  font-weight: 500;
  color: #52665b;
  line-height: 1.5;
}
/* Single-row attendance cards; wrap naturally on narrow screens. */
.personal-shell #personalrecords .record {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 14px;
}
.personal-shell #personalrecords .record > .row {
  flex: 1 1 220px;
  gap: 9px;
}
.personal-shell #personalrecords .record > .times {
  flex: 1 1 230px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 0;
  margin: 0;
  padding: 0;
  gap: 8px;
}
.personal-shell #personalrecords .person {
  flex: 1 1 auto;
}
.personal-shell #personalrecords .person strong {
  font-size: 0.9375rem;
}
.personal-shell #personalrecords .attendance-badge {
  min-width: 46px;
  padding: 5px 7px;
}
.personal-shell #personalrecords .times > div {
  gap: 5px;
}
.personal-shell #personalrecords .times b {
  font-size: 1rem;
}
.personal-shell #personalrecords .times .arrow {
  font-size: 12px;
}
.payroll-card {
  margin: 0;
}
.payroll-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.payroll-values dt {
  font-size: 14px;
  color: #617368;
}
.payroll-values dd {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.payroll-values small {
  font-size: 13px;
  font-weight: 400;
}
.nav button {
  flex: 1 1 0;
}
.confirm-datetime {
  text-align: center;
  margin: 0 0 20px;
  padding: 14px 8px;
  background: #f2f5ed;
  border-radius: 12px;
}
.confirm-datetime span {
  display: block;
  font-size: 14px;
  color: #607058;
  margin-bottom: 5px;
}
.confirm-datetime strong {
  display: block;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-variant-numeric: tabular-nums;
  color: #203c35;
  overflow-wrap: anywhere;
}
.payroll-type {
  width: 48px;
  height: 44px;
  font-size: 14px;
}
.payroll-type.daily {
  background: #f5ebdc;
  color: #886234;
}
.toolbar:has(#date) {
  grid-template-columns: minmax(160px, 0.55fr) minmax(0, 1fr);
}
.edit-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #163e36;
  color: white;
  font-size: 14px;
  font-weight: 650;
  flex-shrink: 0;
}
.attendance-badge.done {
  background: #e7f1de;
  color: #486229;
}
.attendance-badge.working {
  background: #e3eff6;
  color: #315f7d;
}
.attendance-badge.none {
  background: #edf0ed;
  color: #626e67;
}
@media (max-width: 420px) {
  .toolbar:has(#date) {
    grid-template-columns: minmax(0, 1fr);
  }
  #records .person {
    flex-basis: 100px;
  }
  .edit-record {
    padding-inline: 9px;
  }
}
/* Name and employee ID share a row; the date has its own readable line. */
#records .record-identity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
#records .record-identity > span {
  font-size: 14px;
  color: #617368;
}
#records .record-date {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  color: #203c35;
  font-variant-numeric: tabular-nums;
}
#records .person {
  flex: 1 1 170px;
}
@media (max-width: 420px) {
  #records .record > .row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }
  #records .record > .row > .edit-record {
    grid-column: 2;
    justify-self: end;
  }
  #records .record-date {
    font-size: 17px;
  }
}
.time-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.time-fields legend {
  font-size: 16px;
  margin-bottom: 8px;
}
.time-parts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.time-parts label {
  font-size: 14px;
  color: #617368;
}
.time-parts input {
  font-variant-numeric: tabular-nums;
}
.edit-record {
  min-height: 36px;
  padding: 6px 9px;
  background: #eef3ee;
  color: #4d6a58;
  border: 1px solid #d9e3da;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
}
.edit-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  font-size: 18px;
  color: #203c35;
  line-height: 1.6;
  margin: 16px 0;
}
.edit-identity strong {
  font-size: 20px;
}
.edit-summary {
  padding: 16px;
  background: #f2f5ed;
  border-radius: 12px;
}
.edit-summary > div + div {
  margin-top: 16px;
}
.edit-summary span {
  font-size: 16px;
  color: #52665b;
}
.edit-summary p {
  font-size: 18px;
  line-height: 1.6;
  margin: 5px 0 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.actions.edit-actions {
  margin-top: 20px;
  gap: 12px;
}
.actions.edit-actions button {
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
}
.time-parts input::placeholder {
  color: #8a958f;
}
.edit-summary .time-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.edit-summary .time-comparison > span,
.edit-summary .time-comparison > strong {
  font-size: 18px;
  color: #203c35;
  line-height: 1.6;
  min-width: 0;
}
.edit-summary .time-comparison .time-arrow {
  text-align: center;
}
/* Mobile: edit beside the name, date beneath; no standalone action row. */
@media (max-width: 600px) {
  #records .record > .row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 9px;
    row-gap: 4px;
    align-items: center;
  }
  #records .record > .row > .attendance-badge {
    grid-column: 1;
    grid-row: 1 / 3;
    min-width: 46px;
    padding-inline: 7px;
  }
  #records .record > .row > .person {
    display: contents;
  }
  #records .record-identity {
    grid-column: 2;
    grid-row: 1;
    gap: 4px 7px;
    min-width: 0;
  }
  #records .record > .row > .edit-record {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    min-height: 36px;
    padding: 6px 8px;
    white-space: nowrap;
  }
  #records .record-date {
    grid-column: 2 / 4;
    grid-row: 2;
    margin-top: 0;
    font-size: 17px;
  }
}
/* Center the edit action across the name and date rows, matching the status. */
@media (max-width: 600px) {
  #records .record > .row > .edit-record {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }
  #records .record-date {
    grid-column: 2;
    grid-row: 2;
  }
}

/* Keep management navigation anchored, including short landscape viewports. */
.nav {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 10;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}
.shell:has(.nav) {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
@media (max-width: 600px) {
  .nav {
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 0;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    box-shadow: 0 -3px 18px #163e3610;
  }
}
.payroll-months {
  border: 0;
  margin: 0 0 22px;
  padding: 0;
  min-width: 0;
}
.payroll-months legend {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.month-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 5px 12px;
  margin-top: 8px;
}
.month-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  font-size: 15px;
  cursor: pointer;
}
.month-option input[type='checkbox'] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex-shrink: 0;
  accent-color: #163e36;
}
.month-dropdown {
  position: relative;
}
.month-dropdown summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid #dbe3dc;
  border-radius: 12px;
  background: white;
  font-size: 16px;
  cursor: pointer;
}
.month-dropdown summary::-webkit-details-marker {
  display: none;
}
.month-dropdown summary:focus-visible {
  outline: 2px solid #83a581;
}
.month-dropdown[open] summary {
  border-color: #83a581;
}
.month-menu {
  position: absolute;
  inset: calc(100% + 6px) 0 auto;
  z-index: 12;
  max-height: 280px;
  overflow: auto;
  padding: 12px 16px;
  border: 1px solid #dbe3dc;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 25px #163e3620;
}
.month-menu .month-options {
  grid-template-columns: 1fr;
  margin-top: 4px;
}
.selected-months {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}
.selected-months:empty {
  display: none;
}
.month-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-left: 11px;
  background: #e9efdf;
  color: #244a39;
  border-radius: 9px;
  font-size: 14px;
}
.month-tag button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 22px;
  min-width: 36px;
  min-height: 40px;
  cursor: pointer;
  border-radius: 8px;
}
.payroll-identity {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}
.payroll-identity > span {
  font-size: 14px;
  color: #617368;
}
.payroll-date {
  font-size: 17px;
  font-weight: 600;
  color: #203c35;
  margin-top: 6px;
}
.clear-months {
  display: block;
  margin: 0 0 8px auto;
  border: 0;
  border-radius: 8px;
  background: #eef3ee;
  color: #365b48;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
.clear-months:disabled {
  opacity: 0.45;
  cursor: default;
}
#payrolllist {
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.payroll-month-card {
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.payroll-month-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #eaf0e5;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.payroll-month-heading h2 {
  margin: 0;
  font-size: 21px;
}
.payroll-month-heading > span {
  font-size: 14px;
  color: #617368;
}
.payroll-entry {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
}
.payroll-entry + .payroll-entry {
  border-top: 1px solid var(--line);
}
.payroll-entry .payroll-values {
  margin: 0;
  padding: 0;
  border: 0;
}
.payroll-entry .payroll-values dd {
  font-size: 23px;
}
.payroll-month-note {
  margin: 0;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fafbf8;
}
@media (max-width: 600px) {
  .payroll-entry {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
  }
  .payroll-month-heading {
    padding: 16px 18px;
  }
  .payroll-entry .payroll-values {
    padding-left: 0;
  }
}
.range-field {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.range-field legend {
  margin-bottom: 8px;
  font-size: 15px;
}
.range-field > div {
  display: grid;
  grid-template-columns: minmax(65px, 1.3fr) auto minmax(60px, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.range-field input,
.range-field select {
  padding: 10px 8px;
}
.range-shortcuts {
  margin-top: 16px;
}
#payrollperiod {
  line-height: 1.6;
}
#morepayroll {
  margin-top: 18px;
}
.employee-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 18px;
  padding: 10px 16px;
  background: #e4eedf;
  color: #254b38;
  border: 1px solid #c7d8bf;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.employee-row {
  flex-wrap: nowrap;
  gap: 16px;
  padding: 17px 0;
}
.employee-info {
  min-width: 0;
}
.employee-info strong {
  font-size: 17px;
  line-height: 1.5;
}
.employee-info small {
  font-size: 14px;
  margin-top: 3px;
  display: block;
}
.employee-edit {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid #d4e0d6;
  border-radius: 10px;
  background: #f4f8f3;
  color: #365b48;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.employee-edit span {
  font-size: 21px;
  font-weight: 400;
}
.employee-edit:hover,
.employee-back:hover {
  background: #dce9d6;
}
/* Compact employee management actions. */
.employee-back {
  min-height: 34px;
  padding: 5px 15px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1.4;
}
.employee-edit {
  min-height: 34px;
  padding: 5px 12px;
  line-height: 1.4;
  gap: 9px;
}
.employee-edit span {
  font-size: 18px;
  line-height: 1;
}
.employee-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 12px 0 0;
}
.employee-details > div {
  min-width: 70px;
}
.employee-details dt {
  font-size: 13px;
  color: #71817a;
  margin-bottom: 3px;
}
.employee-details dd {
  margin: 0;
  font-size: 15px;
  color: #203c35;
  line-height: 1.5;
}
.employee-row {
  align-items: flex-start;
}
.employee-row .employee-edit {
  margin-top: 2px;
}
@media (max-width: 420px) {
  .employee-details {
    gap: 10px 14px;
  }
}
.employee-info {
  flex: 1;
}
.employee-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.employee-code {
  font-size: 14px;
  color: #617368;
}
.employee-monthly {
  font-size: 14px;
  color: #617368;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.employee-monthly b {
  font-size: 17px;
  color: #203c35;
  font-variant-numeric: tabular-nums;
}
/* Keep all employee fields in one compact flow, with natural wrapping only when necessary. */
.employee-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.employee-title-row > strong,
.employee-title-row > span {
  white-space: nowrap;
}
.employee-inline-detail {
  font-size: 14px;
  color: #617368;
}
.employee-inline-detail b {
  font-size: 15px;
  font-weight: 500;
  color: #203c35;
}
.employee-row {
  padding: 13px 0;
  align-items: center;
  gap: 12px;
}
.employee-row .employee-edit {
  margin-top: 0;
}
.employee-monthly b {
  font-size: 15px;
}
/* Employee directory: identity and action first, payroll details second. */
.employee-row.employee-two-lines {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 12px;
  padding: 16px 0;
  align-items: center;
}
.employee-two-lines .employee-title-row {
  grid-column: 1;
  gap: 8px 12px;
}
.employee-two-lines .employee-edit {
  grid-column: 2;
  grid-row: 1;
}
.employee-pay-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  color: #617368;
  line-height: 1.6;
}
.employee-pay-row > span {
  white-space: nowrap;
}
.employee-pay-row b {
  font-size: 15px;
  font-weight: 600;
  color: #203c35;
  font-variant-numeric: tabular-nums;
}
.employee-pay-type {
  color: #365b48;
  font-weight: 600;
}
@media (max-width: 420px) {
  .employee-pay-row {
    gap: 5px 10px;
    font-size: 13px;
  }
  .employee-pay-row b {
    font-size: 14px;
  }
}
/* Quiet two-level employee layout, aligned payroll metrics. */
.directory-period {
  font-size: 14px;
  color: #71817a;
  margin: 0 0 8px;
}
.employee-row.employee-two-lines {
  padding: 20px 0;
  row-gap: 14px;
}
.employee-two-lines .employee-title-row strong {
  font-size: 18px;
}
.employee-pay-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: #f5f7f3;
  border-radius: 12px;
}
.employee-salary-chip {
  font-size: 14px;
  font-weight: 600;
  color: #365b48;
  background: #e7eedf;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
}
.employee-salary-chip.daily {
  background: #f3ebdd;
  color: #876337;
}
.employee-metric {
  display: grid;
  gap: 5px;
}
.employee-metric > span {
  font-size: 13px;
  color: #71817a;
}
.employee-metric > strong {
  font-size: 20px;
  font-weight: 600;
  color: #203c35;
  font-variant-numeric: tabular-nums;
}
.employee-metric small {
  font-size: 13px;
  font-weight: 400;
}
.employee-pay-summary.unavailable {
  display: block;
  color: #71817a;
  font-size: 14px;
}
@media (max-width: 380px) {
  .employee-pay-summary {
    gap: 10px;
    padding: 12px 10px;
    grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr);
  }
  .employee-metric > strong {
    font-size: 18px;
  }
  .employee-salary-chip {
    padding: 6px;
  }
}
.employee-pay-summary.employee-pay-simple {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  background: none;
  border-radius: 0;
}
.employee-pay-simple .employee-salary-chip {
  font-size: 14px;
  padding: 4px 10px;
}
.employee-salary-value {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  font-size: 14px;
  color: #71817a;
}
.employee-salary-value strong {
  font-size: 18px;
  color: #203c35;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.employee-row.employee-two-lines {
  padding: 16px 0;
  row-gap: 9px;
}
/* Edit action centered across both employee information rows. */
.employee-two-lines .employee-title-row {
  grid-column: 1;
  grid-row: 1;
}
.employee-two-lines .employee-pay-summary {
  grid-column: 1;
  grid-row: 2;
}
.employee-two-lines .employee-edit {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}
.personal-profile .employee-title-row {
  margin-bottom: 12px;
}
.personal-profile .employee-title-row strong {
  font-size: 20px;
}
.personal-shell .personal-readonly {
  cursor: default;
  font-family: inherit;
  font-size: 1rem;
}
.personal-shell .personal-readonly:hover {
  transform: none;
  border-color: var(--line);
}
/* Personal summary: one compact row and a distinct tinted surface. */
.panel.personal-profile {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 16px 18px;
  background: #e8f0e2;
  border-color: #d3dfcc;
}
.personal-profile .employee-title-row {
  margin: 0;
  gap: 10px;
  flex-wrap: nowrap;
}
.personal-profile .employee-title-row strong {
  font-size: 18px;
}
.personal-profile .employee-pay-summary.employee-pay-simple {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
}
.personal-profile .employee-salary-chip {
  background: #d4e3c9;
  color: #315034;
}
.personal-profile .employee-salary-value {
  white-space: nowrap;
}
@media (max-width: 420px) {
  .panel.personal-profile {
    padding: 14px 12px;
    gap: 8px 12px;
  }
  .personal-profile .employee-title-row {
    gap: 7px;
  }
  .personal-profile .employee-title-row strong {
    font-size: 17px;
  }
  .personal-profile .employee-pay-summary.employee-pay-simple {
    gap: 8px;
  }
  .personal-profile .employee-salary-chip {
    padding: 4px 7px;
  }
  .personal-profile .employee-salary-value {
    gap: 5px;
    font-size: 13px;
  }
  .personal-profile .employee-salary-value strong {
    font-size: 16px;
  }
}

/* V2.2 employee creation */
.employee-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.employee-controls .employee-back {
  margin: 0;
}
.employee-add {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 14px;
  white-space: nowrap;
}
#createemployeeform {
  margin-top: 20px;
}
#createemployeeform [hidden] {
  display: none !important;
}
#createemployeeform .caption {
  margin: 0;
}

.remember-device {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}
.remember-device input {
  width: 20px;
  min-height: 20px;
  height: 20px;
}
#modal textarea {
  width: 100%;
  overflow-wrap: anywhere;
}

/* V3.1 員工編輯、装置清單與薪資工時 */
.editor-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.editor-section h3 {
  margin: 0;
  font-size: 17px;
}
.editor-section [hidden] {
  display: none !important;
}
.inactive-label {
  color: #946137;
  background: #fff0de;
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 12px;
}
.device-setting-row {
  gap: 12px;
}
.device-setting-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.device-setting-row button {
  flex-shrink: 0;
}
.payroll-values {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 480px) {
  .payroll-values {
    gap: 10px;
  }
  .payroll-values dd,
  .payroll-entry .payroll-values dd {
    font-size: 20px;
  }
  .payroll-values dt {
    font-size: 13px;
  }
}

/* Compact daily overview with explicit attendance definitions. */
.heading .overview-date {
  font-size: 21px;
  font-weight: 600;
  color: #36594e;
}
.today-stats {
  margin-bottom: 12px;
}
.today-stats .stat {
  padding: 12px 16px;
  min-height: 0;
}
.today-stats .stat strong {
  font-size: 28px;
  margin-top: 4px;
  line-height: 1.2;
}
.status-definitions {
  display: grid;
  gap: 5px;
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.6;
  color: #617368;
}
.status-definitions b {
  color: #36594e;
}
@media (max-width: 480px) {
  .today-stats {
    gap: 8px;
  }
  .today-stats .stat {
    padding: 10px;
  }
  .today-stats .stat strong {
    font-size: 25px;
  }
}
.today-stats .stat > small {
  font-size: 16px;
  line-height: 1.5;
  opacity: 1;
}
.today-stats .stat-definition {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.78;
}
@media (max-width: 600px) {
  .today-stats {
    grid-template-columns: 1fr;
  }
  .today-stats .stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .today-stats .stat strong {
    flex-shrink: 0;
    margin-top: 0;
  }
}

.delete-record {
  color: #a13b31;
  font-weight: 600;
}
