:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e0eb;
  --accent: #0f172a;
  --accent-2: #2563eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 18px 50px rgba(15, 23, 42, .12);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100%;
  padding: max(16px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

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

.mobile-page {
  width: min(100%, 430px);
  margin: 0 auto;
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 25px rgba(15, 23, 42, .2);
}

.center-card, .card, .panel {
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.center-card {
  width: min(100%, 430px);
  margin: 9vh auto 0;
  padding: 24px;
}

.card { padding: 22px; }
.panel { padding: 18px; }

h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1;
  letter-spacing: -.05em;
  margin-bottom: 12px;
}
h2 { font-size: 24px; letter-spacing: -.03em; margin-bottom: 8px; }
h3 { font-size: 17px; margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.5; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(280px, 430px) 1fr;
  gap: 18px;
  align-items: start;
}

.form { display: grid; gap: 12px; }
.field { display: grid; gap: 7px; }
.label {
  font-size: 13px;
  color: #344054;
  font-weight: 700;
}
.input, .textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.input.pin {
  font-size: 32px;
  letter-spacing: .28em;
  text-align: center;
  font-weight: 800;
  padding-left: calc(14px + .28em);
}
.textarea { min-height: 110px; resize: vertical; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.between { justify-content: space-between; }
.btn {
  min-height: 48px;
  border-radius: 15px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  background: #eef2f7;
  color: var(--text);
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.blue { background: var(--accent-2); color: #fff; }
.btn.danger { background: #fee2e2; color: #991b1b; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.full { width: 100%; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.notice {
  border-radius: 16px;
  padding: 12px 14px;
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  line-height: 1.45;
  font-size: 14px;
}
.notice.warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
.error-text { color: var(--danger); font-weight: 700; font-size: 14px; }
.success-text { color: var(--ok); font-weight: 700; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.accounts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}
.accounts-table th,
.accounts-table td {
  border-bottom: 1px solid #edf1f7;
  border-right: 1px solid #edf1f7;
  padding: 0;
  background: #fff;
}
.accounts-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px;
  text-align: left;
  font-size: 13px;
  color: #344054;
  background: #f8fafc;
}
.accounts-table th:first-child,
.accounts-table td:first-child {
  width: 54px;
  text-align: center;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}
.accounts-table input {
  width: 100%;
  min-height: 44px;
  border: 0;
  outline: 0;
  padding: 10px 12px;
  background: transparent;
}
.accounts-table tr.invalid input { background: #fff7f7; }
.accounts-table td:last-child, .accounts-table th:last-child { border-right: 0; }
.accounts-table tr:last-child td { border-bottom: 0; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
}

.list-stack { display: grid; gap: 10px; }
.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}
.list-item strong { display: block; }

.hero-spacer { flex: 1; display: grid; align-content: center; }
.pin-card {
  padding: 26px;
  border-radius: 30px;
}
.pin-digits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.pin-dot {
  height: 58px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
}

.account-card {
  user-select: none;
  touch-action: pan-y;
  padding: 20px;
  border-radius: 30px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 900;
  word-break: break-word;
}
.counter {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef2f7;
  padding: 9px 13px;
  font-size: 15px;
  font-weight: 900;
  color: #344054;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04);
}
.copy-fields { display: grid; gap: 14px; }
.copy-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: #fff;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
  display: grid;
  gap: 7px;
  transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.copy-field:active { background: #f8fafc; transform: scale(.992); }
.copy-field.copied {
  border-color: rgba(22, 163, 74, .62);
  background: #f0fdf4;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .10);
  animation: copiedPulse .65s ease;
}
.copy-field:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.copy-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 900;
}
.copy-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  word-break: break-all;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  text-decoration: none;
}
.copy-value span {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  text-decoration: none;
}
@keyframes copiedPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.018); }
  100% { transform: scale(1); }
}
.copy-icon {
  flex: 0 0 auto;
  min-width: 80px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 9px 11px;
  font-size: 12px;
  text-align: center;
}
.nav-row {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}
.arrow {
  height: 54px;
  border-radius: 18px;
  background: #eef2f7;
  font-size: 26px;
  font-weight: 900;
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s ease;
}
.done-bar {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  margin-top: 12px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(15, 23, 42, .1);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.switch {
  position: relative;
  display: inline-flex;
  width: 74px;
  height: 42px;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #d0d5dd;
  border-radius: 999px;
  transition: .2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 34px;
  width: 34px;
  left: 4px;
  top: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transition: .2s;
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider:before { transform: translateX(32px); }

.finished {
  text-align: center;
  display: grid;
  gap: 12px;
  place-items: center;
  padding: 36px 24px;
}
.finished .big { font-size: 54px; }

.celebration {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.celebration.show { opacity: 1; }
.celebration-card {
  position: relative;
  z-index: 2;
  min-width: min(82vw, 320px);
  border-radius: 30px;
  padding: 28px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  transform: translateY(12px) scale(.94);
  transition: transform .28s cubic-bezier(.2,.9,.2,1.2);
}
.celebration.show .celebration-card { transform: translateY(0) scale(1); }
.party-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; }
.celebration-title {
  font-size: 34px;
  line-height: 1;
  letter-spacing: -.04em;
  font-weight: 950;
}
.confetti-cloud {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.confetti-cloud span {
  position: absolute;
  left: calc(8% + var(--i) * 7.5%);
  top: -28px;
  font-size: 22px;
  opacity: .95;
  animation: confettiFall 1.55s cubic-bezier(.16,.68,.24,1) forwards;
  animation-delay: calc(var(--i) * .045s);
}
@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(104vh) rotate(520deg); opacity: .9; }
}

.toast {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  z-index: 20;
  transform: translate(-50%, -120%);
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
  opacity: 0;
  transition: .2s ease;
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.hidden { display: none !important; }


@media (max-width: 520px) {
  body.employee-card-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  body.employee-card-screen .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
  }
  body.employee-card-screen .mobile-page {
    height: 100%;
    min-height: 0;
  }
  body.employee-card-screen .topbar {
    flex: 0 0 auto;
    margin-bottom: 10px;
  }
  body.employee-card-screen .account-card {
    flex: 1 1 auto;
    min-height: 0;
    touch-action: none;
  }
  body.employee-card-screen .done-bar {
    position: static;
    flex: 0 0 auto;
    margin-top: 10px;
  }
}

@media (max-width: 820px) {
  .grid-two { grid-template-columns: 1fr; }
  .page { width: min(100%, 430px); }
  .desktop-only { display: none; }
  .table-wrap { margin-left: -10px; margin-right: -10px; border-radius: 14px; }
  .accounts-table { min-width: 620px; }
}

/* Admin layout tweaks */
.page { width: min(100%, 1380px); }
.admin-grid { grid-template-columns: minmax(740px, 1fr) minmax(280px, 360px); }
.panel-accounts .table-wrap { max-width: 100%; }
.panel-lists { align-self: start; }
.list-main { min-width: 0; }
.list-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.done-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--ok);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  flex: 0 0 auto;
}
.finished-list { border-color: rgba(22, 163, 74, .45); }
.card-kicker {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 10px;
}

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
}

/* Admin settings modal */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  background: #eef2f7;
  color: var(--accent);
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  transition: transform .14s ease, background .14s ease;
}
.icon-btn:active { transform: translateY(1px) scale(.98); }
.icon-btn.light {
  background: #f2f4f7;
  font-size: 28px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .32);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(100%, 430px);
  border-radius: 26px;
  padding: 20px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .26);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
