.commodity-form {
  margin: 1.25em 0;
  padding: 1em;
  border: 1px solid #ddd;
  border-radius: 0.3em;
  background-color: var(--bg-color, #fff);
}

.form-group {
  margin-bottom: 1em;
}

.split-fields .form-group.horizontal,
.transaction-fields-grid .form-group.horizontal {
  margin-bottom: 0.25em !important;
  display: flex;
  align-items: center;
  gap: 0.5em;
  width: 100%;
}

.form-group.horizontal label {
  display: inline-block;
  margin-bottom: 0;
  font-weight: bold;
  width: 5em;
  flex-shrink: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-fields .form-group.grouped-fields {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.25em !important;
  width: 100%;
}

.form-group.grouped-fields label {
  display: inline-block;
  margin-bottom: 0;
  font-weight: bold;
  width: 5em;
  flex-shrink: 0;
  text-align: left;
}

.field-group {
  display: flex;
  gap: 0.375em;
  flex: 1;
  width: 100%;
  min-width: 0;
}

.field-group .input-wrapper {
  flex: 1;
  min-width: 0;
}

.field-group .input-wrapper:first-child {
  flex: 2;
}

.field-group .input-wrapper:last-child {
  flex: 1;
}

.field-group .input-wrapper input,
.input-wrapper input {
  width: 100%;
  box-sizing: border-box;
}

.hidden-field {
  display: none !important;
}

.form-group label {
  display: block;
  margin-bottom: 0.3em;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 0.25em;
  box-sizing: border-box;
}

.split-fields .form-group.horizontal input,
.transaction-fields-grid .form-group.horizontal input {
  flex: 1;
  width: 100%;
  min-width: 0;
}

.input-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}

.input-wrapper input {
  width: 100%;
  box-sizing: border-box;
}

.form-group small {
  display: block;
  margin-top: 0.3em;
  color: #666;
  font-size: 0.8em;
}

button.button {
  background-color: var(--tg-theme-button-color, #4caf50);
  color: var(--tg-theme-button-text-color, white);
  padding: 0.6em 1em;
  border: none;
  border-radius: 0.25em;
  cursor: pointer;
  font-size: 1em;
  min-width: 10em;
}

button.button:hover {
  opacity: 0.9;
}

button.button.compact,
a.button.compact {
  min-width: auto;
  padding: 0.4em 0.6em;
  font-size: 1.2em;
}

.htmx-indicator {
  display: none;
  margin-left: 0.6em;
  color: #666;
}

.htmx-request .htmx-indicator {
  display: inline;
}

.htmx-request.button {
  opacity: 0.7;
  cursor: wait;
}
