:root {
  --ink: #1f2426;
  --muted: #5d686b;
  --paper: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #eef2f0;
  --line: #d9dedb;
  --accent: #245f63;
  --accent-2: #8c4d35;
  --warning: #a6422f;
  --good: #2f6b4f;
  --shadow: 0 14px 32px rgba(31, 36, 38, 0.09);
  font-family: Inter, Avenir Next, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 244, 239, 0.94);
  padding: 16px clamp(16px, 4vw, 36px);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
}

main {
  padding: clamp(14px, 3vw, 28px);
}

.top-actions,
.button-row,
.filters,
.stats-row,
.dialog-header {
  display: flex;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost,
.secondary,
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.danger {
  color: var(--warning);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.home-primary {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

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

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

.home-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink);
  padding: 16px;
  text-align: left;
  text-decoration: none;
}

.home-card span {
  font-size: 1.05rem;
  font-weight: 900;
}

.home-card small,
.placeholder-copy {
  color: var(--muted);
  line-height: 1.45;
}

.link-card {
  min-height: 150px;
}

.resource-panel {
  background: var(--surface-alt);
}

.resource-card {
  border: 2px solid var(--accent);
  background: var(--surface);
}

.resource-card::after {
  content: "Open information";
  align-self: end;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.hours-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.hours-row:last-child {
  border-bottom: 0;
}

.hours-row strong {
  font-size: 0.9rem;
}

.hours-row span {
  color: var(--muted);
}

.hours-editor {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.dialog-copy {
  padding: 16px 16px 0;
}

.dialog-copy p {
  color: var(--muted);
  line-height: 1.45;
}

.form-message {
  margin: 0;
  border: 1px solid rgba(166, 66, 47, 0.3);
  border-radius: 8px;
  background: rgba(166, 66, 47, 0.08);
  color: var(--warning);
  padding: 11px 12px;
  font-weight: 800;
}

.handbook-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(16px, 5vw, 48px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.focused-form-layout {
  max-width: 860px;
  margin: 0 auto;
}

.form-menu,
.entry-form,
.dashboard-heading,
.filters,
.table-wrap,
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-menu,
.entry-form,
.dashboard-heading,
.filters {
  padding: 16px;
}

.form-menu {
  align-self: start;
  display: grid;
  gap: 10px;
}

.template-button {
  display: grid;
  gap: 3px;
  min-height: 72px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink);
  text-align: left;
}

.template-button.active {
  border-color: var(--accent);
  background: #e4eeec;
}

.template-button span {
  font-weight: 900;
}

.template-button small {
  color: var(--muted);
}

.entry-form {
  display: grid;
  gap: 18px;
}

.form-heading,
.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.measurement-group {
  display: grid;
  gap: 8px;
}

.dimensions-group {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(72px, 0.5fr);
}

.weight-group {
  grid-template-columns: minmax(0, 1fr) 88px;
}

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

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

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.photo-preview {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.photo-preview img {
  width: 120px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: #d8ddda;
}

.photo-preview p {
  margin-bottom: 4px;
}

.button-row {
  flex-wrap: wrap;
  align-items: center;
}

.button-row.compact {
  justify-content: flex-end;
}

.dashboard-heading,
.filters,
.stats-row,
.table-wrap {
  max-width: 1180px;
  margin: 0 auto 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(150px, 210px));
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.stat-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.stat-heading strong {
  font-size: 1.45rem;
}

.stat-heading span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.stat-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-alt);
}

.stat-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.site-footer {
  display: flex;
  justify-content: center;
  padding: 10px 16px 28px;
}

.footer-dashboard-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: underline;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

.status-select {
  min-width: 132px;
  padding: 8px;
}

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

.row-actions button {
  min-height: 36px;
  padding: 7px 10px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(760px, calc(100vw - 24px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(31, 36, 38, 0.38);
}

.dialog-header {
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
}

#detailBody {
  padding: 16px;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-item dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.detail-photo {
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-alt);
}

@media (max-width: 760px) {
  .topbar,
  .form-heading,
  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .top-actions button,
  .button-row button,
  .button-row.compact,
  .button-row.compact button {
    width: 100%;
  }

  .split-layout,
  .home-layout,
  .home-card-grid,
  .field-grid,
  .filters,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .dimensions-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dimensions-group select {
    grid-column: 1 / -1;
  }

  .home-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .home-card,
  .link-card {
    min-height: 0;
    padding: 13px 14px;
  }

  .resource-card::after {
    margin-top: 4px;
  }

  .home-heading button,
  .dialog-actions button {
    width: 100%;
  }

  .photo-preview {
    grid-template-columns: 1fr;
  }

  .photo-preview img {
    width: 100%;
  }
}

@media print {
  body > * {
    display: none !important;
  }

  body.printing {
    background: #fff;
  }

  body.printing #printMount {
    display: block !important;
  }

  .print-sign {
    display: block;
    padding: 0.45in;
    color: #000;
    font-family: Arial, sans-serif;
  }

  .print-kicker {
    margin-bottom: 0.15in;
    border-bottom: 4px solid #000;
    padding-bottom: 0.08in;
    font-size: 18pt;
    font-weight: 900;
    text-transform: uppercase;
  }

  .print-sign h1 {
    margin: 0 0 0.2in;
    font-size: 38pt;
  }

  .print-sign dl {
    display: grid;
    grid-template-columns: 1.6in 1fr;
    gap: 0.08in 0.16in;
    margin: 0;
    font-size: 16pt;
  }

  .print-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.8in;
    gap: 0.25in;
    align-items: start;
  }

  .print-content.without-photo {
    grid-template-columns: 1fr;
  }

  .print-photo {
    display: block;
    width: 100%;
    max-height: 3.5in;
    border: 2px solid #000;
    object-fit: contain;
  }

  .print-sign dt {
    font-weight: 900;
  }

  .print-sign dd {
    margin: 0;
  }

  .print-note {
    margin-top: 0.25in;
    border: 2px solid #000;
    padding: 0.14in;
    font-size: 16pt;
    font-weight: 900;
  }
}
