:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --surface: #fffdf8;
  --surface-soft: #f9f6ef;
  --ink: #181a17;
  --muted: #646a61;
  --line: #d9d0c2;
  --green: #1f6b4f;
  --green-soft: #e3f0e9;
  --red: #b6423a;
  --red-soft: #f7e5e2;
  --blue: #285e8f;
  --blue-soft: #e4eef8;
  --gold: #9b6a1e;
  --gold-soft: #f5ead6;
  --shadow: 0 18px 50px rgba(41, 36, 28, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(120deg, rgba(31, 107, 79, 0.08), transparent 34%),
    linear-gradient(300deg, rgba(40, 94, 143, 0.08), transparent 36%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(244, 240, 232, 0.9);
  border-bottom: 1px solid rgba(24, 26, 23, 0.12);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #0b7a3b 0 56%, #f5d328 56% 100%);
  color: #fffdf8;
  border: 1px solid rgba(11, 122, 59, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 253, 248, 0.34);
  font-size: 0.82rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.top-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.language-switcher {
  min-width: 118px;
}

.language-switcher select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 34px 0 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
}

main {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-heading h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.page-heading h1.compact-title {
  max-width: 760px;
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.metric {
  min-height: 136px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.metric.good {
  border-color: rgba(31, 107, 79, 0.35);
}

.metric.warn {
  border-color: rgba(155, 106, 30, 0.4);
}

.metric.bad {
  border-color: rgba(182, 66, 58, 0.42);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.panel {
  padding: clamp(16px, 2.2vw, 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.turnover-form {
  display: grid;
  gap: 14px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.08;
}

.pill,
.counter,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.good,
.tag.good {
  background: var(--green-soft);
  color: var(--green);
}

.pill.warn,
.tag.warn {
  background: var(--gold-soft);
  color: var(--gold);
}

.pill.bad,
.tag.bad {
  background: var(--red-soft);
  color: var(--red);
}

.record-list,
.attention-stack,
.issue-list,
.task-list,
.room-grid,
.inventory-entry {
  display: grid;
  gap: 12px;
}

.record,
.attention-item,
.issue-card,
.task-card,
.room-card,
.stock-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record,
.attention-item,
.issue-card {
  padding: 14px;
}

.record {
  display: grid;
  gap: 12px;
}

.record-top,
.attention-item,
.stock-row,
.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-top strong,
.attention-item strong,
.issue-card strong {
  display: block;
}

.record-top span,
.attention-item span,
.issue-card span,
.field-note {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.proof-tile {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid rgba(24, 26, 23, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 107, 79, 0.14), transparent),
    var(--surface);
  color: var(--muted);
  text-align: center;
}

.proof-tile strong {
  color: var(--ink);
}

.photo-review {
  display: grid;
  gap: 10px;
}

.photo-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-review-header strong {
  color: var(--ink);
}

.photo-review-header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

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

.photo-review-grid figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(24, 26, 23, 0.14);
  border-radius: 8px;
  background: var(--surface);
}

.photo-review-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-soft);
}

.photo-review-grid figcaption {
  padding: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.field-label {
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(24, 26, 23, 0.2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

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

.task-card,
.room-card {
  padding: 14px;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.task-main,
.room-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-main input,
.room-main input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(24, 26, 23, 0.34);
  border-radius: 6px;
  appearance: none;
  background: var(--surface);
}

.task-main input:checked,
.room-main input:checked {
  border-color: var(--green);
  background:
    linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.16) 50%),
    var(--green);
}

.task-main input:checked::after,
.room-main input:checked::after {
  content: "";
  display: block;
  width: 7px;
  height: 12px;
  margin: 2px 0 0 6px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-main strong,
.room-main strong {
  display: block;
}

.task-main span,
.room-main span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.task-inline-field {
  grid-column: 1 / -1;
  width: min(320px, 100%);
  margin-left: 34px;
}

.proof-input {
  width: min(280px, 100%);
  color: var(--muted);
  font-size: 0.84rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.file-control {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.reference-file-control {
  margin-top: 10px;
}

.file-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(24, 26, 23, 0.28);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
}

.file-status {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.reference-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  width: min(520px, 100%);
  border: 1px solid rgba(24, 26, 23, 0.14);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.reference-card-wide {
  width: min(760px, 100%);
}

.reference-card > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.reference-photo {
  min-height: 112px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  border-radius: 6px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, rgba(40, 94, 143, 0.16), rgba(31, 107, 79, 0.13));
}

.reference-photo span {
  min-height: 58px;
  display: grid;
  place-items: end center;
  border: 1px solid rgba(24, 26, 23, 0.18);
  border-radius: 6px 6px 12px 12px;
  background: rgba(255, 253, 248, 0.68);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.reference-photo.tableware span {
  min-height: 54px;
  border-radius: 50%;
  place-items: center;
}

.reference-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.reference-image-grid figure {
  min-width: 0;
  margin: 0;
}

.reference-image-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  border: 1px solid rgba(24, 26, 23, 0.16);
  border-radius: 6px;
  background: var(--surface-soft);
}

.reference-image-grid figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  font-weight: 850;
}

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

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

.inventory-entry label {
  min-width: 0;
}

.inventory-photo-action {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 7px;
  border: 1px solid rgba(24, 26, 23, 0.12);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.submit-bar {
  position: sticky;
  bottom: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(24, 26, 23, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.submit-bar strong,
.submit-bar span {
  display: block;
}

.submit-bar span {
  color: var(--muted);
  font-size: 0.88rem;
}

.primary-button,
.icon-button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 850;
}

.primary-button {
  padding: 0 18px;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.1rem;
}

.inventory-table {
  display: grid;
  gap: 10px;
}

.owner-inventory-form,
.owner-inventory-list {
  display: grid;
  gap: 10px;
}

.owner-inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(24, 26, 23, 0.12);
}

.owner-inventory-header strong,
.owner-inventory-header span {
  display: block;
}

.owner-inventory-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stock-row {
  padding: 13px 14px;
}

.stock-row.bad,
.history-stock.bad {
  border-color: rgba(182, 66, 58, 0.45);
  background: var(--red-soft);
}

.stock-row.warn,
.history-stock.warn {
  border-color: rgba(155, 106, 30, 0.42);
  background: var(--gold-soft);
}

.stock-row div {
  min-width: 0;
}

.stock-row strong {
  display: block;
}

.stock-row span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.owner-inventory-control {
  display: grid;
  grid-template-columns: auto minmax(112px, 150px);
  align-items: center;
  gap: 10px;
}

.owner-inventory-control input,
.owner-inventory-control select {
  min-height: 40px;
}

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

.issue-card {
  display: grid;
  gap: 10px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.history-card summary::-webkit-details-marker {
  display: none;
}

.history-card summary strong,
.history-issue strong,
.history-stock strong {
  display: block;
}

.history-card summary span,
.history-issue span,
.history-stock span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-detail {
  display: grid;
  gap: 16px;
  padding: 0 16px 16px;
  border-top: 1px solid rgba(24, 26, 23, 0.12);
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
}

.danger-button {
  min-height: 40px;
  border: 1px solid rgba(182, 66, 58, 0.45);
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  padding: 0 14px;
  font-weight: 850;
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.history-detail h2 {
  margin: 16px 0 10px;
  font-size: 1rem;
}

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

.history-stock,
.history-issue {
  border: 1px solid rgba(24, 26, 23, 0.12);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-stock {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.history-stock .tag {
  width: max-content;
}

.history-issues {
  display: grid;
  gap: 10px;
}

.history-issue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.empty-inline {
  border: 1px dashed rgba(24, 26, 23, 0.2);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface-soft);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 180px;
  place-content: center;
  border: 1px dashed rgba(24, 26, 23, 0.24);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

@media (max-width: 860px) {
  .app-shell {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .language-switcher {
    width: 100%;
  }

  .layout-grid,
  .form-grid,
  .room-grid,
  .inventory-entry,
  .issue-list,
  .history-inventory,
  .proof-grid,
  .photo-review-grid,
  .reference-image-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  main {
    padding: 18px 12px 80px;
  }

  .page-heading {
    align-items: stretch;
  }

  .page-heading h1 {
    font-size: 2.35rem;
  }

  .task-card,
  .room-card,
  .stock-row,
  .owner-inventory-header,
  .history-card summary,
  .history-issue,
  .submit-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .task-card {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .owner-inventory-control {
    grid-template-columns: 1fr;
  }

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

  .metric {
    min-height: 104px;
    padding: 12px;
  }

  .metric span {
    font-size: 0.76rem;
  }

  .metric strong {
    margin-top: 10px;
    font-size: 1.6rem;
  }
}
