:root {
  --bg: #fff;
  --ink: #141414;
  --ink-soft: #444;
  --muted: #666;
  --placeholder: #888;
  --panel: #fff;
  --line: #e9e9e9;
  --line-strong: #d0d0d0;
  --fill-soft: #f7f7f7;
  --hairline: #f0f0f0;
  --black: #000;
  --danger: #444;
  --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 10px 30px rgba(0, 0, 0, .055);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.hero {
  background: #fff;
  color: var(--ink);
  padding: 22px clamp(20px, 5vw, 58px) 54px;
  border-bottom: 1px solid var(--hairline);
}

.nav {
  display: grid;
  grid-template-columns: minmax(190px, auto) 1fr;
  align-items: start;
  gap: 18px;
  margin: 0 auto;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: clamp(132px, 16vw, 178px);
  height: auto;
  max-height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: none;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
}

.brand small {
  display: block;
  color: var(--placeholder);
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.25;
}

.nav-actions,
.hero-buttons,
.section-head,
.report-actions,
.table-actions,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-actions {
  justify-content: flex-end;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  align-items: end;
  max-width: 1200px;
  margin: clamp(70px, 10vh, 116px) auto 0;
}

.eyebrow {
  color: var(--placeholder);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  margin: 0 0 12px;
  text-transform: none;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 600;
  margin: 0 0 18px;
  max-width: 840px;
  text-wrap: balance;
}

.hero-copy {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.62;
  max-width: 720px;
  margin: 0 0 26px;
}

.container {
  width: min(1200px, calc(100vw - 40px));
  margin: 30px auto 42px;
}

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

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi {
  min-width: 0;
  min-height: 126px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.kpi span,
.report-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi strong,
.report-summary strong {
  display: block;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0;
}

.kpi strong {
  font-size: clamp(26px, 3vw, 34px);
}

.kpi small,
.report-summary small,
.section-head small,
.entry-form small {
  color: var(--placeholder);
  line-height: 1.45;
}

.panel {
  padding: 22px;
  margin-top: 18px;
  min-width: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

label {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 13px;
  color: var(--ink);
  outline: none;
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .08);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.wide-field {
  grid-column: span 2;
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--fill-soft);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(.98);
}

.btn:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .08);
}

.primary {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.primary:hover {
  background: #141414;
  border-color: #141414;
}

.ghost {
  background: #fff;
  color: var(--ink);
}

.danger {
  border-color: var(--line-strong);
  color: var(--ink-soft);
  background: #fff;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 16px;
  align-items: flex-start;
}

.section-head > div {
  min-width: 0;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
}

.section-head .eyebrow {
  color: var(--placeholder);
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(80px, 1fr) minmax(52px, 70px);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.bar-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 10px;
  background: var(--fill-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--black);
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.entry-form button {
  align-self: end;
}

.form-actions {
  justify-content: flex-start;
  align-self: end;
}

.entry-form small {
  display: block;
  font-size: 12px;
  margin-top: 5px;
}

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

.hint,
.upload-panel p,
footer {
  color: var(--placeholder);
}

.hint {
  line-height: 1.5;
}

.filter-hint {
  max-width: 1200px;
  margin: 10px 2px 0;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overscroll-behavior: contain;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1040px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--hairline);
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  line-height: 1.35;
  vertical-align: middle;
}

thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 0 var(--line);
}

tbody tr:hover {
  background: var(--fill-soft);
}

td:nth-child(4),
td:nth-child(10) {
  white-space: normal;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  white-space: nowrap;
}

.pill.risk {
  border-color: var(--ink);
  color: var(--ink);
}

.pill.leave {
  color: var(--ink-soft);
  background: var(--fill-soft);
}

.pill.status-red {
  background: #fff1f0;
  border-color: #f0b8b4;
  color: #8a1f17;
}

.pill.status-blue {
  background: #edf5ff;
  border-color: #b8d5ff;
  color: #174a7c;
}

.pill.status-purple {
  background: #f6f0ff;
  border-color: #d8c2f0;
  color: #5b3386;
}

.delete {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: 7px 9px;
  cursor: pointer;
}

.delete:hover {
  background: var(--fill-soft);
}

.mini-time {
  width: 94px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.warn-text {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.sync-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.employee-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.selected-employees {
  min-height: 48px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--fill-soft);
}

.employee-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  padding: 7px 9px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.employee-chip b {
  font-size: 15px;
  line-height: 1;
}

.hidden-input {
  display: none;
}

.daily-report-panel {
  border: 1px solid var(--line);
  background: #fff;
}

.report-actions {
  justify-content: flex-end;
}

.report-actions input {
  width: auto;
  min-width: 170px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.report-summary article {
  background: var(--fill-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.report-summary strong {
  font-size: 28px;
  margin: 6px 0;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin: 14px 0;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  min-width: 0;
}

.report-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
}

.report-table-wrap {
  max-height: 420px;
}

.report-table-wrap table {
  min-width: 920px;
}

footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
}

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

  .nav-actions {
    justify-content: flex-start;
  }

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

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

@media (max-width: 900px) {
  .grid-two,
  .entry-form,
  .deduction-form,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: span 1;
  }

  .container {
    width: min(100% - 28px, 1200px);
  }

  .bar-row {
    grid-template-columns: minmax(92px, 120px) minmax(70px, 1fr) 58px;
  }

  .report-actions input,
  .report-actions .btn,
  .table-actions .btn,
  .form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .hero {
    padding-inline: 16px;
  }

  .cards,
  .filters,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .nav-actions,
  .hero-buttons,
  .section-head,
  .table-actions,
  .form-actions {
    align-items: stretch;
  }

  .nav-actions .btn,
  .hero-buttons .btn,
  .section-head .btn,
  .table-actions .btn,
  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  .employee-picker {
    grid-template-columns: 1fr;
  }

  .employee-picker .btn {
    width: 100%;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
  }

  .table-wrap table,
  .report-table-wrap table {
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
  }

  tbody tr:hover {
    background: #fff;
  }

  td {
    display: grid;
    grid-template-columns: minmax(94px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 36px;
    border-bottom: 0;
    padding: 7px 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--placeholder);
    font-size: 12px;
    font-weight: 500;
  }

  td[data-label=""] {
    display: block;
  }

  td[data-label=""]::before {
    content: none;
  }

  .mini-time {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .hero,
  .nav-actions,
  .filters,
  .grid-two,
  .upload-panel,
  #records .section-head div:last-child,
  footer,
  .hero-buttons,
  .cards,
  .chart-panel:not(.daily-report-panel),
  #add-entry {
    display: none !important;
  }

  .container {
    margin: 0;
    max-width: none;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    border: 0;
    border-radius: 0;
  }

  .daily-report-panel {
    display: block !important;
    border: 0;
    background: white;
  }

  .report-actions {
    display: none;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 1px solid var(--line);
  }

  thead th {
    position: static;
  }

  a[href]::after {
    content: "";
  }
}
