:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #68717c;
  --line: #d9e0e7;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #dc2626;
  --green-soft: #e1f3ed;
  --blue-soft: #e7efff;
  --amber-soft: #fff1d6;
  --red-soft: #ffe4e6;
  --shadow: 0 18px 42px rgba(31, 41, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-pill,
.count-pill {
  flex: 0 0 auto;
  max-width: 220px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.05);
}

.status-pill.is-error {
  border-color: #fecdd3;
  background: var(--red-soft);
  color: #991b1b;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.field,
form label {
  display: grid;
  gap: 7px;
}

.field-label,
form label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
}

.segment {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.segment.is-active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.18);
}

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

.metric {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric strong {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
}

.metric small {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.accent-total {
  border-top-color: var(--teal);
}

.accent-planned {
  border-top-color: var(--blue);
}

.accent-extra {
  border-top-color: var(--amber);
}

.accent-pay {
  border-top-color: var(--red);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.panel-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

.form-grid label:first-child {
  grid-column: 1 / -1;
}

.primary-button,
.ghost-button,
.danger-button,
.plain-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button {
  grid-column: 1 / -1;
  border: 0;
  background: var(--teal);
  color: #fff;
}

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

.ghost-button,
.plain-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button {
  padding: 8px 12px;
  color: var(--muted);
}

.plain-button,
.danger-button {
  min-width: 86px;
  padding: 8px 11px;
}

.danger-button {
  border: 1px solid #fecdd3;
  background: var(--red-soft);
  color: #991b1b;
}

.list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.employee-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.employee-name {
  margin: 0 0 5px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.employee-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quick-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 18px 18px;
  padding: 16px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #1d4ed8;
}

.quick-total span {
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.quick-total strong {
  font-size: 1.55rem;
}

.entries-panel {
  overflow: hidden;
}

.entries-heading {
  align-items: flex-start;
}

.week-caption {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.entry-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  font-weight: 700;
}

.empty-cell {
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.overnight {
  display: inline-flex;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 850;
}

@media (max-width: 900px) {
  .toolbar,
  .summary-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 118px;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .app-header,
  .panel-heading,
  .employee-item,
  .quick-total {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    display: grid;
  }

  .status-pill {
    justify-content: flex-start;
    max-width: none;
  }

  .toolbar,
  .panel,
  .metric {
    border-radius: 8px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .list {
    padding: 0 14px 14px;
  }

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

  .row-actions {
    justify-content: stretch;
  }

  .row-actions button {
    flex: 1 1 120px;
  }

  .entry-pagination {
    justify-content: stretch;
  }

  .entry-pagination .count-pill {
    flex: 1 1 auto;
    max-width: none;
  }

  th,
  td {
    padding: 12px 14px;
  }
}
