:root {
  --bg: #eef2ec;
  --bg-accent: #d7e3d4;
  --ink: #1f2a24;
  --muted: #5b6b62;
  --brand: #2f5d3a;
  --brand-dark: #23462c;
  --line: #c5d2c7;
  --card: #f7faf6;
  --danger: #8b2e2e;
  --ok: #2f5d3a;
  --warn: #8a6a1f;
  --radius: 14px;
  --font: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dce8d8 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #cfe0d3 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 4.5rem; }
.app-shell--wide { max-width: 960px; }
.app-shell--wide .entry-form { max-width: none; }

.app-footer {
  margin-top: 1.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
}

.brand {
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--brand-dark);
  margin: 0;
}
.brand span { display: block; font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-top: 0.15rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: flex-start;
}
.nav-primary,
.nav-more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  align-items: center;
}
.nav-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 0.25rem;
  width: 100%;
  text-align: right;
}
.nav-toggle {
  display: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.nav-link,
.site-nav a {
  font-size: 0.9rem;
  color: var(--ink);
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  text-decoration: none;
}
.nav-link:hover,
.site-nav a:hover { background: #fff; text-decoration: none; }
.nav-link--primary {
  font-weight: 650;
  border-color: #9cbc9f;
  background: #fff;
}
.nav-link--primary.is-active,
.nav-link.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.nav-link--admin {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  padding: 0.3rem 0.55rem;
}
.nav-link--admin:hover {
  background: rgba(255,255,255,0.7);
  border-color: var(--line);
  color: var(--ink);
}
.nav-link--admin.is-active {
  background: #e7efe6;
  border-color: #9cbc9f;
  color: var(--brand-dark);
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .nav-primary {
    justify-content: flex-start;
  }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-more {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0.35rem 0 0;
  }
  .nav-more.is-open { display: flex; }
  .nav-more a,
  .nav-more .nav-link { text-align: left; }
  .nav-group-label { text-align: left; }
}

h1.page-title { font-size: 1.25rem; margin: 0 0 1rem; font-weight: 700; }

.flash {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.ok { border-color: #9cbc9f; background: #e9f4eb; }
.flash.error { border-color: #d7a0a0; background: #f8ecec; color: var(--danger); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-grid { display: grid; gap: 0.85rem; }
.form-row { display: grid; gap: 0.35rem; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 560px) { .form-row.two { grid-template-columns: 1fr; } }

.form-section {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 0 1rem;
  border-top: 1px solid var(--line);
}
.form-section:first-of-type,
.entry-form > .form-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.form-section--primary {
  background: #eef5ee;
  border: 1px solid #c5d8c7;
  border-radius: 12px;
  padding: 0.9rem;
  margin: 0;
}
.form-section .section-title { margin-top: 0; }
.form-section .section-title + .section-title,
.form-section .checks + .section-title,
.form-section .form-row + .section-title {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed #c5d2c7;
}

.form-sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0.25rem -1rem -1rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(247, 250, 246, 0.4) 0%, var(--card) 35%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(31, 42, 36, 0.06);
}
.form-sticky-bar .btn-primary { width: 100%; max-width: none; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.85rem;
  align-items: end;
}
.filter-bar .form-row { min-width: 9rem; flex: 0 1 10rem; }
.filter-bar-grow { flex: 1 1 14rem; min-width: 12rem; }
.filter-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding-bottom: 0.1rem;
}
.filter-bar-actions .btn { width: auto; }

.page-actions { margin-bottom: 1rem; }

.view-hero {
  background: linear-gradient(160deg, #e7efe6 0%, var(--card) 55%);
}
.view-hero-date {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--brand);
  letter-spacing: 0.02em;
}
.view-hero-project {
  margin: 0.2rem 0 0.55rem;
  font-size: 1.45rem;
  font-weight: 750;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.view-hero-meta {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.4;
}
.view-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.stat-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
  min-width: 5.5rem;
  display: grid;
  gap: 0.1rem;
}
.stat-chip strong { font-size: 1.1rem; }

.dl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
}
.dl-grid--stack { grid-template-columns: 1fr; }
.dl-item { display: grid; gap: 0.2rem; min-width: 0; }
.dl-item--wide { grid-column: 1 / -1; }
.dl-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dl-value {
  font-size: 0.98rem;
  color: var(--ink);
  word-break: break-word;
}
.worker-chip {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.88rem;
}
@media (max-width: 560px) {
  .dl-grid { grid-template-columns: 1fr; }
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 1.25rem 0.5rem !important;
  font-style: italic;
}

label { font-size: 0.86rem; color: var(--muted); font-weight: 600; }
input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid #8fb897;
  outline-offset: 1px;
}

.checks { display: grid; gap: 0.45rem; }
.checks label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 500;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}
.checks input { width: auto; }

.section-title {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.95rem;
  color: var(--brand-dark);
  font-weight: 700;
}

.computed {
  background: #e7efe6;
  border: 1px dashed #9cb49d;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; width: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table thead th,
.entries-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  box-shadow: 0 1px 0 var(--line);
}
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0; align-items: center; }
td.actions { white-space: nowrap; }

.muted { color: var(--muted); }
.login-wrap { max-width: 420px; margin: 2rem auto; }

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.55rem;
  margin-top: 0.5rem;
}
.photo-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow: hidden;
}
.photo-thumb {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.photo-thumb--static { cursor: zoom-in; width: 100%; }
.photo-list img,
.photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
  vertical-align: middle;
}
.photo-meta {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-word;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}
.photo-delete-form {
  /* Külső form (form= attribútum); a gomb a .photo-item-ben van */
  display: none;
}
.photo-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(139, 46, 46, 0.92);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.photo-item > .photo-delete-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
}
.photo-delete-btn:hover { background: var(--danger); }
.photo-item--pending .photo-delete-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
}
.photo-section-label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0.65rem 0 0.15rem;
}

/* Lightbox */
body.photo-lightbox-open { overflow: hidden; }
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 22, 18, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 3rem 4.5rem;
}
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox figure {
  margin: 0;
  max-width: min(96vw, 960px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  background: #111;
}
.photo-lightbox figcaption {
  color: #e8efe9;
  font-size: 0.9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.photo-lightbox-close,
.photo-lightbox-prev,
.photo-lightbox-next {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  min-width: 2.75rem;
  min-height: 2.75rem;
}
.photo-lightbox-close:hover,
.photo-lightbox-prev:hover,
.photo-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
}
.photo-lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
  font-size: 1.75rem;
}
.photo-lightbox-prev {
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
}
.photo-lightbox-next {
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
}
@media (max-width: 560px) {
  .photo-lightbox { padding: 3.25rem 0.5rem 4rem; }
  .photo-lightbox-prev { left: 0.15rem; }
  .photo-lightbox-next { right: 0.15rem; }
}

.label-required::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}
input:required:invalid:not(:focus):not(:placeholder-shown),
select:required:invalid:not(:focus) {
  border-color: #d7a0a0;
}

.picker-field { cursor: pointer; }
.time-24h {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  cursor: pointer;
  background: #fff;
}
.time-picker-wrap {
  position: relative;
}
.time-picker-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(31, 42, 36, 0.14);
  padding: 0.75rem;
}
.time-picker-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.time-picker-row select {
  width: auto;
  min-width: 4.2rem;
  flex: 1;
}
.time-picker-sep {
  font-weight: 700;
  font-size: 1.1rem;
}
.time-picker-actions {
  display: flex;
  gap: 0.45rem;
}
.time-picker-actions .btn {
  width: auto;
  flex: 1;
}
.entries-table th,
.entries-table td {
  white-space: nowrap;
}
.entries-table td:nth-child(2),
.entries-table td:last-child {
  white-space: normal;
}
.status-form { margin: 0; }
.status-select {
  width: auto;
  min-width: 8rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
}
