:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.32);
  --text: #f6f6f3;
  --muted: #a7a7a2;
  --soft: #d4d4cf;
  --black: #090909;
  --white: #ffffff;
  --danger: #d6b9b9;
  --radius: 18px;
  --small-radius: 12px;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.105), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(145deg, #050505 0%, #0c0c0c 46%, #171717 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 72%);
}

body::after {
  opacity: 0.18;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 0 1px, transparent 1px);
  background-size: 23px 29px, 41px 37px;
  animation: grainShift 10s steps(8, end) infinite;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 42px;
}

.section-panel {
  margin-bottom: 18px;
}

.glass-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.055) 46%, rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.05);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(26px) saturate(135%);
}

.hero {
  min-height: min(710px, calc(100vh - 28px));
  padding: 12px 0 26px;
  display: grid;
  align-content: space-between;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.brand,
.top-actions,
.hero-buttons,
.tag-row,
.confirm-actions,
.record-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 760;
}

.mark {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #777);
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.22);
}

.top-actions {
  gap: 8px;
}

.tiny-select,
.icon-btn,
.primary-btn,
.secondary-btn,
.text-btn,
.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: var(--small-radius);
  outline: none;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.tiny-select,
.icon-btn {
  min-height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.session-pill {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 34px;
  align-items: end;
  padding: 86px 0 22px;
}

.overline {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin-bottom: 24px;
  color: #fbfbf8;
  font-size: clamp(54px, 8.8vw, 112px);
  line-height: 0.92;
  font-weight: 760;
  letter-spacing: 0;
}

.hero-sub {
  max-width: 620px;
  margin-bottom: 30px;
  color: var(--soft);
  font-size: clamp(17px, 2.1vw, 24px);
  line-height: 1.52;
}

.hero-buttons {
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.text-btn {
  min-height: 46px;
  padding: 0 18px;
  font-weight: 780;
}

.primary-btn {
  background: var(--white);
  color: var(--black);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.text-btn {
  background: transparent;
  color: var(--muted);
}

.danger {
  color: var(--danger);
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover,
.text-btn:hover,
.field input:focus,
.field select:focus {
  border-color: var(--line-strong);
}

.primary-btn:active,
.secondary-btn:active,
.icon-btn:active,
.text-btn:active,
.record-main:active {
  transform: scale(0.985);
}

.tag-row {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.tag-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.overview-card {
  min-height: 430px;
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  align-content: space-between;
  transform: perspective(980px) rotateX(1.3deg) rotateY(-2.5deg);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.section-title p,
.section-title strong {
  margin: 0;
}

.section-title p {
  color: var(--muted);
}

.metric-stack {
  display: grid;
  gap: 10px;
}

.metric-stack div {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.metric-stack span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-stack strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
  font-weight: 760;
}

.read-only {
  border-radius: var(--small-radius);
  padding: 14px 16px;
  color: var(--soft);
}

.workspace,
.records {
  padding: 28px 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 420px);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
  font-weight: 720;
}

.section-heading p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.payroll-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-column {
  border-radius: var(--radius);
  padding: 18px;
}

.form-column h3 {
  margin-bottom: 16px;
  color: var(--soft);
  font-size: 17px;
}

.field {
  display: block;
  margin-bottom: 11px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.field select option,
.tiny-select option {
  color: #111;
}

.payable-total {
  border: 1px solid var(--line);
  border-radius: var(--small-radius);
  padding: 14px;
  margin: 12px 0;
  background: rgba(255, 255, 255, 0.075);
}

.payable-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.payable-total strong {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  line-height: 1;
}

.form-actions {
  display: grid;
  gap: 8px;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-card {
  overflow: hidden;
  border-radius: var(--radius);
}

.record-main {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 0.85fr 0.85fr auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 14px 16px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.record-name {
  font-size: 18px;
  font-weight: 820;
}

.record-period,
.record-days {
  color: var(--muted);
  font-size: 13px;
}

.record-pay {
  font-size: 18px;
  font-weight: 820;
}

.status-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 780;
}

.status-badge.pending {
  color: #ded8c3;
  background: rgba(224, 217, 193, 0.08);
}

.status-badge.confirmed {
  color: #d8e5dc;
  background: rgba(210, 230, 218, 0.08);
}

.status-badge.settled {
  color: #e7e7e0;
  background: rgba(255, 255, 255, 0.11);
}

.status-badge.review {
  color: #e1caca;
  background: rgba(225, 202, 202, 0.08);
}

.record-detail {
  display: none;
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
}

.record-detail.open {
  display: block;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: var(--small-radius);
  padding: 11px;
  background: rgba(255, 255, 255, 0.045);
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid strong {
  display: block;
  margin-top: 5px;
}

.record-note {
  margin: 12px 0;
  color: var(--soft);
  line-height: 1.55;
}

.record-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.empty-card {
  border-radius: var(--radius);
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(18px);
}

.login-card,
.confirm-card {
  width: calc(100vw - 28px);
  max-width: 390px;
  border-radius: var(--radius);
  padding: 22px;
}

.login-card h2,
.confirm-card h2 {
  margin-bottom: 10px;
  font-size: 34px;
}

.login-card p,
.confirm-card p {
  color: var(--muted);
  line-height: 1.55;
}

.login-card label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.login-card input {
  width: 100%;
  height: 46px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: var(--small-radius);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
}

.login-error {
  min-height: 22px;
  margin: 10px 0;
  color: #e6d1d1;
  font-size: 13px;
}

.confirm-actions {
  gap: 10px;
}

.confirm-actions button {
  flex: 1;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.93);
  color: var(--black);
  box-shadow: var(--shadow);
  font-weight: 820;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes grainShift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  33% {
    transform: translate3d(12px, -8px, 0);
  }
  66% {
    transform: translate3d(-9px, 7px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 12px 10px 32px;
  }

  .hero {
    min-height: auto;
  }

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

  .hero-grid,
  .section-heading,
  .payroll-form {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: 18px;
    padding: 58px 0 16px;
  }

  h1 {
    margin-bottom: 18px;
    font-size: clamp(48px, 15vw, 74px);
  }

  .hero-sub {
    margin-bottom: 20px;
    font-size: 17px;
  }

  .overview-card {
    min-height: 0;
    padding: 18px;
    transform: none;
  }

  .metric-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-stack strong {
    font-size: 30px;
  }

  .workspace,
  .records {
    padding: 18px 0;
  }

  .section-heading h2 {
    font-size: 38px;
  }

  .form-column {
    padding: 15px;
  }

  .record-main {
    min-height: 66px;
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
    padding: 12px;
  }

  .record-name {
    font-size: 17px;
  }

  .record-period {
    grid-column: 1 / -1;
    order: 3;
  }

  .record-days {
    order: 4;
  }

  .record-pay {
    text-align: right;
  }

  .status-badge {
    justify-self: end;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 470px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .session-pill {
    max-width: 132px;
  }

  .hero-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-buttons button,
  .form-actions button,
  .record-actions button {
    width: 100%;
  }

  .tag-row span {
    font-size: 11px;
    padding: 7px 9px;
  }

  .metric-stack {
    gap: 8px;
  }

  .metric-stack div {
    padding-top: 12px;
  }

  .metric-stack span,
  .record-period,
  .record-days {
    font-size: 12px;
  }

  .record-actions {
    display: grid;
  }
}
