:root {
  --bg: #eff2ef;
  --ink: #141815;
  --muted: #667069;
  --panel: #fbfcf8;
  --panel-2: #e3e9e2;
  --line: #cdd6cd;
  --green: #174d35;
  --green-2: #0d3525;
  --gold: #b69244;
  --red: #a23d35;
  --blue: #244c63;
  --shadow: 0 20px 56px rgba(20, 24, 21, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(20, 24, 21, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(20, 24, 21, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(23, 77, 53, 0.14), transparent 42%),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.login-panel {
  width: min(480px, 100%);
  padding: 38px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 8px solid var(--green);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.brand-mark img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.06;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 8vw, 72px);
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
}

h3 {
  font-size: 22px;
}

.login-form,
.form-grid,
.stack {
  display: grid;
  gap: 14px;
}

.login-form {
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(35, 95, 74, 0.14);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 44px;
  border: 1px solid var(--ink);
  padding: 0 16px;
  border-radius: 4px;
}

.primary {
  background: var(--green);
  color: #fffdf7;
}

.primary:hover {
  background: var(--green-2);
}

.secondary {
  background: var(--ink);
  color: #fffdf7;
}

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

.danger {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 22px;
  background: var(--ink);
  color: #f8f5e8;
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-brand span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: #ffffff;
  border: 1px solid rgba(248, 245, 232, 0.28);
  border-radius: 4px;
  overflow: hidden;
}

.mini-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.user-card {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid rgba(255, 248, 223, 0.22);
  background: rgba(255, 248, 223, 0.06);
}

.user-card small,
.user-card span {
  color: #cbc2a8;
}

.nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav button,
.sidebar .ghost {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 248, 223, 0.22);
  background: transparent;
  color: #f8f5e8;
  text-align: left;
}

.nav button {
  padding: 0 14px;
}

.nav button.active,
.nav button:hover {
  background: #f8f5e8;
  color: var(--ink);
}

.content {
  padding: 24px;
}

.page {
  display: grid;
  gap: 18px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 8px solid var(--green);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.metrics.three {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.summary-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

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

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.object-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.object-meta span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
}

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

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fffdf7;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--ink);
  border-radius: 999px;
}

.chip.green {
  border-color: var(--green);
  color: var(--green);
}

.chip.red {
  border-color: var(--red);
  color: var(--red);
}

.chip.gold {
  border-color: var(--gold);
  color: #7f5b13;
}

.checkin-box {
  display: grid;
  gap: 18px;
  min-height: 360px;
  align-content: center;
  justify-items: center;
  text-align: center;
  border-top: 8px solid var(--green);
}

.checkin-box h2 {
  max-width: 760px;
}

.big-action {
  min-height: 92px;
  padding: 0 36px;
  font-size: 28px;
  background: var(--green);
  color: #fffdf7;
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 8px 8px 0 var(--ink);
}

.big-action:hover {
  transform: translate(2px, 2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 6px;
}

.day-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fffdf7;
}

.day-btn.selected {
  background: var(--green);
  color: #fffdf7;
  border-color: var(--green);
}

.day-btn.selected.weekend {
  background: var(--green);
  color: #fffdf7;
}

.project-list {
  display: grid;
  gap: 8px;
}

.project-choice {
  min-height: 52px;
  border: 1px solid var(--line);
  background: #fffdf7;
  text-align: left;
  padding: 0 14px;
  border-radius: 4px;
}

.project-choice:hover {
  border-color: var(--green);
  background: #f6f4ea;
}

.project-choice:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: #e7e9e2;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 24, 19, 0.58);
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.28);
}

.modal.modal-wide {
  width: min(1180px, 100%);
}

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

#modalBody {
  padding: 18px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.empty {
  padding: 24px;
  color: var(--muted);
  background: #fffdf7;
  border: 1px dashed var(--line);
}

.notice {
  padding: 12px 14px;
  background: #fff4d8;
  border: 1px solid #d8b35b;
  color: #6f4d08;
}

.presence-list,
.object-buttons {
  display: grid;
  gap: 10px;
}

.presence-row,
.object-button,
.object-line {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.presence-person {
  min-width: 0;
}

.presence-row strong,
.object-line strong {
  display: block;
  font-size: 20px;
}

.presence-row span,
.object-line span,
.object-button span {
  color: var(--muted);
}

.presence-object {
  color: var(--green);
  overflow-wrap: anywhere;
}

.presence-object strong {
  font-size: 22px;
}

.presence-object span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.muted-row {
  opacity: 0.58;
}

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

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  text-align: left;
}

.object-buttons {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.object-button {
  grid-template-columns: 1fr;
  min-height: 116px;
  text-align: left;
  cursor: pointer;
}

.object-button em {
  color: var(--ink);
  font-style: normal;
  line-height: 1.35;
}

.object-button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.object-button strong {
  font-size: 24px;
}

.segmented {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 16px;
  background: transparent;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--green);
  color: #fffdf7;
}

.month-control {
  max-width: 260px;
}

.calendar-wrap {
  max-width: 100%;
}

.calendar-table {
  min-width: 980px;
}

.calendar-table th,
.calendar-table td {
  min-width: 38px;
  padding: 10px 9px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.calendar-table th:first-child,
.calendar-table td:first-child {
  min-width: 160px;
  text-align: left;
}

.calendar-table th:nth-child(2),
.calendar-table td:nth-child(2) {
  min-width: 90px;
}

.calendar-table th span,
.calendar-table th small,
.day-btn span,
.day-btn small {
  display: block;
}

.calendar-table th small,
.day-btn small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.calendar-table .weekend,
.day-btn.weekend {
  background: #eef0eb;
}

.day-btn.selected.weekend {
  background: var(--green);
  color: #fffdf7;
}

.mark-full {
  color: var(--green);
  font-size: 26px;
  font-weight: 800;
}

.mark-extra {
  color: var(--red);
  font-size: 26px;
  font-weight: 800;
}

.correct-cell {
  cursor: pointer;
}

.correct-cell.request-add {
  background: #dff1df;
  color: var(--green);
  font-size: 24px;
  font-weight: 800;
}

.correct-cell.request-add::before {
  content: "+";
}

.correct-cell.request-remove {
  color: var(--red);
  text-decoration: line-through;
  text-decoration-thickness: 3px;
}

.request-card p {
  white-space: pre-wrap;
}

.current-project {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf7;
}

.current-project span {
  color: var(--muted);
}

.current-project strong {
  color: var(--green);
  font-size: clamp(30px, 7vw, 52px);
  line-height: 1;
}

.entry-history {
  display: grid;
  width: min(720px, 100%);
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf7;
  text-align: left;
}

.history-row.is-open {
  border-color: var(--green);
  background: #edf5ef;
}

.history-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.modal-actions,
.pay-object-list {
  display: grid;
  gap: 10px;
}

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

.pay-remainder {
  padding: 14px;
  border: 1px solid var(--green);
  border-radius: 4px;
  background: #edf5ef;
  color: var(--green);
  font-weight: 700;
}

.pay-object {
  display: grid;
  gap: 4px;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf7;
  text-align: left;
}

.allocation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf7;
  color: var(--ink);
}

.allocation-row span,
.allocation-row small {
  display: block;
}

.allocation-row small,
.muted {
  color: var(--muted);
}

.pay-object:hover {
  border-color: var(--green);
}

.pay-object:disabled,
.pay-object.is-used {
  cursor: not-allowed;
  opacity: 0.52;
  background: #e8ebe4;
}

.small-btn {
  min-height: 36px;
}

.compact-table table {
  min-width: 560px;
}

.compact-object-line {
  grid-template-columns: minmax(110px, 1fr) auto;
  box-shadow: none;
}

.day-btn.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.day-btn.filled {
  border-color: var(--green);
  background: #e2f0e6;
  color: var(--green);
  opacity: 1;
}

.hidden {
  display: none !important;
}

.collapsible-form {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fffdf7;
}

.permission-grid,
.project-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf7;
  color: var(--ink);
}

.check-row input {
  width: auto;
  min-height: auto;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .metrics,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .metrics.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .content,
  .sidebar {
    padding: 14px;
  }

  .page-head {
    display: grid;
    padding: 18px;
  }

  .page-head h1 {
    font-size: 30px;
  }

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

  .nav button,
  .sidebar .ghost {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .presence-row,
  .object-line {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 14px;
  }

  .presence-object {
    font-size: 18px;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .object-button {
    min-height: 98px;
  }

  .object-button strong {
    font-size: 21px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .big-action {
    width: 100%;
    min-height: 74px;
    font-size: 22px;
  }

  .month-days {
    grid-template-columns: repeat(5, minmax(38px, 1fr));
  }

  table {
    min-width: 620px;
  }

  .calendar-table {
    min-width: 980px;
  }
}
