:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #111;
  background: #fafafa;
}

body {
  margin: 0;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

h1 {
  margin: 0 0 16px;
  font-size: 22px;
}

h2.panel-title {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.col-6 {
  grid-column: span 6;
}

.col-4 {
  grid-column: span 4;
}

.col-12 {
  grid-column: span 12;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #333;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
}

.col-6 .row > input,
.col-6 .row > select {
  max-width: min(100%, 20rem);
}

.col-6 .row > input.input-wide {
  max-width: min(100%, 36rem);
}

.item-fields-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.item-field-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-field-group label {
  white-space: nowrap;
}

.items-table-head {
  margin-bottom: 4px;
}

.items-header-row {
  padding-bottom: 6px;
  border-bottom: 1px solid #ddd;
}

.items-header-row .items-col-head {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
}

.item-remove-slot {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  min-width: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
}

.item-field-desc {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.item-field-qty {
  flex: 0 0 4.75rem;
  max-width: 4.75rem;
}

.item-field-unit {
  flex: 0 0 5.5rem;
  max-width: 5.5rem;
}

.item-field-price {
  flex: 0 0 7.25rem;
  max-width: 7.25rem;
}

.item-field-special {
  flex: 0 0 6.75rem;
  max-width: 6.75rem;
  min-width: 0;
}

.item-field-special label {
  font-size: 11px;
  margin-bottom: 4px;
}

.item-line-total-row {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.item-line-total-row .item-line-total {
  font-size: 12px;
  white-space: nowrap;
}

.item-remove-btn {
  flex: 0 0 auto;
  align-self: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin-bottom: 2px;
  line-height: 1;
  font-size: 1.15rem;
  font-weight: 500;
  color: #666;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.item-remove-btn:hover:not(:disabled) {
  background: #f0f0f0;
  color: #111;
}

.item-remove-btn:disabled {
  opacity: 0.45;
}

button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cfcfcf;
  background: #fff;
  cursor: pointer;
}

button.primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.row {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.muted {
  color: #666;
  font-size: 12px;
}

.error {
  padding: 12px 14px;
  background: #ffecec;
  border: 1px solid #ffb3b3;
  border-radius: 8px;
  color: #9a0000;
  margin-bottom: 14px;
}

.error.hidden {
  display: none;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.inv-table th,
.inv-table td {
  border: 1px solid #e0e0e0;
  padding: 8px 10px;
  text-align: left;
}

.inv-table th {
  background: #f4f4f4;
  font-weight: 600;
}

.inv-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.spacer {
  height: 10px;
}

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

.history-head h2 {
  margin: 0;
  font-size: 15px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button.danger {
  border-color: #c08080;
  color: #8b0000;
}

button.danger:hover {
  background: #fff5f5;
}

.item-card {
  border: 1px solid #eee;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.row-items {
  margin-top: 12px;
}

.items-total-estimate {
  margin-top: 14px;
  font-size: 13px;
}

.row-history {
  margin-top: 24px;
}
