:root {
  --ink: #18211b;
  --muted: #68736b;
  --line: #d9dfd8;
  --panel: #ffffff;
  --surface: #f4f6f2;
  --accent: #2f6f4e;
  --accent-dark: #24583d;
  --warn: #a33c32;
  --gold: #b68b2e;
  --shadow: 0 8px 18px rgba(24, 33, 27, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

#checkedBy,
#trimmer,
#strain {
  text-transform: uppercase;
}

button {
  cursor: pointer;
}

.app {
  width: min(1440px, calc(100% - 16px));
  margin: 0 auto;
  padding: 12px 0 20px;
}

.header,
.section-head,
.form-footer,
.bottom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header {
  margin-bottom: 10px;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.version-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.bottom-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.download-links {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.download-links:empty {
  display: none;
}

.download-links a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ed;
  color: var(--accent-dark);
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1;
}

h2 {
  font-size: 0.95rem;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

#entryForm .primary {
  min-height: 68px;
  min-width: 180px;
  padding: 0 20px;
  font-size: 1.05rem;
}

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

.schedule,
.report-panel,
.auth-card,
.stats,
.entry-card,
.records,
.summaries article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-panel {
  padding: 10px;
}

.auth-card {
  max-width: 360px;
  padding: 10px;
}

.auth-card form {
  display: grid;
  gap: 8px;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.schedule {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

label {
  min-width: 0;
}

.autocomplete-field {
  position: relative;
  display: block;
}

label span,
.stats span,
.form-footer span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 5px 8px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(47, 111, 78, 0.16);
}

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

.stats div {
  min-width: 0;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8faf6 100%);
}

.stats strong,
.form-footer strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.18rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.left-stack {
  display: grid;
  gap: 10px;
}

.entry-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.strain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 120px);
  gap: 8px;
  align-items: end;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
}

.autocomplete-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  right: 0;
  left: 0;
  display: none;
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 4px;
}

.autocomplete-menu.open {
  display: grid;
  gap: 2px;
}

.autocomplete-menu button {
  min-height: 30px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.autocomplete-menu button:hover,
.autocomplete-menu button:focus {
  background: #eef3ed;
  outline: none;
}

.pick-btn {
  min-height: 26px;
  max-width: 100%;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef3ed;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

.quick-picks:empty {
  display: none;
}

.form-footer {
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.save-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.save-status.error {
  color: var(--warn);
}

.save-status.saved {
  color: var(--accent-dark);
}

.records {
  min-width: 0;
  margin-top: 10px;
  padding: 8px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.record-actions {
  display: flex;
  gap: 5px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 5px 3px;
  text-align: left;
  vertical-align: middle;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 650;
}

#recordsBody tr:nth-child(odd) {
  background: #ffffff;
}

#recordsBody tr:nth-child(even) {
  background: #f3f5f2;
}

th:nth-child(1),
td:nth-child(1) {
  width: 54px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 46px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 42px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 78px;
  padding-left: 8px;
}

th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6) {
  width: 106px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 62px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 102px;
}

.edit-col {
  width: 108px;
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
}

.small-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0 5px;
  font-size: 0.7rem;
}

.small-btn.delete {
  color: var(--warn);
}

.empty {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.summaries article {
  min-width: 0;
  padding: 10px;
}

.summary-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.summary-row b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-row span {
  color: var(--accent-dark);
  font-weight: 900;
}

.bar {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebe5;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

@media (max-width: 1100px) {
  .schedule,
  .workspace,
  .summaries {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .app {
    width: min(100% - 12px, 1440px);
    padding-top: 8px;
  }

  .header,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .bottom-actions,
  .bottom-actions button {
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .bottom-actions,
  .entry-card,
  .danger,
  .edit-col,
  .row-actions {
    display: none;
  }

  .schedule,
  .stats,
  .records,
  .summaries article {
    box-shadow: none;
  }
}
