/* ═══ 폼 섹션 ═══ */

.form-section + .form-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #80868b);
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}

.form-section-title svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ═══ 폼 그리드 ═══ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 14px;
}

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

/* ═══ 필드 ═══ */

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: var(--font-size-sub, 11px);
  font-weight: var(--font-weight-strong, 400);
  color: var(--text-subtle, #5f6368);
  line-height: 1.3;
}

.field.is-required label::after {
  content: ' *';
  color: #ef4444;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f2f3f7;
  font-size: var(--panel-head-font, 12px);
  font-weight: var(--font-weight-base, 300);
  color: var(--text-main, #1a1a1a);
  outline: none;
  transition: all 0.18s ease;
}

.field textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 14px;
  resize: vertical;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2380868b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* 포커스: 흰색 배경 + 테두리 강조 */
.field input:focus,
.field select:focus,
.field textarea:focus {
  background: #fff;
  border-color: var(--form-focus-border, #2b3a52);
  box-shadow: 0 0 0 3px rgba(43, 58, 82, 0.1);
}

/* hover */
.field input:not(:focus):not(:disabled):not([readonly]):hover,
.field select:not(:focus):not(:disabled):hover,
.field textarea:not(:focus):not(:disabled):not([readonly]):hover {
  background: #eaecf2;
}

/* disabled / readonly */
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: #f5f6f8;
  color: var(--text-main, #1a1a1a);
  cursor: default;
  opacity: 0.75;
}

.field input[readonly] {
  background: #f5f6f8;
  cursor: default;
  opacity: 0.75;
}

/* ═══ 자동완성 드롭다운 ═══ */

.field-autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 2px;
  border: 1px solid var(--border-main, #dadce0);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.autocomplete-list:empty {
  display: none;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-main, #1a1a1a);
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.is-focused {
  background: #f2f3f7;
}

.autocomplete-item__main {
  font-weight: 500;
}

.autocomplete-item__sub {
  color: var(--text-muted, #80868b);
  font-size: 11px;
}

.autocomplete-item mark {
  background: rgba(43, 58, 82, 0.12);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ═══ 엑셀형 인라인 테이블 ═══ */

.inline-table-wrap {
  border: 1px solid #e2e5eb;
  border-radius: 8px;
  overflow: hidden;
}

.inline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.inline-table thead th {
  height: 32px;
  padding: 0 10px;
  background: #f2f3f7;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #80868b);
  text-align: left;
  border-bottom: 1px solid #e2e5eb;
  white-space: nowrap;
}

.inline-table thead th.col-action {
  width: 36px;
  text-align: center;
}

.inline-table tbody td {
  height: 38px;
  padding: 0;
  border-bottom: 1px solid #eff0f3;
  vertical-align: middle;
}

.inline-table tbody tr:last-child td {
  border-bottom: none;
}

.inline-table tbody tr:hover {
  background: #f8f9fc;
}

.inline-table tbody tr.is-focused {
  background: #eef1f8;
}

/* 셀 입력 */
.inline-table .cell-input,
.inline-table .cell-select {
  width: 100%;
  height: 100%;
  padding: 0 10px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  color: var(--text-main, #1a1a1a);
  outline: none;
}

.inline-table .cell-input:focus,
.inline-table .cell-select:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(43, 58, 82, 0.2);
}

.inline-table .cell-select {
  appearance: none;
  cursor: pointer;
}

.inline-table .cell-input.cell-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 삭제 버튼 */
.inline-table .btn-row-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: #b0b5be;
  cursor: pointer;
  transition: color 0.12s;
}

.inline-table .btn-row-del:hover {
  color: #dc2626;
}

/* 합계 행 */
.inline-table tfoot td {
  height: 38px;
  padding: 0 10px;
  background: #f7f8fb;
  border-top: 1.5px solid #e2e5eb;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-main, #1a1a1a);
  font-variant-numeric: tabular-nums;
}

.inline-table tfoot .total-label {
  text-align: right;
  color: var(--text-subtle, #5f6368);
}

.inline-table tfoot .total-value {
  text-align: right;
}

/* 행 추가 버튼 */
.inline-table-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 36px;
  border: none;
  border-top: 1px solid #eff0f3;
  background: transparent;
  font-size: 12px;
  color: var(--text-subtle, #5f6368);
  cursor: pointer;
  transition: background 0.12s;
}

.inline-table-add:hover {
  background: #f2f3f7;
  color: var(--text-main, #1a1a1a);
}
