:root {
  --bg: #f4f1ea;
  --ink: #1b1d1f;
  --muted: #626970;
  --panel: #fffdf7;
  --line: #d9d2c4;
  --green: #2f6f5e;
  --green-dark: #214e43;
  --blue: #355c91;
  --red: #a64036;
  --shadow: 0 18px 50px rgba(32, 38, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(53, 92, 145, 0.10), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: #9b927f;
}

button.primary {
  border-color: var(--green-dark);
  background: var(--green);
  color: white;
}

button.danger {
  color: var(--red);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 14px;
}

.summary span,
#storageNote {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 253, 247, 0.72);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 18px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.12);
}

input[readonly] {
  background: #f1eee6;
  color: #303437;
  font-weight: 700;
}

.planned-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 14px;
  background: #fffaf0;
}

.planned-box label {
  margin: 0;
}

.run-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 14px;
  background: white;
  color: var(--muted);
  line-height: 1.45;
}

.run-plan strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.run-plan ul {
  margin: 0;
  padding-left: 20px;
}

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

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

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

.hidden {
  display: none;
}

.sets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}

.sets-head button {
  padding: 0 14px;
}

.sets {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.set-row {
  display: grid;
  grid-template-columns: 110px minmax(190px, 1.35fr) 72px 104px 78px 96px 72px minmax(120px, 0.8fr) 42px;
  gap: 8px;
  align-items: center;
}

.set-row input {
  min-width: 0;
  padding: 10px;
}

.remove-set {
  min-width: 42px;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.image-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.actions,
.tools {
  display: grid;
  gap: 10px;
}

.actions {
  grid-template-columns: 1fr 140px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.card.accent {
  border-left: 5px solid var(--green);
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.entries-panel {
  margin-top: 18px;
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.entries {
  display: grid;
  gap: 10px;
}

.entry {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.entry-date {
  font-weight: 700;
}

.entry-type {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.entry-main {
  min-width: 0;
}

.entry-title {
  margin: 0 0 5px;
  font-weight: 700;
}

.entry-meta,
.entry-notes {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.entry button {
  min-width: 42px;
  padding: 0 12px;
}

.entry-image {
  display: block;
  width: min(260px, 100%);
  max-height: 260px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
}

@media (max-width: 820px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary {
    justify-content: flex-start;
  }

  .workspace,
  .grid.two,
  .grid.three,
  .actions,
  .planned-box,
  .entry,
  .set-row {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 18px, 1180px);
    padding-top: 12px;
  }

  .form-panel,
  .entries-panel {
    padding: 12px;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(244, 241, 234, 0.96);
    padding: 8px 0;
  }

  .set-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
  }

  .remove-set {
    width: 100%;
  }

  h1 {
    font-size: 28px;
  }
}
