:root {
  color-scheme: light;
  --ink: #142127;
  --muted: #5f6f6d;
  --line: #d8e3df;
  --soft: #f4f8f6;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-strong: #0b5f58;
  --blue: #1d4ed8;
  --amber: #b45309;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(20, 33, 39, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body.attendance-body {
  margin: 0;
  background: #eef5f1;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.kiosk-shell {
  min-height: 100svh;
  padding: clamp(16px, 3vw, 32px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.kiosk-topbar,
.kiosk-main,
.side-panel,
.qr-card,
.checkin-card,
.settings-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(20, 33, 39, 0.04);
}

.kiosk-topbar {
  min-height: 96px;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-strong);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

.kiosk-topbar h1 {
  font-size: clamp(1.5rem, 4vw, 2.6rem);
}

.clock-stack {
  min-width: 210px;
  text-align: right;
}

.clock-stack span {
  display: block;
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  font-weight: 900;
  line-height: 1;
}

.clock-stack small {
  color: var(--muted);
  font-weight: 700;
}

.kiosk-main {
  min-height: 0;
  border-radius: 8px;
  padding: clamp(14px, 2vw, 22px);
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(260px, 360px);
  gap: 18px;
}

.qr-card {
  min-width: 0;
  border-radius: 8px;
  padding: clamp(14px, 2.3vw, 24px);
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto auto;
  gap: 14px;
  place-items: center;
}

.qr-status-line {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.status-pill {
  min-width: 106px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e0f2fe;
  color: #075985;
  text-align: center;
}

.status-pill.is-live {
  background: #dff7ed;
  color: var(--teal-strong);
}

.status-pill.is-preview {
  background: #fff3d8;
  color: var(--amber);
}

.status-pill.is-error {
  background: #fee4e2;
  color: var(--red);
}

.qr-frame {
  width: min(72svh, 100%, 560px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(10px, 2vw, 18px);
  display: grid;
  place-items: center;
}

.qr-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-placeholder {
  max-width: 320px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.countdown-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #d8e3df;
}

.countdown-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width 180ms linear;
}

.code-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: var(--muted);
  font-weight: 800;
}

.code-row strong {
  color: var(--ink);
  font-size: clamp(1.3rem, 5vw, 2.6rem);
  letter-spacing: 0;
}

.kiosk-instruction {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 750;
  text-align: center;
}

.kiosk-side {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

.side-panel {
  border-radius: 8px;
  padding: 16px;
}

.side-panel h2 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.check-list li {
  position: relative;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px 9px 34px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 750;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 13px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa8a4;
}

.check-list li.is-ok {
  color: var(--teal-strong);
  background: #effaf5;
}

.check-list li.is-ok::before {
  background: var(--teal);
}

.check-list li.is-warn {
  color: var(--amber);
  background: #fff8e8;
}

.check-list li.is-warn::before {
  background: var(--amber);
}

.detail-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.kiosk-actions,
.settings-actions {
  align-self: end;
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-strong);
}

.secondary-button,
.icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover,
.icon-button:hover {
  background: var(--soft);
}

.wide-button {
  width: 100%;
}

.offline-banner {
  border: 1px solid #f4c7c2;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 800;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(20, 33, 39, 0.44);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-panel {
  width: min(620px, 100%);
  max-height: min(860px, 92svh);
  overflow: auto;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.pin-panel {
  width: min(420px, 100%);
}

.settings-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.settings-panel label,
.checkin-form label,
.api-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
}

.settings-panel input,
.checkin-form input,
.checkin-form select,
.api-form input,
.employee-edit-form input,
.employee-edit-form select,
.manager-key-row input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cddbd6;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.settings-panel input:focus,
.checkin-form input:focus,
.checkin-form select:focus,
.api-form input:focus,
.employee-edit-form input:focus,
.employee-edit-form select:focus,
.manager-key-row input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--teal);
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toggle-row input {
  width: 22px;
  height: 22px;
  min-height: 22px;
}

.settings-note {
  border: 1px solid #f2d29b;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff8e8;
  color: var(--amber);
  font-weight: 800;
}

.checkin-body {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 16px;
}

.checkin-shell {
  width: min(480px, 100%);
}

.checkin-card {
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.checkin-card h1 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 8vw, 2.5rem);
}

.checkin-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 750;
}

.checkin-form,
.api-form {
  display: grid;
  gap: 14px;
}

.checkin-mode-toggle {
  background: #eef6f3;
  border: 1px solid #d3e0db;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
}

.checkin-mode-toggle label {
  display: block;
}

.checkin-mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkin-mode-toggle span {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #355047;
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
}

.checkin-mode-toggle input:checked + span {
  background: #fff;
  border-color: #c8d9d2;
  box-shadow: 0 1px 4px rgba(19, 48, 39, .1);
  color: var(--teal-strong);
}

.checkin-result {
  margin-top: 16px;
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
}

.checkin-result.is-ok {
  border: 1px solid #b8e5d1;
  background: #effaf5;
  color: var(--teal-strong);
}

.checkin-result.is-error {
  border: 1px solid #f4c7c2;
  background: #fff1f0;
  color: var(--red);
}

.advanced-panel {
  margin-top: 18px;
  color: var(--muted);
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 850;
}

.api-form {
  margin-top: 12px;
}

.manager-body {
  min-height: 100svh;
  padding: 16px;
}

.manager-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.manager-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.manager-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.secondary-link {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.manager-key-row,
.employee-edit-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.manager-key-row {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
}

.employee-edit-form {
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.2fr) minmax(150px, 0.8fr) auto auto;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.employee-edit-form label,
.manager-key-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
}

.employee-active-row {
  min-width: 78px;
  justify-items: center;
}

.employee-form-actions,
.employee-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.employee-table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.employee-table th,
.employee-table td {
  border-bottom: 1px solid #e5eeeb;
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.employee-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #40524e;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.employee-row-inactive {
  color: var(--muted);
  background: #f8fbfa;
}

.employee-status {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.82rem;
  font-weight: 850;
}

.employee-status.is-active {
  background: #dff7ed;
  color: var(--teal-strong);
}

.employee-status.is-inactive {
  background: #eef2f1;
  color: var(--muted);
}

.employee-mini-button {
  min-height: 34px;
  padding: 0 10px;
}

.employee-empty {
  height: 120px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

@media (max-width: 920px) {
  .kiosk-main {
    grid-template-columns: 1fr;
  }

  .kiosk-side {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .kiosk-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .kiosk-shell {
    padding: 12px;
  }

  .kiosk-topbar {
    align-items: flex-start;
  }

  .clock-stack {
    min-width: 156px;
  }

  .kiosk-side {
    grid-template-columns: 1fr;
  }

  .kiosk-actions,
  .settings-actions {
    flex-direction: column;
  }

  .manager-heading,
  .manager-key-row,
  .employee-edit-form {
    grid-template-columns: 1fr;
  }

  .manager-heading {
    display: grid;
  }

  .employee-form-actions {
    flex-direction: column;
  }
}
