:root {
  --ink: #17201b;
  --muted: #637069;
  --paper: #f4f1e9;
  --surface: #fbfaf6;
  --line: #d9d5ca;
  --accent: #d05b34;
  --accent-hover: #b84725;
  --danger: #a3322a;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans Hebrew", "Segoe UI", sans-serif;
}

.page-container {
  width: min(calc(100% - 2rem), 92rem);
  margin-inline: auto;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.app-header {
  width: min(calc(100% - 2rem), 92rem);
  min-height: 4.5rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.app-header a {
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.logout-button {
  padding: 0.45rem 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font: inherit;
}

.logout-button:hover {
  color: var(--ink);
}

.login-page {
  display: grid;
  align-items: center;
}

.login-page .page-container {
  width: min(calc(100% - 2rem), 70rem);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  align-items: center;
  gap: clamp(3rem, 9vw, 8rem);
  padding-block: 3rem;
}

.login-intro h1,
.empty-workday h1 {
  max-width: 11ch;
  margin: 0.35rem 0 1rem;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.login-intro > p:last-child,
.empty-workday > p:last-child {
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form {
  padding-block: 2.5rem;
  border-block: 1px solid var(--line);
}

.form-field + .form-field {
  margin-top: 1.25rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding-inline: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  font: inherit;
}

.form-field input {
  height: 3.25rem;
}

.form-field textarea {
  min-height: 6rem;
  padding-block: 0.75rem;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.field-validation-error,
.validation-summary {
  display: block;
  margin-top: 0.45rem;
  color: var(--danger);
  font-size: 0.875rem;
}

.validation-summary:empty,
.validation-summary-valid,
.field-validation-valid {
  display: none;
}

.validation-summary ul {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.login-form button[type="submit"] {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 1.75rem;
  color: #fffaf1;
  background: var(--accent);
  border: 0;
  border-radius: 0.2rem;
  font: inherit;
  font-weight: 800;
  transition: background-color 140ms ease-out, transform 140ms ease-out;
}

.login-form button[type="submit"]:hover {
  background: var(--accent-hover);
}

.login-form button[type="submit"]:active {
  transform: translateY(1px);
}

.empty-workday {
  padding-block: clamp(5rem, 14vw, 10rem);
}

button,
input,
textarea {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 2.5rem;
  }

  .login-intro h1 {
    font-size: clamp(2.4rem, 13vw, 4rem);
  }
}

.calendar-page,
.workday-page,
.entry-editor {
  container-type: inline-size;
  padding-block: clamp(2rem, 6vw, 4.5rem);
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.page-heading h1,
.editor-heading h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(2.15rem, 7vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.page-heading p,
.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.month-navigation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-navigation a,
.back-link,
.form-actions > a {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
}

.month-navigation a {
  padding-inline: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
}

.month-navigation a:active,
.back-link:active,
.form-actions > a:active {
  color: var(--ink);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.calendar-weekday {
  min-width: 0;
  padding: 0.65rem 0.15rem;
  color: var(--muted);
  background: var(--paper);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-width: 0;
  min-height: 4.75rem;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  transition: background-color 140ms ease-out;
}

.calendar-day time {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 750;
}

.calendar-day.today time {
  color: #fffaf1;
  background: var(--accent);
}

.calendar-day.outside-month {
  color: color-mix(in srgb, var(--muted) 58%, var(--paper));
  background: color-mix(in srgb, var(--paper) 86%, var(--surface));
}

.day-count {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  color: var(--accent-hover);
}

.day-count strong {
  font-size: 1.2rem;
  line-height: 1;
}

.day-count span,
.no-entries {
  display: none;
  font-size: 0.72rem;
}

.no-entries {
  color: var(--line);
}

.primary-action {
  min-height: 2.9rem;
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #fffaf1;
  background: var(--accent);
  border: 0;
  border-radius: 0.2rem;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 140ms ease-out, transform 140ms ease-out;
}

.primary-action:active {
  color: #fffaf1;
  background: var(--accent-hover);
  transform: translateY(1px);
}

.workday-heading .primary-action {
  align-self: flex-start;
}

.back-link {
  width: fit-content;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.empty-state {
  padding-block: clamp(3rem, 10vw, 7rem);
  border-block: 1px solid var(--line);
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.work-table-wrapper {
  width: 100%;
}

.work-table,
.work-table tbody {
  display: block;
  width: 100%;
}

.work-table {
  border-collapse: separate;
}

.work-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.work-table tbody {
  display: grid;
  gap: 0.9rem;
}

.work-table tr {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
}

.work-table td {
  min-width: 0;
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.work-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.work-table td:nth-child(1),
.work-table td:nth-child(2) {
  min-height: 4.5rem;
  justify-content: center;
  background: color-mix(in srgb, var(--paper) 58%, var(--surface));
}

.work-table td:nth-child(1) {
  border-inline-end: 1px solid var(--line);
}

.work-table td:nth-child(1) strong {
  color: var(--accent-hover);
  font-size: 1.15rem;
}

.work-table td:nth-child(n + 3) {
  grid-column: 1 / -1;
}

.work-table td:nth-last-child(2) {
  border-bottom: 0;
}

.work-table .row-action {
  padding: 0.65rem;
  background: color-mix(in srgb, var(--paper) 72%, var(--surface));
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.work-table .row-action a {
  width: 100%;
  min-height: 2.8rem;
  padding-inline: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-hover);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-weight: 750;
  text-decoration: none;
}

.editor-heading {
  max-width: 42rem;
  margin-bottom: clamp(2rem, 6vw, 4rem);
}

.work-entry-form {
  max-width: 58rem;
  padding-block: clamp(1.5rem, 4vw, 2.75rem);
  border-block: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.form-actions .primary-action {
  min-width: 9rem;
}

@container (min-width: 40rem) {
  .day-count span,
  .no-entries {
    display: inline;
  }

  .calendar-day {
    min-height: 7rem;
    padding: 0.7rem;
  }

  .work-table td:nth-child(6) {
    grid-column: 1;
    border-inline-end: 1px solid var(--line);
  }

  .work-table td:nth-child(7) {
    grid-column: 2;
  }
}

@media (min-width: 45rem) {
  .page-heading {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .workday-heading .primary-action {
    align-self: flex-end;
  }

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

  .form-field-wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 62rem) {
  .work-table-wrapper {
    overflow-x: auto;
    border-top: 1px solid var(--line);
  }

  .work-table {
    min-width: 76rem;
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .work-table thead {
    position: static;
    width: auto;
    height: auto;
    display: table-header-group;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .work-table tbody {
    display: table-row-group;
  }

  .work-table tr {
    display: table-row;
    width: auto;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .work-table th,
  .work-table td {
    display: table-cell;
    width: auto;
    min-height: 0;
    padding: 0.8rem 0.7rem;
    vertical-align: top;
    text-align: right;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  .work-table th {
    color: var(--muted);
    background: color-mix(in srgb, var(--paper) 76%, var(--surface));
    font-size: 0.73rem;
    font-weight: 800;
  }

  .work-table td {
    background: var(--surface);
    font-size: 0.88rem;
  }

  .work-table td:nth-child(n) {
    min-height: 0;
    grid-column: auto;
    background: var(--surface);
    border-inline-end: 0;
  }

  .work-table td::before {
    display: none;
  }

  .work-table th:nth-child(1) { width: 5rem; }
  .work-table th:nth-child(2) { width: 7rem; }
  .work-table th:nth-child(3) { width: 9rem; }
  .work-table th:nth-child(5) { width: 15rem; }
  .work-table th:nth-child(6) { width: 8rem; }
  .work-table th:nth-child(7) { width: 9.5rem; }
  .work-table th:last-child { width: 4.5rem; }

  .work-table .row-action {
    padding: 0.8rem 0.7rem;
    background: var(--surface);
    border-top: 0;
  }

  .work-table .row-action a {
    width: auto;
    min-height: 0;
    padding: 0;
    justify-content: flex-start;
    background: transparent;
    border: 0;
    border-radius: 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .calendar-day:hover {
    background: color-mix(in srgb, var(--surface) 82%, var(--accent));
  }

  .month-navigation a:hover,
  .back-link:hover,
  .form-actions > a:hover,
  .work-table .row-action a:hover {
    color: var(--ink);
  }

  .primary-action:hover {
    color: #fffaf1;
    background: var(--accent-hover);
  }
}

@media (pointer: coarse) {
  .logout-button,
  .month-navigation a,
  .back-link,
  .form-actions > a,
  .work-table .row-action a {
    min-height: 3rem;
  }
}

@media (max-width: 22rem) {
  .page-container,
  .app-header {
    width: calc(100% - 0.75rem);
  }
}
