:root {
  color-scheme: light;
  --ink: #16211f;
  --muted: #64716d;
  --line: #d8dfdb;
  --surface: #f7f9f7;
  --panel: #ffffff;
  --accent: #0f7a68;
  --accent-strong: #075849;
  --warn: #b7422f;
  --soft: #e6f3ef;
  --shadow: 0 16px 40px rgba(22, 33, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
}

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

button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.file-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button.secondary,
button.ghost {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

button.secondary:hover,
button.ghost:hover {
  background: #edf3f0;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 247, 0.95);
  backdrop-filter: blur(10px);
}

.app-header h1,
.form-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions,
.actions,
.section-title,
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  min-height: calc(100vh - 73px);
}

.workspace {
  min-width: 0;
  padding: 20px 24px 32px;
}

.editor {
  border-left: 1px solid var(--line);
  background: var(--panel);
}

form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 190px;
  gap: 12px;
  margin-bottom: 14px;
}

label,
fieldset {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

label > span,
legend,
.section-title > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 122, 104, 0.2);
  border-color: var(--accent);
}

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

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

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input {
  width: 18px;
  height: 18px;
}

.drop-zone {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed #91aaa2;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbfa;
}

.drop-zone strong {
  color: var(--ink);
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--soft);
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  color: #06483c;
  background: var(--soft);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  margin-bottom: 12px;
}

.stat {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f5f8f6;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: #eef7f4;
}

.customer-cell {
  display: grid;
  gap: 2px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8eeeb;
  font-size: 13px;
  text-transform: capitalize;
}

.pill.issue-mould {
  color: #7d2d1e;
  background: #fde9e4;
}

.pill.issue-consistency {
  color: #68470b;
  background: #fbf0d1;
}

.pill.issue-damage-during-post {
  color: #264f83;
  background: #e5effc;
}

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

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.photo-tile {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f5f3;
}

.photo-tile img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.photo-tile button {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 26px;
  width: 26px;
  padding: 0;
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

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

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(15, 36, 31, 0.28);
  backdrop-filter: blur(2px);
}

.drop-overlay.active {
  display: grid;
}

.drop-overlay > div {
  display: grid;
  gap: 5px;
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 2px dashed #fff;
  border-radius: 8px;
  color: #fff;
  text-align: center;
  background: rgba(7, 88, 73, 0.72);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .app-header,
  .header-actions,
  .form-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .workspace,
  form {
    padding: 16px;
  }
}
