:root {
  --ink: #07264a;
  --muted: #65738a;
  --line: #e6ebf3;
  --soft: #f5f8fd;
  --panel: #ffffff;
  --blue: #3267e3;
  --blue-dark: #194fae;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #0891b2;
  --shadow: 0 18px 45px rgba(9, 31, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 78% 4%, rgba(50, 103, 227, 0.12), transparent 28rem),
    linear-gradient(135deg, #f8fbff 0%, #eef4ff 46%, #ffffff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 8px;
}

.full-button {
  width: 100%;
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 86px;
  padding: 12px;
  resize: vertical;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 68px;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 54px;
  height: 32px;
  padding: 0 10px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  background: var(--soft);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  letter-spacing: 0;
  background: var(--ink);
}

.brand strong,
.brand span,
.session-card strong,
.session-card small,
.history-row strong,
.history-row small,
.request-row strong,
.request-row small,
.person-row strong,
.person-row small,
.worksite-row strong,
.worksite-row small {
  display: block;
}

.brand strong {
  font-size: 20px;
}

.brand span,
.session-card span,
.session-card small,
.eyebrow,
label,
.metrics span,
.timeline-note,
.empty-state,
.history-row small,
.request-row small,
.person-row small,
.worksite-row small {
  color: var(--muted);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.nav-tab.active {
  color: var(--blue);
  border-color: rgba(50, 103, 227, 0.18);
  background: rgba(50, 103, 227, 0.08);
}

.icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-weight: 800;
}

.session-card {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 25px rgba(9, 31, 68, 0.07);
}

.session-card strong {
  margin: 5px 0 10px;
}

main {
  padding: 36px;
}

.view,
.admin-tab {
  display: none;
}

.view.active,
.admin-tab.active {
  display: block;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.period-label {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.02;
}

h2 {
  font-size: 19px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.dark-label {
  color: rgba(255, 255, 255, 0.76);
}

.employee-picker {
  display: grid;
  gap: 7px;
  width: min(280px, 100%);
}

.employee-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.punch-panel {
  padding: 22px;
  background:
    linear-gradient(155deg, rgba(7, 38, 74, 0.97), rgba(28, 80, 160, 0.94)),
    var(--ink);
  color: white;
}

.status-line,
.panel-heading,
.history-row,
.request-row,
.person-row,
.worksite-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.status-line {
  color: rgba(255, 255, 255, 0.82);
}

.status-line > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 99px;
  background: var(--red);
}

.status-dot.working {
  background: var(--green);
}

.status-dot.break {
  background: var(--amber);
}

.time-hero {
  display: grid;
  gap: 8px;
  margin: 34px 0;
}

.time-hero span {
  font-size: clamp(58px, 11vw, 92px);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: 0;
}

.time-hero small {
  color: rgba(255, 255, 255, 0.68);
}

.punch-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.primary-action,
.secondary-action,
.danger-action,
.ghost-button,
.secondary-light,
.tiny-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-action {
  color: white;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(50, 103, 227, 0.24);
}

.primary-action:hover {
  background: var(--blue-dark);
}

.primary-action:disabled,
.secondary-action:disabled,
.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.secondary-action {
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
}

.danger-action {
  color: white;
  background: rgba(239, 68, 68, 0.94);
}

.secondary-light,
.ghost-button {
  color: var(--blue);
  border-color: rgba(50, 103, 227, 0.18);
  background: rgba(50, 103, 227, 0.08);
}

.compact {
  width: auto;
  min-height: 38px;
}

.panel-heading {
  min-height: 72px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.timeline,
.history-list,
.request-list,
.people-table,
.worksite-list {
  padding: 12px 18px 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  font-weight: 900;
}

.timeline-type {
  display: block;
  font-weight: 800;
}

.stack-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.stack-form.separated {
  border-top: 1px solid var(--line);
}

.compact-form {
  padding-bottom: 6px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-row,
.request-row,
.person-row,
.worksite-row {
  min-height: 62px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.history-row:last-child,
.request-row:last-child,
.person-row:last-child,
.worksite-row:last-child {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: var(--blue);
  background: rgba(50, 103, 227, 0.1);
}

.pill.green {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.pill.amber {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

.pill.red {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

.pill.cyan {
  color: #0e7490;
  background: rgba(8, 145, 178, 0.12);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 25px rgba(9, 31, 68, 0.08);
}

.metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 31px;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.sub-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  background: white;
}

.sub-tab.active {
  color: var(--blue);
  border-color: rgba(50, 103, 227, 0.18);
  background: rgba(50, 103, 227, 0.08);
}

.wide-panel {
  min-height: 520px;
}

.person-profile {
  display: flex;
  gap: 11px;
  align-items: center;
}

.payroll-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 420px;
  text-align: right;
}

.payroll-summary small {
  flex-basis: 100%;
  color: var(--muted);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #071f3d, #3267e3);
}

.request-actions,
.month-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(50, 103, 227, 0.18);
  border-radius: 8px;
  color: var(--blue);
  background: rgba(50, 103, 227, 0.08);
}

.month-picker input {
  width: 150px;
  height: 30px;
  padding: 0 6px;
  border-color: transparent;
  color: var(--ink);
  background: white;
}

.correction-box {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 180px) minmax(120px, 160px) auto;
  gap: 12px;
  align-items: end;
  margin: 0 18px 16px;
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
}

.correction-box strong,
.correction-box small {
  display: block;
}

.tiny-button {
  min-height: 32px;
  padding: 0 10px;
  border-color: var(--line);
  color: var(--ink);
  background: white;
}

.tiny-button.approve {
  color: #047857;
}

.tiny-button.reject {
  color: #b91c1c;
}

.tiny-button.neutral {
  color: var(--blue);
}

.person-row.clickable {
  cursor: pointer;
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
}

.person-row.clickable:hover {
  background: rgba(50, 103, 227, 0.06);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 38, 74, 0.38);
  backdrop-filter: blur(6px);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.modal-heading,
.modal-summary {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-summary {
  align-items: stretch;
}

.summary-item {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.summary-item span,
.summary-item small {
  display: block;
  color: var(--muted);
}

.summary-item strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.modal-timeline {
  padding-top: 4px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  color: white;
  font-weight: 800;
  background: var(--ink);
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1080px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .brand {
    margin-bottom: 16px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .session-card {
    display: none;
  }

  main {
    padding: 20px 16px 28px;
  }

  .topbar,
  .employee-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

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

@media (max-width: 680px) {
  h1 {
    font-size: 38px;
  }

  .nav-tabs,
  .punch-actions,
  .metrics,
  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .history-row,
  .request-row,
  .person-row,
  .worksite-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .request-actions,
  .month-actions {
    width: 100%;
  }

  .request-actions button,
  .month-actions button {
    flex: 1;
  }

  .modal-summary {
    flex-direction: column;
  }
}
