* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px;
}

h1 {
  margin-bottom: 6px;
  font-size: 25px;
}

.hint {
  margin-top: 0;
  color: #666;
  line-height: 1.5;
}

.scanTip {
  margin: 8px 0 0;
  color: #777;
  line-height: 1.45;
  font-size: 14px;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

input, select, textarea, button {
  width: 100%;
  font-size: 16px;
  border-radius: 10px;
}

input, select, textarea {
  border: 1px solid #ddd;
  padding: 12px;
  background: #fff;
}

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

button {
  border: 0;
  padding: 12px;
  margin-top: 12px;
  background: #222;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:active { transform: scale(0.99); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.primary { background: #111; }
.secondary { background: #666; }

.editStatus {
  margin-bottom: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #fff7e6;
  color: #7a4b00;
  font-weight: 600;
  line-height: 1.45;
}

.statusText {
  margin-top: 12px;
  color: #555;
  line-height: 1.5;
  background: #f7f7f7;
  padding: 10px;
  border-radius: 10px;
}

.previewBox { margin-top: 12px; }

.previewBox img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #eee;
}

.scanner {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fafafa;
}
.hidden { display: none !important; }

#reader {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.ocrDetails {
  margin-top: 12px;
  color: #555;
}

pre {
  white-space: pre-wrap;
  background: #f7f7f7;
  padding: 10px;
  border-radius: 10px;
  max-height: 180px;
  overflow: auto;
}

.formActions {
  display: flex;
  gap: 10px;
}

.formActions button {
  flex: 1;
}

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

.listHeader h2 { margin: 0; }

.listHeader button {
  width: 130px;
  margin-top: 0;
}

.tableWrap {
  overflow-x: auto;
  margin-top: 12px;
}

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

th, td {
  border-bottom: 1px solid #eee;
  padding: 10px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th { background: #fafafa; }

.rowActions {
  display: flex;
  gap: 6px;
}

.rowActions button {
  width: auto;
  padding: 8px 10px;
  margin: 0;
  white-space: nowrap;
}

.editBtn { background: #2563eb; }
.deleteBtn { background: #c0392b; }

@media (max-width: 640px) {
  .listHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .listHeader button {
    width: 100%;
  }

  .formActions {
    flex-direction: column;
  }
}
